commit a1a3d78dd67ad70246c6f8d0daff62e7b7a4bf56 Author: 赵忠林 <170083662@qq.com> Date: Fri Feb 13 02:21:21 2026 +0800 feat(generator): 添加代码生成器模板和AI聊天功能 - 新增.gitignore文件配置忽略规则 - 添加Taro页面配置模板add.config.ts.btl - 添加Taro页面组件模板add.tsx.btl用于动态表单生成 - 实现AiController提供AI聊天消息处理功能 - 集成WebSocket实现AI消息流式传输 - 添加支付宝支付配置工具类AlipayConfigUtil - 创建支付宝参数实体AlipayParam - 集成阿里云短信发送工具AliYunSender - 添加阿里云机器翻译工具AliyunTranslateUtil - 完善API响应结果包装类ApiResult - 配置多环境应用参数application.yml - 添加CMS生产环境配置application-cms.yml - 添加开发环境配置application-dev.yml - 添加生产环境配置application-prod.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..512842c --- /dev/null +++ b/.gitignore @@ -0,0 +1,45 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/** +!**/src/test/** + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ + +### VS Code ### +.vscode/ +/cert/ +/src/main/resources/dev/ + +### macOS ### +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db +/file/ +/websoft-modules.log +/tmp/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..84ae9f9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,51 @@ +# 使用更小的 Alpine Linux + OpenJDK 17 镜像 +FROM openjdk:17-jdk-alpine + +# 设置工作目录 +WORKDIR /app + +# 创建日志目录 +RUN mkdir -p /app/logs + +# 创建上传文件目录 +RUN mkdir -p /app/uploads + +# 安装必要工具和中文字体支持 +# fontconfig: 字体配置库 +# ttf-dejavu: 包含DejaVu字体,支持中文显示 +# wqy-zenhei: 文泉驿正黑字体,开源中文字体 +RUN apk add --no-cache wget fontconfig ttf-dejavu && \ + # 下载并安装文泉驿微米黑字体(更好的中文支持) + wget -O /tmp/wqy-microhei.ttc https://github.com/anthonyfok/fonts-wqy-microhei/raw/master/wqy-microhei.ttc && \ + mkdir -p /usr/share/fonts/truetype/wqy && \ + mv /tmp/wqy-microhei.ttc /usr/share/fonts/truetype/wqy/ && \ + # 刷新字体缓存 + fc-cache -fv && \ + # 创建应用用户(安全考虑) + addgroup -g 1000 appgroup && \ + adduser -D -u 1000 -G appgroup appuser + +# 复制jar包到容器 +COPY target/*.jar app.jar + +# 设置目录权限 +RUN chown -R appuser:appgroup /app + +# 切换到应用用户 +USER appuser + +# 暴露端口 +EXPOSE 9200 + +# 设置JVM参数 +ENV JAVA_OPTS="-Xms512m -Xmx1024m -Djava.security.egd=file:/dev/./urandom" + +# 设置Spring Profile +ENV SPRING_PROFILES_ACTIVE=prod + +# 健康检查 +HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ + CMD wget --no-verbose --tries=1 --spider http://localhost:9200/actuator/health || exit 1 + +# 启动应用 +ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar app.jar"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..ef5a814 --- /dev/null +++ b/README.md @@ -0,0 +1,286 @@ +
+

🚀 WebSoft API

+

基于 Spring Boot + MyBatis Plus 的企业级后端API服务

+ +

+ Java + Spring Boot + MyBatis Plus + MySQL + Redis + License +

+
+ +## 📖 项目简介 + +WebSoft API 是一个基于 **Spring Boot + MyBatis Plus** 构建的现代化企业级后端API服务,采用最新的Java技术栈: + +- **核心框架**:Spring Boot 2.5.4 + Spring Security + Spring AOP +- **数据访问**:MyBatis Plus 3.4.3 + Druid 连接池 +- **数据库**:MySQL + Redis +- **文档工具**:Swagger 3.0 + Knife4j +- **工具库**:Hutool、Lombok、FastJSON + + + +## 项目演示 +| 后台管理系统 | https://mp.websoft.top | +|--------|-------------------------------------------------------------------------------------------------------------------------------------| +| 测试账号 | 13800010123,123456 +| 正式账号 | [立即注册](https://mp.websoft.top/register/?inviteCode=github) | +| 关注公众号 | ![输入图片说明](https://oss.wsdns.cn/20240327/f1175cc5aae741d3af05484747270bd5.jpeg?x-oss-process=image/resize,m_fixed,w_150/quality,Q_90) | + + + + +## 🛠️ 技术栈 + +### 核心框架 +| 技术 | 版本 | 说明 | +|------|------|------| +| Java | 1.8+ | 编程语言 | +| Spring Boot | 2.5.4 | 微服务框架 | +| Spring Security | 5.5.x | 安全框架 | +| MyBatis Plus | 3.4.3 | ORM框架 | +| MySQL | 8.0+ | 关系型数据库 | +| Redis | 6.0+ | 缓存数据库 | +| Druid | 1.2.6 | 数据库连接池 | + +### 功能组件 +- **Swagger 3.0 + Knife4j** - API文档生成与测试 +- **JWT** - 用户认证与授权 +- **Hutool** - Java工具类库 +- **EasyPOI** - Excel文件处理 +- **阿里云OSS** - 对象存储服务 +- **微信支付/支付宝** - 支付集成 +- **Socket.IO** - 实时通信 +- **MQTT** - 物联网消息传输 + +## 📋 环境要求 + +### 基础环境 +- ☕ **Java 1.8+** +- 🗄️ **MySQL 8.0+** +- 🔴 **Redis 6.0+** +- 📦 **Maven 3.6+** + +### 开发工具 +- **推荐**:IntelliJ IDEA / Eclipse +- **插件**:Lombok Plugin、MyBatis Plugin + +## 🚀 快速开始 + +### 1. 克隆项目 +```bash +git clone https://github.com/websoft-top/mp-java.git +cd mp-java +``` + +### 2. 数据库配置 +```sql +-- 创建数据库 +CREATE DATABASE websoft_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; + +-- 导入数据库脚本(如果有的话) +-- source /path/to/database.sql +``` + +### 3. 配置文件 +编辑 `src/main/resources/application-dev.yml` 文件,配置数据库连接: +```yaml +spring: + datasource: + url: jdbc:mysql://localhost:3306/websoft_db?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8 + username: your_username + password: your_password + redis: + host: localhost + port: 6379 + password: your_redis_password +``` + +### 4. 启动项目 +```bash +# 使用 Maven 启动 +mvn spring-boot:run + +# 或者使用 IDE 直接运行 WebSoftApplication.java +``` + +访问 `http://localhost:9200` 即可看到API服务。 + +### 5. API文档 +启动项目后,访问以下地址查看API文档: +- Swagger UI: `http://localhost:9200/swagger-ui/index.html` +- Knife4j: `http://localhost:9200/doc.html` + +## ⚙️ 配置说明 + +### 数据库配置 +在 `application-dev.yml` 中配置数据库连接: +```yaml +spring: + datasource: + url: jdbc:mysql://localhost:3306/websoft_db + username: root + password: your_password + driver-class-name: com.mysql.cj.jdbc.Driver +``` + +### Redis配置 +```yaml +spring: + redis: + host: localhost + port: 6379 + password: your_redis_password + database: 0 +``` + +### 阿里云OSS配置 +```yaml +config: + endpoint: https://oss-cn-shenzhen.aliyuncs.com + accessKeyId: your_access_key_id + accessKeySecret: your_access_key_secret + bucketName: your_bucket_name + bucketDomain: https://your-domain.com +``` + +### 其他配置 +- **JWT密钥**:`config.token-key` 用于JWT令牌加密 +- **文件上传路径**:`config.upload-path` 本地文件存储路径 +- **邮件服务**:配置SMTP服务器用于发送邮件 + +## 🎯 核心功能 + +### 🔐 用户认证与授权 +- **JWT认证**:基于JSON Web Token的用户认证 +- **Spring Security**:完整的安全框架集成 +- **角色权限**:基于RBAC的权限控制 +- **图形验证码**:防止恶意登录 + +### 📝 内容管理系统(CMS) +- **文章管理**:支持富文本内容管理 +- **媒体文件**:图片/视频文件上传与管理 +- **分类管理**:内容分类与标签管理 +- **SEO优化**:搜索引擎优化支持 + +### 🛒 电商系统 +- **商品管理**:商品信息、规格、库存管理 +- **订单系统**:完整的订单流程管理 +- **支付集成**:支持微信支付、支付宝 +- **物流跟踪**:快递100物流查询集成 + +### 🔧 系统管理 +- **用户管理**:用户信息维护与管理 +- **系统配置**:动态配置管理 +- **日志监控**:系统操作日志记录 +- **数据备份**:数据库备份与恢复 + +### 📊 数据分析 +- **统计报表**:业务数据统计分析 +- **图表展示**:数据可视化展示 +- **导出功能**:Excel数据导出 +- **实时监控**:系统性能监控 + +## 🏗️ 项目结构 + +``` +src/main/java/com/gxwebsoft/ +├── WebSoftApplication.java # 启动类 +├── cms/ # 内容管理模块 +│ ├── controller/ # 控制器层 +│ ├── service/ # 业务逻辑层 +│ ├── mapper/ # 数据访问层 +│ └── entity/ # 实体类 +├── shop/ # 商城模块 +│ ├── controller/ +│ ├── service/ +│ ├── mapper/ +│ └── entity/ +├── common/ # 公共模块 +│ ├── core/ # 核心配置 +│ ├── utils/ # 工具类 +│ └── exception/ # 异常处理 +└── resources/ + ├── application.yml # 主配置文件 + ├── application-dev.yml # 开发环境配置 + └── application-prod.yml# 生产环境配置 +``` + +## 🔧 开发规范 + +### 代码结构 +- **Controller层**:处理HTTP请求,参数验证 +- **Service层**:业务逻辑处理,事务管理 +- **Mapper层**:数据访问,SQL映射 +- **Entity层**:数据实体,数据库表映射 + +### 命名规范 +- **类名**:使用大驼峰命名法(PascalCase) +- **方法名**:使用小驼峰命名法(camelCase) +- **常量**:使用全大写,下划线分隔 +- **包名**:使用小写字母,点分隔 + +## 📚 API文档 + +项目集成了Swagger和Knife4j,提供完整的API文档: + +### 访问地址 +- **Swagger UI**: `http://localhost:9200/swagger-ui/index.html` +- **Knife4j**: `http://localhost:9200/doc.html` + +### 主要接口模块 +- **用户认证**: `/api/auth/**` - 登录、注册、权限验证 +- **用户管理**: `/api/user/**` - 用户CRUD操作 +- **内容管理**: `/api/cms/**` - 文章、媒体文件管理 +- **商城管理**: `/api/shop/**` - 商品、订单管理 +- **系统管理**: `/api/system/**` - 系统配置、日志管理 + +## 🚀 部署指南 + +### 开发环境部署 +```bash +# 1. 启动MySQL和Redis服务 +# 2. 创建数据库并导入初始数据 +# 3. 修改配置文件 +# 4. 启动应用 +mvn spring-boot:run +``` + +### 生产环境部署 +```bash +# 1. 打包应用 +mvn clean package -Dmaven.test.skip=true + +# 2. 运行jar包 +java -jar target/com-gxwebsoft-modules-1.5.0.jar --spring.profiles.active=prod + +# 3. 使用Docker部署(可选) +docker build -t websoft-api . +docker run -d -p 9200:9200 websoft-api +``` + +## 🤝 贡献指南 + +1. Fork 本仓库 +2. 创建特性分支 (`git checkout -b feature/AmazingFeature`) +3. 提交更改 (`git commit -m 'Add some AmazingFeature'`) +4. 推送到分支 (`git push origin feature/AmazingFeature`) +5. 打开 Pull Request + +## 📄 许可证 + +本项目采用 MIT 许可证 - 查看 [LICENSE](LICENSE) 文件了解详情 + +## 📞 联系我们 + +- 官网:https://websoft.top +- 邮箱:170083662@qq.top +- QQ群:479713884 + +--- + +⭐ 如果这个项目对您有帮助,请给我们一个星标! \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ea6a7d7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,38 @@ +version: '3.8' + +services: + # 应用服务 + cms-api: + build: . + container_name: cms-api + ports: + - "9200:9200" + environment: + - SPRING_PROFILES_ACTIVE=prod + - JAVA_OPTS=-Xms512m -Xmx1024m + volumes: + # 证书挂载卷 - 将宿主机证书目录挂载到容器 + - ./certs:/app/certs:ro + # 日志挂载卷 + - ./logs:/app/logs + # 上传文件挂载卷 + - ./uploads:/app/uploads + networks: + - cms-network + restart: unless-stopped + healthcheck: + test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9200/actuator/health"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 60s + +networks: + cms-network: + driver: bridge + +volumes: + mysql_data: + driver: local + redis_data: + driver: local diff --git a/docker-deploy-guide.md b/docker-deploy-guide.md new file mode 100644 index 0000000..4961d64 --- /dev/null +++ b/docker-deploy-guide.md @@ -0,0 +1,188 @@ +# Docker容器化部署指南 + +## 支付证书问题解决方案 + +本项目已经解决了Docker容器中支付证书路径失效的问题,支持多种证书加载方式。 + +## 目录结构 + +``` +project-root/ +├── Dockerfile +├── docker-compose.yml +├── certs/ # 证书目录(需要手动创建) +│ ├── wechat/ # 微信支付证书 +│ │ ├── apiclient_key.pem +│ │ ├── apiclient_cert.pem +│ │ └── wechatpay_cert.pem +│ └── alipay/ # 支付宝证书 +│ ├── app_private_key.pem +│ ├── appCertPublicKey.crt +│ ├── alipayCertPublicKey.crt +│ └── alipayRootCert.crt +├── logs/ # 日志目录 +├── uploads/ # 上传文件目录 +└── src/ +``` + +## 部署步骤 + +### 1. 准备证书文件 + +创建证书目录并放置证书文件: + +```bash +# 创建证书目录 +mkdir -p certs/wechat +mkdir -p certs/alipay + +# 复制微信支付证书到对应目录 +cp /path/to/your/apiclient_key.pem certs/wechat/ +cp /path/to/your/apiclient_cert.pem certs/wechat/ +cp /path/to/your/wechatpay_cert.pem certs/wechat/ + +# 复制支付宝证书到对应目录 +cp /path/to/your/app_private_key.pem certs/alipay/ +cp /path/to/your/appCertPublicKey.crt certs/alipay/ +cp /path/to/your/alipayCertPublicKey.crt certs/alipay/ +cp /path/to/your/alipayRootCert.crt certs/alipay/ + +# 设置证书文件权限(只读) +chmod -R 444 certs/ +``` + +### 2. 配置环境变量 + +创建 `.env` 文件(可选): + +```bash +# 应用配置 +SPRING_PROFILES_ACTIVE=prod +JAVA_OPTS=-Xms512m -Xmx1024m + +# 数据库配置 +MYSQL_ROOT_PASSWORD=root123456 +MYSQL_DATABASE=modules +MYSQL_USER=modules +MYSQL_PASSWORD=8YdLnk7KsPAyDXGA + +# Redis配置 +REDIS_PASSWORD=redis_WSDb88 +``` + +### 3. 构建和启动 + +```bash +# 构建应用 +mvn clean package -DskipTests + +# 启动所有服务 +docker-compose up -d + +# 查看服务状态 +docker-compose ps + +# 查看应用日志 +docker-compose logs -f cms-app +``` + +### 4. 验证部署 + +```bash +# 检查应用健康状态 +curl http://localhost:9200/actuator/health + +# 检查证书是否正确加载 +docker exec cms-java-app ls -la /app/certs/ +``` + +## 证书加载模式 + +### 开发环境 (CLASSPATH) +- 证书文件放在 `src/main/resources/certs/` 目录下 +- 打包时会包含在jar包中 +- 适合开发和测试环境 + +### 生产环境 (VOLUME) +- 证书文件通过Docker挂载卷加载 +- 证书文件在宿主机上,挂载到容器的 `/app/certs` 目录 +- 支持证书文件的动态更新(重启容器后生效) + +### 文件系统模式 (FILESYSTEM) +- 直接从文件系统路径加载证书 +- 适合传统部署方式 + +## 配置说明 + +### application.yml 配置 + +```yaml +certificate: + load-mode: VOLUME # 证书加载模式 + cert-root-path: /app/certs # 证书根目录 + + wechat-pay: + dev: + api-v3-key: "your-api-v3-key" + private-key-file: "apiclient_key.pem" + apiclient-cert-file: "apiclient_cert.pem" + wechatpay-cert-file: "wechatpay_cert.pem" +``` + +### 环境特定配置 + +- **开发环境**: `application-dev.yml` - 使用CLASSPATH模式 +- **生产环境**: `application-prod.yml` - 使用VOLUME模式 + +## 故障排除 + +### 1. 证书文件找不到 + +```bash +# 检查证书文件是否存在 +docker exec cms-java-app ls -la /app/certs/ + +# 检查文件权限 +docker exec cms-java-app ls -la /app/certs/wechat/ +``` + +### 2. 支付接口调用失败 + +```bash +# 查看应用日志 +docker-compose logs cms-app | grep -i cert + +# 检查证书配置 +docker exec cms-java-app cat /app/application.yml | grep -A 10 certificate +``` + +### 3. 容器启动失败 + +```bash +# 查看详细错误信息 +docker-compose logs cms-app + +# 检查容器状态 +docker-compose ps +``` + +## 安全建议 + +1. **证书文件权限**: 设置为只读权限 (444) +2. **证书目录权限**: 限制访问权限 +3. **敏感信息**: 使用环境变量或Docker secrets管理敏感配置 +4. **网络安全**: 使用内部网络,限制端口暴露 + +## 更新证书 + +1. 停止应用容器:`docker-compose stop cms-app` +2. 更新证书文件到 `certs/` 目录 +3. 重启应用容器:`docker-compose start cms-app` + +## 监控和日志 + +- 应用日志:`./logs/` 目录 +- 容器日志:`docker-compose logs` +- 健康检查:访问 `/actuator/health` 端点 + +通过以上配置,你的应用在Docker容器中就能正确加载支付证书了! diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..3cd2de5 --- /dev/null +++ b/pom.xml @@ -0,0 +1,422 @@ + + + 4.0.0 + + com.gxwebsoft + mp-api + 1.5.0 + + mp-api + WebSoftApi project for Spring Boot + + + org.springframework.boot + spring-boot-starter-parent + 2.7.18 + + + + + 17 + UTF-8 + UTF-8 + + + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + org.springframework.boot + spring-boot-starter-web + + + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + + + org.springframework.boot + spring-boot-starter-aop + + + + + org.springframework.boot + spring-boot-configuration-processor + true + + + + + org.projectlombok + lombok + true + + + + + com.mysql + mysql-connector-j + runtime + + + + + com.alibaba + druid-spring-boot-starter + 1.2.20 + + + + + com.baomidou + mybatis-plus-boot-starter + 3.4.3.3 + + + + + com.github.yulichang + mybatis-plus-join-boot-starter + 1.4.5 + + + + + com.baomidou + mybatis-plus-generator + 3.4.1 + + + + + cn.hutool + hutool-core + 5.8.25 + + + cn.hutool + hutool-extra + 5.8.25 + + + cn.hutool + hutool-http + 5.8.25 + + + cn.hutool + hutool-crypto + 5.8.25 + + + + + cn.afterturn + easypoi-base + 4.4.0 + + + + + org.apache.tika + tika-core + 2.9.1 + + + + + com.github.livesense + jodconverter-core + 1.0.5 + + + + + org.springframework.boot + spring-boot-starter-mail + + + + + com.ibeetl + beetl + 3.15.10.RELEASE + + + + + org.springdoc + springdoc-openapi-ui + 1.7.0 + + + + + org.springframework.boot + spring-boot-starter-security + + + + + io.jsonwebtoken + jjwt-api + 0.11.5 + + + io.jsonwebtoken + jjwt-impl + 0.11.5 + runtime + + + io.jsonwebtoken + jjwt-jackson + 0.11.5 + runtime + + + + + com.github.whvcse + easy-captcha + 1.6.2 + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + com.aliyun + aliyun-java-sdk-core + 4.4.3 + + + + com.alipay.sdk + alipay-sdk-java + 4.35.0.ALL + + + + org.bouncycastle + bcprov-jdk18on + 1.77 + + + + commons-logging + commons-logging + 1.3.0 + + + + com.alibaba + fastjson + 2.0.43 + + + + + com.google.zxing + core + 3.5.2 + + + + com.google.code.gson + gson + 2.10.1 + + + + com.vaadin.external.google + android-json + 0.0.20131108.vaadin1 + compile + + + + + com.corundumstudio.socketio + netty-socketio + 2.0.2 + + + + + com.github.wechatpay-apiv3 + wechatpay-java + 0.2.17 + + + + + org.springframework.integration + spring-integration-mqtt + + + org.eclipse.paho + org.eclipse.paho.client.mqttv3 + 1.2.0 + + + + com.github.binarywang + weixin-java-miniapp + 4.6.0 + + + + com.github.binarywang + weixin-java-mp + 4.6.0 + + + + + com.aliyun.oss + aliyun-sdk-oss + 3.17.4 + + + + com.github.kuaidi100-api + sdk + 1.0.13 + + + + + com.nuonuo + open-sdk + 1.0.5.2 + + + + + com.github.xiaoymin + knife4j-openapi3-spring-boot-starter + 4.3.0 + + + + com.belerweb + pinyin4j + 2.5.1 + + + + + com.aliyun + alimt20181012 + 1.0.3 + + + com.aliyun + tea-openapi + 0.2.5 + + + + com.squareup.okhttp3 + okhttp + 4.12.0 + + + + com.github.ben-manes.caffeine + caffeine + 3.1.8 + + + + + com.aliyun + bailian20231229 + 2.4.0 + + + + com.freewayso + image-combiner + 2.6.9 + + + + org.springframework.boot + spring-boot-starter-websocket + + + + + + + + + src/main/java + + **/*Mapper.xml + + + + src/main/resources + + ** + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.project-lombok + lombok + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 17 + 17 + + + + + + + + aliYunMaven + https://maven.aliyun.com/repository/public + + + + diff --git a/src/main/java/com/gxwebsoft/WebSoftApplication.java b/src/main/java/com/gxwebsoft/WebSoftApplication.java new file mode 100644 index 0000000..1a7fa35 --- /dev/null +++ b/src/main/java/com/gxwebsoft/WebSoftApplication.java @@ -0,0 +1,31 @@ +package com.gxwebsoft; + +import com.gxwebsoft.common.core.config.ConfigProperties; +import com.gxwebsoft.common.core.config.MqttProperties; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.springframework.web.socket.config.annotation.EnableWebSocket; + +/** + * 启动类 + * Created by WebSoft on 2018-02-22 11:29:03 + */ +@EnableAsync +@EnableTransactionManagement +@MapperScan("com.gxwebsoft.**.mapper") +@EnableConfigurationProperties({ConfigProperties.class, MqttProperties.class}) +@SpringBootApplication +@EnableScheduling +@EnableWebSocket +public class WebSoftApplication { + + public static void main(String[] args) { + SpringApplication.run(WebSoftApplication.class, args); + } + +} diff --git a/src/main/java/com/gxwebsoft/auto/controller/QrLoginController.java b/src/main/java/com/gxwebsoft/auto/controller/QrLoginController.java new file mode 100644 index 0000000..d296d82 --- /dev/null +++ b/src/main/java/com/gxwebsoft/auto/controller/QrLoginController.java @@ -0,0 +1,104 @@ +package com.gxwebsoft.auto.controller; + +import com.gxwebsoft.auto.dto.QrLoginConfirmRequest; +import com.gxwebsoft.auto.dto.QrLoginGenerateResponse; +import com.gxwebsoft.auto.dto.QrLoginStatusResponse; +import com.gxwebsoft.auto.service.QrLoginService; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.ApiResult; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +/** + * 认证模块 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Tag(name = "认证模块") +@RestController +@RequestMapping("/api/qr-login") +public class QrLoginController extends BaseController { + + @Autowired + private QrLoginService qrLoginService; + + /** + * 生成扫码登录token + */ + @Operation(summary = "生成扫码登录token") + @PostMapping("/generate") + public ApiResult generateQrLoginToken() { + try { + QrLoginGenerateResponse response = qrLoginService.generateQrLoginToken(); + return success("生成成功", response); + } catch (Exception e) { + return fail(e.getMessage()); + } + } + + /** + * 检查扫码登录状态 + */ + @Operation(summary = "检查扫码登录状态") + @GetMapping("/status/{token}") + public ApiResult checkQrLoginStatus( + @Parameter(description = "扫码登录token") @PathVariable String token) { + try { + QrLoginStatusResponse response = qrLoginService.checkQrLoginStatus(token); + return success("查询成功", response); + } catch (Exception e) { + return fail(e.getMessage()); + } + } + + /** + * 确认扫码登录 + */ + @Operation(summary = "确认扫码登录") + @PostMapping("/confirm") + public ApiResult confirmQrLogin(@Valid @RequestBody QrLoginConfirmRequest request) { + try { + QrLoginStatusResponse response = qrLoginService.confirmQrLogin(request); + return success("确认成功", response); + } catch (Exception e) { + return fail(e.getMessage()); + } + } + + /** + * 扫码操作(可选接口,用于移动端扫码后更新状态) + */ + @Operation(summary = "扫码操作") + @PostMapping("/scan/{token}") + public ApiResult scanQrCode(@Parameter(description = "扫码登录token") @PathVariable String token) { + try { + boolean result = qrLoginService.scanQrCode(token); + return success("操作成功", result); + } catch (Exception e) { + return fail(e.getMessage()); + } + } + + /** + * 微信小程序扫码登录确认(便捷接口) + */ + @Operation(summary = "微信小程序扫码登录确认") + @PostMapping("/wechat-confirm") + public ApiResult wechatMiniProgramConfirm(@Valid @RequestBody QrLoginConfirmRequest request) { + try { + // 设置平台为微信小程序 + request.setPlatform("miniprogram"); + QrLoginStatusResponse response = qrLoginService.confirmQrLogin(request); + return success("微信小程序登录确认成功", response); + } catch (Exception e) { + return fail(e.getMessage()); + } + } + +} diff --git a/src/main/java/com/gxwebsoft/auto/dto/QrLoginConfirmRequest.java b/src/main/java/com/gxwebsoft/auto/dto/QrLoginConfirmRequest.java new file mode 100644 index 0000000..f3b423e --- /dev/null +++ b/src/main/java/com/gxwebsoft/auto/dto/QrLoginConfirmRequest.java @@ -0,0 +1,50 @@ +package com.gxwebsoft.auto.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 扫码登录确认请求 + * + * @author 科技小王子 + * @since 2025-08-31 + */ +@Data +@Schema(description = "扫码登录确认请求") +public class QrLoginConfirmRequest { + + @Schema(description = "扫码登录token") + @NotBlank(message = "token不能为空") + private String token; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "登录平台: web-网页端, app-移动应用, miniprogram-微信小程序") + private String platform; + + @Schema(description = "微信小程序相关信息") + private WechatMiniProgramInfo wechatInfo; + + /** + * 微信小程序信息 + */ + @Data + @Schema(description = "微信小程序信息") + public static class WechatMiniProgramInfo { + @Schema(description = "微信openid") + private String openid; + + @Schema(description = "微信unionid") + private String unionid; + + @Schema(description = "微信昵称") + private String nickname; + + @Schema(description = "微信头像") + private String avatar; + } + +} diff --git a/src/main/java/com/gxwebsoft/auto/dto/QrLoginData.java b/src/main/java/com/gxwebsoft/auto/dto/QrLoginData.java new file mode 100644 index 0000000..563bf1d --- /dev/null +++ b/src/main/java/com/gxwebsoft/auto/dto/QrLoginData.java @@ -0,0 +1,55 @@ +package com.gxwebsoft.auto.dto; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * 扫码登录数据模型 + * + * @author 科技小王子 + * @since 2025-08-31 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class QrLoginData { + + /** + * 扫码登录token + */ + private String token; + + /** + * 状态: pending-等待扫码, scanned-已扫码, confirmed-已确认, expired-已过期 + */ + private String status; + + /** + * 用户ID(扫码确认后设置) + */ + private Integer userId; + + /** + * 用户名(扫码确认后设置) + */ + private String username; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 过期时间 + */ + private LocalDateTime expireTime; + + /** + * JWT访问令牌(确认后生成) + */ + private String accessToken; + +} diff --git a/src/main/java/com/gxwebsoft/auto/dto/QrLoginGenerateResponse.java b/src/main/java/com/gxwebsoft/auto/dto/QrLoginGenerateResponse.java new file mode 100644 index 0000000..f0b69e5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/auto/dto/QrLoginGenerateResponse.java @@ -0,0 +1,29 @@ +package com.gxwebsoft.auto.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 扫码登录生成响应 + * + * @author 科技小王子 + * @since 2025-08-31 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "扫码登录生成响应") +public class QrLoginGenerateResponse { + + @Schema(description = "扫码登录token") + private String token; + + @Schema(description = "二维码内容") + private String qrCode; + + @Schema(description = "过期时间(秒)") + private Long expiresIn; + +} diff --git a/src/main/java/com/gxwebsoft/auto/dto/QrLoginStatusResponse.java b/src/main/java/com/gxwebsoft/auto/dto/QrLoginStatusResponse.java new file mode 100644 index 0000000..1eb0d4a --- /dev/null +++ b/src/main/java/com/gxwebsoft/auto/dto/QrLoginStatusResponse.java @@ -0,0 +1,32 @@ +package com.gxwebsoft.auto.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 扫码登录状态响应 + * + * @author 科技小王子 + * @since 2025-08-31 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "扫码登录状态响应") +public class QrLoginStatusResponse { + + @Schema(description = "状态: pending-等待扫码, scanned-已扫码, confirmed-已确认, expired-已过期") + private String status; + + @Schema(description = "JWT访问令牌(仅在confirmed状态时返回)") + private String accessToken; + + @Schema(description = "用户信息(仅在confirmed状态时返回)") + private Object userInfo; + + @Schema(description = "剩余过期时间(秒)") + private Long expiresIn; + +} diff --git a/src/main/java/com/gxwebsoft/auto/service/QrLoginService.java b/src/main/java/com/gxwebsoft/auto/service/QrLoginService.java new file mode 100644 index 0000000..85ed28f --- /dev/null +++ b/src/main/java/com/gxwebsoft/auto/service/QrLoginService.java @@ -0,0 +1,46 @@ +package com.gxwebsoft.auto.service; + +import com.gxwebsoft.auto.dto.QrLoginConfirmRequest; +import com.gxwebsoft.auto.dto.QrLoginGenerateResponse; +import com.gxwebsoft.auto.dto.QrLoginStatusResponse; + +/** + * 扫码登录服务接口 + * + * @author 科技小王子 + * @since 2025-08-31 + */ +public interface QrLoginService { + + /** + * 生成扫码登录token + * + * @return QrLoginGenerateResponse + */ + QrLoginGenerateResponse generateQrLoginToken(); + + /** + * 检查扫码登录状态 + * + * @param token 扫码登录token + * @return QrLoginStatusResponse + */ + QrLoginStatusResponse checkQrLoginStatus(String token); + + /** + * 确认扫码登录 + * + * @param request 确认请求 + * @return QrLoginStatusResponse + */ + QrLoginStatusResponse confirmQrLogin(QrLoginConfirmRequest request); + + /** + * 扫码操作(更新状态为已扫码) + * + * @param token 扫码登录token + * @return boolean + */ + boolean scanQrCode(String token); + +} diff --git a/src/main/java/com/gxwebsoft/auto/service/impl/QrLoginServiceImpl.java b/src/main/java/com/gxwebsoft/auto/service/impl/QrLoginServiceImpl.java new file mode 100644 index 0000000..34658e8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/auto/service/impl/QrLoginServiceImpl.java @@ -0,0 +1,239 @@ +package com.gxwebsoft.auto.service.impl; + +import cn.hutool.core.lang.UUID; +import cn.hutool.core.util.StrUtil; +import com.gxwebsoft.auto.dto.*; +import com.gxwebsoft.auto.service.QrLoginService; +import com.gxwebsoft.common.core.security.JwtSubject; +import com.gxwebsoft.common.core.security.JwtUtil; +import com.gxwebsoft.common.core.utils.JSONUtil; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.service.UserService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; +import java.util.concurrent.TimeUnit; + +import static com.gxwebsoft.common.core.constants.RedisConstants.*; + +/** + * 扫码登录服务实现 + * + * @author 科技小王子 + * @since 2025-08-31 + */ +@Slf4j +@Service +public class QrLoginServiceImpl implements QrLoginService { + + @Autowired + private RedisUtil redisUtil; + + @Autowired + private UserService userService; + + @Value("${config.jwt.secret:websoft-jwt-secret-key-2025}") + private String jwtSecret; + + @Value("${config.jwt.expire:86400}") + private Long jwtExpire; + + @Override + public QrLoginGenerateResponse generateQrLoginToken() { + // 生成唯一的扫码登录token + String token = UUID.randomUUID().toString(true); + + // 创建扫码登录数据 + QrLoginData qrLoginData = new QrLoginData(); + qrLoginData.setToken(token); + qrLoginData.setStatus(QR_LOGIN_STATUS_PENDING); + qrLoginData.setCreateTime(LocalDateTime.now()); + qrLoginData.setExpireTime(LocalDateTime.now().plusSeconds(QR_LOGIN_TOKEN_TTL)); + + // 存储到Redis,设置过期时间 + String redisKey = QR_LOGIN_TOKEN_KEY + token; + redisUtil.set(redisKey, qrLoginData, QR_LOGIN_TOKEN_TTL, TimeUnit.SECONDS); + + log.info("生成扫码登录token: {}", token); + + // 构造二维码内容(这里可以是前端登录页面的URL + token参数) + String qrCodeContent = "qr-login:" + token; + + return new QrLoginGenerateResponse(token, qrCodeContent, QR_LOGIN_TOKEN_TTL); + } + + @Override + public QrLoginStatusResponse checkQrLoginStatus(String token) { + if (StrUtil.isBlank(token)) { + return new QrLoginStatusResponse(QR_LOGIN_STATUS_EXPIRED, null, null, 0L); + } + + String redisKey = QR_LOGIN_TOKEN_KEY + token; + QrLoginData qrLoginData = redisUtil.get(redisKey, QrLoginData.class); + + if (qrLoginData == null) { + return new QrLoginStatusResponse(QR_LOGIN_STATUS_EXPIRED, null, null, 0L); + } + + // 检查是否过期 + if (LocalDateTime.now().isAfter(qrLoginData.getExpireTime())) { + // 删除过期的token + redisUtil.delete(redisKey); + return new QrLoginStatusResponse(QR_LOGIN_STATUS_EXPIRED, null, null, 0L); + } + + // 计算剩余过期时间 + long expiresIn = ChronoUnit.SECONDS.between(LocalDateTime.now(), qrLoginData.getExpireTime()); + + QrLoginStatusResponse response = new QrLoginStatusResponse(); + response.setStatus(qrLoginData.getStatus()); + response.setExpiresIn(expiresIn); + + // 如果已确认,返回token和用户信息 + if (QR_LOGIN_STATUS_CONFIRMED.equals(qrLoginData.getStatus())) { + response.setAccessToken(qrLoginData.getAccessToken()); + + // 获取用户信息 + if (qrLoginData.getUserId() != null) { + User user = userService.getByIdRel(qrLoginData.getUserId()); + if (user != null) { + // 清除敏感信息 + user.setPassword(null); + response.setUserInfo(user); + } + } + + // 确认后删除token,防止重复使用 + redisUtil.delete(redisKey); + } + + return response; + } + + @Override + public QrLoginStatusResponse confirmQrLogin(QrLoginConfirmRequest request) { + String token = request.getToken(); + Integer userId = request.getUserId(); + String platform = request.getPlatform(); + + if (StrUtil.isBlank(token) || userId == null) { + throw new RuntimeException("参数不能为空"); + } + + String redisKey = QR_LOGIN_TOKEN_KEY + token; + QrLoginData qrLoginData = redisUtil.get(redisKey, QrLoginData.class); + + if (qrLoginData == null) { + throw new RuntimeException("扫码登录token不存在或已过期"); + } + + // 检查是否过期 + if (LocalDateTime.now().isAfter(qrLoginData.getExpireTime())) { + redisUtil.delete(redisKey); + throw new RuntimeException("扫码登录token已过期"); + } + + // 获取用户信息 + User user = userService.getByIdRel(userId); + if (user == null) { + throw new RuntimeException("用户不存在"); + } + + // 检查用户状态 + if (user.getStatus() != null && user.getStatus() != 0) { + throw new RuntimeException("用户已被冻结"); + } + + // 如果是微信小程序登录,处理微信相关信息 + if ("miniprogram".equals(platform) && request.getWechatInfo() != null) { + handleWechatMiniProgramLogin(user, request.getWechatInfo()); + } + + // 生成JWT token + JwtSubject jwtSubject = new JwtSubject(user.getUsername(), user.getTenantId()); + String accessToken = JwtUtil.buildToken(jwtSubject, jwtExpire, jwtSecret); + + // 更新扫码登录数据 + qrLoginData.setStatus(QR_LOGIN_STATUS_CONFIRMED); + qrLoginData.setUserId(userId); + qrLoginData.setUsername(user.getUsername()); + qrLoginData.setAccessToken(accessToken); + + // 更新Redis中的数据 + redisUtil.set(redisKey, qrLoginData, 60L, TimeUnit.SECONDS); // 给前端60秒时间获取token + + log.info("用户 {} 通过 {} 平台确认扫码登录,token: {}", user.getUsername(), + platform != null ? platform : "unknown", token); + + // 清除敏感信息 + user.setPassword(null); + + return new QrLoginStatusResponse(QR_LOGIN_STATUS_CONFIRMED, accessToken, user, 60L); + } + + /** + * 处理微信小程序登录相关逻辑 + */ + private void handleWechatMiniProgramLogin(User user, QrLoginConfirmRequest.WechatMiniProgramInfo wechatInfo) { + // 更新用户的微信信息 + if (StrUtil.isNotBlank(wechatInfo.getOpenid())) { + user.setOpenid(wechatInfo.getOpenid()); + } + if (StrUtil.isNotBlank(wechatInfo.getUnionid())) { + user.setUnionid(wechatInfo.getUnionid()); + } + if (StrUtil.isNotBlank(wechatInfo.getNickname()) && StrUtil.isBlank(user.getNickname())) { + user.setNickname(wechatInfo.getNickname()); + } + if (StrUtil.isNotBlank(wechatInfo.getAvatar()) && StrUtil.isBlank(user.getAvatar())) { + user.setAvatar(wechatInfo.getAvatar()); + } + + // 更新用户信息到数据库 + try { + userService.updateById(user); + log.info("更新用户 {} 的微信小程序信息成功", user.getUsername()); + } catch (Exception e) { + log.warn("更新用户 {} 的微信小程序信息失败: {}", user.getUsername(), e.getMessage()); + } + } + + @Override + public boolean scanQrCode(String token) { + if (StrUtil.isBlank(token)) { + return false; + } + + String redisKey = QR_LOGIN_TOKEN_KEY + token; + QrLoginData qrLoginData = redisUtil.get(redisKey, QrLoginData.class); + + if (qrLoginData == null) { + return false; + } + + // 检查是否过期 + if (LocalDateTime.now().isAfter(qrLoginData.getExpireTime())) { + redisUtil.delete(redisKey); + return false; + } + + // 只有pending状态才能更新为scanned + if (QR_LOGIN_STATUS_PENDING.equals(qrLoginData.getStatus())) { + qrLoginData.setStatus(QR_LOGIN_STATUS_SCANNED); + + // 计算剩余过期时间 + long remainingSeconds = ChronoUnit.SECONDS.between(LocalDateTime.now(), qrLoginData.getExpireTime()); + redisUtil.set(redisKey, qrLoginData, remainingSeconds, TimeUnit.SECONDS); + + log.info("扫码登录token {} 状态更新为已扫码", token); + return true; + } + + return false; + } +} diff --git a/src/main/java/com/gxwebsoft/bszx/controller/BszxBmController.java b/src/main/java/com/gxwebsoft/bszx/controller/BszxBmController.java new file mode 100644 index 0000000..995c6fb --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/controller/BszxBmController.java @@ -0,0 +1,166 @@ +package com.gxwebsoft.bszx.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.cms.service.CmsArticleService; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.bszx.service.BszxBmService; +import com.gxwebsoft.bszx.entity.BszxBm; +import com.gxwebsoft.bszx.param.BszxBmParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.context.annotation.Lazy; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 百色中学-报名记录控制器 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Tag(name = "百色中学-报名记录管理") +@RestController +@RequestMapping("/api/bszx/bszx-bm") +public class BszxBmController extends BaseController { + @Resource + private BszxBmService bszxBmService; + @Resource + @Lazy + private CmsArticleService cmsArticleService; + + @PreAuthorize("hasAuthority('bszx:bszxBm:list')") + @Operation(summary = "分页查询百色中学-报名记录") + @GetMapping("/page") + public ApiResult> page(BszxBmParam param) { + // 使用关联查询 + return success(bszxBmService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('bszx:bszxBm:list')") + @Operation(summary = "查询全部百色中学-报名记录") + @GetMapping() + public ApiResult> list(BszxBmParam param) { + // 使用关联查询 + return success(bszxBmService.listRel(param)); + } + + @PreAuthorize("hasAuthority('bszx:bszxBm:list')") + @Operation(summary = "根据id查询百色中学-报名记录") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(bszxBmService.getByIdRel(id)); + } + + @OperationLog + @Operation(summary = "申请报名生成邀请函") + @PostMapping() + public ApiResult save(@RequestBody BszxBm bszxBm) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (bszxBm.getName() == null) { + return fail("请填写姓名"); + } + if (loginUser != null) { + bszxBm.setUserId(loginUser.getUserId()); + if (bszxBmService.count(new LambdaQueryWrapper().eq(BszxBm::getUserId,loginUser.getUserId())) > 0) { + return fail("您已经报名过了",null); + } + if (bszxBmService.save(bszxBm)) { + cmsArticleService.saveInc(bszxBm.getFormId()); + return success("报名成功"); + } + } + return fail("添加失败"); + } + + @OperationLog + @Operation(summary = "修改报名信息") + @PutMapping() + public ApiResult update(@RequestBody BszxBm bszxBm) { + final User loginUser = getLoginUser(); + if(loginUser == null){ + return fail("请先登录"); + } + if (bszxBmService.updateById(bszxBm)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxBm:remove')") + @OperationLog + @Operation(summary = "删除报名记录") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (bszxBmService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxBm:save')") + @OperationLog + @Operation(summary = "批量添加百色中学-报名记录") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (bszxBmService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxBm:update')") + @OperationLog + @Operation(summary = "批量修改百色中学-报名记录") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(bszxBmService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxBm:remove')") + @OperationLog + @Operation(summary = "批量删除百色中学-报名记录") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (bszxBmService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "查询我的报名记录") + @GetMapping("/myPage") + public ApiResult> myPage(BszxBmParam param) { + // 使用关联查询 + if (getLoginUser() != null) { + param.setUserId(getLoginUserId()); + return success(bszxBmService.pageRel(param)); + } + return fail("请先登录",null); + } + + @Operation(summary = "获取海报地址") + @GetMapping("/generatePoster") + public ApiResult generatePoster() throws Exception { + if (getLoginUser() == null) { + return fail("请先登录",null); + } + final BszxBm bm = bszxBmService.getOne(new LambdaQueryWrapper().eq(BszxBm::getUserId, getLoginUser().getUserId()).last("limit 1")); + return success("生成宣传海报",bszxBmService.generatePoster(bm)); + } + +} diff --git a/src/main/java/com/gxwebsoft/bszx/controller/BszxBranchController.java b/src/main/java/com/gxwebsoft/bszx/controller/BszxBranchController.java new file mode 100644 index 0000000..6a24686 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/controller/BszxBranchController.java @@ -0,0 +1,121 @@ +package com.gxwebsoft.bszx.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.bszx.service.BszxBranchService; +import com.gxwebsoft.bszx.entity.BszxBranch; +import com.gxwebsoft.bszx.param.BszxBranchParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 百色中学-分部控制器 + * + * @author 科技小王子 + * @since 2025-03-17 17:18:22 + */ +@Tag(name = "百色中学-分部管理") +@RestController +@RequestMapping("/api/bszx/bszx-branch") +public class BszxBranchController extends BaseController { + @Resource + private BszxBranchService bszxBranchService; + + @Operation(summary = "分页查询百色中学-分部") + @GetMapping("/page") + public ApiResult> page(BszxBranchParam param) { + // 使用关联查询 + return success(bszxBranchService.pageRel(param)); + } + + @Operation(summary = "查询全部百色中学-分部") + @GetMapping() + public ApiResult> list(BszxBranchParam param) { + // 使用关联查询 + return success(bszxBranchService.listRel(param)); + } + + @Operation(summary = "根据id查询百色中学-分部") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(bszxBranchService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('bszx:bszxBranch:save')") + @OperationLog + @Operation(summary = "添加百色中学-分部") + @PostMapping() + public ApiResult save(@RequestBody BszxBranch bszxBranch) { + if (bszxBranchService.save(bszxBranch)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxBranch:update')") + @OperationLog + @Operation(summary = "修改百色中学-分部") + @PutMapping() + public ApiResult update(@RequestBody BszxBranch bszxBranch) { + if (bszxBranchService.updateById(bszxBranch)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxBranch:remove')") + @OperationLog + @Operation(summary = "删除百色中学-分部") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (bszxBranchService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxBranch:save')") + @OperationLog + @Operation(summary = "批量添加百色中学-分部") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (bszxBranchService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxBranch:update')") + @OperationLog + @Operation(summary = "批量修改百色中学-分部") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(bszxBranchService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxBranch:remove')") + @OperationLog + @Operation(summary = "批量删除百色中学-分部") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (bszxBranchService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/bszx/controller/BszxClassController.java b/src/main/java/com/gxwebsoft/bszx/controller/BszxClassController.java new file mode 100644 index 0000000..ceb251c --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/controller/BszxClassController.java @@ -0,0 +1,156 @@ +package com.gxwebsoft.bszx.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.bszx.entity.BszxBranch; +import com.gxwebsoft.bszx.entity.BszxEra; +import com.gxwebsoft.bszx.entity.BszxGrade; +import com.gxwebsoft.bszx.param.BszxGradeParam; +import com.gxwebsoft.bszx.service.BszxBranchService; +import com.gxwebsoft.bszx.service.BszxEraService; +import com.gxwebsoft.bszx.service.BszxGradeService; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.bszx.service.BszxClassService; +import com.gxwebsoft.bszx.entity.BszxClass; +import com.gxwebsoft.bszx.param.BszxClassParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 百色中学-班级控制器 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Tag(name = "百色中学-班级管理") +@RestController +@RequestMapping("/api/bszx/bszx-class") +public class BszxClassController extends BaseController { + @Resource + private BszxClassService bszxClassService; + @Resource + private BszxGradeService bszxGradeService; + @Resource + private BszxBranchService bszxBranchService; + + @Operation(summary = "分页查询百色中学-班级") + @GetMapping("/page") + public ApiResult> page(BszxClassParam param) { + // 使用关联查询 + return success(bszxClassService.pageRel(param)); + } + + @Operation(summary = "查询全部百色中学-班级") + @GetMapping() + public ApiResult> list(BszxClassParam param) { + // 使用关联查询 + return success(bszxClassService.listRel(param)); + } + + @Operation(summary = "根据id查询百色中学-班级") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(bszxClassService.getByIdRel(id)); + } + + @Operation(summary = "百色中学-年级班级数据") + @GetMapping("/tree") + public ApiResult> tree() { + final List list = bszxBranchService.list(); + final BszxGradeParam bszxGradeParam = new BszxGradeParam(); + final List gradeList = bszxGradeService.listRel(bszxGradeParam); + final BszxClassParam bszxClassParam = new BszxClassParam(); + final List bszxClasseList = bszxClassService.listRel(bszxClassParam); + final Map> collectClass = bszxClasseList.stream().collect(Collectors.groupingBy(BszxClass::getGradeId)); + gradeList.forEach(d -> { + d.setChildren(collectClass.get(d.getId())); + }); + final Map> collectGrade = gradeList.stream().collect(Collectors.groupingBy(BszxGrade::getBranch)); + + list.forEach(d -> { + d.setChildren(collectGrade.get(d.getId())); + }); + + return success(list); + } + + @PreAuthorize("hasAuthority('bszx:bszxClass:save')") + @OperationLog + @Operation(summary = "添加百色中学-班级") + @PostMapping() + public ApiResult save(@RequestBody BszxClass bszxClass) { + if (bszxClassService.save(bszxClass)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxClass:update')") + @OperationLog + @Operation(summary = "修改百色中学-班级") + @PutMapping() + public ApiResult update(@RequestBody BszxClass bszxClass) { + if (bszxClassService.updateById(bszxClass)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxClass:remove')") + @OperationLog + @Operation(summary = "删除百色中学-班级") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (bszxClassService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxClass:save')") + @OperationLog + @Operation(summary = "批量添加百色中学-班级") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (bszxClassService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxClass:update')") + @OperationLog + @Operation(summary = "批量修改百色中学-班级") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(bszxClassService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxClass:remove')") + @OperationLog + @Operation(summary = "批量删除百色中学-班级") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (bszxClassService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/bszx/controller/BszxEraController.java b/src/main/java/com/gxwebsoft/bszx/controller/BszxEraController.java new file mode 100644 index 0000000..c827039 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/controller/BszxEraController.java @@ -0,0 +1,121 @@ +package com.gxwebsoft.bszx.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.bszx.service.BszxEraService; +import com.gxwebsoft.bszx.entity.BszxEra; +import com.gxwebsoft.bszx.param.BszxEraParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 百色中学-年代控制器 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Tag(name = "百色中学-年代管理") +@RestController +@RequestMapping("/api/bszx/bszx-era") +public class BszxEraController extends BaseController { + @Resource + private BszxEraService bszxEraService; + + @Operation(summary = "分页查询百色中学-年代") + @GetMapping("/page") + public ApiResult> page(BszxEraParam param) { + // 使用关联查询 + return success(bszxEraService.pageRel(param)); + } + + @Operation(summary = "查询全部百色中学-年代") + @GetMapping() + public ApiResult> list(BszxEraParam param) { + // 使用关联查询 + return success(bszxEraService.listRel(param)); + } + + @Operation(summary = "根据id查询百色中学-年代") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(bszxEraService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('bszx:bszxEra:save')") + @OperationLog + @Operation(summary = "添加百色中学-年代") + @PostMapping() + public ApiResult save(@RequestBody BszxEra bszxEra) { + if (bszxEraService.save(bszxEra)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxEra:update')") + @OperationLog + @Operation(summary = "修改百色中学-年代") + @PutMapping() + public ApiResult update(@RequestBody BszxEra bszxEra) { + if (bszxEraService.updateById(bszxEra)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxEra:remove')") + @OperationLog + @Operation(summary = "删除百色中学-年代") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (bszxEraService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxEra:save')") + @OperationLog + @Operation(summary = "批量添加百色中学-年代") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (bszxEraService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxEra:update')") + @OperationLog + @Operation(summary = "批量修改百色中学-年代") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(bszxEraService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxEra:remove')") + @OperationLog + @Operation(summary = "批量删除百色中学-年代") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (bszxEraService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/bszx/controller/BszxGradeController.java b/src/main/java/com/gxwebsoft/bszx/controller/BszxGradeController.java new file mode 100644 index 0000000..3280d0f --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/controller/BszxGradeController.java @@ -0,0 +1,121 @@ +package com.gxwebsoft.bszx.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.bszx.service.BszxGradeService; +import com.gxwebsoft.bszx.entity.BszxGrade; +import com.gxwebsoft.bszx.param.BszxGradeParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 百色中学-年级控制器 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Tag(name = "百色中学-年级管理") +@RestController +@RequestMapping("/api/bszx/bszx-grade") +public class BszxGradeController extends BaseController { + @Resource + private BszxGradeService bszxGradeService; + + @Operation(summary = "分页查询百色中学-年级") + @GetMapping("/page") + public ApiResult> page(BszxGradeParam param) { + // 使用关联查询 + return success(bszxGradeService.pageRel(param)); + } + + @Operation(summary = "查询全部百色中学-年级") + @GetMapping() + public ApiResult> list(BszxGradeParam param) { + // 使用关联查询 + return success(bszxGradeService.listRel(param)); + } + + @Operation(summary = "根据id查询百色中学-年级") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(bszxGradeService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('bszx:bszxGrade:save')") + @OperationLog + @Operation(summary = "添加百色中学-年级") + @PostMapping() + public ApiResult save(@RequestBody BszxGrade bszxGrade) { + if (bszxGradeService.save(bszxGrade)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxGrade:update')") + @OperationLog + @Operation(summary = "修改百色中学-年级") + @PutMapping() + public ApiResult update(@RequestBody BszxGrade bszxGrade) { + if (bszxGradeService.updateById(bszxGrade)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxGrade:remove')") + @OperationLog + @Operation(summary = "删除百色中学-年级") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (bszxGradeService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxGrade:save')") + @OperationLog + @Operation(summary = "批量添加百色中学-年级") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (bszxGradeService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxGrade:update')") + @OperationLog + @Operation(summary = "批量修改百色中学-年级") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(bszxGradeService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxGrade:remove')") + @OperationLog + @Operation(summary = "批量删除百色中学-年级") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (bszxGradeService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/bszx/controller/BszxOrderController.java b/src/main/java/com/gxwebsoft/bszx/controller/BszxOrderController.java new file mode 100644 index 0000000..01ba5c2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/controller/BszxOrderController.java @@ -0,0 +1,91 @@ +package com.gxwebsoft.bszx.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.bszx.entity.BszxBm; +import com.gxwebsoft.bszx.entity.BszxPay; +import com.gxwebsoft.bszx.param.BszxPayParam; +import com.gxwebsoft.bszx.service.BszxBmService; +import com.gxwebsoft.bszx.service.BszxPayService; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopOrder; +import com.gxwebsoft.shop.param.ShopOrderParam; +import com.gxwebsoft.shop.service.ShopOrderService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 百色中学-订单管理 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Tag(name = "百色中学-订单管理") +@RestController +@RequestMapping("/api/bszx/bszx-order") +public class BszxOrderController extends BaseController { + @Resource + private BszxPayService bszxPayService; + @Resource + private BszxBmService bszxBmService; + @Resource + private ShopOrderService shopOrderService; + + @Operation(summary = "分页查询百色中学-订单列表") + @GetMapping("/page") + public ApiResult> page(ShopOrderParam param) { + // 使用关联查询 + final PageResult result = shopOrderService.pageRel(param); + if(!CollectionUtils.isEmpty(result.getList())){ + final Set userIds = result.getList().stream().map(ShopOrder::getUserId).collect(Collectors.toSet()); + final List bmList = bszxBmService.list(new LambdaQueryWrapper().in(BszxBm::getUserId, userIds).isNotNull(BszxBm::getName)); + final Map> collect = bmList.stream().collect(Collectors.groupingBy(BszxBm::getUserId)); + final Set orderNos = result.getList().stream().map(ShopOrder::getOrderNo).collect(Collectors.toSet()); + final BszxPayParam bszxPayParam = new BszxPayParam(); + bszxPayParam.setOrderNos(orderNos); + final List bszxPays = bszxPayService.listRel(bszxPayParam); + final Map> collectByOrderNo = bszxPays.stream().collect(Collectors.groupingBy(BszxPay::getOrderNo)); + + result.getList().forEach(d -> { + final List pays = collectByOrderNo.get(d.getOrderNo()); + if(!CollectionUtils.isEmpty(pays)){ + d.setDeliveryStatus(20); + } + final List bmList1 = collect.get(d.getUserId()); + if(!CollectionUtils.isEmpty(bmList1)){ + final BszxBm bm = bmList1.get(0); + d.setBm(bm); + d.setRealName(bm.getName()); + if(bm.getPhone() != null){ + d.setPhone(bm.getPhone()); + } + } + }); + } + return success(result); + } + + + @Operation(summary = "统计订单总金额") + @GetMapping("/total") + public ApiResult total() { + try { + BigDecimal totalAmount = bszxPayService.total(); + return success(totalAmount); + } catch (Exception e) { + // 异常时返回0,保持接口稳定性 + return success(BigDecimal.ZERO); + } + } + +} diff --git a/src/main/java/com/gxwebsoft/bszx/controller/BszxPayController.java b/src/main/java/com/gxwebsoft/bszx/controller/BszxPayController.java new file mode 100644 index 0000000..3254532 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/controller/BszxPayController.java @@ -0,0 +1,345 @@ +package com.gxwebsoft.bszx.controller; + +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.bszx.entity.BszxBm; +import com.gxwebsoft.bszx.service.BszxBmService; +import com.wechat.pay.java.core.notification.*; +import com.gxwebsoft.common.core.config.ConfigProperties; +import com.gxwebsoft.common.core.security.JwtUtil; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.bszx.service.BszxPayService; +import com.gxwebsoft.bszx.entity.BszxPay; +import com.gxwebsoft.bszx.param.BszxPayParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.Payment; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.shop.entity.ShopOrder; +import com.gxwebsoft.shop.service.ShopOrderService; +import com.wechat.pay.java.core.notification.RequestParam; +import com.wechat.pay.java.service.partnerpayments.jsapi.JsapiService; +import com.wechat.pay.java.service.partnerpayments.jsapi.model.Transaction; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.*; + +/** + * 百色中学-捐款记录控制器 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Tag(name = "百色中学-捐款记录管理") +@RestController +@RequestMapping("/api/bszx/bszx-pay") +public class BszxPayController extends BaseController { + public static JsapiService service; + @Resource + private BszxPayService bszxPayService; + @Resource + private BszxBmService bszxBmService; + @Resource + private RedisUtil redisUtil; + @Resource + private ShopOrderService shopOrderService; + @Resource + private ConfigProperties conf; + @Value("${spring.profiles.active}") + String active; + + @PreAuthorize("hasAuthority('bszx:bszxPay:list')") + @Operation(summary = "分页查询百色中学-捐款记录") + @GetMapping("/page") + public ApiResult> page(BszxPayParam param) { + // 使用关联查询 + return success(bszxPayService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('bszx:bszxPay:list')") + @Operation(summary = "查询全部百色中学-捐款记录") + @GetMapping() + public ApiResult> list(BszxPayParam param) { + // 使用关联查询 + return success(bszxPayService.listRel(param)); + } + + @PreAuthorize("hasAuthority('bszx:bszxPay:list')") + @Operation(summary = "根据id查询百色中学-捐款记录") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(bszxPayService.getByIdRel(id)); + } + + @OperationLog + @Operation(summary = "活动捐款") + @PostMapping() + public ApiResult save(@RequestBody BszxPay bszxPay, HttpServletRequest request) { + if (bszxPay.getPrice().compareTo(BigDecimal.ZERO) == 0) { + return fail("金额不能为0"); + } + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + String access_token = JwtUtil.getAccessToken(request); + bszxPay.setUserId(loginUser.getUserId()); + // 微信openid(必填) + if (StrUtil.isBlank(loginUser.getOpenid())) { + return fail("微信openid(必填)"); + } + final BszxBm bmInfo = bszxBmService.getByUserId(loginUser.getUserId()); + bszxPay.setName(bmInfo.getName()); + bszxPay.setSex(bmInfo.getSex()); + bszxPay.setPhone(bmInfo.getPhone()); + bszxPay.setBranchName(bmInfo.getBranchName()); + bszxPay.setGradeName(bmInfo.getGradeName()); + bszxPay.setClassName(bmInfo.getClassName()); + bszxPay.setAddress(bmInfo.getAddress()); + bszxPay.setWorkUnit(bmInfo.getWorkUnit()); + bszxPay.setPosition(bmInfo.getPosition()); + bszxPay.setAge(bmInfo.getAge()); + bszxPay.setNumber(bmInfo.getNumber()); + } + if (bszxPayService.save(bszxPay)) { + // 调起支付 + return success("下单成功", bszxPay); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxPay:update')") + @OperationLog + @Operation(summary = "修改百色中学-捐款记录") + @PutMapping() + public ApiResult update(@RequestBody BszxPay bszxPay) { + if (bszxPayService.updateById(bszxPay)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxPay:remove')") + @OperationLog + @Operation(summary = "删除百色中学-捐款记录") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (bszxPayService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxPay:save')") + @OperationLog + @Operation(summary = "批量添加百色中学-捐款记录") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (bszxPayService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxPay:update')") + @OperationLog + @Operation(summary = "批量修改百色中学-捐款记录") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(bszxPayService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxPay:remove')") + @OperationLog + @Operation(summary = "批量删除百色中学-捐款记录") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (bszxPayService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "查询我的报名记录") + @GetMapping("/myPage") + public ApiResult> myPage(BszxPayParam param) { + // 使用关联查询 + if (getLoginUser() != null) { + param.setUserId(getLoginUserId()); + return success(bszxPayService.pageRel(param)); + } + return fail("请先登录", null); + } + + @Operation(summary = "统计捐款总金额与人次") + @GetMapping("/getCount") + public ApiResult getCount() { + final HashMap map = new HashMap<>(); + final LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + final BigDecimal bigDecimal = bszxPayService.sumMoney(wrapper); + Long count = (long) bszxPayService.count(new LambdaQueryWrapper()); + map.put("numbers", count); + map.put("totalMoney", bigDecimal); + return success(map); + } + + @Schema(description = "异步通知") + @PostMapping("/notify/{tenantId}") + public String wxNotify(@RequestHeader Map header, @RequestBody String body,HttpServletRequest request, @PathVariable("tenantId") Integer tenantId) { + // 获取支付配置信息用于解密 - 优先使用 Payment:1* 格式 + String key = "Payment:11"; // 微信支付类型为1,使用 Payment:11 格式 + Payment payment = redisUtil.get(key, Payment.class); + + // 如果 Payment:1* 格式不存在,尝试原有格式 + if (payment == null) { + String fallbackKey = "Payment:1:".concat(tenantId.toString()); + payment = redisUtil.get(fallbackKey, Payment.class); + } + String uploadPath = conf.getUploadPath(); + + // 开发环境 + String mid = "1242289702"; + String apiV3Key = "0b2996803383c3e3391abd9183b54key"; + String serialNumber = "3B458EB14A28160DC094431A21C0508EFA712D1C"; + String privateKey = "/Users/gxwebsoft/JAVA/site-java/cert/bszx/apiclient_key.pem"; + String apiclientCert = "/Users/gxwebsoft/JAVA/site-java/cert/bszx/apiclient_cert.pem"; + String pubKey = "/Users/gxwebsoft/JAVA/site-java/cert/bszx/0f65a8517c284acb90aa83dd0c23e8f6.pem"; + String pubId = "PUB_KEY_ID_0112422897022025011300326200001208"; + // 生产环境 + if (ObjectUtil.isNotEmpty(payment)) { + // 检查 payment 字段是否为空,并避免直接解析为数字 + mid = payment.getMchId(); + apiV3Key = payment.getApiKey(); + serialNumber = payment.getMerchantSerialNumber(); + // 生产环境使用容器证书路径 /www/wwwroot/file.ws + privateKey = "/www/wwwroot/file.ws" + payment.getApiclientKey(); + apiclientCert = "/www/wwwroot/file.ws" + payment.getApiclientCert(); + pubKey = "/www/wwwroot/file.ws" + payment.getPubKey(); + pubId = payment.getPubKeyId(); + } + RequestParam requestParam = new RequestParam.Builder() + .serialNumber(header.get("wechatpay-serial")) + .nonce(header.get("wechatpay-nonce")) + .signature(header.get("wechatpay-signature")) + .timestamp(header.get("wechatpay-timestamp")) + .body(body) + .build(); + + +// NotificationConfig config = new RSAPublicKeyConfig.Builder() +// .merchantId(mid) +// .publicKeyFromPath(pubKey) +// .publicKeyId(pubId) +// .privateKeyFromPath(privateKey) +// .merchantSerialNumber(serialNumber) +// .apiV3Key(apiV3Key) +// .build(); + + NotificationConfig config = new RSAPublicKeyNotificationConfig.Builder() + .publicKeyFromPath(pubKey) + .publicKeyId(pubId) + .apiV3Key(apiV3Key) + .build(); + + + // 初始化 NotificationParser + NotificationParser parser = new NotificationParser(config); + + // 以支付通知回调为例,验签、解密并转换成 Transaction + try { + Transaction transaction = parser.parse(requestParam, Transaction.class); + final String outTradeNo = transaction.getOutTradeNo(); + final String transactionId = transaction.getTransactionId(); + final Integer total = transaction.getAmount().getTotal(); + final String tradeStateDesc = transaction.getTradeStateDesc(); + final Transaction.TradeStateEnum tradeState = transaction.getTradeState(); + final Transaction.TradeTypeEnum tradeType = transaction.getTradeType(); + System.out.println("transaction = " + transaction); + System.out.println("tradeStateDesc = " + tradeStateDesc); + System.out.println("tradeType = " + tradeType); + System.out.println("tradeState = " + tradeState); + System.out.println("outTradeNo = " + outTradeNo); + System.out.println("amount = " + total); + + if (StrUtil.equals("支付成功", tradeStateDesc)) { + // 1. 查询要处理的订单 + ShopOrder order = shopOrderService.getByOutTradeNo(outTradeNo); + // 2. 已支付则跳过 + if (order.getPayStatus().equals(true)) { + return "SUCCESS"; + } + // 2. 未支付则处理更新订单状态 + if (order.getPayStatus().equals(false)) { + // 5. TODO 处理订单状态 + order.setPayTime(LocalDateTime.now()); + order.setPayStatus(true); + order.setTransactionId(transactionId); + order.setPayPrice(new BigDecimal(NumberUtil.decimalFormat("0.00", total * 0.01))); + order.setExpirationTime(LocalDateTime.now().plusYears(10)); + System.out.println("实际付款金额 = " + order.getPayPrice()); + return "SUCCESS"; + } + } + } catch (Exception $e) { + System.out.println($e.getMessage()); + System.out.println(Arrays.toString($e.getStackTrace())); + } + + return "fail"; + } + + + @PreAuthorize("hasAuthority('shop:shopOrder:update')") + @Operation(summary = "修复订单") + @PutMapping("/repair") + public ApiResult repair(@RequestBody ShopOrder shopOrder) { + if (shopOrderService.queryOrderByOutTradeNo(shopOrder)) { + if (bszxPayService.count(new LambdaQueryWrapper().eq(BszxPay::getOrderNo, shopOrder.getOrderNo())) == 0) { + final BszxPay bszxPay = new BszxPay(); + final BszxBm bm = shopOrder.getBm(); + if (ObjectUtil.isNotEmpty(bm)) { + bszxPay.setName(bm.getName()); + bszxPay.setSex(bm.getSex()); + bszxPay.setClassName(bm.getClassName()); + bszxPay.setGradeName(bm.getGradeName()); + bszxPay.setAddress(bm.getAddress()); + bszxPay.setWorkUnit(bm.getWorkUnit()); + bszxPay.setPosition(bm.getPosition()); + bszxPay.setPrice(shopOrder.getPayPrice()); + bszxPay.setOrderNo(shopOrder.getOrderNo()); + bszxPay.setUserId(shopOrder.getUserId()); + bszxPay.setFormId(shopOrder.getFormId()); + bszxPay.setComments(shopOrder.getComments()); + bszxPayService.save(bszxPay); + } + shopOrder.setOrderStatus(1); + shopOrderService.updateById(shopOrder); + } + return success("修复成功"); + } + return fail("修复失败"); + } + + @Operation(summary = "获取捐款证书") + @GetMapping("/generatePayCert/{id}") + public ApiResult generatePayCert(@PathVariable("id") Integer id) throws Exception { + return success("获取捐款证书", bszxPayService.generatePayCert(id)); + } +} diff --git a/src/main/java/com/gxwebsoft/bszx/controller/BszxPayRankingController.java b/src/main/java/com/gxwebsoft/bszx/controller/BszxPayRankingController.java new file mode 100644 index 0000000..6458b32 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/controller/BszxPayRankingController.java @@ -0,0 +1,198 @@ +package com.gxwebsoft.bszx.controller; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.bszx.entity.BszxClass; +import com.gxwebsoft.bszx.entity.BszxPay; +import com.gxwebsoft.bszx.param.BszxClassParam; +import com.gxwebsoft.bszx.service.BszxClassService; +import com.gxwebsoft.bszx.service.BszxPayService; +import com.gxwebsoft.cms.entity.CmsArticle; +import com.gxwebsoft.cms.service.CmsArticleService; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.bszx.service.BszxPayRankingService; +import com.gxwebsoft.bszx.entity.BszxPayRanking; +import com.gxwebsoft.bszx.param.BszxPayRankingParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * 百色中学-捐款排行控制器 + * + * @author 科技小王子 + * @since 2025-03-25 08:54:09 + */ +@Tag(name = "百色中学-捐款排行管理") +@RestController +@RequestMapping("/api/bszx/bszx-pay-ranking") +public class BszxPayRankingController extends BaseController { + @Resource + private BszxPayRankingService bszxPayRankingService; + @Resource + private CmsArticleService cmsArticleService; + @Resource + private BszxPayService bszxPayService; + @Resource + private BszxClassService bszxClassService; + @Resource + private RedisUtil redisUtil; + + @PreAuthorize("hasAuthority('bszx:bszxPayRanking:list')") + @Operation(summary = "分页查询百色中学-捐款排行") + @GetMapping("/page") + public ApiResult> page(BszxPayRankingParam param) { + // 使用关联查询 + return success(bszxPayRankingService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('bszx:bszxPayRanking:list')") + @Operation(summary = "查询全部百色中学-捐款排行") + @GetMapping() + public ApiResult> list(BszxPayRankingParam param) { + // 使用关联查询 + return success(bszxPayRankingService.listRel(param)); + } + + @Operation(summary = "查询全部百色中学-捐款排行榜") + @GetMapping("/ranking") + public ApiResult> ranking(BszxPayRankingParam param) { + final ArrayList rankings = new ArrayList<>(); + final LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + final List list = cmsArticleService.list(new LambdaQueryWrapper().eq(CmsArticle::getCategoryId, 2444)); + + list.forEach(item -> { + final BszxPayRanking ranking = new BszxPayRanking(); + wrapper.clear(); + // 按时间段查询 + if(param.getCreateTimeStart() != null && param.getCreateTimeEnd() != null){ + final String timeStart = param.getCreateTimeStart(); + final String timeEnd = param.getCreateTimeEnd(); + wrapper.ge(BszxPay::getCreateTime, timeStart); + wrapper.le(BszxPay::getCreateTime, timeEnd); + } + wrapper.eq(BszxPay::getFormId, item.getArticleId()); + ranking.setFormId(item.getArticleId()); + ranking.setFormName(item.getTitle()); + ranking.setNumber((long) bszxPayService.count(wrapper)); + ranking.setTotalPrice(bszxPayService.sumMoney(wrapper)); + rankings.add(ranking); + }); + // totalPrice按大到小排序 + rankings.sort((o1, o2) -> o2.getTotalPrice().compareTo(o1.getTotalPrice())); + return success(rankings); + } + + + @Operation(summary = "查询全部百色中学-千班万元") + @GetMapping("/ranking2") + public ApiResult> ranking2(BszxClassParam param) { + final LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + final List list = bszxClassService.listRel(param); + + String key = "BSZX:UpdateRanking2"; + final String isTimeOut = redisUtil.get(key); + if(StrUtil.isNotBlank(isTimeOut)){ + list.sort((o1, o2) -> o2.getTotalMoney().compareTo(o1.getTotalMoney())); + return success(list); + } + list.forEach(item -> { + wrapper.clear(); + wrapper.eq(BszxPay::getGradeName,item.getGradeName()); + wrapper.eq(BszxPay::getClassName, item.getName()); + item.setTotalMoney(bszxPayService.sumMoney(wrapper)); + bszxClassService.updateById(item); + }); + // totalPrice按大到小排序 + list.sort((o1, o2) -> o2.getTotalMoney().compareTo(o1.getTotalMoney())); + redisUtil.set(key, 1,1L, TimeUnit.DAYS); + return success(list); + } + + + @PreAuthorize("hasAuthority('bszx:bszxPayRanking:list')") + @Operation(summary = "根据id查询百色中学-捐款排行") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(bszxPayRankingService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('bszx:bszxPayRanking:save')") + @OperationLog + @Operation(summary = "添加百色中学-捐款排行") + @PostMapping() + public ApiResult save(@RequestBody BszxPayRanking bszxPayRanking) { + if (bszxPayRankingService.save(bszxPayRanking)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxPayRanking:update')") + @OperationLog + @Operation(summary = "修改百色中学-捐款排行") + @PutMapping() + public ApiResult update(@RequestBody BszxPayRanking bszxPayRanking) { + if (bszxPayRankingService.updateById(bszxPayRanking)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxPayRanking:remove')") + @OperationLog + @Operation(summary = "删除百色中学-捐款排行") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (bszxPayRankingService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxPayRanking:save')") + @OperationLog + @Operation(summary = "批量添加百色中学-捐款排行") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (bszxPayRankingService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxPayRanking:update')") + @OperationLog + @Operation(summary = "批量修改百色中学-捐款排行") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(bszxPayRankingService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('bszx:bszxPayRanking:remove')") + @OperationLog + @Operation(summary = "批量删除百色中学-捐款排行") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (bszxPayRankingService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/bszx/entity/BszxBm.java b/src/main/java/com/gxwebsoft/bszx/entity/BszxBm.java new file mode 100644 index 0000000..c4dee60 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/entity/BszxBm.java @@ -0,0 +1,151 @@ +package com.gxwebsoft.bszx.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import java.time.LocalDate; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import com.gxwebsoft.cms.entity.CmsArticle; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 百色中学-报名记录 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "BszxBm对象", description = "百色中学-报名记录") +public class BszxBm implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "姓名") + private String name; + + @Schema(description = "类型 0校友 1单位 2爱心人士") + private Integer type; + + @Schema(description = "性别 1男 2女") + private String sex; + + @Schema(description = "性别名称") + @TableField(exist = false) + private String sexName; + + @Schema(description = "手机号码") + private String phone; + + @Schema(description = "手机号码") + @TableField(exist = false) + private String mobile; + + @Schema(description = "班级ID") + private Integer classId; + + @Schema(description = "班级") + private String className; + + @Schema(description = "年级") + private String gradeName; + + @Schema(description = "分部ID") + private Integer branchId; + + @Schema(description = "分部名称") + @TableField(exist = false) + private String branchName; + + @Schema(description = "居住地址") + private String address; + + @Schema(description = "工作单位") + private String workUnit; + + @Schema(description = "职务") + private String position; + + @Schema(description = "是否能到场") + private String present; + + @Schema(description = "年龄") + private Integer age; + + @Schema(description = "人数") + private Integer number; + + @Schema(description = "额外信息") + private String extra; + + @Schema(description = "生成的邀请函存放路径") + private String certificate; + + @Schema(description = "预定日期") + private LocalDate dateTime; + + @Schema(description = "表单数据") + private String formData; + + @Schema(description = "表单ID") + private Integer formId; + + @Schema(description = "活动名称") + @TableField(exist = false) + private String formName; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "文章对象") + @TableField(exist = false) + private CmsArticle article; + + public String getSexName() { + if (this.sex == null) { + return ""; + } + return this.sex.equals("1") ? "男" : "女"; + } + +} diff --git a/src/main/java/com/gxwebsoft/bszx/entity/BszxBranch.java b/src/main/java/com/gxwebsoft/bszx/entity/BszxBranch.java new file mode 100644 index 0000000..f8ffe72 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/entity/BszxBranch.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.bszx.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import java.util.List; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 百色中学-分部 + * + * @author 科技小王子 + * @since 2025-03-17 17:18:22 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "BszxBranch对象", description = "百色中学-分部") +public class BszxBranch implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "分部名称 ") + private String name; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "子分类") + @TableField(exist = false) + private List children; + +} diff --git a/src/main/java/com/gxwebsoft/bszx/entity/BszxClass.java b/src/main/java/com/gxwebsoft/bszx/entity/BszxClass.java new file mode 100644 index 0000000..e7340cd --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/entity/BszxClass.java @@ -0,0 +1,70 @@ +package com.gxwebsoft.bszx.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 百色中学-班级 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "BszxClass对象", description = "百色中学-班级") +public class BszxClass implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "时代ID") + private Integer eraId; + + @Schema(description = "时代名称") + @TableField(exist = false) + private String eraName; + + @Schema(description = "年级ID") + private Integer gradeId; + + @Schema(description = "年级名称") + @TableField(exist = false) + private String gradeName; + + @Schema(description = "班级") + private String name; + + @Schema(description = "累计捐款金额") + private BigDecimal totalMoney; + + @Schema(description = "分部") + private Integer branch; + + @Schema(description = "分部名称") + @TableField(exist = false) + private String branchName; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "子分类") + @TableField(exist = false) + private List children; +} diff --git a/src/main/java/com/gxwebsoft/bszx/entity/BszxEra.java b/src/main/java/com/gxwebsoft/bszx/entity/BszxEra.java new file mode 100644 index 0000000..5b7be7a --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/entity/BszxEra.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.bszx.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import java.util.List; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 百色中学-年代 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "BszxEra对象", description = "百色中学-年代") +public class BszxEra implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "年代") + private String name; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "子分类") + @TableField(exist = false) + private List children; + +} diff --git a/src/main/java/com/gxwebsoft/bszx/entity/BszxGrade.java b/src/main/java/com/gxwebsoft/bszx/entity/BszxGrade.java new file mode 100644 index 0000000..6eacb08 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/entity/BszxGrade.java @@ -0,0 +1,53 @@ +package com.gxwebsoft.bszx.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 百色中学-年级 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "BszxGrade对象", description = "百色中学-年级") +public class BszxGrade implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "年级") + private String name; + + @Schema(description = "年代") + private Integer eraId; + + @Schema(description = "分部") + private Integer branch; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "子分类") + @TableField(exist = false) + private List children; + +} diff --git a/src/main/java/com/gxwebsoft/bszx/entity/BszxPay.java b/src/main/java/com/gxwebsoft/bszx/entity/BszxPay.java new file mode 100644 index 0000000..a61e6b8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/entity/BszxPay.java @@ -0,0 +1,143 @@ +package com.gxwebsoft.bszx.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import java.time.LocalDate; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import com.gxwebsoft.cms.entity.CmsArticle; +import com.gxwebsoft.shop.entity.ShopOrder; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 百色中学-捐款记录 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "BszxPay对象", description = "百色中学-捐款记录") +public class BszxPay implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "年龄") + private Integer age; + + @Schema(description = "姓名") + private String name; + + @Schema(description = "性别 1男 2女") + private String sex; + + @Schema(description = "手机号码") + private String phone; + + @Schema(description = "手机号码") + @TableField(exist = false) + private String mobile; + + @Schema(description = "分部") + private String branchName; + + @Schema(description = "班级") + private String className; + + @Schema(description = "年级") + private String gradeName; + + @Schema(description = "居住地址") + private String address; + + @Schema(description = "工作单位") + private String workUnit; + + @Schema(description = "职务") + private String position; + + @Schema(description = "数量") + private Integer number; + + @Schema(description = "付费金额") + private BigDecimal price; + + @Schema(description = "额外信息") + private String extra; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "预定日期") + private LocalDate dateTime; + + @Schema(description = "捐赠证书") + private String certificate; + + @Schema(description = "表单数据") + private String formData; + + @Schema(description = "来源表ID") + private Integer formId; + + @Schema(description = "活动名称") + @TableField(exist = false) + private String formName; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "文章") + @TableField(exist = false) + private CmsArticle article; + + @Schema(description = "订单") + @TableField(exist = false) + private ShopOrder shopOrder; + + public String getSexName() { + return this.sex.equals("1") ? "男" : "女"; + } + +} diff --git a/src/main/java/com/gxwebsoft/bszx/entity/BszxPayRanking.java b/src/main/java/com/gxwebsoft/bszx/entity/BszxPayRanking.java new file mode 100644 index 0000000..6956822 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/entity/BszxPayRanking.java @@ -0,0 +1,67 @@ +package com.gxwebsoft.bszx.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 百色中学-捐款排行 + * + * @author 科技小王子 + * @since 2025-03-25 08:54:09 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "BszxPayRanking对象", description = "百色中学-捐款排行") +public class BszxPayRanking implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "来源表ID(文章ID)") + private Integer formId; + + @Schema(description = "项目名称") + @TableField(exist = false) + private String formName; + + @Schema(description = "数量") + private Long number; + + @Schema(description = "获得捐款总金额") + private BigDecimal totalPrice; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/bszx/mapper/BszxBmMapper.java b/src/main/java/com/gxwebsoft/bszx/mapper/BszxBmMapper.java new file mode 100644 index 0000000..7c63575 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/mapper/BszxBmMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.bszx.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.bszx.entity.BszxBm; +import com.gxwebsoft.bszx.param.BszxBmParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 百色中学-报名记录Mapper + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +public interface BszxBmMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") BszxBmParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") BszxBmParam param); + +} diff --git a/src/main/java/com/gxwebsoft/bszx/mapper/BszxBranchMapper.java b/src/main/java/com/gxwebsoft/bszx/mapper/BszxBranchMapper.java new file mode 100644 index 0000000..d94fd0b --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/mapper/BszxBranchMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.bszx.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.bszx.entity.BszxBranch; +import com.gxwebsoft.bszx.param.BszxBranchParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 百色中学-分部Mapper + * + * @author 科技小王子 + * @since 2025-03-17 17:18:22 + */ +public interface BszxBranchMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") BszxBranchParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") BszxBranchParam param); + +} diff --git a/src/main/java/com/gxwebsoft/bszx/mapper/BszxClassMapper.java b/src/main/java/com/gxwebsoft/bszx/mapper/BszxClassMapper.java new file mode 100644 index 0000000..81d251f --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/mapper/BszxClassMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.bszx.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.bszx.entity.BszxClass; +import com.gxwebsoft.bszx.param.BszxClassParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 百色中学-班级Mapper + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +public interface BszxClassMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") BszxClassParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") BszxClassParam param); + +} diff --git a/src/main/java/com/gxwebsoft/bszx/mapper/BszxEraMapper.java b/src/main/java/com/gxwebsoft/bszx/mapper/BszxEraMapper.java new file mode 100644 index 0000000..17d83c9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/mapper/BszxEraMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.bszx.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.bszx.entity.BszxEra; +import com.gxwebsoft.bszx.param.BszxEraParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 百色中学-年代Mapper + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +public interface BszxEraMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") BszxEraParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") BszxEraParam param); + +} diff --git a/src/main/java/com/gxwebsoft/bszx/mapper/BszxGradeMapper.java b/src/main/java/com/gxwebsoft/bszx/mapper/BszxGradeMapper.java new file mode 100644 index 0000000..1e566bb --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/mapper/BszxGradeMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.bszx.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.bszx.entity.BszxGrade; +import com.gxwebsoft.bszx.param.BszxGradeParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 百色中学-年级Mapper + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +public interface BszxGradeMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") BszxGradeParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") BszxGradeParam param); + +} diff --git a/src/main/java/com/gxwebsoft/bszx/mapper/BszxPayMapper.java b/src/main/java/com/gxwebsoft/bszx/mapper/BszxPayMapper.java new file mode 100644 index 0000000..020c7ea --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/mapper/BszxPayMapper.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.bszx.mapper; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.bszx.entity.BszxPay; +import com.gxwebsoft.bszx.param.BszxPayParam; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 百色中学-捐款记录Mapper + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +public interface BszxPayMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") BszxPayParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") BszxPayParam param); + + BigDecimal selectSumMoney(@Param("ew") Wrapper wrapper); + +} diff --git a/src/main/java/com/gxwebsoft/bszx/mapper/BszxPayRankingMapper.java b/src/main/java/com/gxwebsoft/bszx/mapper/BszxPayRankingMapper.java new file mode 100644 index 0000000..c6e14b0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/mapper/BszxPayRankingMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.bszx.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.bszx.entity.BszxPayRanking; +import com.gxwebsoft.bszx.param.BszxPayRankingParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 百色中学-捐款排行Mapper + * + * @author 科技小王子 + * @since 2025-03-25 08:54:09 + */ +public interface BszxPayRankingMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") BszxPayRankingParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") BszxPayRankingParam param); + +} diff --git a/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxBmMapper.xml b/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxBmMapper.xml new file mode 100644 index 0000000..74d0099 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxBmMapper.xml @@ -0,0 +1,113 @@ + + + + + + + SELECT a.*,b.title as formName, c.name as branchName, u.phone as mobile,u.avatar,u.nickname + FROM bszx_bm a + LEFT JOIN cms_article b ON a.form_id = b.article_id + LEFT JOIN bszx_branch c ON a.branch_id = c.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.type = #{param.type} + + + AND a.sex = #{param.sex} + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.branch_id = #{param.branchId} + + + AND a.class_name LIKE CONCAT('%', #{param.className}, '%') + + + AND a.grade_name LIKE CONCAT('%', #{param.gradeName}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.work_unit LIKE CONCAT('%', #{param.workUnit}, '%') + + + AND a.position LIKE CONCAT('%', #{param.position}, '%') + + + AND a.present = #{param.present} + + + AND a.age = #{param.age} + + + AND a.number = #{param.number} + + + AND a.extra LIKE CONCAT('%', #{param.extra}, '%') + + + AND a.certificate LIKE CONCAT('%', #{param.certificate}, '%') + + + AND a.date_time LIKE CONCAT('%', #{param.dateTime}, '%') + + + AND a.form_data LIKE CONCAT('%', #{param.formData}, '%') + + + AND a.form_id = #{param.formId} + + + AND a.user_id = #{param.userId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.phone = #{param.keywords} + OR a.name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxBranchMapper.xml b/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxBranchMapper.xml new file mode 100644 index 0000000..c9c7fa0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxBranchMapper.xml @@ -0,0 +1,36 @@ + + + + + + + SELECT a.* + FROM bszx_branch a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxClassMapper.xml b/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxClassMapper.xml new file mode 100644 index 0000000..8f07436 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxClassMapper.xml @@ -0,0 +1,63 @@ + + + + + + + SELECT a.*,b.name as gradeName, c.name as eraName, d.name as branchName + FROM bszx_class a + LEFT JOIN bszx_grade b ON a.grade_id = b.id + LEFT JOIN bszx_era c ON a.era_id = c.id + LEFT JOIN bszx_branch d ON a.branch = d.id + + + AND a.id = #{param.id} + + + AND a.era_id = #{param.eraId} + + + AND a.grade_id = #{param.gradeId} + + + AND b.name = #{param.gradeName} + + + AND a.name = #{param.name} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.branch = #{param.branch} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxEraMapper.xml b/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxEraMapper.xml new file mode 100644 index 0000000..867fdf4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxEraMapper.xml @@ -0,0 +1,36 @@ + + + + + + + SELECT a.* + FROM bszx_era a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxGradeMapper.xml b/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxGradeMapper.xml new file mode 100644 index 0000000..df9419e --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxGradeMapper.xml @@ -0,0 +1,54 @@ + + + + + + + SELECT a.* + FROM bszx_grade a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.era_id = #{param.eraId} + + + AND a.branch = #{param.branch} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxPayMapper.xml b/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxPayMapper.xml new file mode 100644 index 0000000..fde31b8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxPayMapper.xml @@ -0,0 +1,126 @@ + + + + + + + SELECT a.*,b.title as formName,u.phone as mobile,u.avatar,u.nickname + FROM bszx_pay a + LEFT JOIN cms_article b ON a.form_id = b.article_id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.age = #{param.age} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.sex = #{param.sex} + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.class_name = #{param.className} + + + AND a.grade_name LIKE CONCAT('%', #{param.gradeName}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.work_unit LIKE CONCAT('%', #{param.workUnit}, '%') + + + AND a.position LIKE CONCAT('%', #{param.position}, '%') + + + AND a.number = #{param.number} + + + AND a.price = #{param.price} + + + AND a.extra LIKE CONCAT('%', #{param.extra}, '%') + + + AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%') + + + AND a.date_time LIKE CONCAT('%', #{param.dateTime}, '%') + + + AND a.certificate LIKE CONCAT('%', #{param.certificate}, '%') + + + AND a.form_data LIKE CONCAT('%', #{param.formData}, '%') + + + AND a.form_id = #{param.formId} + + + AND a.user_id = #{param.userId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND a.order_no IN + + #{item} + + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR u.phone = #{param.keywords} + OR a.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.order_no = #{param.keywords} + ) + + + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxPayRankingMapper.xml b/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxPayRankingMapper.xml new file mode 100644 index 0000000..806e26f --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/mapper/xml/BszxPayRankingMapper.xml @@ -0,0 +1,61 @@ + + + + + + + SELECT a.*,b.title as formName + FROM bszx_pay_ranking a + LEFT JOIN cms_article b ON a.form_id = b.article_id + + + AND a.id = #{param.id} + + + AND a.form_id = #{param.formId} + + + AND a.number = #{param.number} + + + AND a.total_price = #{param.totalPrice} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/bszx/param/BszxBmParam.java b/src/main/java/com/gxwebsoft/bszx/param/BszxBmParam.java new file mode 100644 index 0000000..b8b665c --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/param/BszxBmParam.java @@ -0,0 +1,114 @@ +package com.gxwebsoft.bszx.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 百色中学-报名记录查询参数 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "BszxBmParam对象", description = "百色中学-报名记录查询参数") +public class BszxBmParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "姓名") + private String name; + + @Schema(description = "类型 0校友 1单位") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "性别 1男 2女") + @QueryField(type = QueryType.EQ) + private Integer sex; + + @Schema(description = "手机号码") + private String phone; + + @Schema(description = "班级") + private String className; + + @Schema(description = "年级") + private String gradeName; + + @Schema(description = "分部ID") + @QueryField(type = QueryType.EQ) + private Integer branchId; + + @Schema(description = "居住地址") + private String address; + + @Schema(description = "工作单位") + private String workUnit; + + @Schema(description = "职务") + private String position; + + @Schema(description = "是否能到场") + @QueryField(type = QueryType.EQ) + private Boolean present; + + @Schema(description = "年龄") + @QueryField(type = QueryType.EQ) + private Integer age; + + @Schema(description = "人数") + @QueryField(type = QueryType.EQ) + private Integer number; + + @Schema(description = "额外信息") + private String extra; + + @Schema(description = "生成的邀请函存放路径") + private String certificate; + + @Schema(description = "预定日期") + private String dateTime; + + @Schema(description = "表单数据") + private String formData; + + @Schema(description = "表单ID") + @QueryField(type = QueryType.EQ) + private Integer formId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "订单编号") + @QueryField(type = QueryType.LIKE) + private String orderNo; + +} diff --git a/src/main/java/com/gxwebsoft/bszx/param/BszxBranchParam.java b/src/main/java/com/gxwebsoft/bszx/param/BszxBranchParam.java new file mode 100644 index 0000000..642988c --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/param/BszxBranchParam.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.bszx.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 百色中学-分部查询参数 + * + * @author 科技小王子 + * @since 2025-03-17 17:18:22 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "BszxBranchParam对象", description = "百色中学-分部查询参数") +public class BszxBranchParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "分部名称 ") + private String name; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + +} diff --git a/src/main/java/com/gxwebsoft/bszx/param/BszxClassParam.java b/src/main/java/com/gxwebsoft/bszx/param/BszxClassParam.java new file mode 100644 index 0000000..5145480 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/param/BszxClassParam.java @@ -0,0 +1,64 @@ +package com.gxwebsoft.bszx.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 百色中学-班级查询参数 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "BszxClassParam对象", description = "百色中学-班级查询参数") +public class BszxClassParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "时代ID") + @QueryField(type = QueryType.EQ) + private Integer eraId; + + @Schema(description = "年级ID") + @QueryField(type = QueryType.EQ) + private Integer gradeId; + + @Schema(description = "年级") + @QueryField(type = QueryType.EQ) + private String gradeName; + + @Schema(description = "累计捐款金额") + @QueryField(type = QueryType.EQ) + private BigDecimal totalMoney; + + @Schema(description = "班级") + private String name; + + @Schema(description = "分部") + @QueryField(type = QueryType.EQ) + private Integer branch; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/bszx/param/BszxEraParam.java b/src/main/java/com/gxwebsoft/bszx/param/BszxEraParam.java new file mode 100644 index 0000000..4fb6ffe --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/param/BszxEraParam.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.bszx.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 百色中学-年代查询参数 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "BszxEraParam对象", description = "百色中学-年代查询参数") +public class BszxEraParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "年代") + private String name; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + +} diff --git a/src/main/java/com/gxwebsoft/bszx/param/BszxGradeParam.java b/src/main/java/com/gxwebsoft/bszx/param/BszxGradeParam.java new file mode 100644 index 0000000..3d40762 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/param/BszxGradeParam.java @@ -0,0 +1,52 @@ +package com.gxwebsoft.bszx.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 百色中学-年级查询参数 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "BszxGradeParam对象", description = "百色中学-年级查询参数") +public class BszxGradeParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "年级") + private String name; + + @Schema(description = "年代") + @QueryField(type = QueryType.EQ) + private Integer eraId; + + @Schema(description = "分部") + @QueryField(type = QueryType.EQ) + private Integer branch; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/bszx/param/BszxPayParam.java b/src/main/java/com/gxwebsoft/bszx/param/BszxPayParam.java new file mode 100644 index 0000000..95ff991 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/param/BszxPayParam.java @@ -0,0 +1,118 @@ +package com.gxwebsoft.bszx.param; + +import java.math.BigDecimal; +import java.util.Set; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 百色中学-捐款记录查询参数 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "BszxPayParam对象", description = "百色中学-捐款记录查询参数") +public class BszxPayParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "年龄") + @QueryField(type = QueryType.EQ) + private Integer age; + + @Schema(description = "姓名") + private String name; + + @Schema(description = "性别 1男 2女") + @QueryField(type = QueryType.EQ) + private Integer sex; + + @Schema(description = "手机号码") + private String phone; + + @Schema(description = "班级") + private String className; + + @Schema(description = "年级") + private String gradeName; + + @Schema(description = "居住地址") + private String address; + + @Schema(description = "工作单位") + private String workUnit; + + @Schema(description = "职务") + private String position; + + @Schema(description = "数量") + @QueryField(type = QueryType.EQ) + private Integer number; + + @Schema(description = "付费金额") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "额外信息") + private String extra; + + @Schema(description = "订单编号") + @QueryField(type = QueryType.EQ) + private String orderNo; + + @Schema(description = "订单编号") + @QueryField(type = QueryType.IN) + private Set orderNos; + + @Schema(description = "预定日期") + private String dateTime; + + @Schema(description = "捐赠证书") + private String certificate; + + @Schema(description = "表单数据") + private String formData; + + @Schema(description = "来源表ID") + @QueryField(type = QueryType.EQ) + private Integer formId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "登录用户") + @TableField(exist = false) + private User loginUser; + +} diff --git a/src/main/java/com/gxwebsoft/bszx/param/BszxPayRankingParam.java b/src/main/java/com/gxwebsoft/bszx/param/BszxPayRankingParam.java new file mode 100644 index 0000000..51a37a6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/param/BszxPayRankingParam.java @@ -0,0 +1,57 @@ +package com.gxwebsoft.bszx.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 百色中学-捐款排行查询参数 + * + * @author 科技小王子 + * @since 2025-03-25 08:54:09 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "BszxPayRankingParam对象", description = "百色中学-捐款排行查询参数") +public class BszxPayRankingParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "来源表ID(项目名称)") + @QueryField(type = QueryType.EQ) + private Integer formId; + + @Schema(description = "数量") + @QueryField(type = QueryType.EQ) + private Integer number; + + @Schema(description = "获得捐款总金额") + @QueryField(type = QueryType.EQ) + private BigDecimal totalPrice; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/bszx/service/BszxBmService.java b/src/main/java/com/gxwebsoft/bszx/service/BszxBmService.java new file mode 100644 index 0000000..f8caaa3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/service/BszxBmService.java @@ -0,0 +1,50 @@ +package com.gxwebsoft.bszx.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.bszx.entity.BszxBm; +import com.gxwebsoft.bszx.param.BszxBmParam; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 百色中学-报名记录Service + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +public interface BszxBmService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(BszxBmParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(BszxBmParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return BszxBm + */ + BszxBm getByIdRel(Integer id); + + /** + * 生成海报 + */ + String generatePoster(BszxBm bm) throws Exception; + + BszxBm getByUserId(Integer userId); +} diff --git a/src/main/java/com/gxwebsoft/bszx/service/BszxBranchService.java b/src/main/java/com/gxwebsoft/bszx/service/BszxBranchService.java new file mode 100644 index 0000000..c7fe0ac --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/service/BszxBranchService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.bszx.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.bszx.entity.BszxBranch; +import com.gxwebsoft.bszx.param.BszxBranchParam; + +import java.util.List; + +/** + * 百色中学-分部Service + * + * @author 科技小王子 + * @since 2025-03-17 17:18:22 + */ +public interface BszxBranchService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(BszxBranchParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(BszxBranchParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return BszxBranch + */ + BszxBranch getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/bszx/service/BszxClassService.java b/src/main/java/com/gxwebsoft/bszx/service/BszxClassService.java new file mode 100644 index 0000000..7871918 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/service/BszxClassService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.bszx.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.bszx.entity.BszxClass; +import com.gxwebsoft.bszx.param.BszxClassParam; + +import java.util.List; + +/** + * 百色中学-班级Service + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +public interface BszxClassService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(BszxClassParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(BszxClassParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return BszxClass + */ + BszxClass getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/bszx/service/BszxEraService.java b/src/main/java/com/gxwebsoft/bszx/service/BszxEraService.java new file mode 100644 index 0000000..efff9da --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/service/BszxEraService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.bszx.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.bszx.entity.BszxEra; +import com.gxwebsoft.bszx.param.BszxEraParam; + +import java.util.List; + +/** + * 百色中学-年代Service + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +public interface BszxEraService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(BszxEraParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(BszxEraParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return BszxEra + */ + BszxEra getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/bszx/service/BszxGradeService.java b/src/main/java/com/gxwebsoft/bszx/service/BszxGradeService.java new file mode 100644 index 0000000..17b5dfd --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/service/BszxGradeService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.bszx.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.bszx.entity.BszxGrade; +import com.gxwebsoft.bszx.param.BszxGradeParam; + +import java.util.List; + +/** + * 百色中学-年级Service + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +public interface BszxGradeService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(BszxGradeParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(BszxGradeParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return BszxGrade + */ + BszxGrade getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/bszx/service/BszxPayRankingService.java b/src/main/java/com/gxwebsoft/bszx/service/BszxPayRankingService.java new file mode 100644 index 0000000..962ff2b --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/service/BszxPayRankingService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.bszx.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.bszx.entity.BszxPayRanking; +import com.gxwebsoft.bszx.param.BszxPayRankingParam; + +import java.util.List; + +/** + * 百色中学-捐款排行Service + * + * @author 科技小王子 + * @since 2025-03-25 08:54:09 + */ +public interface BszxPayRankingService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(BszxPayRankingParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(BszxPayRankingParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return BszxPayRanking + */ + BszxPayRanking getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/bszx/service/BszxPayService.java b/src/main/java/com/gxwebsoft/bszx/service/BszxPayService.java new file mode 100644 index 0000000..20c8cfc --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/service/BszxPayService.java @@ -0,0 +1,57 @@ +package com.gxwebsoft.bszx.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.bszx.entity.BszxPay; +import com.gxwebsoft.bszx.param.BszxPayParam; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 百色中学-捐款记录Service + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +public interface BszxPayService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(BszxPayParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(BszxPayParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return BszxPay + */ + BszxPay getByIdRel(Integer id); + + /** + * 生成捐款证书 + */ + String generatePayCert(Integer id) throws Exception; + + BigDecimal sumMoney(LambdaQueryWrapper between); + + /** + * 统计捐款总金额 + * + * @return 捐款总金额 + */ + BigDecimal total(); +} diff --git a/src/main/java/com/gxwebsoft/bszx/service/impl/BszxBmServiceImpl.java b/src/main/java/com/gxwebsoft/bszx/service/impl/BszxBmServiceImpl.java new file mode 100644 index 0000000..2544afd --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/service/impl/BszxBmServiceImpl.java @@ -0,0 +1,239 @@ +package com.gxwebsoft.bszx.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.freewayso.image.combiner.ImageCombiner; +import com.freewayso.image.combiner.enums.OutputFormat; + +import java.awt.Font; +import com.gxwebsoft.bszx.entity.BszxClass; +import com.gxwebsoft.bszx.mapper.BszxBmMapper; +import com.gxwebsoft.bszx.param.BszxClassParam; +import com.gxwebsoft.bszx.service.BszxBmService; +import com.gxwebsoft.bszx.entity.BszxBm; +import com.gxwebsoft.bszx.param.BszxBmParam; +import com.gxwebsoft.bszx.service.BszxClassService; +import com.gxwebsoft.cms.entity.CmsArticle; +import com.gxwebsoft.cms.service.CmsArticleService; +import com.gxwebsoft.common.core.config.ConfigProperties; +import com.gxwebsoft.common.core.utils.FileServerUtil; +import com.gxwebsoft.common.core.utils.ImageUtil; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.jetbrains.annotations.NotNull; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.awt.*; +import java.io.File; +import java.time.LocalDateTime; +import java.util.List; + +/** + * 百色中学-报名记录Service实现 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Service +public class BszxBmServiceImpl extends ServiceImpl implements BszxBmService { + @Value("${config.upload-path}") + private String uploadPath; + @Value("${config.file-server}") + private String fileServer; + @Resource + private ConfigProperties config; + @Resource + @Lazy + private CmsArticleService cmsArticleService; + @Resource + private BszxClassService bszxClassService; + + @Override + public PageResult pageRel(BszxBmParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("id desc"); + List list = baseMapper.selectPageRel(page, param); + list.forEach(d -> { + if(d.getClassId().equals(0)){ + final BszxClassParam classParam = new BszxClassParam(); + classParam.setGradeName(d.getGradeName()); + classParam.setName(d.getClassName()); + final List bszxClasses = bszxClassService.listRel(classParam); + if (!CollectionUtils.isEmpty(bszxClasses)) { + BszxClass bszxClass = bszxClasses.get(0); + d.setClassId(bszxClass.getId()); + d.setBranchId(bszxClass.getBranch()); + updateById(d); + } + } + }); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(BszxBmParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("id desc"); + return page.sortRecords(list); + } + + @Override + public BszxBm getByIdRel(Integer id) { + BszxBmParam param = new BszxBmParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + + /** + * 生成捐款证书 ... + * + * @return + * @throws Exception + */ + @Override + public String generatePoster(BszxBm item) throws Exception { + final CmsArticle article = cmsArticleService.getById(7859); + if (ObjectUtil.isEmpty(article)) { + return null; + } + if (ObjectUtil.isNotEmpty(item)) { + + // 百色一小项目 + if(item.getTenantId().equals(10547)){ + return "https://oss.wsdns.cn/20250915/721b1e49e9924f3a83d7c32186bae16d.png"; + } + + // 百色中学 + // Font font = new Font("阿里巴巴普惠体", Font.PLAIN, 40); + //合成器(指定背景图和输出格式,整个图片的宽高和相关计算依赖于背景图,所以背景图的大小是个基准) + final ImageCombiner combiner = getImageCombiner(item, article); + + if (!FileUtil.exist(uploadPath + "/poster/" + item.getTenantId() + "/bm")) { + FileUtil.mkdir(uploadPath + "/poster/" + item.getTenantId() + "/bm"); + } + String basePath = "/poster/" + item.getTenantId() + "/bm/big-" + item.getId() + ".jpg"; + String smallPath = "/poster/" + item.getTenantId() + "/bm/" + item.getId() + ".jpg"; + String filename = uploadPath + basePath; + String smallFileName = uploadPath + smallPath; + combiner.save(filename); + + File input = new File(filename); + File output = new File(smallFileName); + ImageUtil.adjustQuality(input, output, 0.8f); + if(input.exists()){ + input.delete(); + } + return fileServer + smallPath + "?r=" + RandomUtil.randomNumbers(4); + } + return null; + } + + @NotNull + private static ImageCombiner getImageCombiner(BszxBm item, CmsArticle article) throws Exception { + ImageCombiner combiner = new ImageCombiner(article.getAddress(), OutputFormat.JPG); + + // 创建支持中文的字体 + Font chineseFont = createChineseFont(30); + + //加文本元素:姓名 +// if (item.getType().equals(0)) { +// combiner.addTextElement(item.getName().concat(" 校友"), 40, 220, 540); +// } else { +// combiner.addTextElement(item.getName(), 40, 220, 540); +// } + +// combiner.addTextElement(DateUtil.format(DateUtil.date(), "yyyy年MM月"), 28,650, 1566); + //加图片元素:盖章 +// combiner.addImageElement("https://oss.wsdns.cn/20250304/6936b109b09b4919a3498ac5027e728b.png", 600, 1420); + + // 使用支持中文的字体添加文本 + if (item.getType().equals(0)) { + combiner.addTextElement(item.getName().concat(" 校友"), chineseFont, 160, 1008); + } else { + combiner.addTextElement(item.getName(), chineseFont, 160, 1008); + } + +// combiner.addTextElement(DateUtil.format(DateUtil.date(), "yyyy年MM月"), 28,650, 1566); + //加图片元素:盖章 +// combiner.addImageElement("https://oss.wsdns.cn/20250304/6936b109b09b4919a3498ac5027e728b.png", 600, 1420); + //执行图片合并 + combiner.combine(); + return combiner; + } + + /** + * 创建支持中文的字体 + * @param fontSize 字体大小 + * @return Font对象 + */ + private static Font createChineseFont(int fontSize) { + try { + // 尝试使用系统中文字体 + String[] chineseFonts = { + "Alibaba PuHuiTi 2.0", + "PingFang SC", // 苹方 (macOS) - 优先使用 + "STHeiti", // 华文黑体 (macOS) + "Hiragino Sans GB", // 冬青黑体 (macOS) + "Microsoft YaHei", // 微软雅黑 (Windows) + "SimHei", // 黑体 (Windows) + "SimSun", // 宋体 (Windows) + "WenQuanYi Micro Hei", // 文泉驿微米黑 (Linux) + "Noto Sans CJK SC", // 思源黑体 (Linux) + "Arial Unicode MS", // 支持Unicode的Arial + "DejaVu Sans" // 备用字体 + }; + + for (String fontName : chineseFonts) { + Font font = new Font(fontName, Font.PLAIN, fontSize); + // 检查字体是否能正确显示中文 + if (font.canDisplay('中') && font.canDisplay('文')) { + System.out.println("✓ 成功使用字体: " + fontName + " (字号: " + fontSize + ")"); + return font; + } else { + System.out.println("✗ 字体不支持中文: " + fontName); + } + } + + // 如果没有找到合适的字体,尝试加载系统默认中文字体 + System.out.println("⚠ 警告:未找到预定义的中文字体,尝试使用系统默认字体"); + + // 尝试使用逻辑字体名称,这些在Java中通常会映射到系统字体 + String[] logicalFonts = {"SansSerif", "Serif", "Monospaced", "Dialog", "DialogInput"}; + for (String logicalFont : logicalFonts) { + Font font = new Font(logicalFont, Font.PLAIN, fontSize); + if (font.canDisplay('中') && font.canDisplay('文')) { + System.out.println("✓ 使用逻辑字体: " + logicalFont); + return font; + } + } + + // 最后的备选方案 + System.err.println("❌ 严重警告:系统中没有找到任何支持中文的字体!请安装中文字体包。"); + return new Font("SansSerif", Font.PLAIN, fontSize); + + } catch (Exception e) { + System.err.println("❌ 创建中文字体失败: " + e.getMessage()); + e.printStackTrace(); + return new Font("SansSerif", Font.PLAIN, fontSize); + } + } + + @Override + public BszxBm getByUserId(Integer userId) { + return getOne(new LambdaQueryWrapper().eq(BszxBm::getUserId, userId).last("limit 1")); + } +} diff --git a/src/main/java/com/gxwebsoft/bszx/service/impl/BszxBranchServiceImpl.java b/src/main/java/com/gxwebsoft/bszx/service/impl/BszxBranchServiceImpl.java new file mode 100644 index 0000000..7e12499 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/service/impl/BszxBranchServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.bszx.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.bszx.mapper.BszxBranchMapper; +import com.gxwebsoft.bszx.service.BszxBranchService; +import com.gxwebsoft.bszx.entity.BszxBranch; +import com.gxwebsoft.bszx.param.BszxBranchParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 百色中学-分部Service实现 + * + * @author 科技小王子 + * @since 2025-03-17 17:18:22 + */ +@Service +public class BszxBranchServiceImpl extends ServiceImpl implements BszxBranchService { + + @Override + public PageResult pageRel(BszxBranchParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(BszxBranchParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public BszxBranch getByIdRel(Integer id) { + BszxBranchParam param = new BszxBranchParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/bszx/service/impl/BszxClassServiceImpl.java b/src/main/java/com/gxwebsoft/bszx/service/impl/BszxClassServiceImpl.java new file mode 100644 index 0000000..20ea2f7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/service/impl/BszxClassServiceImpl.java @@ -0,0 +1,68 @@ +package com.gxwebsoft.bszx.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.bszx.entity.BszxPay; +import com.gxwebsoft.bszx.mapper.BszxClassMapper; +import com.gxwebsoft.bszx.service.BszxClassService; +import com.gxwebsoft.bszx.entity.BszxClass; +import com.gxwebsoft.bszx.param.BszxClassParam; +import com.gxwebsoft.bszx.service.BszxPayService; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 百色中学-班级Service实现 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Service +public class BszxClassServiceImpl extends ServiceImpl implements BszxClassService { + @Resource + private RedisUtil redisUtil; + @Resource + private BszxPayService bszxPayService; + + @Override + public PageResult pageRel(BszxClassParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, id asc"); + List list = baseMapper.selectPageRel(page, param); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (param.getLimit() == null) { + list.forEach(item -> { + wrapper.clear(); +// wrapper.eq(BszxPay::getBranchName,item.getBranchName()); + wrapper.eq(BszxPay::getGradeName,item.getGradeName()); + wrapper.eq(BszxPay::getClassName, item.getName()); + item.setTotalMoney(bszxPayService.sumMoney(wrapper)); + updateById(item); + }); + } + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(BszxClassParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, id asc"); + return page.sortRecords(list); + } + + @Override + public BszxClass getByIdRel(Integer id) { + BszxClassParam param = new BszxClassParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/bszx/service/impl/BszxEraServiceImpl.java b/src/main/java/com/gxwebsoft/bszx/service/impl/BszxEraServiceImpl.java new file mode 100644 index 0000000..ad39481 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/service/impl/BszxEraServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.bszx.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.bszx.mapper.BszxEraMapper; +import com.gxwebsoft.bszx.service.BszxEraService; +import com.gxwebsoft.bszx.entity.BszxEra; +import com.gxwebsoft.bszx.param.BszxEraParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 百色中学-年代Service实现 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Service +public class BszxEraServiceImpl extends ServiceImpl implements BszxEraService { + + @Override + public PageResult pageRel(BszxEraParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(BszxEraParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public BszxEra getByIdRel(Integer id) { + BszxEraParam param = new BszxEraParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/bszx/service/impl/BszxGradeServiceImpl.java b/src/main/java/com/gxwebsoft/bszx/service/impl/BszxGradeServiceImpl.java new file mode 100644 index 0000000..1dded74 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/service/impl/BszxGradeServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.bszx.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.bszx.mapper.BszxGradeMapper; +import com.gxwebsoft.bszx.service.BszxGradeService; +import com.gxwebsoft.bszx.entity.BszxGrade; +import com.gxwebsoft.bszx.param.BszxGradeParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 百色中学-年级Service实现 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Service +public class BszxGradeServiceImpl extends ServiceImpl implements BszxGradeService { + + @Override + public PageResult pageRel(BszxGradeParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, id asc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(BszxGradeParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, id asc"); + return page.sortRecords(list); + } + + @Override + public BszxGrade getByIdRel(Integer id) { + BszxGradeParam param = new BszxGradeParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/bszx/service/impl/BszxPayRankingServiceImpl.java b/src/main/java/com/gxwebsoft/bszx/service/impl/BszxPayRankingServiceImpl.java new file mode 100644 index 0000000..22cee64 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/service/impl/BszxPayRankingServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.bszx.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.bszx.mapper.BszxPayRankingMapper; +import com.gxwebsoft.bszx.service.BszxPayRankingService; +import com.gxwebsoft.bszx.entity.BszxPayRanking; +import com.gxwebsoft.bszx.param.BszxPayRankingParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 百色中学-捐款排行Service实现 + * + * @author 科技小王子 + * @since 2025-03-25 08:54:09 + */ +@Service +public class BszxPayRankingServiceImpl extends ServiceImpl implements BszxPayRankingService { + + @Override + public PageResult pageRel(BszxPayRankingParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(BszxPayRankingParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public BszxPayRanking getByIdRel(Integer id) { + BszxPayRankingParam param = new BszxPayRankingParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/bszx/service/impl/BszxPayServiceImpl.java b/src/main/java/com/gxwebsoft/bszx/service/impl/BszxPayServiceImpl.java new file mode 100644 index 0000000..12957c3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/bszx/service/impl/BszxPayServiceImpl.java @@ -0,0 +1,288 @@ +package com.gxwebsoft.bszx.service.impl; + +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.freewayso.image.combiner.ImageCombiner; +import com.freewayso.image.combiner.enums.OutputFormat; +import com.gxwebsoft.bszx.entity.BszxBm; +import com.gxwebsoft.bszx.mapper.BszxPayMapper; +import com.gxwebsoft.bszx.service.BszxBmService; +import com.gxwebsoft.bszx.service.BszxPayService; +import com.gxwebsoft.bszx.entity.BszxPay; +import com.gxwebsoft.bszx.param.BszxPayParam; +import com.gxwebsoft.cms.entity.CmsArticle; +import com.gxwebsoft.cms.service.CmsArticleService; +import com.gxwebsoft.common.core.utils.ImageUtil; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.awt.Font; +import java.io.File; +import java.math.BigDecimal; +import java.util.List; + +/** + * 百色中学-捐款记录Service实现 + * + * @author 科技小王子 + * @since 2025-03-06 22:50:25 + */ +@Service +public class BszxPayServiceImpl extends ServiceImpl implements BszxPayService { + @Value("${config.upload-path}") + private String uploadPath; + @Value("${config.file-server}") + private String fileServer; + + @Resource + private CmsArticleService cmsArticleService; + @Resource + public BszxBmService bszxBmService; + @Resource + private BszxPayService bszxPayService; + + @Override + public PageResult pageRel(BszxPayParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("price desc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + list.forEach(item -> { + if(item.getId().equals(2088)){ + item.setFormName("捐款用于设立阙里校友奖学金"); + } + }); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(BszxPayParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("id desc"); + return page.sortRecords(list); + } + + @Override + public BszxPay getByIdRel(Integer id) { + BszxPayParam param = new BszxPayParam(); + param.setId(id); + final BszxPay item = param.getOne(baseMapper.selectListRel(param)); + final CmsArticle article = cmsArticleService.getById(item.getFormId()); + if (ObjectUtil.isNotEmpty(article)) { + item.setArticle(article); + } + return item; + } + + /** + * 生成捐款证书 ... + */ + @Override + public String generatePayCert(Integer id) throws Exception { + final BszxPay payCert = getByIdRel(id); + final CmsArticle item = cmsArticleService.getById(payCert.getFormId()); + final BszxBm bm = bszxBmService.getOne(new LambdaQueryWrapper().eq(BszxBm::getUserId, payCert.getUserId()).last("limit 1")); + final BigDecimal totalMoney = bszxPayService.sumMoney(new LambdaQueryWrapper().eq(BszxPay::getUserId, payCert.getUserId())); + if (StrUtil.isBlank(item.getAddress())) { + return null; + } + // 百色一小项目 + if(payCert.getTenantId().equals(10547) && ObjectUtil.isNotEmpty(payCert)){ + //合成器(指定背景图和输出格式,整个图片的宽高和相关计算依赖于背景图,所以背景图的大小是个基准) + ImageCombiner combiner = new ImageCombiner("https://oss.wsdns.cn/20250908/97f0891f3e4048f5b20ffb07ff370a3a.png?x-oss-process=image/resize,w_750/quality,Q_90", OutputFormat.JPG); + //加图片元素:盖章 +// combiner.addImageElement("https://oss.wsdns.cn/20250304/6936b109b09b4919a3498ac5027e728b.png", 550, 926); + // 创建支持中文的字体 + Font nameFont26 = createChineseFont(26); + Font nameFont22 = createChineseFont(22); + Font moneyFont = createChineseFont(26); + + //加文本元素:姓名 + String str; + if (bm.getType().equals(0)) { + str = bm.getName(); + combiner.addTextElement(str, nameFont26, 200, 468); + } else { + str = bm.getName(); + combiner.addTextElement(str, nameFont22, 200, 468); + } +// combiner.addTextElement(bm.getName(), 32,900, 450); + //加文本元素:捐款证书内容 +// combiner.addTextElement(" 承您慷慨解囊,襄助百色市百色中学", 32,200, 650); +// combiner.addTextElement("百廿校庆“" + item.getTitle() + "”项目,捐赠人民币", 32,200, 700); + combiner.addTextElement(totalMoney + "", moneyFont, 420, 584); +// combiner.addTextElement(" 您对学校的支持,为我们共同教育理", 32,200, 800); +// combiner.addTextElement("想的实现增添了一份动力。", 32,200, 850); +// combiner.addTextElement(" 承蒙惠赠,隆情铭感,特颁此证,以资谢旌!", 32, 200, 900); +// combiner.addTextElement("百色市百色中学", 32,560, 1015); +// final Date createTime = payCert.getCreateTime(); +// combiner.addTextElement(DateUtil.format(createTime, "yyyy年MM月"), 28,586, 1060); +// combiner.addTextElement("2025年4月15日", 28,580, 1060); + + //执行图片合并 + combiner.combine(); + + if (!FileUtil.exist(uploadPath + "/poster/" + payCert.getTenantId() + "/pay")) { + FileUtil.mkdir(uploadPath + "/poster/" + payCert.getTenantId() + "/pay"); + } + String basePath = "/poster/" + payCert.getTenantId() + "/pay/big-" + id + ".jpg"; + String smallPath = "/poster/" + payCert.getTenantId() + "/pay/" + id + ".jpg"; + String filename = uploadPath + basePath; + String smallFileName = uploadPath + smallPath; + System.out.println("smallFileName = " + smallFileName); + combiner.save(filename); + + File input = new File(filename); + File output = new File(smallFileName); + ImageUtil.adjustQuality(input, output, 0.8f); + if (input.exists()) { + input.delete(); + } + return fileServer + smallPath + "?v=" + RandomUtil.randomNumbers(4); + } + // 百色中学 + if (ObjectUtil.isNotEmpty(payCert)) { + //合成器(指定背景图和输出格式,整个图片的宽高和相关计算依赖于背景图,所以背景图的大小是个基准) + ImageCombiner combiner = new ImageCombiner("https://oss.wsdns.cn/20250420/811a380e8e124097aa0940a7c68a1f72.jpeg", OutputFormat.JPG); + + // 创建支持中文的字体 + Font nameFont32 = createChineseFont(32); + Font nameFont22 = createChineseFont(22); + Font moneyFont32 = createChineseFont(32); + + //加图片元素:盖章 +// combiner.addImageElement("https://oss.wsdns.cn/20250304/6936b109b09b4919a3498ac5027e728b.png", 550, 926); + //加文本元素:姓名 + String str; + if (bm.getType().equals(0)) { + str = bm.getName().concat(" 校友"); + combiner.addTextElement(str, nameFont32, 930, 450); + } else { + str = bm.getName(); + combiner.addTextElement(str, nameFont22, 880, 450); + } +// combiner.addTextElement(bm.getName(), 32,900, 450); + //加文本元素:捐款证书内容 +// combiner.addTextElement(" 承您慷慨解囊,襄助百色市百色中学", 32,200, 650); +// combiner.addTextElement("百廿校庆“" + item.getTitle() + "”项目,捐赠人民币", 32,200, 700); + combiner.addTextElement(totalMoney + "", moneyFont32, 1330, 600); +// combiner.addTextElement(" 您对学校的支持,为我们共同教育理", 32,200, 800); +// combiner.addTextElement("想的实现增添了一份动力。", 32,200, 850); +// combiner.addTextElement(" 承蒙惠赠,隆情铭感,特颁此证,以资谢旌!", 32, 200, 900); +// combiner.addTextElement("百色市百色中学", 32,560, 1015); +// final Date createTime = payCert.getCreateTime(); +// combiner.addTextElement(DateUtil.format(createTime, "yyyy年MM月"), 28,586, 1060); +// combiner.addTextElement("2025年4月15日", 28,580, 1060); + + //执行图片合并 + combiner.combine(); + + if (!FileUtil.exist(uploadPath + "/poster/" + payCert.getTenantId() + "/pay")) { + FileUtil.mkdir(uploadPath + "/poster/" + payCert.getTenantId() + "/pay"); + } + String basePath = "/poster/" + payCert.getTenantId() + "/pay/big-" + id + ".jpg"; + String smallPath = "/poster/" + payCert.getTenantId() + "/pay/" + id + ".jpg"; + String filename = uploadPath + basePath; + String smallFileName = uploadPath + smallPath; + combiner.save(filename); + + File input = new File(filename); + File output = new File(smallFileName); + ImageUtil.adjustQuality(input, output, 0.8f); + if (input.exists()) { + input.delete(); + } + return fileServer + smallPath + "?v=" + RandomUtil.randomNumbers(4); + } + return null; + } + + @Override + public BigDecimal sumMoney(LambdaQueryWrapper wrapper) { + return baseMapper.selectSumMoney(wrapper); + } + + @Override + public BigDecimal total() { + try { + // 使用数据库聚合查询统计捐款总金额,性能更高 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + BigDecimal total = baseMapper.selectSumMoney(wrapper); + + if (total == null) { + total = BigDecimal.ZERO; + } + + return total; + + } catch (Exception e) { + // 异常时返回0,确保接口稳定性 + return BigDecimal.ZERO; + } + } + + /** + * 创建支持中文的字体 + * @param fontSize 字体大小 + * @return Font对象 + */ + private static Font createChineseFont(int fontSize) { + try { + // 尝试使用系统中文字体 + String[] chineseFonts = { + "Alibaba PuHuiTi 2.0", + "PingFang SC", // 苹方 (macOS) - 优先使用 + "STHeiti", // 华文黑体 (macOS) + "Hiragino Sans GB", // 冬青黑体 (macOS) + "Microsoft YaHei", // 微软雅黑 (Windows) + "SimHei", // 黑体 (Windows) + "SimSun", // 宋体 (Windows) + "WenQuanYi Micro Hei", // 文泉驿微米黑 (Linux) + "Noto Sans CJK SC", // 思源黑体 (Linux) + "Arial Unicode MS", // 支持Unicode的Arial + "DejaVu Sans" // 备用字体 + }; + + for (String fontName : chineseFonts) { + Font font = new Font(fontName, Font.PLAIN, fontSize); + // 检查字体是否能正确显示中文 + if (font.canDisplay('中') && font.canDisplay('文')) { + System.out.println("✓ 成功使用字体: " + fontName + " (字号: " + fontSize + ")"); + return font; + } else { + System.out.println("✗ 字体不支持中文: " + fontName); + } + } + + // 如果没有找到合适的字体,尝试加载系统默认中文字体 + System.out.println("⚠ 警告:未找到预定义的中文字体,尝试使用系统默认字体"); + + // 尝试使用逻辑字体名称,这些在Java中通常会映射到系统字体 + String[] logicalFonts = {"SansSerif", "Serif", "Monospaced", "Dialog", "DialogInput"}; + for (String logicalFont : logicalFonts) { + Font font = new Font(logicalFont, Font.PLAIN, fontSize); + if (font.canDisplay('中') && font.canDisplay('文')) { + System.out.println("✓ 使用逻辑字体: " + logicalFont); + return font; + } + } + + // 最后的备选方案 + System.err.println("❌ 严重警告:系统中没有找到任何支持中文的字体!请安装中文字体包。"); + return new Font("SansSerif", Font.PLAIN, fontSize); + + } catch (Exception e) { + System.err.println("❌ 创建中文字体失败: " + e.getMessage()); + e.printStackTrace(); + return new Font("SansSerif", Font.PLAIN, fontSize); + } + } +} diff --git a/src/main/java/com/gxwebsoft/clinic/controller/ClinicAppointmentController.java b/src/main/java/com/gxwebsoft/clinic/controller/ClinicAppointmentController.java new file mode 100644 index 0000000..cf186e3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/controller/ClinicAppointmentController.java @@ -0,0 +1,122 @@ +package com.gxwebsoft.clinic.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.clinic.service.ClinicAppointmentService; +import com.gxwebsoft.clinic.entity.ClinicAppointment; +import com.gxwebsoft.clinic.param.ClinicAppointmentParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 挂号控制器 + * + * @author 科技小王子 + * @since 2025-10-19 09:27:04 + */ +@Tag(name = "挂号管理") +@RestController +@RequestMapping("/api/clinic/clinic-appointment") +public class ClinicAppointmentController extends BaseController { + @Resource + private ClinicAppointmentService clinicAppointmentService; + + @Operation(summary = "分页查询挂号") + @GetMapping("/page") + public ApiResult> page(ClinicAppointmentParam param) { + // 使用关联查询 + return success(clinicAppointmentService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('clinic:clinicAppointment:list')") + @Operation(summary = "查询全部挂号") + @GetMapping() + public ApiResult> list(ClinicAppointmentParam param) { + // 使用关联查询 + return success(clinicAppointmentService.listRel(param)); + } + + @PreAuthorize("hasAuthority('clinic:clinicAppointment:list')") + @Operation(summary = "根据id查询挂号") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(clinicAppointmentService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('clinic:clinicAppointment:save')") + @OperationLog + @Operation(summary = "添加挂号") + @PostMapping() + public ApiResult save(@RequestBody ClinicAppointment clinicAppointment) { + if (clinicAppointmentService.save(clinicAppointment)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicAppointment:update')") + @OperationLog + @Operation(summary = "修改挂号") + @PutMapping() + public ApiResult update(@RequestBody ClinicAppointment clinicAppointment) { + if (clinicAppointmentService.updateById(clinicAppointment)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicAppointment:remove')") + @OperationLog + @Operation(summary = "删除挂号") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (clinicAppointmentService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicAppointment:save')") + @OperationLog + @Operation(summary = "批量添加挂号") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (clinicAppointmentService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicAppointment:update')") + @OperationLog + @Operation(summary = "批量修改挂号") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(clinicAppointmentService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicAppointment:remove')") + @OperationLog + @Operation(summary = "批量删除挂号") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (clinicAppointmentService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/clinic/controller/ClinicDoctorApplyController.java b/src/main/java/com/gxwebsoft/clinic/controller/ClinicDoctorApplyController.java new file mode 100644 index 0000000..7471fa7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/controller/ClinicDoctorApplyController.java @@ -0,0 +1,128 @@ +package com.gxwebsoft.clinic.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.clinic.service.ClinicDoctorApplyService; +import com.gxwebsoft.clinic.entity.ClinicDoctorApply; +import com.gxwebsoft.clinic.param.ClinicDoctorApplyParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 医生入驻申请控制器 + * + * @author 科技小王子 + * @since 2025-10-19 09:27:04 + */ +@Tag(name = "医生入驻申请管理") +@RestController +@RequestMapping("/api/clinic/clinic-doctor-apply") +public class ClinicDoctorApplyController extends BaseController { + @Resource + private ClinicDoctorApplyService clinicDoctorApplyService; + + @PreAuthorize("hasAuthority('clinic:clinicDoctorApply:list')") + @Operation(summary = "分页查询医生入驻申请") + @GetMapping("/page") + public ApiResult> page(ClinicDoctorApplyParam param) { + // 使用关联查询 + return success(clinicDoctorApplyService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('clinic:clinicDoctorApply:list')") + @Operation(summary = "查询全部医生入驻申请") + @GetMapping() + public ApiResult> list(ClinicDoctorApplyParam param) { + // 使用关联查询 + return success(clinicDoctorApplyService.listRel(param)); + } + + @PreAuthorize("hasAuthority('clinic:clinicDoctorApply:list')") + @Operation(summary = "根据id查询医生入驻申请") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(clinicDoctorApplyService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('clinic:clinicDoctorApply:save')") + @OperationLog + @Operation(summary = "添加医生入驻申请") + @PostMapping() + public ApiResult save(@RequestBody ClinicDoctorApply clinicDoctorApply) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // clinicDoctorApply.setUserId(loginUser.getUserId()); + // } + if (clinicDoctorApplyService.save(clinicDoctorApply)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicDoctorApply:update')") + @OperationLog + @Operation(summary = "修改医生入驻申请") + @PutMapping() + public ApiResult update(@RequestBody ClinicDoctorApply clinicDoctorApply) { + if (clinicDoctorApplyService.updateById(clinicDoctorApply)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicDoctorApply:remove')") + @OperationLog + @Operation(summary = "删除医生入驻申请") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (clinicDoctorApplyService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicDoctorApply:save')") + @OperationLog + @Operation(summary = "批量添加医生入驻申请") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (clinicDoctorApplyService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicDoctorApply:update')") + @OperationLog + @Operation(summary = "批量修改医生入驻申请") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(clinicDoctorApplyService, "apply_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicDoctorApply:remove')") + @OperationLog + @Operation(summary = "批量删除医生入驻申请") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (clinicDoctorApplyService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/clinic/controller/ClinicDoctorUserController.java b/src/main/java/com/gxwebsoft/clinic/controller/ClinicDoctorUserController.java new file mode 100644 index 0000000..9f7012e --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/controller/ClinicDoctorUserController.java @@ -0,0 +1,128 @@ +package com.gxwebsoft.clinic.controller; + +import com.gxwebsoft.clinic.entity.ClinicDoctorUser; +import com.gxwebsoft.clinic.param.ClinicDoctorUserParam; +import com.gxwebsoft.clinic.service.ClinicDoctorUserService; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 分销商用户记录表控制器 + * + * @author 科技小王子 + * @since 2025-10-23 15:58:21 + */ +@Tag(name = "分销商用户记录表管理") +@RestController +@RequestMapping("/api/clinic/clinic-doctor-user") +public class ClinicDoctorUserController extends BaseController { + @Resource + private ClinicDoctorUserService clinicDoctorUserService; + + @PreAuthorize("hasAuthority('clinic:clinicDoctorUser:list')") + @Operation(summary = "分页查询分销商用户记录表") + @GetMapping("/page") + public ApiResult> page(ClinicDoctorUserParam param) { + // 使用关联查询 + return success(clinicDoctorUserService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('clinic:clinicDoctorUser:list')") + @Operation(summary = "查询全部分销商用户记录表") + @GetMapping() + public ApiResult> list(ClinicDoctorUserParam param) { + // 使用关联查询 + return success(clinicDoctorUserService.listRel(param)); + } + + @PreAuthorize("hasAuthority('clinic:clinicDoctorUser:list')") + @Operation(summary = "根据id查询分销商用户记录表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(clinicDoctorUserService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('clinic:clinicDoctorUser:save')") + @OperationLog + @Operation(summary = "添加分销商用户记录表") + @PostMapping() + public ApiResult save(@RequestBody ClinicDoctorUser clinicDoctorUser) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + clinicDoctorUser.setUserId(loginUser.getUserId()); + } + if (clinicDoctorUserService.save(clinicDoctorUser)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicDoctorUser:update')") + @OperationLog + @Operation(summary = "修改分销商用户记录表") + @PutMapping() + public ApiResult update(@RequestBody ClinicDoctorUser clinicDoctorUser) { + if (clinicDoctorUserService.updateById(clinicDoctorUser)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicDoctorUser:remove')") + @OperationLog + @Operation(summary = "删除分销商用户记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (clinicDoctorUserService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicDoctorUser:save')") + @OperationLog + @Operation(summary = "批量添加分销商用户记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (clinicDoctorUserService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicDoctorUser:update')") + @OperationLog + @Operation(summary = "批量修改分销商用户记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(clinicDoctorUserService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicDoctorUser:remove')") + @OperationLog + @Operation(summary = "批量删除分销商用户记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (clinicDoctorUserService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/clinic/controller/ClinicMedicineController.java b/src/main/java/com/gxwebsoft/clinic/controller/ClinicMedicineController.java new file mode 100644 index 0000000..28e27c6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/controller/ClinicMedicineController.java @@ -0,0 +1,127 @@ +package com.gxwebsoft.clinic.controller; + +import com.gxwebsoft.clinic.entity.ClinicMedicine; +import com.gxwebsoft.clinic.param.ClinicMedicineParam; +import com.gxwebsoft.clinic.service.ClinicMedicineService; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 药品库控制器 + * + * @author 科技小王子 + * @since 2025-10-22 02:06:32 + */ +@Tag(name = "药品库管理") +@RestController +@RequestMapping("/api/clinic/clinic-medicine") +public class ClinicMedicineController extends BaseController { + @Resource + private ClinicMedicineService clinicMedicineService; + + @PreAuthorize("hasAuthority('clinic:clinicMedicine:list')") + @Operation(summary = "分页查询药品库") + @GetMapping("/page") + public ApiResult> page(ClinicMedicineParam param) { + // 使用关联查询 + return success(clinicMedicineService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicine:list')") + @Operation(summary = "查询全部药品库") + @GetMapping() + public ApiResult> list(ClinicMedicineParam param) { + // 使用关联查询 + return success(clinicMedicineService.listRel(param)); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicine:list')") + @Operation(summary = "根据id查询药品库") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(clinicMedicineService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicine:save')") + @OperationLog + @Operation(summary = "添加药品库") + @PostMapping() + public ApiResult save(@RequestBody ClinicMedicine clinicMedicine) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // clinicMedicine.setUserId(loginUser.getUserId()); + // } + if (clinicMedicineService.save(clinicMedicine)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicine:update')") + @OperationLog + @Operation(summary = "修改药品库") + @PutMapping() + public ApiResult update(@RequestBody ClinicMedicine clinicMedicine) { + if (clinicMedicineService.updateById(clinicMedicine)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicine:remove')") + @OperationLog + @Operation(summary = "删除药品库") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (clinicMedicineService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicine:save')") + @OperationLog + @Operation(summary = "批量添加药品库") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (clinicMedicineService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicine:update')") + @OperationLog + @Operation(summary = "批量修改药品库") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(clinicMedicineService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicine:remove')") + @OperationLog + @Operation(summary = "批量删除药品库") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (clinicMedicineService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/clinic/controller/ClinicMedicineInoutController.java b/src/main/java/com/gxwebsoft/clinic/controller/ClinicMedicineInoutController.java new file mode 100644 index 0000000..e1b89a8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/controller/ClinicMedicineInoutController.java @@ -0,0 +1,127 @@ +package com.gxwebsoft.clinic.controller; + +import com.gxwebsoft.clinic.entity.ClinicMedicineInout; +import com.gxwebsoft.clinic.param.ClinicMedicineInoutParam; +import com.gxwebsoft.clinic.service.ClinicMedicineInoutService; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 出入库控制器 + * + * @author 科技小王子 + * @since 2025-10-22 02:06:32 + */ +@Tag(name = "出入库管理") +@RestController +@RequestMapping("/api/clinic/clinic-medicine-inout") +public class ClinicMedicineInoutController extends BaseController { + @Resource + private ClinicMedicineInoutService clinicMedicineInoutService; + + @PreAuthorize("hasAuthority('clinic:clinicMedicineInout:list')") + @Operation(summary = "分页查询出入库") + @GetMapping("/page") + public ApiResult> page(ClinicMedicineInoutParam param) { + // 使用关联查询 + return success(clinicMedicineInoutService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicineInout:list')") + @Operation(summary = "查询全部出入库") + @GetMapping() + public ApiResult> list(ClinicMedicineInoutParam param) { + // 使用关联查询 + return success(clinicMedicineInoutService.listRel(param)); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicineInout:list')") + @Operation(summary = "根据id查询出入库") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(clinicMedicineInoutService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicineInout:save')") + @OperationLog + @Operation(summary = "添加出入库") + @PostMapping() + public ApiResult save(@RequestBody ClinicMedicineInout clinicMedicineInout) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // clinicMedicineInout.setUserId(loginUser.getUserId()); + // } + if (clinicMedicineInoutService.save(clinicMedicineInout)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicineInout:update')") + @OperationLog + @Operation(summary = "修改出入库") + @PutMapping() + public ApiResult update(@RequestBody ClinicMedicineInout clinicMedicineInout) { + if (clinicMedicineInoutService.updateById(clinicMedicineInout)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicineInout:remove')") + @OperationLog + @Operation(summary = "删除出入库") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (clinicMedicineInoutService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicineInout:save')") + @OperationLog + @Operation(summary = "批量添加出入库") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (clinicMedicineInoutService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicineInout:update')") + @OperationLog + @Operation(summary = "批量修改出入库") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(clinicMedicineInoutService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicineInout:remove')") + @OperationLog + @Operation(summary = "批量删除出入库") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (clinicMedicineInoutService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/clinic/controller/ClinicMedicineStockController.java b/src/main/java/com/gxwebsoft/clinic/controller/ClinicMedicineStockController.java new file mode 100644 index 0000000..867b425 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/controller/ClinicMedicineStockController.java @@ -0,0 +1,127 @@ +package com.gxwebsoft.clinic.controller; + +import com.gxwebsoft.clinic.entity.ClinicMedicineStock; +import com.gxwebsoft.clinic.param.ClinicMedicineStockParam; +import com.gxwebsoft.clinic.service.ClinicMedicineStockService; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 药品库存控制器 + * + * @author 科技小王子 + * @since 2025-10-22 02:06:32 + */ +@Tag(name = "药品库存管理") +@RestController +@RequestMapping("/api/clinic/clinic-medicine-stock") +public class ClinicMedicineStockController extends BaseController { + @Resource + private ClinicMedicineStockService clinicMedicineStockService; + + @PreAuthorize("hasAuthority('clinic:clinicMedicineStock:list')") + @Operation(summary = "分页查询药品库存") + @GetMapping("/page") + public ApiResult> page(ClinicMedicineStockParam param) { + // 使用关联查询 + return success(clinicMedicineStockService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicineStock:list')") + @Operation(summary = "查询全部药品库存") + @GetMapping() + public ApiResult> list(ClinicMedicineStockParam param) { + // 使用关联查询 + return success(clinicMedicineStockService.listRel(param)); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicineStock:list')") + @Operation(summary = "根据id查询药品库存") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(clinicMedicineStockService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicineStock:save')") + @OperationLog + @Operation(summary = "添加药品库存") + @PostMapping() + public ApiResult save(@RequestBody ClinicMedicineStock clinicMedicineStock) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // clinicMedicineStock.setUserId(loginUser.getUserId()); + // } + if (clinicMedicineStockService.save(clinicMedicineStock)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicineStock:update')") + @OperationLog + @Operation(summary = "修改药品库存") + @PutMapping() + public ApiResult update(@RequestBody ClinicMedicineStock clinicMedicineStock) { + if (clinicMedicineStockService.updateById(clinicMedicineStock)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicineStock:remove')") + @OperationLog + @Operation(summary = "删除药品库存") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (clinicMedicineStockService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicineStock:save')") + @OperationLog + @Operation(summary = "批量添加药品库存") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (clinicMedicineStockService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicineStock:update')") + @OperationLog + @Operation(summary = "批量修改药品库存") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(clinicMedicineStockService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicMedicineStock:remove')") + @OperationLog + @Operation(summary = "批量删除药品库存") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (clinicMedicineStockService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/clinic/controller/ClinicPatientUserController.java b/src/main/java/com/gxwebsoft/clinic/controller/ClinicPatientUserController.java new file mode 100644 index 0000000..87aa108 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/controller/ClinicPatientUserController.java @@ -0,0 +1,129 @@ +package com.gxwebsoft.clinic.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.clinic.service.ClinicPatientUserService; +import com.gxwebsoft.clinic.entity.ClinicPatientUser; +import com.gxwebsoft.clinic.param.ClinicPatientUserParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 患者控制器 + * + * @author 科技小王子 + * @since 2025-10-19 09:27:04 + */ +@Tag(name = "患者管理") +@RestController +@RequestMapping("/api/clinic/clinic-patient-user") +public class ClinicPatientUserController extends BaseController { + @Resource + private ClinicPatientUserService clinicPatientUserService; + + @PreAuthorize("hasAuthority('clinic:clinicPatientUser:list')") + @Operation(summary = "分页查询患者") + @GetMapping("/page") + public ApiResult> page(ClinicPatientUserParam param) { + // 使用关联查询 + return success(clinicPatientUserService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('clinic:clinicPatientUser:list')") + @Operation(summary = "查询全部患者") + @GetMapping() + public ApiResult> list(ClinicPatientUserParam param) { + // 使用关联查询 + return success(clinicPatientUserService.listRel(param)); + } + + @PreAuthorize("hasAuthority('clinic:clinicPatientUser:list')") + @Operation(summary = "根据id查询患者") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(clinicPatientUserService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('clinic:clinicPatientUser:save')") + @OperationLog + @Operation(summary = "添加患者") + @PostMapping() + public ApiResult save(@RequestBody ClinicPatientUser clinicPatientUser) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + clinicPatientUser.setUserId(loginUser.getUserId()); + } + if (clinicPatientUserService.save(clinicPatientUser)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicPatientUser:update')") + @OperationLog + @Operation(summary = "修改患者") + @PutMapping() + public ApiResult update(@RequestBody ClinicPatientUser clinicPatientUser) { + if (clinicPatientUserService.updateById(clinicPatientUser)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicPatientUser:remove')") + @OperationLog + @Operation(summary = "删除患者") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (clinicPatientUserService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicPatientUser:save')") + @OperationLog + @Operation(summary = "批量添加患者") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (clinicPatientUserService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicPatientUser:update')") + @OperationLog + @Operation(summary = "批量修改患者") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(clinicPatientUserService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicPatientUser:remove')") + @OperationLog + @Operation(summary = "批量删除患者") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (clinicPatientUserService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/clinic/controller/ClinicPrescriptionController.java b/src/main/java/com/gxwebsoft/clinic/controller/ClinicPrescriptionController.java new file mode 100644 index 0000000..f51872e --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/controller/ClinicPrescriptionController.java @@ -0,0 +1,191 @@ +package com.gxwebsoft.clinic.controller; + +import cn.hutool.core.util.IdUtil; +import com.gxwebsoft.clinic.dto.PrescriptionOrderRequest; +import com.gxwebsoft.clinic.entity.ClinicPrescription; +import com.gxwebsoft.clinic.param.ClinicPrescriptionParam; +import com.gxwebsoft.clinic.service.ClinicPrescriptionService; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.List; + +/** + * 处方主表 +控制器 + * + * @author 科技小王子 + * @since 2025-10-22 02:01:13 + */ +@Tag(name = "处方主表管理") +@RestController +@RequestMapping("/api/clinic/clinic-prescription") +public class ClinicPrescriptionController extends BaseController { + @Resource + private ClinicPrescriptionService clinicPrescriptionService; + + @Operation(summary = "分页查询处方主表") + @GetMapping("/page") + public ApiResult> page(ClinicPrescriptionParam param) { + // 使用关联查询 + return success(clinicPrescriptionService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('clinic:clinicPrescription:list')") + @Operation(summary = "查询全部处方主表") + @GetMapping() + public ApiResult> list(ClinicPrescriptionParam param) { + // 使用关联查询 + return success(clinicPrescriptionService.listRel(param)); + } + + @Operation(summary = "根据id查询处方主表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(clinicPrescriptionService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('clinic:clinicPrescription:save')") + @OperationLog + @Operation(summary = "添加处方主表") + @PostMapping() + public ApiResult save(@RequestBody ClinicPrescription clinicPrescription) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + clinicPrescription.setDoctorId(loginUser.getUserId()); + // 生成订单号 + String orderNo = Long.toString(IdUtil.getSnowflakeNextId()); + clinicPrescription.setOrderNo(orderNo); + } + if (clinicPrescriptionService.save(clinicPrescription)) { + // 返回处方数据,包含处方ID + return success("添加成功",clinicPrescriptionService.getByLastId(clinicPrescription)); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicPrescription:update')") + @OperationLog + @Operation(summary = "修改处方主表") + @PutMapping() + public ApiResult update(@RequestBody ClinicPrescription clinicPrescription) { + if (clinicPrescriptionService.updateById(clinicPrescription)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicPrescription:remove')") + @OperationLog + @Operation(summary = "删除处方主表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (clinicPrescriptionService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicPrescription:save')") + @OperationLog + @Operation(summary = "批量添加处方主表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (clinicPrescriptionService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicPrescription:update')") + @OperationLog + @Operation(summary = "批量修改处方主表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(clinicPrescriptionService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicPrescription:remove')") + @OperationLog + @Operation(summary = "批量删除处方主表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (clinicPrescriptionService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "创建处方订单") + @PostMapping("/order") + public ApiResult createOrder(@RequestBody PrescriptionOrderRequest request) { + try { + // 1. 参数校验 + if (request.getPrescriptionId() == null) { + return fail("处方ID不能为空"); + } + if (request.getPayType() == null) { + return fail("支付方式不能为空"); + } + + // 2. 查询处方信息 + ClinicPrescription prescription = clinicPrescriptionService.getById(request.getPrescriptionId()); + if (prescription == null) { + return fail("处方不存在"); + } + + // 3. 检查处方状态 + if (prescription.getStatus() != null && prescription.getStatus() == 2) { + return fail("该处方已支付,无需重复支付"); + } + if (prescription.getStatus() != null && prescription.getStatus() == 3) { + return fail("该处方已取消,无法支付"); + } + + // 4. 更新处方订单信息 + ClinicPrescription updatePrescription = new ClinicPrescription(); + updatePrescription.setId(request.getPrescriptionId()); + + // 根据支付类型更新状态 + if (request.getPayType() == 1) { + // 微信支付,状态保持为正常,等待支付回调 + updatePrescription.setStatus(0); + } else if (request.getPayType() == 4 || request.getPayType() == 5) { + // 现金支付或POS机支付,直接标记为已支付 + updatePrescription.setStatus(2); + updatePrescription.setIsSettled(1); + updatePrescription.setSettleTime(LocalDateTime.now()); + } else if (request.getPayType() == 6) { + // 免费,直接标记为已完成 + updatePrescription.setStatus(1); + updatePrescription.setIsSettled(1); + updatePrescription.setSettleTime(LocalDateTime.now()); + } + + if (clinicPrescriptionService.updateById(updatePrescription)) { + return success("订单创建成功", prescription); + } + return fail("订单创建失败"); + + } catch (Exception e) { + return fail("订单创建失败:" + e.getMessage()); + } + } + +} diff --git a/src/main/java/com/gxwebsoft/clinic/controller/ClinicPrescriptionItemController.java b/src/main/java/com/gxwebsoft/clinic/controller/ClinicPrescriptionItemController.java new file mode 100644 index 0000000..eda3050 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/controller/ClinicPrescriptionItemController.java @@ -0,0 +1,121 @@ +package com.gxwebsoft.clinic.controller; + +import com.gxwebsoft.clinic.entity.ClinicPrescriptionItem; +import com.gxwebsoft.clinic.param.ClinicPrescriptionItemParam; +import com.gxwebsoft.clinic.service.ClinicPrescriptionItemService; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 处方明细表 +控制器 + * + * @author 科技小王子 + * @since 2025-10-22 02:01:13 + */ +@Tag(name = "处方明细表管理") +@RestController +@RequestMapping("/api/clinic/clinic-prescription-item") +public class ClinicPrescriptionItemController extends BaseController { + @Resource + private ClinicPrescriptionItemService clinicPrescriptionItemService; + + @Operation(summary = "分页查询处方明细表") + @GetMapping("/page") + public ApiResult> page(ClinicPrescriptionItemParam param) { + // 使用关联查询 + return success(clinicPrescriptionItemService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('clinic:clinicPrescription:list')") + @Operation(summary = "查询全部处方明细表") + @GetMapping() + public ApiResult> list(ClinicPrescriptionItemParam param) { + // 使用关联查询 + return success(clinicPrescriptionItemService.listRel(param)); + } + + @Operation(summary = "根据id查询处方明细表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(clinicPrescriptionItemService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('clinic:clinicPrescription:save')") + @OperationLog + @Operation(summary = "添加处方明细表") + @PostMapping() + public ApiResult save(@RequestBody ClinicPrescriptionItem clinicPrescriptionItem) { + if (clinicPrescriptionItemService.save(clinicPrescriptionItem)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicPrescription:update')") + @OperationLog + @Operation(summary = "修改处方明细表") + @PutMapping() + public ApiResult update(@RequestBody ClinicPrescriptionItem clinicPrescriptionItem) { + if (clinicPrescriptionItemService.updateById(clinicPrescriptionItem)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicPrescription:remove')") + @OperationLog + @Operation(summary = "删除处方明细表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (clinicPrescriptionItemService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicPrescription:save')") + @OperationLog + @Operation(summary = "批量添加处方明细表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (clinicPrescriptionItemService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicPrescription:update')") + @OperationLog + @Operation(summary = "批量修改处方明细表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(clinicPrescriptionItemService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('clinic:clinicPrescription:remove')") + @OperationLog + @Operation(summary = "批量删除处方明细表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (clinicPrescriptionItemService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/clinic/controller/业务中台-排班信息接口对接文档20251114(2).docx b/src/main/java/com/gxwebsoft/clinic/controller/业务中台-排班信息接口对接文档20251114(2).docx new file mode 100644 index 0000000..8b21716 Binary files /dev/null and b/src/main/java/com/gxwebsoft/clinic/controller/业务中台-排班信息接口对接文档20251114(2).docx differ diff --git a/src/main/java/com/gxwebsoft/clinic/dto/PrescriptionOrderRequest.java b/src/main/java/com/gxwebsoft/clinic/dto/PrescriptionOrderRequest.java new file mode 100644 index 0000000..44bc7c2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/dto/PrescriptionOrderRequest.java @@ -0,0 +1,24 @@ +package com.gxwebsoft.clinic.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** + * 处方订单请求参数 + * + * @author 科技小王子 + * @since 2025-11-03 + */ +@Data +@Schema(name = "PrescriptionOrderRequest", description = "处方订单请求参数") +public class PrescriptionOrderRequest implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "处方ID", required = true) + private Integer prescriptionId; + + @Schema(description = "支付方式:0余额支付,1微信支付,2支付宝支付,3银联支付,4现金支付,5POS机支付,6免费,7积分支付", required = true) + private Integer payType; +} diff --git a/src/main/java/com/gxwebsoft/clinic/entity/ClinicAppointment.java b/src/main/java/com/gxwebsoft/clinic/entity/ClinicAppointment.java new file mode 100644 index 0000000..c38ae8d --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/entity/ClinicAppointment.java @@ -0,0 +1,81 @@ +package com.gxwebsoft.clinic.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 挂号 + * + * @author 科技小王子 + * @since 2025-10-19 09:27:03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ClinicAppointment对象", description = "挂号") +public class ClinicAppointment implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "类型") + private Integer type; + + @Schema(description = "就诊原因") + private String reason; + + @Schema(description = "挂号时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime evaluateTime; + + @Schema(description = "医生") + private Integer doctorId; + + @Schema(description = "医生名称") + @TableField(exist = false) + private String doctorName; + + @Schema(description = "医生职位") + @TableField(exist = false) + private String doctorPosition; + + @Schema(description = "患者") + private Integer userId; + + @Schema(description = "患者名称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "手机") + @TableField(exist = false) + private String phone; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "是否删除") + private Integer isDelete; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/entity/ClinicDoctorApply.java b/src/main/java/com/gxwebsoft/clinic/entity/ClinicDoctorApply.java new file mode 100644 index 0000000..8d8e173 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/entity/ClinicDoctorApply.java @@ -0,0 +1,125 @@ +package com.gxwebsoft.clinic.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import java.time.LocalDate; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 医生入驻申请 + * + * @author 科技小王子 + * @since 2025-10-19 09:27:04 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ClinicDoctorApply对象", description = "医生入驻申请") +public class ClinicDoctorApply implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "apply_id", type = IdType.AUTO) + private Integer applyId; + + @Schema(description = "类型 0医生") + private Integer type; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "姓名") + private String realName; + + @Schema(description = "性别 1男 2女") + private Integer gender; + + @Schema(description = "手机号") + private String mobile; + + @Schema(description = "客户名称") + private String dealerName; + + @Schema(description = "证件号码") + private String idCard; + + @Schema(description = "生日") + @JsonFormat(pattern = "yyyy-MM-dd") + private LocalDate birthDate; + + @Schema(description = "区分职称等级(如主治医师、副主任医师)") + private String professionalTitle; + + @Schema(description = "工作单位") + private String workUnit; + + @Schema(description = "执业资格核心凭证") + private String practiceLicense; + + @Schema(description = "限定可执业科室或疾病类型") + private String practiceScope; + + @Schema(description = "开始工作时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime startWorkDate; + + @Schema(description = "简历") + private String resume; + + @Schema(description = "使用 JSON 存储多个证件文件路径(如执业证、学历证)") + private String certificationFiles; + + @Schema(description = "详细地址") + private String address; + + @Schema(description = "签约价格") + private BigDecimal money; + + @Schema(description = "推荐人用户ID") + private Integer refereeId; + + @Schema(description = "申请方式(10需后台审核 20无需审核)") + private Integer applyType; + + @Schema(description = "审核状态 (10待审核 20审核通过 30驳回)") + private Integer applyStatus; + + @Schema(description = "申请时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime applyTime; + + @Schema(description = "审核时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime auditTime; + + @Schema(description = "合同时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime contractTime; + + @Schema(description = "过期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime expirationTime; + + @Schema(description = "驳回原因") + private String rejectReason; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "商城ID") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/entity/ClinicDoctorUser.java b/src/main/java/com/gxwebsoft/clinic/entity/ClinicDoctorUser.java new file mode 100644 index 0000000..b95c86b --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/entity/ClinicDoctorUser.java @@ -0,0 +1,99 @@ +package com.gxwebsoft.clinic.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * 分销商用户记录表 + * + * @author 科技小王子 + * @since 2025-10-23 15:58:20 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ClinicDoctorUser对象", description = "分销商用户记录表") +public class ClinicDoctorUser implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "类型 0经销商 1企业 2集团") + private Integer type; + + @Schema(description = "自增ID") + private Integer userId; + + @Schema(description = "昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "姓名") + private String realName; + + @Schema(description = "手机号") + @TableField(exist = false) + private String phone; + + @Schema(description = "部门") + private Integer departmentId; + + @Schema(description = "专业领域") + private String specialty; + + @Schema(description = "职务级别") + private String position; + + @Schema(description = "执业资格") + private String qualification; + + @Schema(description = "医生简介") + private String introduction; + + @Schema(description = "挂号费") + private BigDecimal consultationFee; + + @Schema(description = "工作年限") + private Integer workYears; + + @Schema(description = "问诊人数") + private Integer consultationCount; + + @Schema(description = "专属二维码") + private String qrcode; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "是否删除") + private Integer isDelete; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/entity/ClinicMedicine.java b/src/main/java/com/gxwebsoft/clinic/entity/ClinicMedicine.java new file mode 100644 index 0000000..43aa6df --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/entity/ClinicMedicine.java @@ -0,0 +1,71 @@ +package com.gxwebsoft.clinic.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * 药品库 + * + * @author 科技小王子 + * @since 2025-10-22 02:06:31 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ClinicMedicine对象", description = "药品库") +public class ClinicMedicine implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "药名") + private String name; + + @Schema(description = "拼音") + private String pinyin; + + @Schema(description = "分类(如“清热解毒”、“补气养血”)") + private String category; + + @Schema(description = "规格(如“饮片”、“颗粒”)") + private String specification; + + @Schema(description = "单位(如“克”、“袋”)") + private String unit; + + @Schema(description = "描述") + private String content; + + @Schema(description = "单价") + private BigDecimal pricePerUnit; + + @Schema(description = "是否活跃") + private Integer isActive; + + @Schema(description = "买家用户ID") + private Integer userId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "商城ID") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/entity/ClinicMedicineInout.java b/src/main/java/com/gxwebsoft/clinic/entity/ClinicMedicineInout.java new file mode 100644 index 0000000..3d3f428 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/entity/ClinicMedicineInout.java @@ -0,0 +1,99 @@ +package com.gxwebsoft.clinic.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * 出入库 + * + * @author 科技小王子 + * @since 2025-10-22 02:06:32 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ClinicMedicineInout对象", description = "出入库") +public class ClinicMedicineInout implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "买家用户ID") + private Integer userId; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "分销商用户id(一级)") + private Integer firstUserId; + + @Schema(description = "分销商用户id(二级)") + private Integer secondUserId; + + @Schema(description = "分销商用户id(三级)") + private Integer thirdUserId; + + @Schema(description = "分销佣金(一级)") + private BigDecimal firstMoney; + + @Schema(description = "分销佣金(二级)") + private BigDecimal secondMoney; + + @Schema(description = "分销佣金(三级)") + private BigDecimal thirdMoney; + + @Schema(description = "单价") + private BigDecimal price; + + @Schema(description = "订单总金额") + private BigDecimal orderPrice; + + @Schema(description = "结算金额") + private BigDecimal settledPrice; + + @Schema(description = "换算成度") + private BigDecimal degreePrice; + + @Schema(description = "实发金额") + private BigDecimal payPrice; + + @Schema(description = "税率") + private BigDecimal rate; + + @Schema(description = "结算月份") + private String month; + + @Schema(description = "订单是否失效(0未失效 1已失效)") + private Integer isInvalid; + + @Schema(description = "佣金结算(0未结算 1已结算)") + private Integer isSettled; + + @Schema(description = "结算时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime settleTime; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "商城ID") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/entity/ClinicMedicineStock.java b/src/main/java/com/gxwebsoft/clinic/entity/ClinicMedicineStock.java new file mode 100644 index 0000000..aa5973a --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/entity/ClinicMedicineStock.java @@ -0,0 +1,59 @@ +package com.gxwebsoft.clinic.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 药品库存 + * + * @author 科技小王子 + * @since 2025-10-22 02:06:32 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ClinicMedicineStock对象", description = "药品库存") +public class ClinicMedicineStock implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "药品") + private Integer medicineId; + + @Schema(description = "库存数量") + private Integer stockQuantity; + + @Schema(description = "最小库存预警") + private Integer minStockLevel; + + @Schema(description = "上次更新时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime lastUpdated; + + @Schema(description = "买家用户ID") + private Integer userId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "商城ID") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/entity/ClinicPatientUser.java b/src/main/java/com/gxwebsoft/clinic/entity/ClinicPatientUser.java new file mode 100644 index 0000000..1b99fcb --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/entity/ClinicPatientUser.java @@ -0,0 +1,85 @@ +package com.gxwebsoft.clinic.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 患者 + * + * @author 科技小王子 + * @since 2025-10-19 09:27:04 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ClinicPatientUser对象", description = "患者") +public class ClinicPatientUser implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "类型 0经销商 1企业 2集团") + private Integer type; + + @Schema(description = "自增ID") + private Integer userId; + + @Schema(description = "姓名") + private String realName; + + @Schema(description = "头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "手机号") + @TableField(exist = false) + private String phone; + + @Schema(description = "性别 0未知 1男 2女") + private Integer sex; + + @Schema(description = "年龄") + private Integer age; + + @Schema(description = "身高") + private String height; + + @Schema(description = "体重") + private String weight; + + @Schema(description = "过敏史") + private String allergyHistory; + + @Schema(description = "专属二维码") + private String qrcode; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "是否删除") + private Integer isDelete; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/entity/ClinicPrescription.java b/src/main/java/com/gxwebsoft/clinic/entity/ClinicPrescription.java new file mode 100644 index 0000000..688adfd --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/entity/ClinicPrescription.java @@ -0,0 +1,133 @@ +package com.gxwebsoft.clinic.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.gxwebsoft.shop.entity.ShopOrder; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + * 处方主表 + + * + * @author 科技小王子 + * @since 2025-10-22 02:01:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ClinicPrescription对象", description = "处方主表") +public class ClinicPrescription implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "患者") + private Integer userId; + + @Schema(description = "患者名称") + @TableField(exist = false) + private String realName; + + @Schema(description = "年龄") + @TableField(exist = false) + private String age; + + @Schema(description = "身高") + @TableField(exist = false) + private String height; + + @Schema(description = "体重") + @TableField(exist = false) + private String weight; + + @Schema(description = "医生") + private Integer doctorId; + + @Schema(description = "医生名称") + @TableField(exist = false) + private String doctorName; + + @Schema(description = "医生资格") + @TableField(exist = false) + private String qualification; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "0未付款,1已付款") + @TableField(exist = false) + private Boolean payStatus; + + @Schema(description = "0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款") + @TableField(exist = false) + private Integer orderStatus; + + @Schema(description = "关联就诊表") + private Integer visitRecordId; + + @Schema(description = "处方类型 0中药 1西药") + private Integer prescriptionType; + + @Schema(description = "诊断结果") + private String diagnosis; + + @Schema(description = "治疗方案") + private String treatmentPlan; + + @Schema(description = "煎药说明") + private String decoctionInstructions; + + @Schema(description = "上传附件") + private String image; + + @Schema(description = "订单总金额") + private BigDecimal orderPrice; + + @Schema(description = "单价") + private BigDecimal price; + + @Schema(description = "实付金额") + private BigDecimal payPrice; + + @Schema(description = "订单是否失效(0未失效 1已失效)") + private Integer isInvalid; + + @Schema(description = "结算(0未结算 1已结算)") + private Integer isSettled; + + @Schema(description = "结算时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime settleTime; + + @Schema(description = "状态, 0正常, 1已完成,2已支付,3已取消") + private Integer status; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "商城ID") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "处方明细") + @TableField(exist = false) + private List items; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/entity/ClinicPrescriptionItem.java b/src/main/java/com/gxwebsoft/clinic/entity/ClinicPrescriptionItem.java new file mode 100644 index 0000000..78329d0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/entity/ClinicPrescriptionItem.java @@ -0,0 +1,99 @@ +package com.gxwebsoft.clinic.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * 处方明细表 + + * + * @author 科技小王子 + * @since 2025-10-22 02:01:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ClinicPrescriptionItem对象", description = "处方明细表") +public class ClinicPrescriptionItem implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "关联处方") + private Integer prescriptionId; + + @Schema(description = "订单编号") + private String prescriptionNo; + + @Schema(description = "关联药品") + private Integer medicineId; + + @Schema(description = "药品名称") + @TableField(exist = false) + private String medicineName; + + @Schema(description = "规格") + @TableField(exist = false) + private String specification; + + @Schema(description = "单位") + @TableField(exist = false) + private String unit; + + @Schema(description = "单价") + @TableField(exist = false) + private BigDecimal pricePerUnit; + + @Schema(description = "药品") + @TableField(exist = false) + private ClinicMedicine clinicMedicine; + + @Schema(description = "剂量(如“10g”)") + private String dosage; + + @Schema(description = "用法频率(如“每日三次”)") + private String usageFrequency; + + @Schema(description = "服用天数") + private Integer days; + + @Schema(description = "购买数量") + private Integer amount; + + @Schema(description = "单价") + private BigDecimal unitPrice; + + @Schema(description = "数量") + private Integer quantity; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "用户id") + private Integer userId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "更新时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/ClinicAppointmentMapper.java b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicAppointmentMapper.java new file mode 100644 index 0000000..adcec99 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicAppointmentMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.clinic.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.clinic.entity.ClinicAppointment; +import com.gxwebsoft.clinic.param.ClinicAppointmentParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 挂号Mapper + * + * @author 科技小王子 + * @since 2025-10-19 09:27:03 + */ +public interface ClinicAppointmentMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ClinicAppointmentParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ClinicAppointmentParam param); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/ClinicDoctorApplyMapper.java b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicDoctorApplyMapper.java new file mode 100644 index 0000000..2a08473 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicDoctorApplyMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.clinic.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.clinic.entity.ClinicDoctorApply; +import com.gxwebsoft.clinic.param.ClinicDoctorApplyParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 医生入驻申请Mapper + * + * @author 科技小王子 + * @since 2025-10-19 09:27:04 + */ +public interface ClinicDoctorApplyMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ClinicDoctorApplyParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ClinicDoctorApplyParam param); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/ClinicDoctorUserMapper.java b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicDoctorUserMapper.java new file mode 100644 index 0000000..ffda343 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicDoctorUserMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.clinic.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.clinic.entity.ClinicDoctorUser; +import com.gxwebsoft.clinic.param.ClinicDoctorUserParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 分销商用户记录表Mapper + * + * @author 科技小王子 + * @since 2025-10-19 09:27:04 + */ +public interface ClinicDoctorUserMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ClinicDoctorUserParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ClinicDoctorUserParam param); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/ClinicMedicineInoutMapper.java b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicMedicineInoutMapper.java new file mode 100644 index 0000000..9454319 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicMedicineInoutMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.clinic.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.clinic.entity.ClinicMedicineInout; +import com.gxwebsoft.clinic.param.ClinicMedicineInoutParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 出入库Mapper + * + * @author 科技小王子 + * @since 2025-10-22 02:06:32 + */ +public interface ClinicMedicineInoutMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ClinicMedicineInoutParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ClinicMedicineInoutParam param); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/ClinicMedicineMapper.java b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicMedicineMapper.java new file mode 100644 index 0000000..8fca0aa --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicMedicineMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.clinic.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.clinic.entity.ClinicMedicine; +import com.gxwebsoft.clinic.param.ClinicMedicineParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 药品库Mapper + * + * @author 科技小王子 + * @since 2025-10-22 02:06:31 + */ +public interface ClinicMedicineMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ClinicMedicineParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ClinicMedicineParam param); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/ClinicMedicineStockMapper.java b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicMedicineStockMapper.java new file mode 100644 index 0000000..9a95139 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicMedicineStockMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.clinic.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.clinic.entity.ClinicMedicineStock; +import com.gxwebsoft.clinic.param.ClinicMedicineStockParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 药品库存Mapper + * + * @author 科技小王子 + * @since 2025-10-22 02:06:32 + */ +public interface ClinicMedicineStockMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ClinicMedicineStockParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ClinicMedicineStockParam param); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/ClinicPatientUserMapper.java b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicPatientUserMapper.java new file mode 100644 index 0000000..bf25805 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicPatientUserMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.clinic.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.clinic.entity.ClinicPatientUser; +import com.gxwebsoft.clinic.param.ClinicPatientUserParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 患者Mapper + * + * @author 科技小王子 + * @since 2025-10-19 09:27:04 + */ +public interface ClinicPatientUserMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ClinicPatientUserParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ClinicPatientUserParam param); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/ClinicPrescriptionItemMapper.java b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicPrescriptionItemMapper.java new file mode 100644 index 0000000..1a21b01 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicPrescriptionItemMapper.java @@ -0,0 +1,38 @@ +package com.gxwebsoft.clinic.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.clinic.entity.ClinicPrescriptionItem; +import com.gxwebsoft.clinic.param.ClinicPrescriptionItemParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 处方明细表 +Mapper + * + * @author 科技小王子 + * @since 2025-10-22 02:01:13 + */ +public interface ClinicPrescriptionItemMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ClinicPrescriptionItemParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ClinicPrescriptionItemParam param); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/ClinicPrescriptionMapper.java b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicPrescriptionMapper.java new file mode 100644 index 0000000..6eeefda --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/ClinicPrescriptionMapper.java @@ -0,0 +1,38 @@ +package com.gxwebsoft.clinic.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.clinic.entity.ClinicPrescription; +import com.gxwebsoft.clinic.param.ClinicPrescriptionParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 处方主表 +Mapper + * + * @author 科技小王子 + * @since 2025-10-22 02:01:13 + */ +public interface ClinicPrescriptionMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ClinicPrescriptionParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ClinicPrescriptionParam param); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicAppointmentMapper.xml b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicAppointmentMapper.xml new file mode 100644 index 0000000..5aee909 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicAppointmentMapper.xml @@ -0,0 +1,62 @@ + + + + + + + SELECT a.*, b.nickname, b.phone, c.real_name as doctorName, c.position as doctorPosition + FROM clinic_appointment a + LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id + LEFT JOIN clinic_doctor_user c ON a.doctor_id = c.user_id + + + AND a.id = #{param.id} + + + AND a.type = #{param.type} + + + AND a.reason LIKE CONCAT('%', #{param.reason}, '%') + + + AND a.evaluate_time LIKE CONCAT('%', #{param.evaluateTime}, '%') + + + AND a.doctor_id = #{param.doctorId} + + + AND a.user_id = #{param.userId} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.is_delete = #{param.isDelete} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicDoctorApplyMapper.xml b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicDoctorApplyMapper.xml new file mode 100644 index 0000000..c701860 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicDoctorApplyMapper.xml @@ -0,0 +1,114 @@ + + + + + + + SELECT a.* + FROM clinic_doctor_apply a + + + AND a.apply_id = #{param.applyId} + + + AND a.type = #{param.type} + + + AND a.user_id = #{param.userId} + + + AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') + + + AND a.gender = #{param.gender} + + + AND a.mobile LIKE CONCAT('%', #{param.mobile}, '%') + + + AND a.dealer_name LIKE CONCAT('%', #{param.dealerName}, '%') + + + AND a.id_card LIKE CONCAT('%', #{param.idCard}, '%') + + + AND a.birth_date LIKE CONCAT('%', #{param.birthDate}, '%') + + + AND a.professional_title LIKE CONCAT('%', #{param.professionalTitle}, '%') + + + AND a.work_unit LIKE CONCAT('%', #{param.workUnit}, '%') + + + AND a.practice_license LIKE CONCAT('%', #{param.practiceLicense}, '%') + + + AND a.practice_scope LIKE CONCAT('%', #{param.practiceScope}, '%') + + + AND a.start_work_date LIKE CONCAT('%', #{param.startWorkDate}, '%') + + + AND a.resume LIKE CONCAT('%', #{param.resume}, '%') + + + AND a.certification_files LIKE CONCAT('%', #{param.certificationFiles}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.money = #{param.money} + + + AND a.referee_id = #{param.refereeId} + + + AND a.apply_type = #{param.applyType} + + + AND a.apply_status = #{param.applyStatus} + + + AND a.apply_time LIKE CONCAT('%', #{param.applyTime}, '%') + + + AND a.audit_time LIKE CONCAT('%', #{param.auditTime}, '%') + + + AND a.contract_time LIKE CONCAT('%', #{param.contractTime}, '%') + + + AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') + + + AND a.reject_reason LIKE CONCAT('%', #{param.rejectReason}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicDoctorUserMapper.xml b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicDoctorUserMapper.xml new file mode 100644 index 0000000..61e787f --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicDoctorUserMapper.xml @@ -0,0 +1,86 @@ + + + + + + + SELECT a.*, b.nickname, b.phone, b.avatar + FROM clinic_doctor_user a + LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id + + + AND a.id = #{param.id} + + + AND a.type = #{param.type} + + + AND a.user_id = #{param.userId} + + + AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.department_id = #{param.departmentId} + + + AND a.specialty LIKE CONCAT('%', #{param.specialty}, '%') + + + AND a.position LIKE CONCAT('%', #{param.position}, '%') + + + AND a.qualification LIKE CONCAT('%', #{param.qualification}, '%') + + + AND a.introduction LIKE CONCAT('%', #{param.introduction}, '%') + + + AND a.consultation_fee = #{param.consultationFee} + + + AND a.work_years = #{param.workYears} + + + AND a.consultation_count = #{param.consultationCount} + + + AND a.qrcode LIKE CONCAT('%', #{param.qrcode}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.is_delete = #{param.isDelete} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.real_name = #{param.keywords} + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicMedicineInoutMapper.xml b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicMedicineInoutMapper.xml new file mode 100644 index 0000000..0e49aac --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicMedicineInoutMapper.xml @@ -0,0 +1,93 @@ + + + + + + + SELECT a.* + FROM clinic_medicine_inout a + + + AND a.id = #{param.id} + + + AND a.user_id = #{param.userId} + + + AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%') + + + AND a.first_user_id = #{param.firstUserId} + + + AND a.second_user_id = #{param.secondUserId} + + + AND a.third_user_id = #{param.thirdUserId} + + + AND a.first_money = #{param.firstMoney} + + + AND a.second_money = #{param.secondMoney} + + + AND a.third_money = #{param.thirdMoney} + + + AND a.price = #{param.price} + + + AND a.order_price = #{param.orderPrice} + + + AND a.settled_price = #{param.settledPrice} + + + AND a.degree_price = #{param.degreePrice} + + + AND a.pay_price = #{param.payPrice} + + + AND a.rate = #{param.rate} + + + AND a.month LIKE CONCAT('%', #{param.month}, '%') + + + AND a.is_invalid = #{param.isInvalid} + + + AND a.is_settled = #{param.isSettled} + + + AND a.settle_time LIKE CONCAT('%', #{param.settleTime}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicMedicineMapper.xml b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicMedicineMapper.xml new file mode 100644 index 0000000..644a454 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicMedicineMapper.xml @@ -0,0 +1,66 @@ + + + + + + + SELECT a.* + FROM clinic_medicine a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.pinyin LIKE CONCAT('%', #{param.pinyin}, '%') + + + AND a.category LIKE CONCAT('%', #{param.category}, '%') + + + AND a.specification LIKE CONCAT('%', #{param.specification}, '%') + + + AND a.unit LIKE CONCAT('%', #{param.unit}, '%') + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.price_per_unit = #{param.pricePerUnit} + + + AND a.is_active = #{param.isActive} + + + AND a.user_id = #{param.userId} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicMedicineStockMapper.xml b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicMedicineStockMapper.xml new file mode 100644 index 0000000..93ffcd9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicMedicineStockMapper.xml @@ -0,0 +1,54 @@ + + + + + + + SELECT a.* + FROM clinic_medicine_stock a + + + AND a.id = #{param.id} + + + AND a.medicine_id = #{param.medicineId} + + + AND a.stock_quantity = #{param.stockQuantity} + + + AND a.min_stock_level = #{param.minStockLevel} + + + AND a.last_updated LIKE CONCAT('%', #{param.lastUpdated}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicPatientUserMapper.xml b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicPatientUserMapper.xml new file mode 100644 index 0000000..d2124a7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicPatientUserMapper.xml @@ -0,0 +1,71 @@ + + + + + + + SELECT a.*, b.phone, b.avatar + FROM clinic_patient_user a + LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id + + + AND a.id = #{param.id} + + + AND a.type = #{param.type} + + + AND a.user_id = #{param.userId} + + + AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') + + + AND a.age LIKE CONCAT('%', #{param.age}, '%') + + + AND a.qrcode LIKE CONCAT('%', #{param.qrcode}, '%') + + + AND a.height LIKE CONCAT('%', #{param.height}, '%') + + + AND a.weight LIKE CONCAT('%', #{param.weight}, '%') + + + AND a.allergy_history LIKE CONCAT('%', #{param.allergyHistory}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.is_delete = #{param.isDelete} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.real_name = #{param.keywords} + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicPrescriptionItemMapper.xml b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicPrescriptionItemMapper.xml new file mode 100644 index 0000000..bd5f01c --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicPrescriptionItemMapper.xml @@ -0,0 +1,73 @@ + + + + + + + SELECT a.*, b.name AS medicineName, b.specification, b.unit, b.price_per_unit AS pricePerUnit + FROM clinic_prescription_item a + LEFT JOIN clinic_medicine b ON a.id = b.id + + + AND a.id = #{param.id} + + + AND a.prescription_id = #{param.prescriptionId} + + + AND a.prescription_no LIKE CONCAT('%', #{param.prescriptionNo}, '%') + + + AND a.medicine_id = #{param.medicineId} + + + AND a.dosage LIKE CONCAT('%', #{param.dosage}, '%') + + + AND a.usage_frequency LIKE CONCAT('%', #{param.usageFrequency}, '%') + + + AND a.days = #{param.days} + + + AND a.amount = #{param.amount} + + + AND a.unit_price = #{param.unitPrice} + + + AND a.quantity = #{param.quantity} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicPrescriptionMapper.xml b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicPrescriptionMapper.xml new file mode 100644 index 0000000..877387d --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/mapper/xml/ClinicPrescriptionMapper.xml @@ -0,0 +1,132 @@ + + + + + + + SELECT a.*, b.real_name, b.age, b.sex, b.height, b.weight, c.real_name as doctorName, c.qualification, d.order_status as orderStatus, d.pay_status as payStatus + FROM clinic_prescription a + LEFT JOIN clinic_patient_user b ON a.user_id = b.user_id + LEFT JOIN clinic_doctor_user c ON a.doctor_id = c.user_id + LEFT JOIN shop_order d ON a.order_no = d.order_no + + + AND a.id = #{param.id} + + + AND a.user_id = #{param.userId} + + + AND a.doctor_id = #{param.doctorId} + + + AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%') + + + AND a.visit_record_id = #{param.visitRecordId} + + + AND a.prescription_type = #{param.prescriptionType} + + + AND a.diagnosis LIKE CONCAT('%', #{param.diagnosis}, '%') + + + AND a.treatment_plan LIKE CONCAT('%', #{param.treatmentPlan}, '%') + + + AND a.decoction_instructions LIKE CONCAT('%', #{param.decoctionInstructions}, '%') + + + AND a.order_price = #{param.orderPrice} + + + AND a.price = #{param.price} + + + AND a.pay_price = #{param.payPrice} + + + AND a.is_invalid = #{param.isInvalid} + + + AND a.is_settled = #{param.isSettled} + + + AND a.id IN + + #{item} + + + + AND a.settle_time LIKE CONCAT('%', #{param.settleTime}, '%') + + + AND a.status = #{param.status} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + AND d.pay_status = 0 AND d.order_status = 0 + + + + AND d.pay_status = 1 AND d.delivery_status = 10 AND d.order_status = 0 + + + + AND d.pay_status = 1 AND d.order_status = 0 + + + + AND d.delivery_status = 20 AND d.order_status != 1 + + + + AND d.order_status = 1 AND d.evaluate_status = 0 + + + + AND d.order_status = 1 + + + + AND (d.order_status = 4 OR d.order_status = 5 OR d.order_status = 6 OR d.order_status = 7) + + + + AND d.deleted = 1 + + + + AND a.order_status = 2 + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/clinic/param/ClinicAppointmentParam.java b/src/main/java/com/gxwebsoft/clinic/param/ClinicAppointmentParam.java new file mode 100644 index 0000000..a6e6a17 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/param/ClinicAppointmentParam.java @@ -0,0 +1,58 @@ +package com.gxwebsoft.clinic.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 挂号查询参数 + * + * @author 科技小王子 + * @since 2025-10-19 09:27:03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ClinicAppointmentParam对象", description = "挂号查询参数") +public class ClinicAppointmentParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "类型") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "就诊原因") + private String reason; + + @Schema(description = "挂号时间") + private String evaluateTime; + + @Schema(description = "医生") + @QueryField(type = QueryType.EQ) + private Integer doctorId; + + @Schema(description = "患者") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除") + @QueryField(type = QueryType.EQ) + private Integer isDelete; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/param/ClinicDoctorApplyParam.java b/src/main/java/com/gxwebsoft/clinic/param/ClinicDoctorApplyParam.java new file mode 100644 index 0000000..e9863da --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/param/ClinicDoctorApplyParam.java @@ -0,0 +1,114 @@ +package com.gxwebsoft.clinic.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 医生入驻申请查询参数 + * + * @author 科技小王子 + * @since 2025-10-19 09:27:04 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ClinicDoctorApplyParam对象", description = "医生入驻申请查询参数") +public class ClinicDoctorApplyParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer applyId; + + @Schema(description = "类型 0医生") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "姓名") + private String realName; + + @Schema(description = "性别 1男 2女") + @QueryField(type = QueryType.EQ) + private Integer gender; + + @Schema(description = "手机号") + private String mobile; + + @Schema(description = "客户名称") + private String dealerName; + + @Schema(description = "证件号码") + private String idCard; + + @Schema(description = "生日") + private String birthDate; + + @Schema(description = "区分职称等级(如主治医师、副主任医师)") + private String professionalTitle; + + @Schema(description = "工作单位") + private String workUnit; + + @Schema(description = "执业资格核心凭证") + private String practiceLicense; + + @Schema(description = "限定可执业科室或疾病类型") + private String practiceScope; + + @Schema(description = "开始工作时间") + private String startWorkDate; + + @Schema(description = "简历") + private String resume; + + @Schema(description = "使用 JSON 存储多个证件文件路径(如执业证、学历证)") + private String certificationFiles; + + @Schema(description = "详细地址") + private String address; + + @Schema(description = "签约价格") + @QueryField(type = QueryType.EQ) + private BigDecimal money; + + @Schema(description = "推荐人用户ID") + @QueryField(type = QueryType.EQ) + private Integer refereeId; + + @Schema(description = "申请方式(10需后台审核 20无需审核)") + @QueryField(type = QueryType.EQ) + private Integer applyType; + + @Schema(description = "审核状态 (10待审核 20审核通过 30驳回)") + @QueryField(type = QueryType.EQ) + private Integer applyStatus; + + @Schema(description = "申请时间") + private String applyTime; + + @Schema(description = "审核时间") + private String auditTime; + + @Schema(description = "合同时间") + private String contractTime; + + @Schema(description = "过期时间") + private String expirationTime; + + @Schema(description = "驳回原因") + private String rejectReason; + + @Schema(description = "备注") + private String comments; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/param/ClinicDoctorUserParam.java b/src/main/java/com/gxwebsoft/clinic/param/ClinicDoctorUserParam.java new file mode 100644 index 0000000..5157044 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/param/ClinicDoctorUserParam.java @@ -0,0 +1,86 @@ +package com.gxwebsoft.clinic.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 分销商用户记录表查询参数 + * + * @author 科技小王子 + * @since 2025-10-23 15:58:20 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ClinicDoctorUserParam对象", description = "分销商用户记录表查询参数") +public class ClinicDoctorUserParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "类型 0经销商 1企业 2集团") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "姓名") + private String realName; + + @Schema(description = "手机号") + private String phone; + + @Schema(description = "部门") + @QueryField(type = QueryType.EQ) + private Integer departmentId; + + @Schema(description = "专业领域") + private String specialty; + + @Schema(description = "职务级别") + private String position; + + @Schema(description = "执业资格") + private String qualification; + + @Schema(description = "医生简介") + private String introduction; + + @Schema(description = "挂号费") + @QueryField(type = QueryType.EQ) + private BigDecimal consultationFee; + + @Schema(description = "工作年限") + @QueryField(type = QueryType.EQ) + private Integer workYears; + + @Schema(description = "问诊人数") + @QueryField(type = QueryType.EQ) + private Integer consultationCount; + + @Schema(description = "专属二维码") + private String qrcode; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除") + @QueryField(type = QueryType.EQ) + private Integer isDelete; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/param/ClinicMedicineInoutParam.java b/src/main/java/com/gxwebsoft/clinic/param/ClinicMedicineInoutParam.java new file mode 100644 index 0000000..a438209 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/param/ClinicMedicineInoutParam.java @@ -0,0 +1,102 @@ +package com.gxwebsoft.clinic.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 出入库查询参数 + * + * @author 科技小王子 + * @since 2025-10-22 02:06:32 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ClinicMedicineInoutParam对象", description = "出入库查询参数") +public class ClinicMedicineInoutParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "买家用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "分销商用户id(一级)") + @QueryField(type = QueryType.EQ) + private Integer firstUserId; + + @Schema(description = "分销商用户id(二级)") + @QueryField(type = QueryType.EQ) + private Integer secondUserId; + + @Schema(description = "分销商用户id(三级)") + @QueryField(type = QueryType.EQ) + private Integer thirdUserId; + + @Schema(description = "分销佣金(一级)") + @QueryField(type = QueryType.EQ) + private BigDecimal firstMoney; + + @Schema(description = "分销佣金(二级)") + @QueryField(type = QueryType.EQ) + private BigDecimal secondMoney; + + @Schema(description = "分销佣金(三级)") + @QueryField(type = QueryType.EQ) + private BigDecimal thirdMoney; + + @Schema(description = "单价") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "订单总金额") + @QueryField(type = QueryType.EQ) + private BigDecimal orderPrice; + + @Schema(description = "结算金额") + @QueryField(type = QueryType.EQ) + private BigDecimal settledPrice; + + @Schema(description = "换算成度") + @QueryField(type = QueryType.EQ) + private BigDecimal degreePrice; + + @Schema(description = "实发金额") + @QueryField(type = QueryType.EQ) + private BigDecimal payPrice; + + @Schema(description = "税率") + @QueryField(type = QueryType.EQ) + private BigDecimal rate; + + @Schema(description = "结算月份") + private String month; + + @Schema(description = "订单是否失效(0未失效 1已失效)") + @QueryField(type = QueryType.EQ) + private Integer isInvalid; + + @Schema(description = "佣金结算(0未结算 1已结算)") + @QueryField(type = QueryType.EQ) + private Integer isSettled; + + @Schema(description = "结算时间") + private String settleTime; + + @Schema(description = "备注") + private String comments; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/param/ClinicMedicineParam.java b/src/main/java/com/gxwebsoft/clinic/param/ClinicMedicineParam.java new file mode 100644 index 0000000..71f4744 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/param/ClinicMedicineParam.java @@ -0,0 +1,63 @@ +package com.gxwebsoft.clinic.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 药品库查询参数 + * + * @author 科技小王子 + * @since 2025-10-22 02:06:31 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ClinicMedicineParam对象", description = "药品库查询参数") +public class ClinicMedicineParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "药名") + private String name; + + @Schema(description = "拼音") + private String pinyin; + + @Schema(description = "分类(如“清热解毒”、“补气养血”)") + private String category; + + @Schema(description = "规格(如“饮片”、“颗粒”)") + private String specification; + + @Schema(description = "单位(如“克”、“袋”)") + private String unit; + + @Schema(description = "描述") + private String content; + + @Schema(description = "单价") + @QueryField(type = QueryType.EQ) + private BigDecimal pricePerUnit; + + @Schema(description = "是否活跃") + @QueryField(type = QueryType.EQ) + private Integer isActive; + + @Schema(description = "买家用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "备注") + private String comments; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/param/ClinicMedicineStockParam.java b/src/main/java/com/gxwebsoft/clinic/param/ClinicMedicineStockParam.java new file mode 100644 index 0000000..a784c67 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/param/ClinicMedicineStockParam.java @@ -0,0 +1,50 @@ +package com.gxwebsoft.clinic.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 药品库存查询参数 + * + * @author 科技小王子 + * @since 2025-10-22 02:06:32 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ClinicMedicineStockParam对象", description = "药品库存查询参数") +public class ClinicMedicineStockParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "药品") + @QueryField(type = QueryType.EQ) + private Integer medicineId; + + @Schema(description = "库存数量") + @QueryField(type = QueryType.EQ) + private Integer stockQuantity; + + @Schema(description = "最小库存预警") + @QueryField(type = QueryType.EQ) + private Integer minStockLevel; + + @Schema(description = "上次更新时间") + private String lastUpdated; + + @Schema(description = "买家用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "备注") + private String comments; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/param/ClinicPatientUserParam.java b/src/main/java/com/gxwebsoft/clinic/param/ClinicPatientUserParam.java new file mode 100644 index 0000000..79373df --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/param/ClinicPatientUserParam.java @@ -0,0 +1,66 @@ +package com.gxwebsoft.clinic.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 患者查询参数 + * + * @author 科技小王子 + * @since 2025-10-23 15:27:17 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ClinicPatientUserParam对象", description = "患者查询参数") +public class ClinicPatientUserParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "类型 0经销商 1企业 2集团") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "姓名") + private String realName; + + @Schema(description = "年龄") + private String age; + + @Schema(description = "专属二维码") + private String qrcode; + + @Schema(description = "身高") + private String height; + + @Schema(description = "体重") + private String weight; + + @Schema(description = "过敏史") + private String allergyHistory; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除") + @QueryField(type = QueryType.EQ) + private Integer isDelete; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/param/ClinicPrescriptionItemParam.java b/src/main/java/com/gxwebsoft/clinic/param/ClinicPrescriptionItemParam.java new file mode 100644 index 0000000..5f83762 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/param/ClinicPrescriptionItemParam.java @@ -0,0 +1,81 @@ +package com.gxwebsoft.clinic.param; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.util.Set; + +/** + * 处方明细表 +查询参数 + * + * @author 科技小王子 + * @since 2025-10-22 02:01:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ClinicPrescriptionItemParam对象", description = "处方明细表 查询参数") +public class ClinicPrescriptionItemParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "关联处方") + @QueryField(type = QueryType.EQ) + private Integer prescriptionId; + + @Schema(description = "订单编号") + private String prescriptionNo; + + @Schema(description = "关联药品") + @QueryField(type = QueryType.EQ) + private Integer medicineId; + + @Schema(description = "剂量(如“10g”)") + private String dosage; + + @Schema(description = "用法频率(如“每日三次”)") + private String usageFrequency; + + @Schema(description = "服用天数") + @QueryField(type = QueryType.EQ) + private Integer days; + + @Schema(description = "购买数量") + @QueryField(type = QueryType.EQ) + private Integer amount; + + @Schema(description = "单价") + @QueryField(type = QueryType.EQ) + private BigDecimal unitPrice; + + @Schema(description = "数量") + @QueryField(type = QueryType.EQ) + private Integer quantity; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "用户id") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "处方ID集查询") + @TableField(exist = false) + private Set prescriptionIds; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/param/ClinicPrescriptionParam.java b/src/main/java/com/gxwebsoft/clinic/param/ClinicPrescriptionParam.java new file mode 100644 index 0000000..e8c0a81 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/param/ClinicPrescriptionParam.java @@ -0,0 +1,101 @@ +package com.gxwebsoft.clinic.param; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.util.Set; + +/** + * 处方主表 +查询参数 + * + * @author 科技小王子 + * @since 2025-10-22 02:01:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ClinicPrescriptionParam对象", description = "处方主表查询参数") +public class ClinicPrescriptionParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "患者") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "医生") + @QueryField(type = QueryType.EQ) + private Integer doctorId; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "订单类型 0商城订单 1处方订单") + private Integer type; + + @Schema(description = "关联就诊表") + @QueryField(type = QueryType.EQ) + private Integer visitRecordId; + + @Schema(description = "处方类型 0中药 1西药") + @QueryField(type = QueryType.EQ) + private Integer prescriptionType; + + @Schema(description = "诊断结果") + private String diagnosis; + + @Schema(description = "治疗方案") + private String treatmentPlan; + + @Schema(description = "煎药说明") + private String decoctionInstructions; + + @Schema(description = "订单总金额") + @QueryField(type = QueryType.EQ) + private BigDecimal orderPrice; + + @Schema(description = "单价") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "实付金额") + @QueryField(type = QueryType.EQ) + private BigDecimal payPrice; + + @Schema(description = "订单是否失效(0未失效 1已失效)") + @QueryField(type = QueryType.EQ) + private Integer isInvalid; + + @Schema(description = "结算(0未结算 1已结算)") + @QueryField(type = QueryType.EQ) + private Integer isSettled; + + @Schema(description = "结算时间") + private String settleTime; + + @Schema(description = "状态, 0正常, 1已完成,2已支付,3已取消") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "处方ID集查询") + @TableField(exist = false) + private Set ids; + + @Schema(description = "订单状态筛选:-1全部,0待支付,1待发货,2待核销,3待收货,4待评价,5已完成,6已退款,7已删除") + private Integer statusFilter; + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/ClinicAppointmentService.java b/src/main/java/com/gxwebsoft/clinic/service/ClinicAppointmentService.java new file mode 100644 index 0000000..28c7ac1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/ClinicAppointmentService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.clinic.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.clinic.entity.ClinicAppointment; +import com.gxwebsoft.clinic.param.ClinicAppointmentParam; + +import java.util.List; + +/** + * 挂号Service + * + * @author 科技小王子 + * @since 2025-10-19 09:27:04 + */ +public interface ClinicAppointmentService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ClinicAppointmentParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ClinicAppointmentParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ClinicAppointment + */ + ClinicAppointment getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/ClinicDoctorApplyService.java b/src/main/java/com/gxwebsoft/clinic/service/ClinicDoctorApplyService.java new file mode 100644 index 0000000..228ac95 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/ClinicDoctorApplyService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.clinic.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.clinic.entity.ClinicDoctorApply; +import com.gxwebsoft.clinic.param.ClinicDoctorApplyParam; + +import java.util.List; + +/** + * 医生入驻申请Service + * + * @author 科技小王子 + * @since 2025-10-19 09:27:04 + */ +public interface ClinicDoctorApplyService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ClinicDoctorApplyParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ClinicDoctorApplyParam param); + + /** + * 根据id查询 + * + * @param applyId 主键ID + * @return ClinicDoctorApply + */ + ClinicDoctorApply getByIdRel(Integer applyId); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/ClinicDoctorUserService.java b/src/main/java/com/gxwebsoft/clinic/service/ClinicDoctorUserService.java new file mode 100644 index 0000000..a417b1d --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/ClinicDoctorUserService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.clinic.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.clinic.entity.ClinicDoctorUser; +import com.gxwebsoft.clinic.param.ClinicDoctorUserParam; + +import java.util.List; + +/** + * 分销商用户记录表Service + * + * @author 科技小王子 + * @since 2025-10-19 09:27:04 + */ +public interface ClinicDoctorUserService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ClinicDoctorUserParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ClinicDoctorUserParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ClinicDoctorUser + */ + ClinicDoctorUser getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/ClinicMedicineInoutService.java b/src/main/java/com/gxwebsoft/clinic/service/ClinicMedicineInoutService.java new file mode 100644 index 0000000..f3c55fa --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/ClinicMedicineInoutService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.clinic.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.clinic.entity.ClinicMedicineInout; +import com.gxwebsoft.clinic.param.ClinicMedicineInoutParam; +import com.gxwebsoft.common.core.web.PageResult; + +import java.util.List; + +/** + * 出入库Service + * + * @author 科技小王子 + * @since 2025-10-22 02:06:32 + */ +public interface ClinicMedicineInoutService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ClinicMedicineInoutParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ClinicMedicineInoutParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ClinicMedicineInout + */ + ClinicMedicineInout getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/ClinicMedicineService.java b/src/main/java/com/gxwebsoft/clinic/service/ClinicMedicineService.java new file mode 100644 index 0000000..e393701 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/ClinicMedicineService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.clinic.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.clinic.entity.ClinicMedicine; +import com.gxwebsoft.clinic.param.ClinicMedicineParam; +import com.gxwebsoft.common.core.web.PageResult; + +import java.util.List; + +/** + * 药品库Service + * + * @author 科技小王子 + * @since 2025-10-22 02:06:31 + */ +public interface ClinicMedicineService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ClinicMedicineParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ClinicMedicineParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ClinicMedicine + */ + ClinicMedicine getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/ClinicMedicineStockService.java b/src/main/java/com/gxwebsoft/clinic/service/ClinicMedicineStockService.java new file mode 100644 index 0000000..04e792a --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/ClinicMedicineStockService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.clinic.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.clinic.entity.ClinicMedicineStock; +import com.gxwebsoft.clinic.param.ClinicMedicineStockParam; +import com.gxwebsoft.common.core.web.PageResult; + +import java.util.List; + +/** + * 药品库存Service + * + * @author 科技小王子 + * @since 2025-10-22 02:06:32 + */ +public interface ClinicMedicineStockService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ClinicMedicineStockParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ClinicMedicineStockParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ClinicMedicineStock + */ + ClinicMedicineStock getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/ClinicPatientUserService.java b/src/main/java/com/gxwebsoft/clinic/service/ClinicPatientUserService.java new file mode 100644 index 0000000..df37cc3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/ClinicPatientUserService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.clinic.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.clinic.entity.ClinicPatientUser; +import com.gxwebsoft.clinic.param.ClinicPatientUserParam; + +import java.util.List; + +/** + * 患者Service + * + * @author 科技小王子 + * @since 2025-10-19 09:27:04 + */ +public interface ClinicPatientUserService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ClinicPatientUserParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ClinicPatientUserParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ClinicPatientUser + */ + ClinicPatientUser getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/ClinicPrescriptionItemService.java b/src/main/java/com/gxwebsoft/clinic/service/ClinicPrescriptionItemService.java new file mode 100644 index 0000000..42b8687 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/ClinicPrescriptionItemService.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.clinic.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.clinic.entity.ClinicPrescriptionItem; +import com.gxwebsoft.clinic.param.ClinicPrescriptionItemParam; +import com.gxwebsoft.common.core.web.PageResult; + +import java.util.List; + +/** + * 处方明细表 +Service + * + * @author 科技小王子 + * @since 2025-10-22 02:01:13 + */ +public interface ClinicPrescriptionItemService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ClinicPrescriptionItemParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ClinicPrescriptionItemParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return ClinicPrescriptionItem + */ + ClinicPrescriptionItem getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/ClinicPrescriptionService.java b/src/main/java/com/gxwebsoft/clinic/service/ClinicPrescriptionService.java new file mode 100644 index 0000000..5e6d4c0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/ClinicPrescriptionService.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.clinic.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.clinic.entity.ClinicPrescription; +import com.gxwebsoft.clinic.param.ClinicPrescriptionParam; +import com.gxwebsoft.common.core.web.PageResult; + +import java.util.List; + +/** + * 处方主表 +Service + * + * @author 科技小王子 + * @since 2025-10-22 02:01:13 + */ +public interface ClinicPrescriptionService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ClinicPrescriptionParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ClinicPrescriptionParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ClinicPrescription + */ + ClinicPrescription getByIdRel(Integer id); + + // 添加成功后返回数据 + ClinicPrescription getByLastId(ClinicPrescription clinicPrescription); +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicAppointmentServiceImpl.java b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicAppointmentServiceImpl.java new file mode 100644 index 0000000..2af3f86 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicAppointmentServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.clinic.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.clinic.mapper.ClinicAppointmentMapper; +import com.gxwebsoft.clinic.service.ClinicAppointmentService; +import com.gxwebsoft.clinic.entity.ClinicAppointment; +import com.gxwebsoft.clinic.param.ClinicAppointmentParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 挂号Service实现 + * + * @author 科技小王子 + * @since 2025-10-19 09:27:04 + */ +@Service +public class ClinicAppointmentServiceImpl extends ServiceImpl implements ClinicAppointmentService { + + @Override + public PageResult pageRel(ClinicAppointmentParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ClinicAppointmentParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ClinicAppointment getByIdRel(Integer id) { + ClinicAppointmentParam param = new ClinicAppointmentParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicDoctorApplyServiceImpl.java b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicDoctorApplyServiceImpl.java new file mode 100644 index 0000000..9ba52d1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicDoctorApplyServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.clinic.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.clinic.mapper.ClinicDoctorApplyMapper; +import com.gxwebsoft.clinic.service.ClinicDoctorApplyService; +import com.gxwebsoft.clinic.entity.ClinicDoctorApply; +import com.gxwebsoft.clinic.param.ClinicDoctorApplyParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 医生入驻申请Service实现 + * + * @author 科技小王子 + * @since 2025-10-19 09:27:04 + */ +@Service +public class ClinicDoctorApplyServiceImpl extends ServiceImpl implements ClinicDoctorApplyService { + + @Override + public PageResult pageRel(ClinicDoctorApplyParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ClinicDoctorApplyParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ClinicDoctorApply getByIdRel(Integer applyId) { + ClinicDoctorApplyParam param = new ClinicDoctorApplyParam(); + param.setApplyId(applyId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicDoctorUserServiceImpl.java b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicDoctorUserServiceImpl.java new file mode 100644 index 0000000..5b65655 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicDoctorUserServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.clinic.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.clinic.mapper.ClinicDoctorUserMapper; +import com.gxwebsoft.clinic.service.ClinicDoctorUserService; +import com.gxwebsoft.clinic.entity.ClinicDoctorUser; +import com.gxwebsoft.clinic.param.ClinicDoctorUserParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 分销商用户记录表Service实现 + * + * @author 科技小王子 + * @since 2025-10-19 09:27:04 + */ +@Service +public class ClinicDoctorUserServiceImpl extends ServiceImpl implements ClinicDoctorUserService { + + @Override + public PageResult pageRel(ClinicDoctorUserParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ClinicDoctorUserParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ClinicDoctorUser getByIdRel(Integer id) { + ClinicDoctorUserParam param = new ClinicDoctorUserParam(); + param.setUserId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicMedicineInoutServiceImpl.java b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicMedicineInoutServiceImpl.java new file mode 100644 index 0000000..fbd1caf --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicMedicineInoutServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.clinic.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.clinic.entity.ClinicMedicineInout; +import com.gxwebsoft.clinic.mapper.ClinicMedicineInoutMapper; +import com.gxwebsoft.clinic.param.ClinicMedicineInoutParam; +import com.gxwebsoft.clinic.service.ClinicMedicineInoutService; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 出入库Service实现 + * + * @author 科技小王子 + * @since 2025-10-22 02:06:32 + */ +@Service +public class ClinicMedicineInoutServiceImpl extends ServiceImpl implements ClinicMedicineInoutService { + + @Override + public PageResult pageRel(ClinicMedicineInoutParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ClinicMedicineInoutParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ClinicMedicineInout getByIdRel(Integer id) { + ClinicMedicineInoutParam param = new ClinicMedicineInoutParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicMedicineServiceImpl.java b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicMedicineServiceImpl.java new file mode 100644 index 0000000..cc6deba --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicMedicineServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.clinic.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.clinic.entity.ClinicMedicine; +import com.gxwebsoft.clinic.mapper.ClinicMedicineMapper; +import com.gxwebsoft.clinic.param.ClinicMedicineParam; +import com.gxwebsoft.clinic.service.ClinicMedicineService; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 药品库Service实现 + * + * @author 科技小王子 + * @since 2025-10-22 02:06:31 + */ +@Service +public class ClinicMedicineServiceImpl extends ServiceImpl implements ClinicMedicineService { + + @Override + public PageResult pageRel(ClinicMedicineParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ClinicMedicineParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ClinicMedicine getByIdRel(Integer id) { + ClinicMedicineParam param = new ClinicMedicineParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicMedicineStockServiceImpl.java b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicMedicineStockServiceImpl.java new file mode 100644 index 0000000..2364578 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicMedicineStockServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.clinic.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.clinic.entity.ClinicMedicineStock; +import com.gxwebsoft.clinic.mapper.ClinicMedicineStockMapper; +import com.gxwebsoft.clinic.param.ClinicMedicineStockParam; +import com.gxwebsoft.clinic.service.ClinicMedicineStockService; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 药品库存Service实现 + * + * @author 科技小王子 + * @since 2025-10-22 02:06:32 + */ +@Service +public class ClinicMedicineStockServiceImpl extends ServiceImpl implements ClinicMedicineStockService { + + @Override + public PageResult pageRel(ClinicMedicineStockParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ClinicMedicineStockParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ClinicMedicineStock getByIdRel(Integer id) { + ClinicMedicineStockParam param = new ClinicMedicineStockParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicPatientUserServiceImpl.java b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicPatientUserServiceImpl.java new file mode 100644 index 0000000..a3968b2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicPatientUserServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.clinic.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.clinic.mapper.ClinicPatientUserMapper; +import com.gxwebsoft.clinic.service.ClinicPatientUserService; +import com.gxwebsoft.clinic.entity.ClinicPatientUser; +import com.gxwebsoft.clinic.param.ClinicPatientUserParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 患者Service实现 + * + * @author 科技小王子 + * @since 2025-10-19 09:27:04 + */ +@Service +public class ClinicPatientUserServiceImpl extends ServiceImpl implements ClinicPatientUserService { + + @Override + public PageResult pageRel(ClinicPatientUserParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ClinicPatientUserParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ClinicPatientUser getByIdRel(Integer id) { + ClinicPatientUserParam param = new ClinicPatientUserParam(); + param.setUserId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicPrescriptionItemServiceImpl.java b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicPrescriptionItemServiceImpl.java new file mode 100644 index 0000000..916b716 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicPrescriptionItemServiceImpl.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.clinic.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.clinic.entity.ClinicPrescriptionItem; +import com.gxwebsoft.clinic.mapper.ClinicPrescriptionItemMapper; +import com.gxwebsoft.clinic.param.ClinicPrescriptionItemParam; +import com.gxwebsoft.clinic.service.ClinicPrescriptionItemService; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 处方明细表 +Service实现 + * + * @author 科技小王子 + * @since 2025-10-22 02:01:13 + */ +@Service +public class ClinicPrescriptionItemServiceImpl extends ServiceImpl implements ClinicPrescriptionItemService { + + @Override + public PageResult pageRel(ClinicPrescriptionItemParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ClinicPrescriptionItemParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ClinicPrescriptionItem getByIdRel(Integer id) { + ClinicPrescriptionItemParam param = new ClinicPrescriptionItemParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicPrescriptionServiceImpl.java b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicPrescriptionServiceImpl.java new file mode 100644 index 0000000..742f741 --- /dev/null +++ b/src/main/java/com/gxwebsoft/clinic/service/impl/ClinicPrescriptionServiceImpl.java @@ -0,0 +1,75 @@ +package com.gxwebsoft.clinic.service.impl; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.clinic.entity.ClinicPrescription; +import com.gxwebsoft.clinic.entity.ClinicPrescriptionItem; +import com.gxwebsoft.clinic.mapper.ClinicPrescriptionMapper; +import com.gxwebsoft.clinic.param.ClinicPrescriptionItemParam; +import com.gxwebsoft.clinic.param.ClinicPrescriptionParam; +import com.gxwebsoft.clinic.service.ClinicPrescriptionItemService; +import com.gxwebsoft.clinic.service.ClinicPrescriptionService; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopOrder; +import com.gxwebsoft.shop.entity.ShopOrderGoods; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 处方主表 +Service实现 + * + * @author 科技小王子 + * @since 2025-10-22 02:01:13 + */ +@Service +public class ClinicPrescriptionServiceImpl extends ServiceImpl implements ClinicPrescriptionService { + + @Resource + private ClinicPrescriptionItemService clinicPrescriptionItemService; + @Override + public PageResult pageRel(ClinicPrescriptionParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + // 查询处方明细 + Set collectIds = list.stream().map(ClinicPrescription::getId).collect(Collectors.toSet()); + final ClinicPrescriptionItemParam itemParam = new ClinicPrescriptionItemParam(); + itemParam.setPrescriptionIds(collectIds); + final List clinicPrescriptionItems = clinicPrescriptionItemService.listRel(itemParam); + final Map> collect = clinicPrescriptionItems.stream().collect(Collectors.groupingBy(ClinicPrescriptionItem::getPrescriptionId)); + list.forEach(d -> { + d.setItems(collect.get(d.getId())); + }); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ClinicPrescriptionParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ClinicPrescription getByIdRel(Integer id) { + ClinicPrescriptionParam param = new ClinicPrescriptionParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public ClinicPrescription getByLastId(ClinicPrescription clinicPrescription) { + return getOne(new LambdaQueryWrapper().orderByDesc(ClinicPrescription::getId).eq(ClinicPrescription::getUserId, clinicPrescription.getUserId()).last("limit 1")); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsAdController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsAdController.java new file mode 100644 index 0000000..64a979b --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsAdController.java @@ -0,0 +1,119 @@ +package com.gxwebsoft.cms.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsAdService; +import com.gxwebsoft.cms.entity.CmsAd; +import com.gxwebsoft.cms.param.CmsAdParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 广告位控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Tag(name = "广告位管理") +@RestController +@RequestMapping("/api/cms/cms-ad") +public class CmsAdController extends BaseController { + @Resource + private CmsAdService cmsAdService; + + @Operation(summary = "分页查询广告位") + @GetMapping("/page") + public ApiResult> page(CmsAdParam param) { + // 使用关联查询 + return success(cmsAdService.pageRel(param)); + } + + @Operation(summary = "查询全部广告位") + @GetMapping() + public ApiResult> list(CmsAdParam param) { + // 使用关联查询 + return success(cmsAdService.listRel(param)); + } + + @Operation(summary = "根据id查询广告位") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + final CmsAd ad = cmsAdService.getByIdRel(id); + return success(ad); + } + + @Operation(summary = "根据code查询广告位") + @GetMapping("/getByCode/{code}") + public ApiResult getByCode(@PathVariable("code") String code) { + final CmsAd ad = cmsAdService.getByIdCode(code); + return success(ad); + } + + @Operation(summary = "添加广告位") + @PostMapping() + public ApiResult save(@RequestBody CmsAd cmsAd) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + cmsAd.setUserId(loginUser.getUserId()); + } + if (cmsAdService.save(cmsAd)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改广告位") + @PutMapping() + public ApiResult update(@RequestBody CmsAd cmsAd) { + if (cmsAdService.updateById(cmsAd)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除广告位") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsAdService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加广告位") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsAdService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改广告位") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsAdService, "ad_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除广告位") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsAdService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsAdRecordController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsAdRecordController.java new file mode 100644 index 0000000..4188ead --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsAdRecordController.java @@ -0,0 +1,114 @@ +package com.gxwebsoft.cms.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsAdRecordService; +import com.gxwebsoft.cms.entity.CmsAdRecord; +import com.gxwebsoft.cms.param.CmsAdRecordParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 广告图片控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Tag(name = "广告图片管理") +@RestController +@RequestMapping("/api/cms/cms-ad-record") +public class CmsAdRecordController extends BaseController { + @Resource + private CmsAdRecordService cmsAdRecordService; + + @Operation(summary = "分页查询广告图片") + @GetMapping("/page") + public ApiResult> page(CmsAdRecordParam param) { + // 使用关联查询 + return success(cmsAdRecordService.pageRel(param)); + } + + @Operation(summary = "查询全部广告图片") + @GetMapping() + public ApiResult> list(CmsAdRecordParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(cmsAdRecordService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(cmsAdRecordService.listRel(param)); + } + + @PreAuthorize("hasAuthority('cms:cmsAdRecord:list')") + @OperationLog + @Operation(summary = "根据id查询广告图片") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(cmsAdRecordService.getById(id)); + // 使用关联查询 + //return success(cmsAdRecordService.getByIdRel(id)); + } + + @Operation(summary = "添加广告图片") + @PostMapping() + public ApiResult save(@RequestBody CmsAdRecord cmsAdRecord) { + if (cmsAdRecordService.save(cmsAdRecord)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改广告图片") + @PutMapping() + public ApiResult update(@RequestBody CmsAdRecord cmsAdRecord) { + if (cmsAdRecordService.updateById(cmsAdRecord)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除广告图片") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsAdRecordService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加广告图片") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsAdRecordService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改广告图片") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsAdRecordService, "ad_record_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除广告图片") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsAdRecordService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsArticleCategoryController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsArticleCategoryController.java new file mode 100644 index 0000000..1e540a0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsArticleCategoryController.java @@ -0,0 +1,111 @@ +package com.gxwebsoft.cms.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsArticleCategoryService; +import com.gxwebsoft.cms.entity.CmsArticleCategory; +import com.gxwebsoft.cms.param.CmsArticleCategoryParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 文章分类表控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Tag(name = "文章分类表管理") +@RestController +@RequestMapping("/api/cms/cms-article-category") +public class CmsArticleCategoryController extends BaseController { + @Resource + private CmsArticleCategoryService cmsArticleCategoryService; + + @Operation(summary = "分页查询文章分类表") + @GetMapping("/page") + public ApiResult> page(CmsArticleCategoryParam param) { + // 使用关联查询 + return success(cmsArticleCategoryService.pageRel(param)); + } + + @Operation(summary = "查询全部文章分类表") + @GetMapping() + public ApiResult> list(CmsArticleCategoryParam param) { + // 使用关联查询 + return success(cmsArticleCategoryService.listRel(param)); + } + + @Operation(summary = "根据id查询文章分类表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(cmsArticleCategoryService.getByIdRel(id)); + } + + @Operation(summary = "添加文章分类表") + @PostMapping() + public ApiResult save(@RequestBody CmsArticleCategory cmsArticleCategory) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + cmsArticleCategory.setUserId(loginUser.getUserId()); + } + if (cmsArticleCategoryService.save(cmsArticleCategory)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改文章分类表") + @PutMapping() + public ApiResult update(@RequestBody CmsArticleCategory cmsArticleCategory) { + if (cmsArticleCategoryService.updateById(cmsArticleCategory)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除文章分类表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsArticleCategoryService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加文章分类表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsArticleCategoryService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改文章分类表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsArticleCategoryService, "category_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除文章分类表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsArticleCategoryService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsArticleCommentController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsArticleCommentController.java new file mode 100644 index 0000000..51ed99e --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsArticleCommentController.java @@ -0,0 +1,120 @@ +package com.gxwebsoft.cms.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsArticleCommentService; +import com.gxwebsoft.cms.entity.CmsArticleComment; +import com.gxwebsoft.cms.param.CmsArticleCommentParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 文章评论表控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Tag(name = "文章评论表管理") +@RestController +@RequestMapping("/api/cms/cms-article-comment") +public class CmsArticleCommentController extends BaseController { + @Resource + private CmsArticleCommentService cmsArticleCommentService; + + @Operation(summary = "分页查询文章评论表") + @GetMapping("/page") + public ApiResult> page(CmsArticleCommentParam param) { + // 使用关联查询 + return success(cmsArticleCommentService.pageRel(param)); + } + + @Operation(summary = "查询全部文章评论表") + @GetMapping() + public ApiResult> list(CmsArticleCommentParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(cmsArticleCommentService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(cmsArticleCommentService.listRel(param)); + } + + @PreAuthorize("hasAuthority('cms:cmsArticleComment:list')") + @OperationLog + @Operation(summary = "根据id查询文章评论表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(cmsArticleCommentService.getById(id)); + // 使用关联查询 + //return success(cmsArticleCommentService.getByIdRel(id)); + } + + @Operation(summary = "添加文章评论表") + @PostMapping() + public ApiResult save(@RequestBody CmsArticleComment cmsArticleComment) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + cmsArticleComment.setUserId(loginUser.getUserId()); + } + if (cmsArticleCommentService.save(cmsArticleComment)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改文章评论表") + @PutMapping() + public ApiResult update(@RequestBody CmsArticleComment cmsArticleComment) { + if (cmsArticleCommentService.updateById(cmsArticleComment)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除文章评论表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsArticleCommentService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加文章评论表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsArticleCommentService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改文章评论表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsArticleCommentService, "comment_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除文章评论表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsArticleCommentService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsArticleContentController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsArticleContentController.java new file mode 100644 index 0000000..4f3e3d6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsArticleContentController.java @@ -0,0 +1,113 @@ +package com.gxwebsoft.cms.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsArticleContentService; +import com.gxwebsoft.cms.entity.CmsArticleContent; +import com.gxwebsoft.cms.param.CmsArticleContentParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 文章记录表控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Tag(name = "文章记录表管理") +@RestController +@RequestMapping("/api/cms/cms-article-content") +public class CmsArticleContentController extends BaseController { + @Resource + private CmsArticleContentService cmsArticleContentService; + + @Operation(summary = "分页查询文章记录表") + @GetMapping("/page") + public ApiResult> page(CmsArticleContentParam param) { + // 使用关联查询 + return success(cmsArticleContentService.pageRel(param)); + } + + @Operation(summary = "查询全部文章记录表") + @GetMapping() + public ApiResult> list(CmsArticleContentParam param) { +// PageParam page = new PageParam<>(param); +// page.setDefaultOrder("create_time desc"); +// return success(cmsArticleContentService.list(page.getOrderWrapper())); + // 使用关联查询 + return success(cmsArticleContentService.listRel(param)); + } + + @PreAuthorize("hasAuthority('cms:cmsArticleContent:list')") + @OperationLog + @Operation(summary = "根据id查询文章记录表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { +// return success(cmsArticleContentService.getById(id)); + // 使用关联查询 + return success(cmsArticleContentService.getByIdRel(id)); + } + + @Operation(summary = "添加文章记录表") + @PostMapping() + public ApiResult save(@RequestBody CmsArticleContent cmsArticleContent) { + if (cmsArticleContentService.save(cmsArticleContent)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改文章记录表") + @PutMapping() + public ApiResult update(@RequestBody CmsArticleContent cmsArticleContent) { + if (cmsArticleContentService.updateById(cmsArticleContent)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除文章记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsArticleContentService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加文章记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsArticleContentService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改文章记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsArticleContentService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除文章记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsArticleContentService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsArticleController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsArticleController.java new file mode 100644 index 0000000..31be045 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsArticleController.java @@ -0,0 +1,379 @@ +package com.gxwebsoft.cms.controller; + +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.gxwebsoft.cms.entity.*; +import com.gxwebsoft.cms.param.CmsArticleImportParam; +import com.gxwebsoft.cms.service.*; +import com.gxwebsoft.common.core.utils.JSONUtil; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.param.CmsArticleParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.service.UserService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.context.annotation.Lazy; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.*; + +import static com.gxwebsoft.common.core.constants.ArticleConstants.CACHE_KEY_ARTICLE; + +/** + * 文章控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Slf4j +@Validated +@Tag(name = "文章管理") +@RestController +@RequestMapping("/api/cms/cms-article") +public class CmsArticleController extends BaseController { + @Resource + private CmsArticleService cmsArticleService; + @Resource + private CmsArticleContentService articleContentService; + @Resource + @Lazy + private CmsNavigationService cmsNavigationService; + @Resource + private CmsModelService cmsModelService; + @Resource + private UserService userService; + @Resource + private RedisUtil redisUtil; + + private static final long CACHE_MINUTES = 30L; + + @Operation(summary = "分页查询文章") + @GetMapping("/page") + public ApiResult> page(CmsArticleParam param) { + // 使用关联查询 + return success(cmsArticleService.pageRel(param)); + } + + @Operation(summary = "查询全部文章") + @GetMapping() + public ApiResult> list(CmsArticleParam param) { + // 使用关联查询 + return success(cmsArticleService.listRel(param)); + } + + @Operation(summary = "根据id查询文章") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") @NotNull Integer id) { + final CmsArticle article = cmsArticleService.getByIdRel(id); + if (ObjectUtil.isNotEmpty(article)) { + final CmsArticleContent item = articleContentService.getByIdRel(article.getArticleId()); + if (ObjectUtil.isNotEmpty(item)) { + article.setContent(item.getContent()); + } + return success(article); + } + return fail("文章ID不存在",null); + } + + @Operation(summary = "根据code查询文章") + @GetMapping("/getByCode/{code}") + public ApiResult getByCode(@PathVariable("code") String code) { + final CmsArticle article = cmsArticleService.getByIdCode(code); + if (ObjectUtil.isNotEmpty(article)) { + final CmsArticleContent item = articleContentService.getByIdRel(article.getArticleId()); + if (ObjectUtil.isNotEmpty(item)) { + article.setContent(item.getContent()); + } + } + return success(article); + } + + @PreAuthorize("hasAuthority('cms:cmsArticle:save')") + @Operation(summary = "添加文章") + @PostMapping() + public ApiResult save(@RequestBody @Valid CmsArticle article) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + article.setUserId(loginUser.getUserId()); + article.setAuthor(loginUser.getNickname()); + article.setMerchantId(loginUser.getMerchantId()); + if (cmsArticleService.saveRel(article)) { + return success("添加成功"); + } + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsArticle:update')") + @Operation(summary = "修改文章") + @PutMapping() + public ApiResult update(@RequestBody CmsArticle article) { + if (cmsArticleService.updateByIdRel(article)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsArticle:remove')") + @Operation(summary = "删除文章") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsArticleService.removeById(id)) { + redisUtil.delete(CACHE_KEY_ARTICLE + id); + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsArticle:save')") + @Operation(summary = "批量添加文章") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsArticleService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsArticle:update')") + @Operation(summary = "批量修改文章") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsArticleService, "article_id")) { + // 删除缓存 + final List ids = batchParam.getIds(); + ids.forEach(id -> { + redisUtil.delete(CACHE_KEY_ARTICLE + id); + }); + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsArticle:remove')") + @Operation(summary = "批量删除文章") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsArticleService.removeByIds(ids)) { + // 删除缓存 + ids.forEach(id -> { + redisUtil.delete(CACHE_KEY_ARTICLE + id); + }); + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "读取上一篇") + @GetMapping("/getPrevious/{id}") + public ApiResult getPrevious(@PathVariable("id") Integer id) { + final CmsArticle item = cmsArticleService.getById(id); + if (ObjectUtil.isEmpty(item)) { + return success("没有找到上一篇文章",null); + } + CmsArticle article; + // TODO 按排序号规则 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.lt(CmsArticle::getSortNumber, item.getSortNumber()); + wrapper.eq(CmsArticle::getStatus, 0); + wrapper.eq(CmsArticle::getType, 0); + wrapper.eq(CmsArticle::getCategoryId, item.getCategoryId()); + wrapper.orderByDesc(CmsArticle::getSortNumber); + wrapper.last("limit 1"); + article = cmsArticleService.getOne(wrapper); + if (ObjectUtil.isNotEmpty(article)) { + return success(article); + } + // TODO 按ID排序 + LambdaQueryWrapper wrapper2 = new LambdaQueryWrapper<>(); + wrapper2.lt(CmsArticle::getArticleId, item.getArticleId()); + wrapper2.eq(CmsArticle::getStatus, 0); + wrapper2.eq(CmsArticle::getCategoryId, item.getCategoryId()); + wrapper2.last("limit 1"); + wrapper2.orderByDesc(CmsArticle::getArticleId); + article = cmsArticleService.getOne(wrapper2); + return success(article); + } + + @Operation(summary = "读取下一篇") + @GetMapping("/getNext/{id}") + public ApiResult getNext(@PathVariable("id") Integer id) { + CmsArticle item = cmsArticleService.getById(id); + if (ObjectUtil.isEmpty(item)) { + return success("没有找到下一篇文章",null); + } + CmsArticle article; + // TODO 按排序号规则 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.gt(CmsArticle::getSortNumber, item.getSortNumber()); + wrapper.eq(CmsArticle::getStatus, 0); + wrapper.eq(CmsArticle::getType, 0); + wrapper.eq(CmsArticle::getCategoryId, item.getCategoryId()); + wrapper.orderByAsc(CmsArticle::getSortNumber); + wrapper.last("limit 1"); + article = cmsArticleService.getOne(wrapper); + if (ObjectUtil.isNotEmpty(article)) { + return success(article); + } + // TODO 按ID排序 + LambdaQueryWrapper wrapper2 = new LambdaQueryWrapper<>(); + wrapper2.gt(CmsArticle::getArticleId, item.getArticleId()); + wrapper2.eq(CmsArticle::getStatus, 0); + wrapper2.eq(CmsArticle::getCategoryId, item.getCategoryId()); + wrapper2.last("limit 1"); + wrapper2.orderByAsc(CmsArticle::getArticleId); + article = cmsArticleService.getOne(wrapper2); + return success(article); + } + + @Operation(summary = "统计信息") + @GetMapping("/data") + public ApiResult> data(CmsArticleParam param) { + Map data = new HashMap<>(); + final LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (param.getMerchantId() != null) { + wrapper.eq(CmsArticle::getMerchantId, param.getMerchantId()); + } + + long totalNum = cmsArticleService.count( + wrapper.eq(CmsArticle::getDeleted, 0).eq(CmsArticle::getStatus, 0) + ); + data.put("totalNum", Math.toIntExact(totalNum)); + + long totalNum2 = cmsArticleService.count( + wrapper.eq(CmsArticle::getStatus, 1) + ); + data.put("totalNum2", Math.toIntExact(totalNum2)); + + long totalNum3 = cmsArticleService.count( + wrapper.gt(CmsArticle::getStatus, 1) + ); + data.put("totalNum3", Math.toIntExact(totalNum3)); + + return success(data); + } + + @Operation(summary = "密码校验") + @GetMapping("/checkArticlePassword") + public ApiResult checkArticlePassword(CmsArticle param) { + if (!userService.comparePassword(param.getPassword(), param.getPassword2())) { + return fail("密码不正确"); + } + return success("密码正确"); + } + + /** + * excel批量导入文章 + */ + @PreAuthorize("hasAuthority('cms:cmsArticle:save')") + @Operation(summary = "批量导入文章") + @Transactional(rollbackFor = {Exception.class}) + @PostMapping("/import") + public ApiResult> importBatch(MultipartFile file) { + ImportParams importParams = new ImportParams(); + try { + List list = ExcelImportUtil.importExcel(file.getInputStream(), CmsArticleImportParam.class, importParams); + list.forEach(d -> { + CmsArticle item = JSONUtil.parseObject(JSONUtil.toJSONString(d), CmsArticle.class); + assert item != null; + if (ObjectUtil.isNotEmpty(item)) { + if (item.getStatus() == null) { + item.setStatus(1); + } + if (cmsArticleService.save(item)) { + CmsArticleContent content = new CmsArticleContent(); + content.setArticleId(item.getArticleId()); + content.setContent(item.getContent()); + articleContentService.save(content); + } + } + }); + return success("成功导入" + list.size() + "条", null); + } catch (Exception e) { + e.printStackTrace(); + } + return fail("导入失败", null); + } + + @Operation(summary = "按标签分页查询") + @GetMapping("/findTags") + public ApiResult> findTags(CmsArticleParam param) { + final String tags = param.getTags(); + if (StringUtils.isNotBlank(tags)) { + final String[] split = tags.split(","); + final List list = Arrays.asList(split); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); + if (StrUtil.isNotBlank(tags)) { + for (String s : list) { + queryWrapper.or().like(CmsArticle::getTags, s); +// queryWrapper.or().apply("LOCATE(" + "'" + s + "'," + "tags" + ") > 0"); + } + } + if (param.getCategoryId() != null) { + queryWrapper.eq(CmsArticle::getCategoryId, param.getCategoryId()); + } + if (param.getDetail() != null) { + queryWrapper.eq(CmsArticle::getDetail, param.getDetail()); + } + queryWrapper.last("limit 8"); + List articles = cmsArticleService.list(queryWrapper); + return success(articles); + } + return success("", null); + } + + @Operation(summary = "按标签分页查询") + @GetMapping("/pageTags") + public ApiResult> pageTags(CmsArticleParam param) { + final String tags = param.getTags(); + if (StringUtils.isNotBlank(tags)) { + final String[] split = tags.split(","); + final List list = Arrays.asList(split); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + for (String s : list) { + queryWrapper.or().like(CmsArticle::getTags, s); + } + queryWrapper.orderByDesc(CmsArticle::getCreateTime); + queryWrapper.last("limit 100"); + List articles = cmsArticleService.list(queryWrapper); + if (!articles.isEmpty()) { + List navigationList = cmsNavigationService.listByIds(articles.stream().map(CmsArticle::getCategoryId).toList()); + for (CmsArticle article : articles) { + for (CmsNavigation navigation : navigationList) { + if (article.getCategoryId().equals(navigation.getNavigationId())) { + article.setCategoryName(navigation.getTitle()); + } + } + } + } + return success(articles); + } + return success("", null); + } + + @Operation(summary = "按IDS查询") + @GetMapping("/getByIds") + public ApiResult> getByIds(CmsArticleParam param) { + // 使用关联查询 + return success(cmsArticleService.list(new LambdaQueryWrapper().in(CmsArticle::getArticleId, param.getArticleIds()))); + } +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsArticleCountController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsArticleCountController.java new file mode 100644 index 0000000..f80a684 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsArticleCountController.java @@ -0,0 +1,120 @@ +package com.gxwebsoft.cms.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsArticleCountService; +import com.gxwebsoft.cms.entity.CmsArticleCount; +import com.gxwebsoft.cms.param.CmsArticleCountParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 点赞文章控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Tag(name = "点赞文章管理") +@RestController +@RequestMapping("/api/cms/cms-article-count") +public class CmsArticleCountController extends BaseController { + @Resource + private CmsArticleCountService cmsArticleCountService; + + @Operation(summary = "分页查询点赞文章") + @GetMapping("/page") + public ApiResult> page(CmsArticleCountParam param) { + // 使用关联查询 + return success(cmsArticleCountService.pageRel(param)); + } + + @Operation(summary = "查询全部点赞文章") + @GetMapping() + public ApiResult> list(CmsArticleCountParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(cmsArticleCountService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(cmsArticleCountService.listRel(param)); + } + + @PreAuthorize("hasAuthority('cms:cmsArticleCount:list')") + @OperationLog + @Operation(summary = "根据id查询点赞文章") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(cmsArticleCountService.getById(id)); + // 使用关联查询 + //return success(cmsArticleCountService.getByIdRel(id)); + } + + @Operation(summary = "添加点赞文章") + @PostMapping() + public ApiResult save(@RequestBody CmsArticleCount cmsArticleCount) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + cmsArticleCount.setUserId(loginUser.getUserId()); + } + if (cmsArticleCountService.save(cmsArticleCount)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改点赞文章") + @PutMapping() + public ApiResult update(@RequestBody CmsArticleCount cmsArticleCount) { + if (cmsArticleCountService.updateById(cmsArticleCount)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除点赞文章") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsArticleCountService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加点赞文章") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsArticleCountService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改点赞文章") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsArticleCountService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除点赞文章") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsArticleCountService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsArticleLikeController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsArticleLikeController.java new file mode 100644 index 0000000..2b9d2ef --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsArticleLikeController.java @@ -0,0 +1,120 @@ +package com.gxwebsoft.cms.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsArticleLikeService; +import com.gxwebsoft.cms.entity.CmsArticleLike; +import com.gxwebsoft.cms.param.CmsArticleLikeParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 点赞文章控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Tag(name = "点赞文章管理") +@RestController +@RequestMapping("/api/cms/cms-article-like") +public class CmsArticleLikeController extends BaseController { + @Resource + private CmsArticleLikeService cmsArticleLikeService; + + @Operation(summary = "分页查询点赞文章") + @GetMapping("/page") + public ApiResult> page(CmsArticleLikeParam param) { + // 使用关联查询 + return success(cmsArticleLikeService.pageRel(param)); + } + + @Operation(summary = "查询全部点赞文章") + @GetMapping() + public ApiResult> list(CmsArticleLikeParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(cmsArticleLikeService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(cmsArticleLikeService.listRel(param)); + } + + @PreAuthorize("hasAuthority('cms:cmsArticleLike:list')") + @OperationLog + @Operation(summary = "根据id查询点赞文章") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(cmsArticleLikeService.getById(id)); + // 使用关联查询 + //return success(cmsArticleLikeService.getByIdRel(id)); + } + + @Operation(summary = "添加点赞文章") + @PostMapping() + public ApiResult save(@RequestBody CmsArticleLike cmsArticleLike) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + cmsArticleLike.setUserId(loginUser.getUserId()); + } + if (cmsArticleLikeService.save(cmsArticleLike)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改点赞文章") + @PutMapping() + public ApiResult update(@RequestBody CmsArticleLike cmsArticleLike) { + if (cmsArticleLikeService.updateById(cmsArticleLike)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除点赞文章") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsArticleLikeService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加点赞文章") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsArticleLikeService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改点赞文章") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsArticleLikeService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除点赞文章") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsArticleLikeService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsDesignController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsDesignController.java new file mode 100644 index 0000000..e69d81b --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsDesignController.java @@ -0,0 +1,127 @@ +package com.gxwebsoft.cms.controller; + +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.gxwebsoft.cms.entity.CmsNavigation; +import com.gxwebsoft.cms.service.CmsNavigationService; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsDesignService; +import com.gxwebsoft.cms.entity.CmsDesign; +import com.gxwebsoft.cms.param.CmsDesignParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 页面管理记录表控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Tag(name = "页面管理记录表管理") +@RestController +@RequestMapping("/api/cms/cms-design") +public class CmsDesignController extends BaseController { + @Resource + private CmsDesignService cmsDesignService; + @Resource + private CmsNavigationService cmsNavigationService; + + @Operation(summary = "分页查询页面管理记录表") + @GetMapping("/page") + public ApiResult> page(CmsDesignParam param) { + // 使用关联查询 + return success(cmsDesignService.pageRel(param)); + } + + @Operation(summary = "查询全部页面管理记录表") + @GetMapping() + public ApiResult> list(CmsDesignParam param) { + // 使用关联查询 + return success(cmsDesignService.listRel(param)); + } + + @Operation(summary = "根据id查询页面管理记录表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(cmsDesignService.getByIdRel(id)); + } + + @Operation(summary = "添加页面管理记录表") + @PostMapping() + public ApiResult save(@RequestBody CmsDesign cmsDesign) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + cmsDesign.setUserId(loginUser.getUserId()); + } + if (cmsDesignService.save(cmsDesign)) { + try { + cmsNavigationService.update(new LambdaUpdateWrapper().set(CmsNavigation::getBanner, cmsDesign.getPhoto()).eq(CmsNavigation::getNavigationId,cmsDesign.getCategoryId())); + // 同步翻译英文版 + cmsDesignService.translate(cmsDesign); + return success("添加成功"); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + return fail("添加失败"); + } + + @Operation(summary = "修改页面管理记录表") + @PutMapping() + public ApiResult update(@RequestBody CmsDesign cmsDesign) { + if (cmsDesignService.updateById(cmsDesign)) { + // 同步翻译英文版 + cmsDesignService.translate(cmsDesign); + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除页面管理记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsDesignService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加页面管理记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsDesignService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改页面管理记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsDesignService, "page_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除页面管理记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsDesignService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsDesignRecordController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsDesignRecordController.java new file mode 100644 index 0000000..d921d01 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsDesignRecordController.java @@ -0,0 +1,120 @@ +package com.gxwebsoft.cms.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsDesignRecordService; +import com.gxwebsoft.cms.entity.CmsDesignRecord; +import com.gxwebsoft.cms.param.CmsDesignRecordParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 页面组件表控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Tag(name = "页面组件表管理") +@RestController +@RequestMapping("/api/cms/cms-design-record") +public class CmsDesignRecordController extends BaseController { + @Resource + private CmsDesignRecordService cmsDesignRecordService; + + @Operation(summary = "分页查询页面组件表") + @GetMapping("/page") + public ApiResult> page(CmsDesignRecordParam param) { + // 使用关联查询 + return success(cmsDesignRecordService.pageRel(param)); + } + + @Operation(summary = "查询全部页面组件表") + @GetMapping() + public ApiResult> list(CmsDesignRecordParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(cmsDesignRecordService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(cmsDesignRecordService.listRel(param)); + } + + @PreAuthorize("hasAuthority('cms:cmsDesignRecord:list')") + @OperationLog + @Operation(summary = "根据id查询页面组件表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(cmsDesignRecordService.getById(id)); + // 使用关联查询 + //return success(cmsDesignRecordService.getByIdRel(id)); + } + + @Operation(summary = "添加页面组件表") + @PostMapping() + public ApiResult save(@RequestBody CmsDesignRecord cmsDesignRecord) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + cmsDesignRecord.setUserId(loginUser.getUserId()); + } + if (cmsDesignRecordService.save(cmsDesignRecord)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改页面组件表") + @PutMapping() + public ApiResult update(@RequestBody CmsDesignRecord cmsDesignRecord) { + if (cmsDesignRecordService.updateById(cmsDesignRecord)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除页面组件表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsDesignRecordService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加页面组件表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsDesignRecordService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改页面组件表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsDesignRecordService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除页面组件表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsDesignRecordService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsDomainController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsDomainController.java new file mode 100644 index 0000000..5487036 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsDomainController.java @@ -0,0 +1,166 @@ +package com.gxwebsoft.cms.controller; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.cms.mapper.CmsDomainMapper; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsDomainService; +import com.gxwebsoft.cms.entity.CmsDomain; +import com.gxwebsoft.cms.param.CmsDomainParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 网站域名记录表控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +@Tag(name = "网站域名记录表管理") +@RestController +@RequestMapping("/api/cms/cms-domain") +public class CmsDomainController extends BaseController { + @Resource + private CmsDomainService cmsDomainService; + @Resource + private CmsDomainMapper cmsDomainMapper; + @Resource + private RedisUtil redisUtil; + + @Operation(summary = "分页查询网站域名记录表") + @GetMapping("/page") + public ApiResult> page(CmsDomainParam param) { + // 使用关联查询 + return success(cmsDomainService.pageRel(param)); + } + + @Operation(summary = "查询全部网站域名记录表") + @GetMapping() + public ApiResult> list(CmsDomainParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(cmsDomainService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(cmsDomainService.listRel(param)); + } + + @PreAuthorize("hasAuthority('cms:cmsDomain:list')") + @OperationLog + @Operation(summary = "根据id查询网站域名记录表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(cmsDomainService.getById(id)); + // 使用关联查询 + //return success(cmsDomainService.getByIdRel(id)); + } + + @Operation(summary = "添加网站域名记录表") + @PostMapping() + public ApiResult save(@RequestBody CmsDomain cmsDomain) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + cmsDomain.setUserId(loginUser.getUserId()); + } + if (cmsDomainService.save(cmsDomain)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改网站域名记录表") + @PutMapping() + public ApiResult update(@RequestBody CmsDomain cmsDomain) { + if (cmsDomainService.updateById(cmsDomain)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除网站域名记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsDomainService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加网站域名记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsDomainService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改网站域名记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsDomainService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除网站域名记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsDomainService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "查询授权域名信息") + @GetMapping("/getTenantIdByDomain") + public ApiResult getTenantIdByDomain(CmsDomainParam param) { + final CmsDomain domain = cmsDomainService.getOne(new LambdaQueryWrapper().eq(CmsDomain::getDomain, param.getDomain()).last("limit 1")); + return success(domain); + } + + @Operation(summary = "授权二级域名") + @PostMapping("/domain") + public ApiResult domain(@RequestBody CmsDomain cmsDomain) { + final User loginUser = getLoginUser(); + String key = "Domain:" + cmsDomain.getDomain(); + final Integer tenantId = loginUser.getTenantId(); + final CmsDomain domain = cmsDomainService.getOne(new LambdaQueryWrapper() + .eq(CmsDomain::getWebsiteId, cmsDomain.getWebsiteId()).last("limit 1")); + if (ObjectUtil.isNotEmpty(domain)) { + // 重写缓存 + redisUtil.set(key,tenantId); + domain.setDomain(cmsDomain.getDomain()); + cmsDomainService.updateById(domain); + return success("授权成功"); + } + if(ObjectUtil.isEmpty(domain)){ + cmsDomain.setUserId(loginUser.getUserId()); + cmsDomain.setSortNumber(100); + cmsDomain.setStatus(1); + cmsDomain.setHostName("@"); + cmsDomain.setWebsiteId(cmsDomain.getWebsiteId()); + cmsDomain.setTenantId(tenantId); + if(cmsDomainService.save(cmsDomain)){ + // 重写缓存 + redisUtil.set(key,tenantId); + return success("授权成功"); + } + } + return fail("授权失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsFormController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsFormController.java new file mode 100644 index 0000000..ce9ab34 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsFormController.java @@ -0,0 +1,120 @@ +package com.gxwebsoft.cms.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsFormService; +import com.gxwebsoft.cms.entity.CmsForm; +import com.gxwebsoft.cms.param.CmsFormParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 表单设计表控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Tag(name = "表单设计表管理") +@RestController +@RequestMapping("/api/cms/cms-form") +public class CmsFormController extends BaseController { + @Resource + private CmsFormService cmsFormService; + + @Operation(summary = "分页查询表单设计表") + @GetMapping("/page") + public ApiResult> page(CmsFormParam param) { + // 使用关联查询 + return success(cmsFormService.pageRel(param)); + } + + @Operation(summary = "查询全部表单设计表") + @GetMapping() + public ApiResult> list(CmsFormParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(cmsFormService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(cmsFormService.listRel(param)); + } + + @PreAuthorize("hasAuthority('cms:cmsForm:list')") + @OperationLog + @Operation(summary = "根据id查询表单设计表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(cmsFormService.getById(id)); + // 使用关联查询 + //return success(cmsFormService.getByIdRel(id)); + } + + @Operation(summary = "添加表单设计表") + @PostMapping() + public ApiResult save(@RequestBody CmsForm cmsForm) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + cmsForm.setUserId(loginUser.getUserId()); + } + if (cmsFormService.save(cmsForm)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改表单设计表") + @PutMapping() + public ApiResult update(@RequestBody CmsForm cmsForm) { + if (cmsFormService.updateById(cmsForm)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除表单设计表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsFormService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加表单设计表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsFormService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改表单设计表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsFormService, "form_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除表单设计表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsFormService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsFormRecordController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsFormRecordController.java new file mode 100644 index 0000000..0aedacc --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsFormRecordController.java @@ -0,0 +1,120 @@ +package com.gxwebsoft.cms.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsFormRecordService; +import com.gxwebsoft.cms.entity.CmsFormRecord; +import com.gxwebsoft.cms.param.CmsFormRecordParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 表单数据记录表控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Tag(name = "表单数据记录表管理") +@RestController +@RequestMapping("/api/cms/cms-form-record") +public class CmsFormRecordController extends BaseController { + @Resource + private CmsFormRecordService cmsFormRecordService; + + @Operation(summary = "分页查询表单数据记录表") + @GetMapping("/page") + public ApiResult> page(CmsFormRecordParam param) { + // 使用关联查询 + return success(cmsFormRecordService.pageRel(param)); + } + + @Operation(summary = "查询全部表单数据记录表") + @GetMapping() + public ApiResult> list(CmsFormRecordParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(cmsFormRecordService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(cmsFormRecordService.listRel(param)); + } + + @PreAuthorize("hasAuthority('cms:cmsFormRecord:list')") + @OperationLog + @Operation(summary = "根据id查询表单数据记录表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(cmsFormRecordService.getById(id)); + // 使用关联查询 + //return success(cmsFormRecordService.getByIdRel(id)); + } + + @Operation(summary = "添加表单数据记录表") + @PostMapping() + public ApiResult save(@RequestBody CmsFormRecord cmsFormRecord) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + cmsFormRecord.setUserId(loginUser.getUserId()); + } + if (cmsFormRecordService.save(cmsFormRecord)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改表单数据记录表") + @PutMapping() + public ApiResult update(@RequestBody CmsFormRecord cmsFormRecord) { + if (cmsFormRecordService.updateById(cmsFormRecord)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除表单数据记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsFormRecordService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加表单数据记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsFormRecordService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改表单数据记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsFormRecordService, "form_record_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除表单数据记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsFormRecordService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsLangController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsLangController.java new file mode 100644 index 0000000..475e9cd --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsLangController.java @@ -0,0 +1,113 @@ +package com.gxwebsoft.cms.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsLangService; +import com.gxwebsoft.cms.entity.CmsLang; +import com.gxwebsoft.cms.param.CmsLangParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 国际化控制器 + * + * @author 科技小王子 + * @since 2025-01-06 19:29:26 + */ +@Tag(name = "国际化管理") +@RestController +@RequestMapping("/api/cms/cms-lang") +public class CmsLangController extends BaseController { + @Resource + private CmsLangService cmsLangService; + + @Operation(summary = "分页查询国际化") + @GetMapping("/page") + public ApiResult> page(CmsLangParam param) { + // 使用关联查询 + return success(cmsLangService.pageRel(param)); + } + + @Operation(summary = "查询全部国际化") + @GetMapping() + public ApiResult> list(CmsLangParam param) { + // 使用关联查询 + return success(cmsLangService.listRel(param)); + } + + @PreAuthorize("hasAuthority('cms:cmsLang:list')") + @Operation(summary = "根据id查询国际化") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(cmsLangService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('cms:cmsLang:save')") + @Operation(summary = "添加国际化") + @PostMapping() + public ApiResult save(@RequestBody CmsLang cmsLang) { + if (cmsLangService.save(cmsLang)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsLang:update')") + @Operation(summary = "修改国际化") + @PutMapping() + public ApiResult update(@RequestBody CmsLang cmsLang) { + if (cmsLangService.updateById(cmsLang)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsLang:remove')") + @Operation(summary = "删除国际化") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsLangService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsLang:save')") + @Operation(summary = "批量添加国际化") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsLangService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsLang:update')") + @Operation(summary = "批量修改国际化") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsLangService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsLang:reomve')") + @Operation(summary = "批量删除国际化") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsLangService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsLangLogController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsLangLogController.java new file mode 100644 index 0000000..a881156 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsLangLogController.java @@ -0,0 +1,113 @@ +package com.gxwebsoft.cms.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsLangLogService; +import com.gxwebsoft.cms.entity.CmsLangLog; +import com.gxwebsoft.cms.param.CmsLangLogParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 国际化记录启用控制器 + * + * @author 科技小王子 + * @since 2025-01-06 19:29:26 + */ +@Tag(name = "国际化记录启用管理") +@RestController +@RequestMapping("/api/cms/cms-lang-log") +public class CmsLangLogController extends BaseController { + @Resource + private CmsLangLogService cmsLangLogService; + + @Operation(summary = "分页查询国际化记录启用") + @GetMapping("/page") + public ApiResult> page(CmsLangLogParam param) { + // 使用关联查询 + return success(cmsLangLogService.pageRel(param)); + } + + @Operation(summary = "查询全部国际化记录启用") + @GetMapping() + public ApiResult> list(CmsLangLogParam param) { + // 使用关联查询 + return success(cmsLangLogService.listRel(param)); + } + + @PreAuthorize("hasAuthority('cms:cmsLangLog:list')") + @Operation(summary = "根据id查询国际化记录启用") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(cmsLangLogService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('cms:cmsLangLog:save')") + @Operation(summary = "添加国际化记录启用") + @PostMapping() + public ApiResult save(@RequestBody CmsLangLog cmsLangLog) { + if (cmsLangLogService.save(cmsLangLog)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsLangLog:update')") + @Operation(summary = "修改国际化记录启用") + @PutMapping() + public ApiResult update(@RequestBody CmsLangLog cmsLangLog) { + if (cmsLangLogService.updateById(cmsLangLog)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsLangLog:remove')") + @Operation(summary = "删除国际化记录启用") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsLangLogService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsLangLog:save')") + @Operation(summary = "批量添加国际化记录启用") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsLangLogService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsLangLog:update')") + @Operation(summary = "批量修改国际化记录启用") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsLangLogService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsLangLog:remove')") + @Operation(summary = "批量删除国际化记录启用") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsLangLogService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsLinkController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsLinkController.java new file mode 100644 index 0000000..03f798c --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsLinkController.java @@ -0,0 +1,115 @@ +package com.gxwebsoft.cms.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsLinkService; +import com.gxwebsoft.cms.entity.CmsLink; +import com.gxwebsoft.cms.param.CmsLinkParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 常用链接控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Tag(name = "常用链接管理") +@RestController +@RequestMapping("/api/cms/cms-link") +public class CmsLinkController extends BaseController { + @Resource + private CmsLinkService cmsLinkService; + + @Operation(summary = "分页查询常用链接") + @GetMapping("/page") + public ApiResult> page(CmsLinkParam param) { + // 使用关联查询 + return success(cmsLinkService.pageRel(param)); + } + + @Operation(summary = "查询全部常用链接") + @GetMapping() + public ApiResult> list(CmsLinkParam param) { + // 使用关联查询 + return success(cmsLinkService.listRel(param)); + } + + @PreAuthorize("hasAuthority('cms:cmsLink:list')") + @OperationLog + @Operation(summary = "根据id查询常用链接") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(cmsLinkService.getByIdRel(id)); + } + + @Operation(summary = "添加常用链接") + @PostMapping() + public ApiResult save(@RequestBody CmsLink cmsLink) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + cmsLink.setUserId(loginUser.getUserId()); + } + if (cmsLinkService.save(cmsLink)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改常用链接") + @PutMapping() + public ApiResult update(@RequestBody CmsLink cmsLink) { + if (cmsLinkService.updateById(cmsLink)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除常用链接") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsLinkService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加常用链接") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsLinkService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改常用链接") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsLinkService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除常用链接") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsLinkService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsMainController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsMainController.java new file mode 100644 index 0000000..4242c80 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsMainController.java @@ -0,0 +1,25 @@ +package com.gxwebsoft.cms.controller; + +import com.gxwebsoft.cms.service.CmsWebsiteService; +import com.gxwebsoft.common.core.web.BaseController; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +/** + * 网站应用主入口 + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +@Slf4j +@Tag(name = "网站应用") +@RestController +@RequestMapping("/api/cms") +public class CmsMainController extends BaseController { + @Resource + private CmsWebsiteService cmsWebsiteService; + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsModelController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsModelController.java new file mode 100644 index 0000000..c139eaa --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsModelController.java @@ -0,0 +1,118 @@ +package com.gxwebsoft.cms.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsModelService; +import com.gxwebsoft.cms.entity.CmsModel; +import com.gxwebsoft.cms.param.CmsModelParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 模型控制器 + * + * @author 科技小王子 + * @since 2024-11-26 15:44:53 + */ +@Tag(name = "模型管理") +@RestController +@RequestMapping("/api/cms/cms-model") +public class CmsModelController extends BaseController { + @Resource + private CmsModelService cmsModelService; + + @Operation(summary = "分页查询模型") + @GetMapping("/page") + public ApiResult> page(CmsModelParam param) { + // 使用关联查询 + return success(cmsModelService.pageRel(param)); + } + + @Operation(summary = "查询全部模型") + @GetMapping() + public ApiResult> list(CmsModelParam param) { + // 使用关联查询 + return success(cmsModelService.listRel(param)); + } + + @Operation(summary = "根据id查询模型") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(cmsModelService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('cms:cmsModel:save')") + @Operation(summary = "添加模型") + @PostMapping() + public ApiResult save(@RequestBody CmsModel cmsModel) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + cmsModel.setUserId(loginUser.getUserId()); + } + if (cmsModelService.save(cmsModel)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsModel:update')") + @Operation(summary = "修改模型") + @PutMapping() + public ApiResult update(@RequestBody CmsModel cmsModel) { + if (cmsModelService.updateById(cmsModel)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsModel:remove')") + @Operation(summary = "删除模型") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsModelService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsModel:save')") + @Operation(summary = "批量添加模型") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsModelService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsModel:update')") + @Operation(summary = "批量修改模型") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsModelService, "model_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsModel:remvoe')") + @Operation(summary = "批量删除模型") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsModelService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsNavigationController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsNavigationController.java new file mode 100644 index 0000000..a415b17 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsNavigationController.java @@ -0,0 +1,381 @@ +package com.gxwebsoft.cms.controller; + +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.gxwebsoft.cms.entity.CmsDesign; +import com.gxwebsoft.cms.entity.CmsModel; +import com.gxwebsoft.cms.param.CmsNavigationImportParam; +import com.gxwebsoft.cms.service.CmsDesignService; +import com.gxwebsoft.cms.service.CmsModelService; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsNavigationService; +import com.gxwebsoft.cms.entity.CmsNavigation; +import com.gxwebsoft.cms.param.CmsNavigationParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.service.UserService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 网站导航记录表控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Tag(name = "网站导航记录表管理") +@RestController +@RequestMapping("/api/cms/cms-navigation") +public class CmsNavigationController extends BaseController { + @Resource + private CmsNavigationService cmsNavigationService; + @Resource + private CmsModelService cmsModelService; + @Resource + private CmsDesignService cmsDesignService; + @Resource + private UserService userService; + @Resource + private RedisUtil redisUtil; + + + private static final String SITE_INFO_KEY_PREFIX = "SiteInfo:"; + + @Operation(summary = "分页查询网站导航记录表") + @GetMapping("/page") + public ApiResult> page(CmsNavigationParam param) { + // 使用关联查询 + return success(cmsNavigationService.pageRel(param)); + } + + @Operation(summary = "查询全部网站导航记录表") + @GetMapping() + public ApiResult> list(CmsNavigationParam param) { + // 使用关联查询 + return success(cmsNavigationService.listRel(param)); + } + + @Operation(summary = "根据id查询网站导航记录表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(cmsNavigationService.getByIdRel(id)); + } + + @Operation(summary = "根据code查询网站导航记录表") + @GetMapping("/getByCode/{code}") + public ApiResult getByCode(@PathVariable("code") String code) { + // 使用关联查询 + return success(cmsNavigationService.getByIdRelByCodeRel(code)); + } + + @PreAuthorize("hasAuthority('cms:cmsNavigation:save')") + @Operation(summary = "添加网站导航记录表") + @PostMapping() + public ApiResult save(@RequestBody CmsNavigation cmsNavigation) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + cmsNavigation.setUserId(loginUser.getUserId()); + cmsNavigation.setTenantId(loginUser.getTenantId()); + } + // 去除前面空格 + cmsNavigation.setTitle(StrUtil.trimStart(cmsNavigation.getTitle())); + if (cmsNavigationService.save(cmsNavigation)) { + // 添加成功事务处理 + cmsNavigationService.saveAsync(cmsNavigation); + redisUtil.delete(SITE_INFO_KEY_PREFIX.concat(getTenantId().toString())); + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsNavigation:update')") + @Operation(summary = "修改网站导航记录表") + @PutMapping() + public ApiResult update(@RequestBody CmsNavigation cmsNavigation) { + if (cmsNavigationService.updateById(cmsNavigation)) { + // 修改成功事务处理 + cmsNavigationService.saveAsync(cmsNavigation); + redisUtil.delete(SITE_INFO_KEY_PREFIX.concat(getTenantId().toString())); + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsNavigation:remove')") + @Operation(summary = "删除网站导航记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsNavigationService.removeById(id)) { + redisUtil.delete(SITE_INFO_KEY_PREFIX.concat(getTenantId().toString())); + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsNavigation:save')") + @Operation(summary = "批量添加网站导航记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsNavigationService.saveBatch(list)) { + redisUtil.delete(SITE_INFO_KEY_PREFIX.concat(getTenantId().toString())); + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsNavigation:update')") + @Operation(summary = "批量修改网站导航记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsNavigationService, "navigation_id")) { + redisUtil.delete(SITE_INFO_KEY_PREFIX.concat(getTenantId().toString())); + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsNavigation:remove')") + @Operation(summary = "批量删除网站导航记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsNavigationService.removeByIds(ids)) { + redisUtil.delete(SITE_INFO_KEY_PREFIX.concat(getTenantId().toString())); + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * excel批量导入网站导航 + */ + @PreAuthorize("hasAuthority('cms:cmsNavigation:save')") + @OperationLog + @Operation(summary = "批量导入网站导航") + @Transactional(rollbackFor = {Exception.class}) + @PostMapping("/import") + public ApiResult importBatch(@RequestParam("file") MultipartFile file) { + ImportParams importParams = new ImportParams(); + try { + User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("请先登录"); + } + Integer currentUserId = loginUser.getUserId(); + Integer currentTenantId = loginUser.getTenantId(); + + // 1) 清理当前租户的历史数据:先清理 deleted=1,再把 deleted=0 标记为 deleted=1 + List undeleted = cmsNavigationService.list(new LambdaQueryWrapper() + .eq(CmsNavigation::getTenantId, currentTenantId) + .eq(CmsNavigation::getDeleted, 0)); + cmsNavigationService.remove(new LambdaQueryWrapper() + .eq(CmsNavigation::getTenantId, currentTenantId) + .eq(CmsNavigation::getDeleted, 1)); + if (!CollectionUtils.isEmpty(undeleted)) { + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(CmsNavigation::getTenantId, currentTenantId); + updateWrapper.eq(CmsNavigation::getDeleted, 0); + updateWrapper.set(CmsNavigation::getDeleted, 1); + cmsNavigationService.update(updateWrapper); + } + + // 2) 读取Excel + List list = ExcelImportUtil.importExcel( + file.getInputStream(), CmsNavigationImportParam.class, importParams); + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致"); + } + + // 3) 先全部落库(先按根节点保存),再尝试按“导入文件的 parentId -> 导入文件的 navigationId”映射回填层级。 + // 这样即使 parentId 无法匹配(导入文件缺少导航ID/父节点缺失),也能把数据全部导入,无法还原层级的作为根节点处理。 + Map newIdByOldId = new HashMap<>(); + List newIds = new ArrayList<>(list.size()); + List oldIds = new ArrayList<>(list.size()); + List oldParentIds = new ArrayList<>(list.size()); + + for (CmsNavigationImportParam param : list) { + CmsNavigation nav = convertToNavigation(param, currentUserId, currentTenantId); + nav.setParentId(0); + cmsNavigationService.save(nav); + cmsNavigationService.saveAsync(nav); + + Integer oldId = param.getNavigationId(); + if (oldId != null) { + newIdByOldId.put(oldId, nav.getNavigationId()); + } + newIds.add(nav.getNavigationId()); + oldIds.add(oldId); + oldParentIds.add(param.getParentId() != null ? param.getParentId() : 0); + } + + int orphanCount = 0; + int restoredCount = 0; + for (int i = 0; i < newIds.size(); i++) { + Integer oldParentId = oldParentIds.get(i); + if (oldParentId == null || oldParentId == 0) { + continue; + } + Integer oldId = oldIds.get(i); + Integer newId = newIds.get(i); + Integer newParentId = newIdByOldId.get(oldParentId); + // 无法匹配父节点(或出现自引用)就当作孤儿节点,保持根节点 + if (newParentId == null || (oldId != null && oldParentId.equals(oldId)) || (newId != null && newParentId.equals(newId))) { + orphanCount++; + continue; + } + cmsNavigationService.update(new LambdaUpdateWrapper() + .eq(CmsNavigation::getNavigationId, newId) + .set(CmsNavigation::getParentId, newParentId)); + restoredCount++; + } + + redisUtil.delete(SITE_INFO_KEY_PREFIX.concat(currentTenantId.toString())); + return success("成功导入" + list.size() + "条,恢复层级" + restoredCount + "条,无法还原层级的孤儿节点" + orphanCount + "条(已作为根节点导入)"); + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败: " + e.getMessage()); + } + } + + /** + * 递归创建子级导航 + */ + private void createChildNavigations(Map> navGroups, + Map tempIdMapping, + Integer originalParentId, + Integer defaultUserId, + Integer defaultTenantId) { + if (originalParentId == null || originalParentId == 0) { + return; + } + List children = navGroups.get(originalParentId); + if (CollectionUtils.isEmpty(children)) { + return; + } + CmsNavigation parent = tempIdMapping.get(originalParentId); + if (parent == null || parent.getNavigationId() == null) { + return; + } + Integer newParentId = parent.getNavigationId(); + for (CmsNavigationImportParam param : children) { + CmsNavigation nav = convertToNavigation(param, defaultUserId, defaultTenantId); + nav.setParentId(newParentId); + cmsNavigationService.save(nav); + cmsNavigationService.saveAsync(nav); + if (param.getNavigationId() != null) { + tempIdMapping.put(param.getNavigationId(), nav); + } + createChildNavigations(navGroups, tempIdMapping, param.getNavigationId(), defaultUserId, defaultTenantId); + } + } + + private CmsNavigation convertToNavigation(CmsNavigationImportParam param, Integer defaultUserId, Integer defaultTenantId) { + CmsNavigation nav = new CmsNavigation(); + nav.setType(param.getType()); + nav.setTitle(StrUtil.trimStart(param.getTitle())); + nav.setParentId(param.getParentId() != null ? param.getParentId() : 0); + // saveAsync 依赖 model 生成路由/页面;缺省按 page 处理 + nav.setModel(StrUtil.isBlank(param.getModel()) ? "page" : param.getModel()); + nav.setCode(param.getCode()); + nav.setPath(param.getPath()); + nav.setComponent(param.getComponent()); + nav.setTarget(param.getTarget()); + nav.setIcon(param.getIcon()); + nav.setColor(param.getColor()); + nav.setHide(param.getHide()); + nav.setPermission(param.getPermission()); + nav.setPassword(param.getPassword()); + nav.setPosition(param.getPosition()); + nav.setTop(param.getTop()); + nav.setBottom(param.getBottom()); + nav.setActive(param.getActive()); + nav.setMeta(param.getMeta()); + nav.setStyle(param.getStyle()); + nav.setModelName(param.getModelName()); + nav.setPageId(param.getPageId()); + nav.setItemId(param.getItemId()); + nav.setIsMpWeixin(param.getIsMpWeixin()); + nav.setGutter(param.getGutter()); + nav.setSpan(param.getSpan()); + nav.setReadNum(param.getReadNum()); + nav.setMerchantId(param.getMerchantId()); + nav.setLang(param.getLang()); + nav.setHome(param.getHome()); + nav.setRecommend(param.getRecommend()); + nav.setSortNumber(param.getSortNumber() != null ? param.getSortNumber() : 0); + nav.setComments(param.getComments()); + nav.setStatus(param.getStatus() != null ? param.getStatus() : 0); + + // 导入时强制落到当前登录用户/租户,避免“导出其他租户 -> 导入”写回原租户导致当前租户数据不全。 + nav.setUserId(defaultUserId); + nav.setTenantId(defaultTenantId); + nav.setDeleted(0); + return nav; + } + + @Operation(summary = "获取树形结构的网站导航数据") + @GetMapping("/tree") + public ApiResult> tree(CmsNavigationParam param) { + param.setHide(0); + final List navigations = cmsNavigationService.listRel(param); + return success(CommonUtil.toTreeData(navigations, 0, CmsNavigation::getParentId, CmsNavigation::getNavigationId, CmsNavigation::setChildren)); + } + + @Operation(summary = "根据path获取导航") + @GetMapping("/getNavigationByPath") + public ApiResult getNavigationByPath(CmsNavigationParam param) { + final CmsNavigation navigation = cmsNavigationService.getOne(new LambdaUpdateWrapper().eq(CmsNavigation::getModel, param.getModel()).last("limit 1")); + if (ObjectUtil.isNotEmpty(navigation)) { + // 页面元素 + final CmsDesign design = cmsDesignService.getOne(new LambdaUpdateWrapper().eq(CmsDesign::getCategoryId, navigation.getNavigationId()).last("limit 1")); + // 模型信息 + final CmsModel model = cmsModelService.getOne(new LambdaQueryWrapper().eq(CmsModel::getModel, navigation.getModel()).last("limit 1")); + navigation.setBanner(model.getBanner()); + // 上级导航 + if (!navigation.getParentId().equals(0)) { + final CmsNavigation parent = cmsNavigationService.getById(navigation.getParentId()); + navigation.setParentPath(parent.getPath()); + navigation.setParentName(parent.getTitle()); + } + // 页面信息 + navigation.setDesign(design); + // 页面布局 + if (ObjectUtil.isNotEmpty(design)) { + navigation.setLayout(design.getLayout()); + } + } + return success(navigation); + } + + @Operation(summary = "密码校验") + @GetMapping("/checkNavigationPassword") + public ApiResult checkNavigationPassword(CmsNavigationParam param) { + if (!userService.comparePassword(param.getPassword(), param.getPassword2())) { + return fail("密码不正确"); + } + return success("密码正确"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsOrderController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsOrderController.java new file mode 100644 index 0000000..c18d718 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsOrderController.java @@ -0,0 +1,122 @@ +package com.gxwebsoft.cms.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsOrderService; +import com.gxwebsoft.cms.entity.CmsOrder; +import com.gxwebsoft.cms.param.CmsOrderParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 网站订单控制器 + * + * @author 科技小王子 + * @since 2026-01-27 13:03:25 + */ +@Tag(name = "网站订单管理") +@RestController +@RequestMapping("/api/cms/cms-order") +public class CmsOrderController extends BaseController { + @Resource + private CmsOrderService cmsOrderService; + + @PreAuthorize("hasAuthority('cms:cmsOrder:list')") + @Operation(summary = "分页查询网站订单") + @GetMapping("/page") + public ApiResult> page(CmsOrderParam param) { + // 使用关联查询 + return success(cmsOrderService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('cms:cmsOrder:list')") + @Operation(summary = "查询全部网站订单") + @GetMapping() + public ApiResult> list(CmsOrderParam param) { + // 使用关联查询 + return success(cmsOrderService.listRel(param)); + } + + @PreAuthorize("hasAuthority('cms:cmsOrder:list')") + @Operation(summary = "根据id查询网站订单") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(cmsOrderService.getByIdRel(id)); + } + + @Operation(summary = "添加网站订单") + @PostMapping() + public ApiResult save(@RequestBody CmsOrder cmsOrder) { + + if (cmsOrderService.save(cmsOrder)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsOrder:update')") + @OperationLog + @Operation(summary = "修改网站订单") + @PutMapping() + public ApiResult update(@RequestBody CmsOrder cmsOrder) { + if (cmsOrderService.updateById(cmsOrder)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsOrder:remove')") + @OperationLog + @Operation(summary = "删除网站订单") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsOrderService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsOrder:save')") + @OperationLog + @Operation(summary = "批量添加网站订单") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsOrderService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsOrder:update')") + @OperationLog + @Operation(summary = "批量修改网站订单") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsOrderService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsOrder:remove')") + @OperationLog + @Operation(summary = "批量删除网站订单") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsOrderService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsStatisticsController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsStatisticsController.java new file mode 100644 index 0000000..0e89ff3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsStatisticsController.java @@ -0,0 +1,126 @@ +package com.gxwebsoft.cms.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsStatisticsService; +import com.gxwebsoft.cms.entity.CmsStatistics; +import com.gxwebsoft.cms.param.CmsStatisticsParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 站点统计信息表控制器 + * + * @author 科技小王子 + * @since 2025-07-25 12:32:06 + */ +@Tag(name = "站点统计信息表管理") +@RestController +@RequestMapping("/api/cms/cms-statistics") +public class CmsStatisticsController extends BaseController { + @Resource + private CmsStatisticsService cmsStatisticsService; + + @Operation(summary = "分页查询站点统计信息表") + @GetMapping("/page") + public ApiResult> page(CmsStatisticsParam param) { + // 使用关联查询 + return success(cmsStatisticsService.pageRel(param)); + } + + @Operation(summary = "查询全部站点统计信息表") + @GetMapping() + public ApiResult> list(CmsStatisticsParam param) { + // 使用关联查询 + return success(cmsStatisticsService.listRel(param)); + } + + @Operation(summary = "根据id查询站点统计信息表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(cmsStatisticsService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('cms:cmsStatistics:save')") + @OperationLog + @Operation(summary = "添加站点统计信息表") + @PostMapping() + public ApiResult save(@RequestBody CmsStatistics cmsStatistics) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + cmsStatistics.setUserId(loginUser.getUserId()); + } + if (cmsStatisticsService.save(cmsStatistics)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsStatistics:update')") + @OperationLog + @Operation(summary = "修改站点统计信息表") + @PutMapping() + public ApiResult update(@RequestBody CmsStatistics cmsStatistics) { + if (cmsStatisticsService.updateById(cmsStatistics)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsStatistics:remove')") + @OperationLog + @Operation(summary = "删除站点统计信息表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsStatisticsService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsStatistics:save')") + @OperationLog + @Operation(summary = "批量添加站点统计信息表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsStatisticsService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsStatistics:update')") + @OperationLog + @Operation(summary = "批量修改站点统计信息表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsStatisticsService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsStatistics:remove')") + @OperationLog + @Operation(summary = "批量删除站点统计信息表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsStatisticsService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsTemplateController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsTemplateController.java new file mode 100644 index 0000000..1b3fe9e --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsTemplateController.java @@ -0,0 +1,118 @@ +package com.gxwebsoft.cms.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsTemplateService; +import com.gxwebsoft.cms.entity.CmsTemplate; +import com.gxwebsoft.cms.param.CmsTemplateParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 网站模版控制器 + * + * @author 科技小王子 + * @since 2025-01-21 14:21:16 + */ +@Tag(name = "网站模版管理") +@RestController +@RequestMapping("/api/cms/cms-template") +public class CmsTemplateController extends BaseController { + @Resource + private CmsTemplateService cmsTemplateService; + + @Operation(summary = "分页查询网站模版") + @GetMapping("/page") + public ApiResult> page(CmsTemplateParam param) { + // 使用关联查询 + return success(cmsTemplateService.pageRel(param)); + } + + @Operation(summary = "查询全部网站模版") + @GetMapping() + public ApiResult> list(CmsTemplateParam param) { + // 使用关联查询 + return success(cmsTemplateService.listRel(param)); + } + + @Operation(summary = "根据id查询网站模版") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(cmsTemplateService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('cms:cmsTemplate:save')") + @Operation(summary = "添加网站模版") + @PostMapping() + public ApiResult save(@RequestBody CmsTemplate cmsTemplate) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + cmsTemplate.setUserId(loginUser.getUserId()); + } + if (cmsTemplateService.save(cmsTemplate)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsTemplate:update')") + @Operation(summary = "修改网站模版") + @PutMapping() + public ApiResult update(@RequestBody CmsTemplate cmsTemplate) { + if (cmsTemplateService.updateById(cmsTemplate)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsTemplate:remove')") + @Operation(summary = "删除网站模版") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsTemplateService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsTemplate:save')") + @Operation(summary = "批量添加网站模版") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsTemplateService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsTemplate:update')") + @Operation(summary = "批量修改网站模版") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsTemplateService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsTemplate:remove')") + @Operation(summary = "批量删除网站模版") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsTemplateService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsWebsiteController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsWebsiteController.java new file mode 100644 index 0000000..8c6c045 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsWebsiteController.java @@ -0,0 +1,541 @@ +package com.gxwebsoft.cms.controller; + +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.cms.entity.*; +import com.gxwebsoft.cms.param.CmsNavigationParam; +import com.gxwebsoft.cms.service.CmsNavigationService; +import com.gxwebsoft.cms.service.CmsWebsiteFieldService; +import com.gxwebsoft.cms.service.CmsWebsiteSettingService; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsWebsiteService; +import com.gxwebsoft.cms.param.CmsWebsiteParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.*; + +import java.util.concurrent.TimeUnit; + +/** + * 网站信息记录表控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +@Slf4j +@Tag(name = "网站信息记录表管理") +@RestController +@RequestMapping("/api/cms/cms-website") +public class CmsWebsiteController extends BaseController { + @Resource + private CmsWebsiteService cmsWebsiteService; + @Resource + private RedisUtil redisUtil; + @Resource + private CmsWebsiteFieldService cmsWebsiteFieldService; + @Resource + private CmsNavigationService cmsNavigationService; + @Resource + private CmsWebsiteSettingService cmsWebsiteSettingService; + + private static final String SITE_INFO_KEY_PREFIX = "SiteInfo:"; + private static final String MP_INFO_KEY_PREFIX = "MpInfo:"; + private static final String SELECT_PAYMENT_KEY_PREFIX = "SelectPayment:"; + private static final String SYS_DOMAIN_SUFFIX = ".websoft.top"; + private static final String DOMAIN_SUFFIX = ".wsdns.cn"; + + @Operation(summary = "分页查询网站信息记录表") + @GetMapping("/page") + public ApiResult> page(CmsWebsiteParam param) { + // 使用关联查询 + return success(cmsWebsiteService.pageRel(param)); + } + + @Operation(summary = "查询全部网站信息记录表") + @GetMapping() + public ApiResult> list(CmsWebsiteParam param) { + // 使用关联查询 + return success(cmsWebsiteService.listRel(param)); + } + + @Operation(summary = "分页查询网站信息记录表") + @GetMapping("/pageAll") + public ApiResult> pageAll(CmsWebsiteParam param) { + return success(cmsWebsiteService.pageRelAll(param)); + } + + @Operation(summary = "根据id查询网站信息记录表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(cmsWebsiteService.getByIdRel(id)); + } + + @Operation(summary = "根据id查询网站信息记录表") + @GetMapping("/getAll/{id}") + public ApiResult getAll(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(cmsWebsiteService.getByIdRelAll(id)); + } + + @PreAuthorize("hasAuthority('cms:website:save')") + @Operation(summary = "添加网站信息记录表") + @PostMapping() + public ApiResult save(@RequestBody CmsWebsite cmsWebsite) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + cmsWebsite.setLoginUser(loginUser); + return success("创建成功", cmsWebsiteService.create(cmsWebsite)); + } + return fail("创建失败"); + } + + @PreAuthorize("hasAuthority('cms:website:update')") + @Operation(summary = "修改网站信息记录表") + @PutMapping() + public ApiResult update(@RequestBody CmsWebsite cmsWebsite) { + if (cmsWebsiteService.updateById(cmsWebsite)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:website:update')") + @Operation(summary = "修改网站信息记录表") + @PutMapping("/updateAll") + public ApiResult updateAll(@RequestBody CmsWebsite cmsWebsite) { + if (cmsWebsiteService.updateByIdAll(cmsWebsite)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:website:remove')") + @Operation(summary = "删除网站信息记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsWebsiteService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('cms:website:remove')") + @Operation(summary = "删除网站信息记录表") + @DeleteMapping("/removeAll/{id}") + public ApiResult removeAll(@PathVariable("id") Integer id) { + if (cmsWebsiteService.removeByIdAll(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('cms:website:save')") + @Operation(summary = "批量添加网站信息记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsWebsiteService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:website:update')") + @Operation(summary = "批量修改网站信息记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsWebsiteService, "website_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:website:remove')") + @Operation(summary = "批量删除网站信息记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsWebsiteService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "网站基本信息") + @GetMapping("/getSiteInfo") + public ApiResult getSiteInfo() { + log.info("开始获取网站基本信息..."); + try { + Integer tenantId = getTenantId(); + log.info("获取到租户ID: {}", tenantId); + if (ObjectUtil.isEmpty(tenantId)) { + log.warn("租户ID为空"); + return fail("租户ID不能为空", null); + } + + String key = SITE_INFO_KEY_PREFIX + tenantId; + + // 尝试从缓存获取 + try { + final String siteInfo = redisUtil.get(key); + if (StrUtil.isNotBlank(siteInfo)) { + log.info("从缓存获取网站信息: = {}", key); + // 可以启用缓存返回,但先注释掉确保数据最新 + // return success(JSONUtil.parseObject(siteInfo, CmsWebsite.class)); + } + } catch (Exception e) { + log.warn("获取缓存失败: {}", e.getMessage()); + } + + // 获取站点信息 + CmsWebsite website = null; + try { + log.info("开始查询租户{}的站点信息", tenantId); + website = cmsWebsiteService.getOne(new LambdaQueryWrapper() + .eq(CmsWebsite::getTenantId, tenantId) + .eq(CmsWebsite::getDeleted, 0) + .last("limit 1")); + log.info("查询站点信息完成, website: {}", website != null ? "存在" : "不存在"); + } catch (Exception e) { + log.error("查询站点信息失败: {}", e.getMessage(), e); + return fail("查询站点信息失败: " + e.getMessage(), null); + } + + // 创建默认站点 + if (ObjectUtil.isEmpty(website)) { + return success("请先创建站点...", null); + } + + // 安全地构建网站信息 + try { + buildSafeWebsiteInfo(website); + } catch (Exception e) { + log.error("构建网站信息失败: {}", e.getMessage(), e); + return fail("构建网站信息失败", null); + } + + // 缓存结果 + try { + redisUtil.set(key, website, 1L, TimeUnit.DAYS); + } catch (Exception e) { + log.warn("缓存网站信息失败: {}", e.getMessage()); + } + + return success(website); + + } catch (Exception e) { + log.error("获取网站信息异常: {}", e.getMessage(), e); + return fail("获取网站信息失败: " + e.getMessage(), null); + } + } + + /** + * 安全地构建网站信息 + */ + private void buildSafeWebsiteInfo(CmsWebsite website) { + if (website == null) { + throw new IllegalArgumentException("网站对象不能为空"); + } + + // 1. 设置网站状态 + try { + setWebsiteStatus(website); + } catch (Exception e) { + log.warn("设置网站状态失败: {}", e.getMessage()); + website.setStatus(0); // 默认状态 + website.setStatusText("状态未知"); + } + + // 2. 构建配置信息 + try { + HashMap config = buildSafeWebsiteConfig(website); + website.setConfig(config); + } catch (Exception e) { + log.warn("构建网站配置失败: {}", e.getMessage()); + website.setConfig(new HashMap<>()); + } + + // 3. 设置导航信息 + try { + setSafeWebsiteNavigation(website); + } catch (Exception e) { + log.warn("设置网站导航失败: {}", e.getMessage()); + website.setTopNavs(new ArrayList<>()); + website.setBottomNavs(new ArrayList<>()); + } + + // 4. 设置网站设置信息 + try { + setWebsiteSetting(website); + } catch (Exception e) { + log.warn("设置网站设置失败: {}", e.getMessage()); + // 设置为null,让前端知道没有设置信息 + } + + // 5. 构建服务器时间(使用LocalDateTime) + try { + HashMap serverTime = buildSafeServerTime(); + website.setServerTime(serverTime); + } catch (Exception e) { + log.warn("构建服务器时间失败: {}", e.getMessage()); + HashMap defaultTime = new HashMap<>(); + defaultTime.put("now", java.time.LocalDateTime.now().toString()); + website.setServerTime(defaultTime); + } + } + + private void setWebsiteStatus(CmsWebsite website) { + // 空值检查,避免NullPointerException + Integer running = website.getRunning(); + if (running == null) { + // 默认状态:未开通 + website.setStatusIcon("error"); + website.setStatusText("状态未知"); + return; + } + + if (!running.equals(1)) { + // 未开通 + if (running.equals(0)) { + website.setStatusIcon("error"); + website.setStatusText("该站点未开通"); + } + // 维护中 + if (running.equals(2)) { + website.setStatusIcon("warning"); + } + // 已关闭 + if (running.equals(3)) { + website.setStatusIcon("error"); + website.setStatusText("已关闭"); + } + // 已欠费停机 + if (running.equals(4)) { + website.setStatusIcon("error"); + website.setStatusText("已欠费停机"); + } + // 违规关停 + if (running.equals(5)) { + website.setStatusIcon("error"); + website.setStatusText("违规关停"); + } + } + } + + private HashMap buildWebsiteConfig(CmsWebsite website) { + return buildSafeWebsiteConfig(website); + } + + private HashMap buildSafeWebsiteConfig(CmsWebsite website) { + HashMap config = new HashMap<>(); + + try { + // 获取网站字段配置 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(CmsWebsiteField::getDeleted, 0); + final List fields = cmsWebsiteFieldService.list(wrapper); + + if (fields != null && !fields.isEmpty()) { + fields.forEach(field -> { + if (field != null && StrUtil.isNotBlank(field.getName())) { + config.put(field.getName(), field.getValue() != null ? field.getValue() : ""); + } + }); + } + } catch (Exception e) { + log.warn("获取网站字段配置失败: {}", e.getMessage()); + } + + // 安全地设置域名信息 + try { + config.put("SysDomain", getSafeSysDomain(website)); + config.put("Domain", getSafeDomain(website)); + } catch (Exception e) { + log.warn("设置域名信息失败: {}", e.getMessage()); + config.put("SysDomain", website.getTenantId() + ".websoft.top"); + config.put("Domain", website.getTenantId() + ".wsdns.cn"); + } + + return config; + } + + private String getSysDomain(CmsWebsite website) { + return getSafeSysDomain(website); + } + + private String getDomain(CmsWebsite website) { + return getSafeDomain(website); + } + + private String getSafeSysDomain(CmsWebsite website) { + if (website == null || website.getTenantId() == null) { + return "unknown.websoft.top"; + } + return StrUtil.isNotBlank(website.getWebsiteCode()) ? + website.getWebsiteCode() + SYS_DOMAIN_SUFFIX : + website.getTenantId() + SYS_DOMAIN_SUFFIX; + } + + private String getSafeDomain(CmsWebsite website) { + if (website == null || website.getTenantId() == null) { + return "unknown.wsdns.cn"; + } + + if (StrUtil.isNotBlank(website.getDomain())) { + return website.getDomain(); + } + if (StrUtil.isNotBlank(website.getWebsiteCode())) { + return website.getWebsiteCode() + DOMAIN_SUFFIX; + } + return website.getTenantId() + DOMAIN_SUFFIX; + } + + private void setWebsiteNavigation(CmsWebsite website) { + setSafeWebsiteNavigation(website); + } + + private void setSafeWebsiteNavigation(CmsWebsite website) { + if (website == null) { + return; + } + + // 设置顶部导航 + try { + final CmsNavigationParam topParam = new CmsNavigationParam(); + topParam.setHide(0); + topParam.setTop(0); + topParam.setBottom(null); + final List topNavs = cmsNavigationService.listRel(topParam); + + if (topNavs != null && !topNavs.isEmpty()) { + try { + website.setTopNavs(CommonUtil.toTreeData(topNavs, 0, + CmsNavigation::getParentId, + CmsNavigation::getNavigationId, + CmsNavigation::setChildren)); + } catch (Exception e) { + log.warn("构建顶部导航树失败: {}", e.getMessage()); + website.setTopNavs(new ArrayList<>(topNavs)); + } + } else { + website.setTopNavs(new ArrayList<>()); + } + } catch (Exception e) { + log.warn("获取顶部导航失败: {}", e.getMessage()); + website.setTopNavs(new ArrayList<>()); + } + + // 设置底部导航 + try { + final CmsNavigationParam bottomParam = new CmsNavigationParam(); + bottomParam.setHide(0); + bottomParam.setTop(null); + bottomParam.setBottom(0); + final List bottomNavs = cmsNavigationService.listRel(bottomParam); + + if (bottomNavs != null && !bottomNavs.isEmpty()) { + try { + website.setBottomNavs(CommonUtil.toTreeData(bottomNavs, 0, + CmsNavigation::getParentId, + CmsNavigation::getNavigationId, + CmsNavigation::setChildren)); + } catch (Exception e) { + log.warn("构建底部导航树失败: {}", e.getMessage()); + website.setBottomNavs(new ArrayList<>(bottomNavs)); + } + } else { + website.setBottomNavs(new ArrayList<>()); + } + } catch (Exception e) { + log.warn("获取底部导航失败: {}", e.getMessage()); + website.setBottomNavs(new ArrayList<>()); + } + } + + private void setWebsiteSetting(CmsWebsite website) { + final CmsWebsiteSetting setting = cmsWebsiteSettingService.getOne(new LambdaQueryWrapper().eq(CmsWebsiteSetting::getWebsiteId, website.getWebsiteId())); + if (ObjectUtil.isNotEmpty(setting)) { + website.setSetting(setting); + } + } + + private HashMap buildServerTime() { + return buildSafeServerTime(); + } + + private HashMap buildSafeServerTime() { + HashMap serverTime = new HashMap<>(); + + try { + // 使用 LocalDateTime 替代 DateTime + java.time.LocalDateTime now = java.time.LocalDateTime.now(); + java.time.LocalDate today = java.time.LocalDate.now(); + + // 当前时间 + serverTime.put("now", now.toString()); + + // 今天日期 + serverTime.put("today", today.toString()); + + // 明天日期 + java.time.LocalDate tomorrow = today.plusDays(1); + serverTime.put("tomorrow", tomorrow.toString()); + + // 后天日期 + java.time.LocalDate afterDay = today.plusDays(2); + serverTime.put("afterDay", afterDay.toString()); + + // 今天星期几 (1=Monday, 7=Sunday) + int week = today.getDayOfWeek().getValue(); + serverTime.put("week", week); + + // 下周同一天 + java.time.LocalDate nextWeek = today.plusWeeks(1); + serverTime.put("nextWeek", nextWeek.toString()); + + // 时间戳 + serverTime.put("timestamp", System.currentTimeMillis()); + + } catch (Exception e) { + log.error("构建服务器时间失败: {}", e.getMessage(), e); + // 提供最基本的时间信息 + serverTime.put("now", java.time.LocalDateTime.now().toString()); + serverTime.put("today", java.time.LocalDate.now().toString()); + serverTime.put("timestamp", System.currentTimeMillis()); + } + + return serverTime; + } + + @Operation(summary = "清除缓存") + @DeleteMapping("/clearSiteInfo/{key}") + public ApiResult clearSiteInfo(@PathVariable("key") String key) { + log.info("清除缓存开始,key: {}", key); + System.out.println("清除缓存开始,key = " + key); + // 清除指定key + redisUtil.delete(key); + // 清除缓存 + redisUtil.delete(SITE_INFO_KEY_PREFIX.concat(getTenantId().toString())); + log.info("清除缓存结束,key: {}", SITE_INFO_KEY_PREFIX.concat(getTenantId().toString())); + // 清除小程序缓存 + redisUtil.delete(MP_INFO_KEY_PREFIX.concat(getTenantId().toString())); + // 选择支付方式 + redisUtil.delete(SELECT_PAYMENT_KEY_PREFIX.concat(getTenantId().toString())); + return success("清除成功"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsWebsiteFieldController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsWebsiteFieldController.java new file mode 100644 index 0000000..c21f0ba --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsWebsiteFieldController.java @@ -0,0 +1,188 @@ +package com.gxwebsoft.cms.controller; + +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsWebsiteFieldService; +import com.gxwebsoft.cms.entity.CmsWebsiteField; +import com.gxwebsoft.cms.param.CmsWebsiteFieldParam; +import com.gxwebsoft.cms.param.CmsWebsiteFieldImportParam; +import com.gxwebsoft.common.core.utils.JSONUtil; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.checkerframework.checker.units.qual.A; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; + +/** + * 应用参数控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +@Tag(name = "应用参数管理") +@RestController +@RequestMapping("/api/cms/cms-website-field") +public class CmsWebsiteFieldController extends BaseController { + @Resource + private CmsWebsiteFieldService cmsWebsiteFieldService; + + @Operation(summary = "分页查询应用参数") + @GetMapping("/page") + public ApiResult> page(CmsWebsiteFieldParam param) { + // 使用关联查询 + return success(cmsWebsiteFieldService.pageRel(param)); + } + + @Operation(summary = "查询全部应用参数") + @GetMapping() + public ApiResult> list(CmsWebsiteFieldParam param) { + // 使用关联查询 + return success(cmsWebsiteFieldService.listRel(param)); + } + + @Operation(summary = "根据id查询应用参数") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(cmsWebsiteFieldService.getByIdRel(id)); + } + + @Operation(summary = "根据code查询应用参数") + @GetMapping("/getByCode/{code}") + public ApiResult getByCode(@PathVariable("code") String code) { + // 使用关联查询 + return success(cmsWebsiteFieldService.getByCodeRel(code)); + } + + @PreAuthorize("hasAuthority('cms:cmsWebsiteField:save')") + @Operation(summary = "添加应用参数") + @PostMapping() + public ApiResult save(@RequestBody CmsWebsiteField cmsWebsiteField) { + if (cmsWebsiteFieldService.save(cmsWebsiteField)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsWebsiteField:update')") + @Operation(summary = "修改应用参数") + @PutMapping() + public ApiResult update(@RequestBody CmsWebsiteField cmsWebsiteField) { + if (cmsWebsiteFieldService.updateById(cmsWebsiteField)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsWebsiteField:remove')") + @Operation(summary = "删除应用参数") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsWebsiteFieldService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsWebsiteField:save')") + @Operation(summary = "批量添加应用参数") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsWebsiteFieldService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsWebsiteField:update')") + @Operation(summary = "批量修改应用参数") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsWebsiteFieldService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsWebsiteField:remove')") + @Operation(summary = "批量删除应用参数") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsWebsiteFieldService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "获取网站配置参数-对象形式") + @GetMapping("/config") + public ApiResult getConfig(CmsWebsiteFieldParam param) { + // 使用关联查询 + final List fields = cmsWebsiteFieldService.listRel(param); + + HashMap config = new HashMap<>(); + fields.forEach(d -> { + config.put(d.getName(), d.getValue()); + }); + return success(config); + } + + /** + * excel批量导入应用参数 + */ + @PreAuthorize("hasAuthority('cms:cmsWebsiteField:save')") + @Operation(summary = "批量导入应用参数") + @Transactional(rollbackFor = {Exception.class}) + @PostMapping("/import") + public ApiResult> importBatch(MultipartFile file) { + ImportParams importParams = new ImportParams(); + try { + // 第一步:永久删除已标记为 deleted=1 的记录 + cmsWebsiteFieldService.remove(new LambdaQueryWrapper().eq(CmsWebsiteField::getDeleted, 1)); + + // 第二步:将现有未删除的记录(deleted=0)标记为 deleted=1 + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(CmsWebsiteField::getDeleted, 0); + updateWrapper.set(CmsWebsiteField::getDeleted, 1); + cmsWebsiteFieldService.update(updateWrapper); + + // 第三步:导入XLS文件的内容 + List list = ExcelImportUtil.importExcel(file.getInputStream(), CmsWebsiteFieldImportParam.class, importParams); + list.forEach(d -> { + CmsWebsiteField item = JSONUtil.parseObject(JSONUtil.toJSONString(d), CmsWebsiteField.class); + assert item != null; + if (ObjectUtil.isNotEmpty(item)) { + System.out.println("item = " + item); + // 设置默认值 + if (item.getDeleted() == null) { + item.setDeleted(0); // 新导入的数据deleted设为0 + } + if (item.getSortNumber() == null) { + item.setSortNumber(100); + } + if (item.getEncrypted() == null) { + item.setEncrypted(false); + } + cmsWebsiteFieldService.save(item); + } + }); + return success("成功导入" + list.size() + "条", null); + } catch (Exception e) { + e.printStackTrace(); + } + return fail("导入失败", null); + } +} diff --git a/src/main/java/com/gxwebsoft/cms/controller/CmsWebsiteSettingController.java b/src/main/java/com/gxwebsoft/cms/controller/CmsWebsiteSettingController.java new file mode 100644 index 0000000..49424de --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/controller/CmsWebsiteSettingController.java @@ -0,0 +1,121 @@ +package com.gxwebsoft.cms.controller; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.cms.service.CmsWebsiteSettingService; +import com.gxwebsoft.cms.entity.CmsWebsiteSetting; +import com.gxwebsoft.cms.param.CmsWebsiteSettingParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 网站设置控制器 + * + * @author 科技小王子 + * @since 2025-02-19 01:35:44 + */ +@Tag(name = "网站设置管理") +@RestController +@RequestMapping("/api/cms/cms-website-setting") +public class CmsWebsiteSettingController extends BaseController { + @Resource + private CmsWebsiteSettingService cmsWebsiteSettingService; + + @Operation(summary = "分页查询网站设置") + @GetMapping("/page") + public ApiResult> page(CmsWebsiteSettingParam param) { + // 使用关联查询 + return success(cmsWebsiteSettingService.pageRel(param)); + } + + @Operation(summary = "查询全部网站设置") + @GetMapping() + public ApiResult> list(CmsWebsiteSettingParam param) { + // 使用关联查询 + return success(cmsWebsiteSettingService.listRel(param)); + } + + @Operation(summary = "根据id查询网站设置") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + final CmsWebsiteSetting cmsWebsiteSetting = cmsWebsiteSettingService.getOne(new LambdaQueryWrapper().eq(CmsWebsiteSetting::getWebsiteId, id)); + if(ObjectUtil.isEmpty(cmsWebsiteSetting)){ + final CmsWebsiteSetting setting = new CmsWebsiteSetting(); + setting.setWebsiteId(id); + cmsWebsiteSettingService.save(setting); + return success(cmsWebsiteSettingService.getOne(new LambdaQueryWrapper().eq(CmsWebsiteSetting::getWebsiteId, id))); + } + return success(cmsWebsiteSetting); + } + + @PreAuthorize("hasAuthority('cms:cmsWebsiteSetting:save')") + @Operation(summary = "添加网站设置") + @PostMapping() + public ApiResult save(@RequestBody CmsWebsiteSetting cmsWebsiteSetting) { + if (cmsWebsiteSettingService.save(cmsWebsiteSetting)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:website:update')") + @Operation(summary = "修改网站设置") + @PutMapping() + public ApiResult update(@RequestBody CmsWebsiteSetting cmsWebsiteSetting) { + if (cmsWebsiteSettingService.updateById(cmsWebsiteSetting)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsWebsiteSetting:remove')") + @Operation(summary = "删除网站设置") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (cmsWebsiteSettingService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsWebsiteSetting:save')") + @Operation(summary = "批量添加网站设置") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (cmsWebsiteSettingService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsWebsiteSetting:update')") + @Operation(summary = "批量修改网站设置") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(cmsWebsiteSettingService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('cms:cmsWebsiteSetting:remove')") + @Operation(summary = "批量删除网站设置") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (cmsWebsiteSettingService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsAd.java b/src/main/java/com/gxwebsoft/cms/entity/CmsAd.java new file mode 100644 index 0000000..1f6996a --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsAd.java @@ -0,0 +1,106 @@ +package com.gxwebsoft.cms.entity; + +import cn.hutool.core.util.DesensitizedUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.gxwebsoft.common.core.utils.JSONUtil; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 广告位 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsAd对象", description = "广告位") +public class CmsAd implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "ad_id", type = IdType.AUTO) + private Integer adId; + + @Schema(description = "类型") + private Integer type; + + @Schema(description = "唯一标识") + private String code; + + @Schema(description = "栏目ID") + private Integer categoryId; + + @Schema(description = "栏目名称") + @TableField(exist = false) + private String categoryName; + + @Schema(description = "广告位名称") + private String name; + + @Schema(description = "宽") + private String width; + + @Schema(description = "高") + private String height; + + @Schema(description = "边框") + private String border; + + @Schema(description = "CSS样式") + private String style; + + @Schema(description = "广告图片") + private String images; + + @Schema(description = "广告图片") + @TableField(exist = false) + private JSONArray imageList; + + @Schema(description = "路由/链接地址") + private String path; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "国际化语言") + private String lang; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + public JSONArray getImageList() { + return JSON.parseArray(this.images); + } +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsAdRecord.java b/src/main/java/com/gxwebsoft/cms/entity/CmsAdRecord.java new file mode 100644 index 0000000..8b4cab4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsAdRecord.java @@ -0,0 +1,58 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 广告图片 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsAdRecord对象", description = "广告图片") +public class CmsAdRecord implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "ad_record_id", type = IdType.AUTO) + private Integer adRecordId; + + @Schema(description = "广告标题") + private String title; + + @Schema(description = "图片地址") + private String path; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "广告位ID") + private Integer adId; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsAdVo.java b/src/main/java/com/gxwebsoft/cms/entity/CmsAdVo.java new file mode 100644 index 0000000..d86e281 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsAdVo.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "图片DTO", description = "图片DTO") +public class CmsAdVo implements Serializable { + + @Schema(description = "ID") + @TableField(exist = false) + private Integer uid; + + @Schema(description = "名称") + @TableField(exist = false) + private String title; + + @Schema(description = "图片路径") + @TableField(exist = false) + private String url; + + @Schema(description = "视频地址") + @TableField(exist = false) + private String video; + + @Schema(description = "状态") + @TableField(exist = false) + private String status; + + @Schema(description = "图片宽") + @TableField(exist = false) + private Integer width; + + @Schema(description = "图片高") + @TableField(exist = false) + private Integer height; +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsArticle.java b/src/main/java/com/gxwebsoft/cms/entity/CmsArticle.java new file mode 100644 index 0000000..e6832e8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsArticle.java @@ -0,0 +1,267 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 文章 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsArticle对象", description = "文章") +public class CmsArticle implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "文章ID") + @TableId(value = "article_id", type = IdType.AUTO) + private Integer articleId; + + @Schema(description = "文章标题") + private String title; + + @Schema(description = "文章类型 0常规 1视频") + private Integer type; + + @Schema(description = "文章模型") + private String model; + + @Schema(description = "文章编号") + private String code; + + @Schema(description = "内容模板页面") + private String detail; + + @Schema(description = "banner") + @TableField(exist = false) + private String banner; + + @Schema(description = "访问路径") + @TableField(exist = false) + private String path; + + @Schema(description = "列表显示方式(10小图展示 20大图展示)") + private Integer showType; + + @Schema(description = "话题") + private String topic; + + @Schema(description = "标签") + private String tags; + + @Schema(description = "文章分类ID") + private Integer categoryId; + + @Schema(description = "当前分类") + @TableField(exist = false) + private String categoryName; + + @Schema(description = "父级分类ID") + private Integer parentId; + + @Schema(description = "父级分类") + @TableField(exist = false) + private String parentName; + + @Schema(description = "封面图") + private String image; + + @Schema(description = "封面图宽度") + private Integer imageWidth; + + @Schema(description = "封面图高度") + private Integer imageHeight; + + @Schema(description = "价格") + private BigDecimal price; + + @Schema(description = "开始时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime startTime; + + @Schema(description = "到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime endTime; + + @Schema(description = "来源") + private String source; + + @Schema(description = "产品概述") + private String overview; + + @Schema(description = "虚拟阅读量(仅用作展示)") + private Integer virtualViews; + + @Schema(description = "实际阅读量") + private Integer actualViews; + + @Schema(description = "评分") + private BigDecimal rate; + + @Schema(description = "可见类型 0所有人 1登录可见 2密码可见") + private Integer permission; + + @Schema(description = "访问密码") + private String password; + + @Schema(description = "验证密码(前端回传)") + @TableField(exist = false) + private String password2; + + @Schema(description = "发布来源客户端 (APP、H5、小程序等)") + private String platform; + + @Schema(description = "文章附件") + private String files; + + @Schema(description = "视频地址") + private String video; + + @Schema(description = "接受的文件类型") + private String accept; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "点赞数") + private Integer likes; + + @Schema(description = "评论数") + private Integer commentNumbers; + + @Schema(description = "提醒谁看") + private String toUsers; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "作者") + private String author; + + @Schema(description = "国际化语言") + private String lang; + + @Schema(description = "关联默认语言的文章ID,用于同步翻译更新") + private Integer langArticleId; + + @Schema(description = "是否启用自动翻译") + private Boolean translation; + + @Schema(description = "编辑器类型 1 富文本编辑器 2 Markdown编辑器") + private Integer editor; + + @Schema(description = "PDF地址") + private String pdfUrl; + + @Schema(description = "版本号") + private Integer version; + + @Schema(description = "商户ID") + private Long merchantId; + + @Schema(description = "项目ID") + private Long projectId; + + @Schema(description = "商户名称") + @TableField(exist = false) + private String merchantName; + + @Schema(description = "商户名称") + @TableField(exist = false) + private String merchantAvatar; + + @Schema(description = "昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容") + private Integer status; + + @Schema(description = "状态文本") + @TableField(exist = false) + private String statusText; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "是否更新") + @TableField(exist = false) + private Boolean isUpdate; + + @Schema(description = "文章内容") + @TableField(exist = false) + private String content; + + @Schema(description = "已报名人数") + private Integer bmUsers; + + public String getStatusText() { + if (this.status == 0) { + return "已发布"; + } + if (this.status == 1) { + return "待审核"; + } + if (this.status == 2) { + return "已驳回"; + } + if (this.status == 3) { + return "违规内容"; + } + return ""; + } +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsArticleCategory.java b/src/main/java/com/gxwebsoft/cms/entity/CmsArticleCategory.java new file mode 100644 index 0000000..1f03126 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsArticleCategory.java @@ -0,0 +1,94 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 文章分类表 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsArticleCategory对象", description = "文章分类表") +public class CmsArticleCategory implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "文章分类ID") + @TableId(value = "category_id", type = IdType.AUTO) + private Integer categoryId; + + @Schema(description = "分类标识") + private String categoryCode; + + @Schema(description = "分类名称") + private String title; + + @Schema(description = "类型 0列表 1单页 2外链") + private Integer type; + + @Schema(description = "分类图片") + private String image; + + @Schema(description = "上级分类ID") + private Integer parentId; + + @Schema(description = "路由/链接地址") + private String path; + + @Schema(description = "组件路径") + private String component; + + @Schema(description = "绑定的页面") + private Integer pageId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "文章数量") + private Integer count; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") + private Integer hide; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "是否显示在首页") + private Integer showIndex; + + @Schema(description = "状态, 0正常, 1禁用") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsArticleComment.java b/src/main/java/com/gxwebsoft/cms/entity/CmsArticleComment.java new file mode 100644 index 0000000..3afd431 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsArticleComment.java @@ -0,0 +1,79 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 文章评论表 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsArticleComment对象", description = "文章评论表") +public class CmsArticleComment implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "评价ID") + @TableId(value = "comment_id", type = IdType.AUTO) + private Integer commentId; + + @Schema(description = "文章ID") + private Integer articleId; + + @Schema(description = "评分 (10好评 20中评 30差评)") + private Integer score; + + @Schema(description = "评价内容") + private String content; + + @Schema(description = "是否为图片评价") + private Integer isPicture; + + @Schema(description = "评论者ID") + private Integer userId; + + @Schema(description = "被评价者ID") + private Integer toUserId; + + @Schema(description = "回复的评论ID") + private Integer replyCommentId; + + @Schema(description = "回复者ID") + private Integer replyUserId; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0未读, 1已读") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsArticleContent.java b/src/main/java/com/gxwebsoft/cms/entity/CmsArticleContent.java new file mode 100644 index 0000000..7001e06 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsArticleContent.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 文章记录表 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsArticleContent对象", description = "文章记录表") +public class CmsArticleContent implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "文章ID") + private Integer articleId; + + @Schema(description = "文章内容") + private String content; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsArticleCount.java b/src/main/java/com/gxwebsoft/cms/entity/CmsArticleCount.java new file mode 100644 index 0000000..c145531 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsArticleCount.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 点赞文章 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsArticleCount对象", description = "点赞文章") +public class CmsArticleCount implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "文章ID") + private Integer articleId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsArticleLike.java b/src/main/java/com/gxwebsoft/cms/entity/CmsArticleLike.java new file mode 100644 index 0000000..1e1137a --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsArticleLike.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 点赞文章 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsArticleLike对象", description = "点赞文章") +public class CmsArticleLike implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "文章ID") + private Integer articleId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsDesign.java b/src/main/java/com/gxwebsoft/cms/entity/CmsDesign.java new file mode 100644 index 0000000..ce90519 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsDesign.java @@ -0,0 +1,123 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 页面管理记录表 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsDesign对象", description = "页面管理记录表") +public class CmsDesign implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "page_id", type = IdType.AUTO) + private Integer pageId; + + @Schema(description = "页面") + private String name; + + @Schema(description = "所属栏目ID") + private Integer categoryId; + + @Schema(description = "所属栏目") + @TableField(exist = false) + private String categoryName; + + @Schema(description = "页面模型") + private String model; + + @Schema(description = "页面关键词") + private String keywords; + + @Schema(description = "页面描述") + private String description; + + @Schema(description = "路由地址") + @TableField(exist = false) + private String path; + + @Schema(description = "组件路径") + @TableField(exist = false) + private String component; + + @Schema(description = "缩列图") + private String photo; + + @Schema(description = "购买链接") + private String buyUrl; + + @Schema(description = "页面样式") + private String style; + + @Schema(description = "页面内容") + private String content; + + @Schema(description = "是否开启布局") + private Boolean showLayout; + + @Schema(description = "页面布局") + @TableField(exist = false) + private String layout; + + @Schema(description = "是否显示banner") + private Boolean showBanner; + + @Schema(description = "是否显示Button") + private Boolean showButton; + + @Schema(description = "上级id, 0是顶级") + private Integer parentId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "国际化语言") + private String lang; + + @Schema(description = "用于同步翻译内容") + @TableField(exist = false) + private Integer langCategoryId; + + @Schema(description = "是否启用自动翻译") + private Boolean translation; + + @Schema(description = "设为首页") + private Integer home; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsDesignRecord.java b/src/main/java/com/gxwebsoft/cms/entity/CmsDesignRecord.java new file mode 100644 index 0000000..1b5552b --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsDesignRecord.java @@ -0,0 +1,76 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 页面组件表 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsDesignRecord对象", description = "页面组件表") +public class CmsDesignRecord implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "关联导航ID") + private Integer navigationId; + + @Schema(description = "组件") + private String title; + + @Schema(description = "组件标识") + private String dictCode; + + @Schema(description = "组件样式") + private String styles; + + @Schema(description = "卡片阴影显示时机") + private String shadow; + + @Schema(description = "页面关键词") + private String keywords; + + @Schema(description = "页面描述") + private String description; + + @Schema(description = "页面路由地址") + private String path; + + @Schema(description = "缩列图") + private String photo; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsDomain.java b/src/main/java/com/gxwebsoft/cms/entity/CmsDomain.java new file mode 100644 index 0000000..7d81bc0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsDomain.java @@ -0,0 +1,73 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 网站域名记录表 + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsDomain对象", description = "网站域名记录表") +public class CmsDomain implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "类型 0赠送域名 1绑定域名 ") + private Integer type; + + @Schema(description = "域名") + private String domain; + + @Schema(description = "主机记录") + private String hostName; + + @Schema(description = "记录值") + private String hostValue; + + @Schema(description = "状态") + private Integer status; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "网站ID") + private Integer websiteId; + + @Schema(description = "租户ID") + private Integer appId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsForm.java b/src/main/java/com/gxwebsoft/cms/entity/CmsForm.java new file mode 100644 index 0000000..f989863 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsForm.java @@ -0,0 +1,91 @@ +package com.gxwebsoft.cms.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 表单设计表 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsForm对象", description = "表单设计表") +public class CmsForm implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "form_id", type = IdType.AUTO) + private Integer formId; + + @Schema(description = "表单标题") + private String name; + + @Schema(description = "顶部图片") + private String photo; + + @Schema(description = "背景图片") + private String background; + + @Schema(description = "视频文件") + private String video; + + @Schema(description = "提交次数") + private Integer submitNumber; + + @Schema(description = "页面布局") + private String layout; + + @Schema(description = "是否隐藏顶部图片") + private Integer hidePhoto; + + @Schema(description = "是否隐藏背景图片") + private Integer hideBackground; + + @Schema(description = "是否隐藏视频") + private Integer hideVideo; + + @Schema(description = "背景图片透明度") + private BigDecimal opacity; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "国际化语言") + private String lang; + + @Schema(description = "商户ID") + private Long merchantId; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsFormRecord.java b/src/main/java/com/gxwebsoft/cms/entity/CmsFormRecord.java new file mode 100644 index 0000000..3040320 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsFormRecord.java @@ -0,0 +1,69 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 表单数据记录表 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsFormRecord对象", description = "表单数据记录表") +public class CmsFormRecord implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "form_record_id", type = IdType.AUTO) + private Integer formRecordId; + + @Schema(description = "手机号") + private String phone; + + @Schema(description = "表单数据") + private String formData; + + @Schema(description = "表单ID") + private Integer formId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "商户ID") + private Long merchantId; + + @Schema(description = "姓名") + private String name; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsLang.java b/src/main/java/com/gxwebsoft/cms/entity/CmsLang.java new file mode 100644 index 0000000..5df6393 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsLang.java @@ -0,0 +1,61 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 国际化 + * + * @author 科技小王子 + * @since 2025-01-06 19:29:26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsLang对象", description = "国际化") +public class CmsLang implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "名称") + private String name; + + @Schema(description = "编码") + private String code; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsLangLog.java b/src/main/java/com/gxwebsoft/cms/entity/CmsLangLog.java new file mode 100644 index 0000000..a590e5d --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsLangLog.java @@ -0,0 +1,46 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 国际化记录启用 + * + * @author 科技小王子 + * @since 2025-01-06 19:29:26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsLangLog对象", description = "国际化记录启用") +public class CmsLangLog implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "名称") + private String lang; + + @Schema(description = "关联ID") + private Integer langId; + + @Schema(description = "编码") + private String code; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsLink.java b/src/main/java/com/gxwebsoft/cms/entity/CmsLink.java new file mode 100644 index 0000000..93e61bb --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsLink.java @@ -0,0 +1,80 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 常用链接 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsLink对象", description = "常用链接") +public class CmsLink implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "链接名称") + private String name; + + @Schema(description = "图标") + private String icon; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "栏目ID") + private Integer categoryId; + + @Schema(description = "应用ID") + private Integer appId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "国际化语言") + private String lang; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "状态, 0正常, 1待确认") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "栏目名称") + @TableField(exist = false) + private String categoryName; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsModel.java b/src/main/java/com/gxwebsoft/cms/entity/CmsModel.java new file mode 100644 index 0000000..97c5943 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsModel.java @@ -0,0 +1,97 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 模型 + * + * @author 科技小王子 + * @since 2024-11-26 15:44:53 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsModel对象", description = "模型") +public class CmsModel implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "model_id", type = IdType.AUTO) + private Integer modelId; + + @Schema(description = "模型名称") + private String name; + + @Schema(description = "唯一标识") + private String model; + + @Schema(description = "列表页路径") + private String component; + + @Schema(description = "详情页路径") + private String componentDetail; + + @Schema(description = "模型banner图片") + private String banner; + + @Schema(description = "文章后缀") + private String suffix; + + @Schema(description = "拇指图片") + private String thumb; + + @Schema(description = "封面图宽") + private String imageWidth; + + @Schema(description = "封面图高") + private String imageHeight; + + @Schema(description = "css样式") + private String style; + + @Schema(description = "Banner上的标题") + private String title; + + @Schema(description = "列表显示方式(10小图展示 20大图展示)") + private Integer showType; + + @Schema(description = "是否禁用") + private Boolean disabled; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsNavigation.java b/src/main/java/com/gxwebsoft/cms/entity/CmsNavigation.java new file mode 100644 index 0000000..449cf54 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsNavigation.java @@ -0,0 +1,242 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.util.List; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 网站导航记录表 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsNavigation对象", description = "网站导航记录表") +public class CmsNavigation implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "navigation_id", type = IdType.AUTO) + private Integer navigationId; + + @Schema(description = "类型, 0列表 1图文") + private Integer type; + + @Schema(description = "菜单名称") + private String title; + + @Schema(description = "上级id, 0是顶级") + private Integer parentId; + + @Schema(description = "模型") + private String model; + + @Schema(description = "模型名称") + @TableField(exist = false) + private String modelName; + + @Schema(description = "标识") + private String code; + + @Schema(description = "菜单路由地址") + private String path; + + @Schema(description = "菜单组件地址, 目录可为空") + private String component; + + @Schema(description = "文件后缀") + @TableField(exist = false) + private String suffix; + + @Schema(description = "打开位置") + private String target; + + @Schema(description = "菜单图标") + private String icon; + + @Schema(description = "banner") + @TableField(exist = false) + private String banner; + + @Schema(description = "移动端banner") + @TableField(exist = false) + private String mpBanner; + + @Schema(description = "图标颜色") + private String color; + + @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") + private Integer hide; + + @Schema(description = "可见类型 0所有人 1登录可见 2密码可见") + private Integer permission; + + @Schema(description = "访问密码") + private String password; + + @Schema(description = "验证密码(前端回传)") + @TableField(exist = false) + private String password2; + + @Schema(description = "位置 0不限 1顶部 2底部") + private Integer position; + + @Schema(description = "仅在顶部显示") + private Integer top; + + @Schema(description = "仅在底部显示") + private Integer bottom; + + @Schema(description = "菜单侧栏选中的path") + private String active; + + @Schema(description = "其它路由元信息") + private String meta; + + @Schema(description = "css样式") + private String style; + + @Schema(description = "父级栏目路由") + private String parentPath; + + @Schema(description = "父级栏目名称") + private String parentName; + + @Schema(description = "父级栏目位置") + @TableField(exist = false) + private Integer parentPosition; + + @Schema(description = "绑定的页面(已废弃)") + private Integer pageId; + + @Schema(description = "详情页ID") + private Integer itemId; + + @Schema(description = "是否微信小程序菜单") + private Boolean isMpWeixin; + + @Schema(description = "菜单间距") + private Integer gutter; + + @Schema(description = "菜单宽度") + private Integer span; + + @Schema(description = "阅读量") + private Integer readNum; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "商户ID") + private Long merchantId; + + @Schema(description = "国际化语言") + private String lang; + + @Schema(description = "用于同步翻译内容") + private Integer langCategoryId; + + @Schema(description = "设为首页") + private Integer home; + + @Schema(description = "是否推荐") + private Boolean recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonIgnore // 导航的创建时间前端不需要 + private LocalDateTime createTime; + + + @Schema(description = "页面名称") + @TableField(exist = false) + private String pageName; + + @Schema(description = "子菜单") + @TableField(exist = false) + private List children; + + @Schema(description = "页面布局") + @TableField(exist = false) + private String layout; + + @Schema(description = "关联的页面") + @TableField(exist = false) + private CmsDesign design; + + @Schema(description = "所属模型") + @TableField(exist = false) + private CmsModel modelInfo; + + @Schema(description = "父级栏目") + @TableField(exist = false) + private CmsNavigation parent; + + @Schema(description = "当前栏目名称") + @TableField(exist = false) + private String categoryName; + + @Schema(description = "当前栏目链接") + @TableField(exist = false) + private String categoryPath; + + @Schema(description = "栏目图片") + @TableField(exist = false) + private String photo; + + @Schema(description = "是否开启布局") + @TableField(exist = false) + private Boolean showLayout; + + @Schema(description = "单页内容") + @TableField(exist = false) + private String content; + + @Schema(description = "是否显示banner") + @TableField(exist = false) + private Boolean showBanner; + + @Schema(description = "菜单标题") + @TableField(exist = false) + private String text; + + public String getCategoryName() { + return this.title; + } + + public String getCategoryPath() { + return this.path; + } + + public String getText() { + return this.title; + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsOrder.java b/src/main/java/com/gxwebsoft/cms/entity/CmsOrder.java new file mode 100644 index 0000000..8869d1e --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsOrder.java @@ -0,0 +1,266 @@ +package com.gxwebsoft.cms.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 网站订单 + * + * @author 科技小王子 + * @since 2026-01-27 13:03:24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsOrder对象", description = "网站订单") +public class CmsOrder implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "订单类型,0售前咨询 1售后服务 2意见反馈") + private Integer type; + + @Schema(description = "订单标题") + private String title; + + @Schema(description = "公司/团队名称") + private String company; + + @Schema(description = "订单内容") + private String content; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "快递/自提") + private Integer deliveryType; + + @Schema(description = "下单渠道,0网站 1微信小程序 2其他") + private Integer channel; + + @Schema(description = "微信支付交易号号") + private String transactionId; + + @Schema(description = "微信退款订单号") + private String refundOrder; + + @Schema(description = "商户ID") + private Integer merchantId; + + @Schema(description = "商户名称") + private String merchantName; + + @Schema(description = "商户编号") + private String merchantCode; + + @Schema(description = "使用的优惠券id") + private Integer couponId; + + @Schema(description = "使用的会员卡id") + private String cardId; + + @Schema(description = "关联管理员id") + private Integer adminId; + + @Schema(description = "核销管理员id") + private Integer confirmId; + + @Schema(description = "IC卡号") + private String icCard; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "关联收货地址") + private Integer addressId; + + @Schema(description = "收货地址") + private String address; + + private String addressLat; + + private String addressLng; + + @Schema(description = "自提店铺id") + private Integer selfTakeMerchantId; + + @Schema(description = "自提店铺") + private String selfTakeMerchantName; + + @Schema(description = "配送开始时间") + private String sendStartTime; + + @Schema(description = "配送结束时间") + private String sendEndTime; + + @Schema(description = "发货店铺id") + private Integer expressMerchantId; + + @Schema(description = "发货店铺") + private String expressMerchantName; + + @Schema(description = "订单总额") + private BigDecimal totalPrice; + + @Schema(description = "减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格") + private BigDecimal reducePrice; + + @Schema(description = "实际付款") + private BigDecimal payPrice; + + @Schema(description = "用于统计") + private BigDecimal price; + + @Schema(description = "价钱,用于积分赠送") + private BigDecimal money; + + @Schema(description = "取消时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime cancelTime; + + @Schema(description = "取消原因") + private String cancelReason; + + @Schema(description = "退款金额") + private BigDecimal refundMoney; + + @Schema(description = "教练价格") + private BigDecimal coachPrice; + + @Schema(description = "购买数量") + private Integer totalNum; + + @Schema(description = "教练id") + private Integer coachId; + + @Schema(description = "商品ID") + private Integer formId; + + @Schema(description = "支付的用户id") + private Integer payUserId; + + @Schema(description = "0余额支付,1微信支付,2支付宝支付,3银联支付,4现金支付,5POS机支付,6免费,7积分支付") + private Integer payType; + + @Schema(description = "微信支付子类型:JSAPI小程序支付,NATIVE扫码支付") + private String wechatPayType; + + @Schema(description = "0余额支付,1微信支付,2支付宝支付,3银联支付,4现金支付,5POS机支付,6免费,7积分支付") + private Integer friendPayType; + + @Schema(description = "0未付款,1已付款") + private Integer payStatus; + + @Schema(description = "0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款") + private Integer orderStatus; + + @Schema(description = "发货状态(10未发货 20已发货 30部分发货)") + private Integer deliveryStatus; + + @Schema(description = "无需发货备注") + private String deliveryNote; + + @Schema(description = "发货时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime deliveryTime; + + @Schema(description = "评价状态(0未评价 1已评价)") + private Integer evaluateStatus; + + @Schema(description = "评价时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime evaluateTime; + + @Schema(description = "优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡") + private Integer couponType; + + @Schema(description = "优惠说明") + private String couponDesc; + + @Schema(description = "二维码地址,保存订单号,支付成功后才生成") + private String qrcode; + + @Schema(description = "vip月卡年卡、ic月卡年卡回退次数") + private Integer returnNum; + + @Schema(description = "vip充值回退金额") + private BigDecimal returnMoney; + + @Schema(description = "预约详情开始时间数组") + private String startTime; + + @Schema(description = "是否已开具发票:0未开发票,1已开发票,2不能开具发票") + private Integer isInvoice; + + @Schema(description = "发票流水号") + private String invoiceNo; + + @Schema(description = "商家留言") + private String merchantRemarks; + + @Schema(description = "支付时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime payTime; + + @Schema(description = "退款时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime refundTime; + + @Schema(description = "申请退款时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime refundApplyTime; + + @Schema(description = "过期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime expirationTime; + + @Schema(description = "自提码") + private String selfTakeCode; + + @Schema(description = "是否已收到赠品") + private Boolean hasTakeGift; + + @Schema(description = "对账情况:0=未对账;1=已对账;3=已对账,金额对不上;4=未查询到该订单") + private Integer checkBill; + + @Schema(description = "订单是否已结算(0未结算 1已结算)") + private Integer isSettled; + + @Schema(description = "系统版本号 0当前版本 value=其他版本") + private Integer version; + + @Schema(description = "用户id") + private Integer userId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsStatistics.java b/src/main/java/com/gxwebsoft/cms/entity/CmsStatistics.java new file mode 100644 index 0000000..9ff97d4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsStatistics.java @@ -0,0 +1,126 @@ +package com.gxwebsoft.cms.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import java.time.LocalDate; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 站点统计信息表 + * + * @author 科技小王子 + * @since 2025-07-25 12:32:06 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsStatistics对象", description = "站点统计信息表") +public class CmsStatistics implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "站点ID") + private Integer websiteId; + + @Schema(description = "用户总数") + private Integer userCount; + + @Schema(description = "订单总数") + private Integer orderCount; + + @Schema(description = "商品总数") + private Integer productCount; + + @Schema(description = "总销售额") + private BigDecimal totalSales; + + @Schema(description = "本月销售额") + private BigDecimal monthSales; + + @Schema(description = "今日销售额") + private BigDecimal todaySales; + + @Schema(description = "昨日销售额") + private BigDecimal yesterdaySales; + + @Schema(description = "本周销售额") + private BigDecimal weekSales; + + @Schema(description = "本年销售额") + private BigDecimal yearSales; + + @Schema(description = "今日订单数") + private Integer todayOrders; + + @Schema(description = "本月订单数") + private Integer monthOrders; + + @Schema(description = "今日新增用户") + private Integer todayUsers; + + @Schema(description = "本月新增用户") + private Integer monthUsers; + + @Schema(description = "今日访问量") + private Integer todayVisits; + + @Schema(description = "总访问量") + private Integer totalVisits; + + @Schema(description = "商户总数") + private Integer merchantCount; + + @Schema(description = "活跃用户数") + private Integer activeUsers; + + @Schema(description = "转化率(%)") + private BigDecimal conversionRate; + + @Schema(description = "平均订单金额") + private BigDecimal avgOrderAmount; + + @Schema(description = "统计日期") + private LocalDate statisticsDate; + + @Schema(description = "统计类型: 1日统计, 2月统计, 3年统计") + private Integer statisticsType; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "操作用户ID") + private Integer userId; + + @Schema(description = "商户ID") + private Integer merchantId; + + @Schema(description = "状态: 0禁用, 1启用") + private Boolean status; + + @Schema(description = "是否删除: 0否, 1是") + @TableLogic + private Boolean deleted; + + @Schema(description = "租户ID") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsTemplate.java b/src/main/java/com/gxwebsoft/cms/entity/CmsTemplate.java new file mode 100644 index 0000000..6af939d --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsTemplate.java @@ -0,0 +1,98 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 网站模版 + * + * @author 科技小王子 + * @since 2025-01-21 14:21:16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsTemplate对象", description = "网站模版") +public class CmsTemplate implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "模版名称") + private String name; + + @Schema(description = "模版标识") + private String code; + + @Schema(description = "缩列图") + private String image; + + @Schema(description = "类型 1企业官网 2其他") + private Integer type; + + @Schema(description = "网站关键词") + private String keywords; + + @Schema(description = "域名前缀") + private String prefix; + + @Schema(description = "预览地址") + private String domain; + + @Schema(description = "模版下载地址") + private String downUrl; + + @Schema(description = "色系") + private String color; + + @Schema(description = "应用版本 10免费版 20授权版 30永久授权") + private Integer version; + + @Schema(description = "行业类型(父级)") + private String industryParent; + + @Schema(description = "行业类型(子级)") + private String industryChild; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Boolean recommend; + + @Schema(description = "是否共享模板") + private Boolean share; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsWebsite.java b/src/main/java/com/gxwebsoft/cms/entity/CmsWebsite.java new file mode 100644 index 0000000..46bec1c --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsWebsite.java @@ -0,0 +1,327 @@ +package com.gxwebsoft.cms.entity; + +import cn.hutool.core.util.DesensitizedUtil; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 网站信息记录表 + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsWebsite对象", description = "网站信息记录表") +public class CmsWebsite implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "站点ID") + @TableId(value = "website_id", type = IdType.AUTO) + private Integer websiteId; + + @Schema(description = "网站名称") + private String websiteName; + + @Schema(description = "网站标识") + private String websiteCode; + + @Schema(description = "网站密钥") + private String websiteSecret; + + @Schema(description = "网站LOGO") + private String websiteIcon; + + @Schema(description = "网站LOGO") + private String websiteLogo; + + @Schema(description = "网站LOGO(深色模式)") + private String websiteDarkLogo; + + @Schema(description = "网站类型") + private String websiteType; + + @Schema(description = "栏目ID") + private Integer categoryId; + + @Schema(description = "应用ID") + @TableField(exist = false) + private Integer appId; + + @Schema(description = "网站截图") + private String files; + + @Schema(description = "网站类型 10企业官网 20微信小程序 30APP 40其他") + private Integer type; + + @Schema(description = "网站关键词") + private String keywords; + + @Schema(description = "域名前缀") + private String prefix; + + @Schema(description = "绑定域名") + private String domain; + + @Schema(description = "全局样式") + private String style; + + @Schema(description = "后台管理地址") + private String adminUrl; + + @Schema(description = "自定义API接口") + private String apiUrl; + + @Schema(description = "应用版本 10免费版 20授权版 30永久授权") + private Integer version; + + @Schema(description = "服务到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date expirationTime; + + @Schema(description = "是否到期") + @TableField(exist = false) + private Integer expired; + + @Schema(description = "剩余天数") + @TableField(exist = false) + private Long expiredDays; + + @Schema(description = "服务器ID") + private Integer assetsId; + + @Schema(description = "服务器ID") + private String assetsName; + + @Schema(description = "模版ID(存克隆的租户UID)") + private Integer templateId; + + @Schema(description = "模版名称") + @TableField(exist = false) + private String templateName; + + @Schema(description = "行业类型(父级)") + private String industryParent; + + @Schema(description = "行业类型(子级)") + private String industryChild; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "开发者名称") + private String developer; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "联系电话") + private String phone; + + @Schema(description = "电子邮箱") + private String email; + + @Schema(description = "ICP备案号") + private String icpNo; + + @Schema(description = "公安备案") + private String policeNo; + + @Schema(description = "网站描述") + private String content; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "管理员备注") + private String remarks; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "是否官方产品") + private Boolean official; + + @Schema(description = "允许展示到插件市场") + private Boolean market; + + @Schema(description = "是否插件类型 0应用 1插件") + private Boolean plugin; + + @Schema(description = "允许被搜索") + private Boolean search; + + @Schema(description = "主题色") + private String color; + + @Schema(description = "运行状态 0运行中 1已关闭 2维护中") + private Integer running; + + @Schema(description = "即将过期") + private Integer soon; + + @Schema(description = "评分") + private BigDecimal rate; + + @Schema(description = "点赞数量") + private Integer likes; + + @Schema(description = "点击数量") + private Integer clicks; + + @Schema(description = "购买数量") + private Integer buys; + + @Schema(description = "下载数量") + private Integer downloads; + + @Schema(description = "销售价格") + private BigDecimal price; + + @Schema(description = "交付方式") + private Integer deliveryMethod; + + @Schema(description = "计费方式") + private Integer chargingMethod; + + @Schema(description = "状态 0未开通 1运行中 2维护中 3已关闭 4已欠费停机 5违规关停") + private Integer status; + + @Schema(description = "状态图标") + @TableField(exist = false) + private String statusIcon; + + @Schema(description = "维护说明") + private String statusText; + + @Schema(description = "关闭说明") + private String statusClose; + + @Schema(description = "全局样式") + private String styles; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "商户ID") + private Long merchantId; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "租户名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + @Schema(description = "预设字段") + @TableField(exist = false) + private List fields; + + @Schema(description = "小程序导航图标") + @TableField(exist = false) + private Map> mpMenus; + + @Schema(description = "网站导航栏") + @TableField(exist = false) + private List navigations; + + @Schema(description = "顶部菜单") + @TableField(exist = false) + private List topNavs; + + @Schema(description = "底部菜单") + @TableField(exist = false) + private List bottomNavs; + + @Schema(description = "幻灯片广告") + @TableField(exist = false) + private CmsAd slide; + + @Schema(description = "站点广告") + @TableField(exist = false) + private List ads; + + @Schema(description = "首页布局") + @TableField(exist = false) + private String layout; + + @Schema(description = "友情链接") + @TableField(exist = false) + private List links; + + @Schema(description = "配置信息") + @TableField(exist = false) + private Object config; + + @Schema(description = "服务器时间") + @TableField(exist = false) + private HashMap serverTime; + + @Schema(description = "当前登录用户") + @TableField(exist = false) + private User loginUser; + + @Schema(description = "超管账号") + @TableField(exist = false) + private String superAdminPhone; + + @Schema(description = "是否登录") + @TableField(exist = false) + private Boolean isLogin; + + @Schema(description = "网站设置") + @TableField(exist = false) + private CmsWebsiteSetting setting; + + public String getPhone(){ + return DesensitizedUtil.mobilePhone(this.phone); + } +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsWebsiteField.java b/src/main/java/com/gxwebsoft/cms/entity/CmsWebsiteField.java new file mode 100644 index 0000000..03c451e --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsWebsiteField.java @@ -0,0 +1,75 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 应用参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsWebsiteField对象", description = "应用参数") +public class CmsWebsiteField implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "类型,0文本 1图片 2其他") + private Integer type; + + @Schema(description = "名称") + private String name; + + @Schema(description = "默认值") + private String defaultValue; + + @Schema(description = "可修改的值 [on|off]") + private String modifyRange; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "css样式") + private String style; + + @Schema(description = "名称") + private String value; + + @Schema(description = "国际化语言") + private String lang; + + @Schema(description = "是否加密") + private Boolean encrypted; + + @Schema(description = "商户ID") + private Long merchantId; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsWebsiteSetting.java b/src/main/java/com/gxwebsoft/cms/entity/CmsWebsiteSetting.java new file mode 100644 index 0000000..157ed7d --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsWebsiteSetting.java @@ -0,0 +1,89 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 网站设置 + * + * @author 科技小王子 + * @since 2025-02-19 01:35:44 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CmsWebsiteSetting对象", description = "网站设置") +public class CmsWebsiteSetting implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "关联网站ID") + private Integer websiteId; + + @Schema(description = "是否官方插件") + private Boolean official; + + @Schema(description = "是否展示在插件市场") + private Boolean market; + + @Schema(description = "是否允许被搜索") + private Boolean search; + + @Schema(description = "是否共享") + private Boolean share; + + @Schema(description = "文章是否需要审核") + private Boolean articleReview; + + @Schema(description = "是否插件 0应用1 插件 ") + private Boolean plugin; + + @Schema(description = "编辑器类型 1 富文本编辑器 2 Markdown编辑器") + private Integer editor; + + @Schema(description = "显示站内搜索") + private Boolean searchBtn; + + @Schema(description = "显示登录注册功能") + private Boolean loginBtn; + + @Schema(description = "显示悬浮客服工具") + private Boolean floatTool; + + @Schema(description = "显示版权链接") + private Boolean copyrightLink; + + @Schema(description = "导航栏最多显示数量") + private Boolean maxMenuNum; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/TranslateDataVo.java b/src/main/java/com/gxwebsoft/cms/entity/TranslateDataVo.java new file mode 100644 index 0000000..43e9ba7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/TranslateDataVo.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "翻译结果", description = "翻译结果") +public class TranslateDataVo implements Serializable { + + @Schema(description = "文本格式") + private String FormatType; + + @Schema(description = "原文语言") + private String SourceLanguage; + + @Schema(description = "译文语言") + private String TargetLanguage; + + @Schema(description = "待翻译内容") + private String SourceText; + + @Schema(description = "场景可选取值:商品标题(title),商品描述(description),商品沟通(communication),医疗(medical),社交(social),金融(finance)") + private String Scene; + + @Schema(description = "上下文信息") + private String Context; + + @Schema(description = "翻译结果") + private String translated; + + @Schema(description = "总单词数") + private String wordCount; + + @Schema(description = "源语言传入 auto 时,语种识别后的源语言代码") + private String detectedLanguage; + +} diff --git a/src/main/java/com/gxwebsoft/cms/entity/TranslateVo.java b/src/main/java/com/gxwebsoft/cms/entity/TranslateVo.java new file mode 100644 index 0000000..1a988a2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/entity/TranslateVo.java @@ -0,0 +1,30 @@ +package com.gxwebsoft.cms.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "阿里云机器翻译", description = "阿里云机器翻译") +public class TranslateVo implements Serializable { + + @Schema(description = "错误码") + private String Code; + + @Schema(description = "错误信息") + @JsonIgnoreProperties(ignoreUnknown = true) + private String Message; + + @Schema(description = "请求ID") + private String RequestId; + + @Schema(description = "返回数据") + private TranslateDataVo Data; + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsAdMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsAdMapper.java new file mode 100644 index 0000000..836fa83 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsAdMapper.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsAd; +import com.gxwebsoft.cms.entity.CmsLangLog; +import com.gxwebsoft.cms.param.CmsAdParam; +import com.gxwebsoft.cms.param.CmsLangLogParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 广告位Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsAdMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsAdParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsAdParam param); + + @InterceptorIgnore(tenantLine = "true") + List selectListAllRel(@Param("param") CmsAdParam param); +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsAdRecordMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsAdRecordMapper.java new file mode 100644 index 0000000..329956e --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsAdRecordMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsAdRecord; +import com.gxwebsoft.cms.param.CmsAdRecordParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 广告图片Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsAdRecordMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsAdRecordParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsAdRecordParam param); + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsArticleCategoryMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsArticleCategoryMapper.java new file mode 100644 index 0000000..d540f29 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsArticleCategoryMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsArticleCategory; +import com.gxwebsoft.cms.param.CmsArticleCategoryParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 文章分类表Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsArticleCategoryMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsArticleCategoryParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsArticleCategoryParam param); + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsArticleCommentMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsArticleCommentMapper.java new file mode 100644 index 0000000..ed20748 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsArticleCommentMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsArticleComment; +import com.gxwebsoft.cms.param.CmsArticleCommentParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 文章评论表Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsArticleCommentMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsArticleCommentParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsArticleCommentParam param); + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsArticleContentMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsArticleContentMapper.java new file mode 100644 index 0000000..2a39ca9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsArticleContentMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsArticleContent; +import com.gxwebsoft.cms.param.CmsArticleContentParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 文章记录表Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsArticleContentMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsArticleContentParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsArticleContentParam param); + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsArticleCountMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsArticleCountMapper.java new file mode 100644 index 0000000..596a640 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsArticleCountMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsArticleCount; +import com.gxwebsoft.cms.param.CmsArticleCountParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 点赞文章Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsArticleCountMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsArticleCountParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsArticleCountParam param); + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsArticleLikeMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsArticleLikeMapper.java new file mode 100644 index 0000000..f6eba4b --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsArticleLikeMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsArticleLike; +import com.gxwebsoft.cms.param.CmsArticleLikeParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 点赞文章Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsArticleLikeMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsArticleLikeParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsArticleLikeParam param); + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsArticleMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsArticleMapper.java new file mode 100644 index 0000000..18c2506 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsArticleMapper.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsArticle; +import com.gxwebsoft.cms.entity.CmsLangLog; +import com.gxwebsoft.cms.param.CmsArticleParam; +import com.gxwebsoft.cms.param.CmsLangLogParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 文章Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsArticleMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsArticleParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsArticleParam param); + + + @InterceptorIgnore(tenantLine = "true") + List selectListAllRel(@Param("param") CmsArticleParam param); +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsDesignMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsDesignMapper.java new file mode 100644 index 0000000..5542ff7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsDesignMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsDesign; +import com.gxwebsoft.cms.param.CmsDesignParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 页面管理记录表Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsDesignMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsDesignParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsDesignParam param); + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsDesignRecordMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsDesignRecordMapper.java new file mode 100644 index 0000000..dd25171 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsDesignRecordMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsDesignRecord; +import com.gxwebsoft.cms.param.CmsDesignRecordParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 页面组件表Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsDesignRecordMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsDesignRecordParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsDesignRecordParam param); + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsDomainMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsDomainMapper.java new file mode 100644 index 0000000..e561b20 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsDomainMapper.java @@ -0,0 +1,40 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsDomain; +import com.gxwebsoft.cms.param.CmsDomainParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 网站域名记录表Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +public interface CmsDomainMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsDomainParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsDomainParam param); + + @InterceptorIgnore(tenantLine = "true") + CmsDomain getDomain(@Param("domain") String domain); +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsFormMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsFormMapper.java new file mode 100644 index 0000000..ab12d1a --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsFormMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsForm; +import com.gxwebsoft.cms.param.CmsFormParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 表单设计表Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsFormMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsFormParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsFormParam param); + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsFormRecordMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsFormRecordMapper.java new file mode 100644 index 0000000..b766f7b --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsFormRecordMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsFormRecord; +import com.gxwebsoft.cms.param.CmsFormRecordParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 表单数据记录表Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsFormRecordMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsFormRecordParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsFormRecordParam param); + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsLangLogMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsLangLogMapper.java new file mode 100644 index 0000000..70c8678 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsLangLogMapper.java @@ -0,0 +1,41 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsLangLog; +import com.gxwebsoft.cms.param.CmsLangLogParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 国际化记录启用Mapper + * + * @author 科技小王子 + * @since 2025-01-06 19:29:26 + */ +public interface CmsLangLogMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsLangLogParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsLangLogParam param); + + @InterceptorIgnore(tenantLine = "true") + List selectListAllRel(@Param("param") CmsLangLogParam param); + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsLangMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsLangMapper.java new file mode 100644 index 0000000..b8705df --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsLangMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsLang; +import com.gxwebsoft.cms.param.CmsLangParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 国际化Mapper + * + * @author 科技小王子 + * @since 2025-01-06 19:29:26 + */ +public interface CmsLangMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsLangParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsLangParam param); + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsLinkMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsLinkMapper.java new file mode 100644 index 0000000..915b1f1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsLinkMapper.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsLangLog; +import com.gxwebsoft.cms.entity.CmsLink; +import com.gxwebsoft.cms.param.CmsLangLogParam; +import com.gxwebsoft.cms.param.CmsLinkParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 常用链接Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsLinkMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsLinkParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsLinkParam param); + + + @InterceptorIgnore(tenantLine = "true") + List selectListAllRel(@Param("param") CmsLinkParam param); +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsModelMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsModelMapper.java new file mode 100644 index 0000000..6fe0a36 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsModelMapper.java @@ -0,0 +1,41 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsModel; +import com.gxwebsoft.cms.param.CmsModelParam; +import com.gxwebsoft.cms.param.CmsWebsiteFieldParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 模型Mapper + * + * @author 科技小王子 + * @since 2024-11-26 15:44:53 + */ +public interface CmsModelMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsModelParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsModelParam param); + + @InterceptorIgnore(tenantLine = "true") + List selectListAllRel(@Param("param") CmsModelParam param); +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsNavigationMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsNavigationMapper.java new file mode 100644 index 0000000..e0fcfac --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsNavigationMapper.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsModel; +import com.gxwebsoft.cms.entity.CmsNavigation; +import com.gxwebsoft.cms.param.CmsModelParam; +import com.gxwebsoft.cms.param.CmsNavigationParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 网站导航记录表Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsNavigationMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsNavigationParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsNavigationParam param); + + + @InterceptorIgnore(tenantLine = "true") + List selectListAllRel(@Param("param") CmsNavigationParam param); + + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsOrderMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsOrderMapper.java new file mode 100644 index 0000000..021fb93 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsOrderMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsOrder; +import com.gxwebsoft.cms.param.CmsOrderParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 网站订单Mapper + * + * @author 科技小王子 + * @since 2026-01-27 13:03:24 + */ +public interface CmsOrderMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsOrderParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsOrderParam param); + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsStatisticsMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsStatisticsMapper.java new file mode 100644 index 0000000..160d5be --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsStatisticsMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsStatistics; +import com.gxwebsoft.cms.param.CmsStatisticsParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 站点统计信息表Mapper + * + * @author 科技小王子 + * @since 2025-07-25 12:32:06 + */ +public interface CmsStatisticsMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsStatisticsParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsStatisticsParam param); + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsTemplateMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsTemplateMapper.java new file mode 100644 index 0000000..7cd4485 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsTemplateMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsTemplate; +import com.gxwebsoft.cms.param.CmsTemplateParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 网站模版Mapper + * + * @author 科技小王子 + * @since 2025-01-21 14:21:16 + */ +public interface CmsTemplateMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsTemplateParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsTemplateParam param); + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsWebsiteFieldMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsWebsiteFieldMapper.java new file mode 100644 index 0000000..e4c7e79 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsWebsiteFieldMapper.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsWebsiteField; +import com.gxwebsoft.cms.param.CmsWebsiteFieldParam; +import org.apache.ibatis.annotations.Param; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * 应用参数Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +public interface CmsWebsiteFieldMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsWebsiteFieldParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsWebsiteFieldParam param); + + + @InterceptorIgnore(tenantLine = "true") + List selectListAllRel(@Param("param") CmsWebsiteFieldParam param); + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsWebsiteMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsWebsiteMapper.java new file mode 100644 index 0000000..c24e345 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsWebsiteMapper.java @@ -0,0 +1,53 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsWebsite; +import com.gxwebsoft.cms.param.CmsWebsiteParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 网站信息记录表Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +public interface CmsWebsiteMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsWebsiteParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsWebsiteParam param); + + @InterceptorIgnore(tenantLine = "true") + List selectPageRelAll(@Param("page") IPage page, + @Param("param") CmsWebsiteParam param); + + @InterceptorIgnore(tenantLine = "true") + CmsWebsite getByIdRelAll(@Param("websiteId") Integer id); + + @InterceptorIgnore(tenantLine = "true") + boolean updateByIdAll(@Param("param") CmsWebsite cmsWebsite); + + @InterceptorIgnore(tenantLine = "true") + boolean removeByIdAll(@Param("websiteId") Integer id); + + @InterceptorIgnore(tenantLine = "true") + CmsWebsite getByTenantId(@Param("tenantId") Integer tenantId); +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/CmsWebsiteSettingMapper.java b/src/main/java/com/gxwebsoft/cms/mapper/CmsWebsiteSettingMapper.java new file mode 100644 index 0000000..dc468fd --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/CmsWebsiteSettingMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.cms.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsWebsiteSetting; +import com.gxwebsoft.cms.param.CmsWebsiteSettingParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 网站设置Mapper + * + * @author 科技小王子 + * @since 2025-02-19 01:35:44 + */ +public interface CmsWebsiteSettingMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CmsWebsiteSettingParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CmsWebsiteSettingParam param); + +} diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsAdMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsAdMapper.xml new file mode 100644 index 0000000..6ee7cbf --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsAdMapper.xml @@ -0,0 +1,92 @@ + + + + + + + SELECT a.*, b.user_id as websiteUserId, c.title as categoryName + FROM cms_ad a + LEFT JOIN cms_website b ON a.tenant_id = b.tenant_id + LEFT JOIN cms_navigation c ON a.category_id = c.navigation_id + + + AND a.ad_id = #{param.adId} + + + AND a.type = #{param.type} + + + AND a.code = #{param.code} + + + AND a.category_id = #{param.categoryId} + + + AND a.lang = #{param.lang} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.width LIKE CONCAT('%', #{param.width}, '%') + + + AND a.height LIKE CONCAT('%', #{param.height}, '%') + + + AND a.images LIKE CONCAT('%', #{param.images}, '%') + + + AND a.path LIKE CONCAT('%', #{param.path}, '%') + + + AND a.user_id = #{param.userId} + + + AND b.user_id = #{param.websiteUserId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.ad_id = #{param.keywords} + ) + + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsAdRecordMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsAdRecordMapper.xml new file mode 100644 index 0000000..959667a --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsAdRecordMapper.xml @@ -0,0 +1,53 @@ + + + + + + + SELECT a.* + FROM cms_ad_record a + + + AND a.ad_record_id = #{param.adRecordId} + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.path LIKE CONCAT('%', #{param.path}, '%') + + + AND a.url LIKE CONCAT('%', #{param.url}, '%') + + + AND a.ad_id = #{param.adId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsArticleCategoryMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsArticleCategoryMapper.xml new file mode 100644 index 0000000..f548eb4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsArticleCategoryMapper.xml @@ -0,0 +1,86 @@ + + + + + + + SELECT a.* + FROM cms_article_category a + + + AND a.category_id = #{param.categoryId} + + + AND a.category_code LIKE CONCAT('%', #{param.categoryCode}, '%') + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.type = #{param.type} + + + AND a.image LIKE CONCAT('%', #{param.image}, '%') + + + AND a.parent_id = #{param.parentId} + + + AND a.path LIKE CONCAT('%', #{param.path}, '%') + + + AND a.component LIKE CONCAT('%', #{param.component}, '%') + + + AND a.page_id = #{param.pageId} + + + AND a.user_id = #{param.userId} + + + AND a.count = #{param.count} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.hide = #{param.hide} + + + AND a.recommend = #{param.recommend} + + + AND a.show_index = #{param.showIndex} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsArticleCommentMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsArticleCommentMapper.xml new file mode 100644 index 0000000..8d82a95 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsArticleCommentMapper.xml @@ -0,0 +1,71 @@ + + + + + + + SELECT a.* + FROM cms_article_comment a + + + AND a.comment_id = #{param.commentId} + + + AND a.article_id = #{param.articleId} + + + AND a.score = #{param.score} + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.is_picture = #{param.isPicture} + + + AND a.user_id = #{param.userId} + + + AND a.to_user_id = #{param.toUserId} + + + AND a.reply_comment_id = #{param.replyCommentId} + + + AND a.reply_user_id = #{param.replyUserId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsArticleContentMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsArticleContentMapper.xml new file mode 100644 index 0000000..de251b4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsArticleContentMapper.xml @@ -0,0 +1,38 @@ + + + + + + + SELECT a.* + FROM cms_article_content a + + + AND a.id = #{param.id} + + + AND a.article_id = #{param.articleId} + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsArticleCountMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsArticleCountMapper.xml new file mode 100644 index 0000000..d714ed3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsArticleCountMapper.xml @@ -0,0 +1,38 @@ + + + + + + + SELECT a.* + FROM cms_article_count a + + + AND a.id = #{param.id} + + + AND a.article_id = #{param.articleId} + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsArticleLikeMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsArticleLikeMapper.xml new file mode 100644 index 0000000..b33ff0c --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsArticleLikeMapper.xml @@ -0,0 +1,38 @@ + + + + + + + SELECT a.* + FROM cms_article_like a + + + AND a.id = #{param.id} + + + AND a.article_id = #{param.articleId} + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsArticleMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsArticleMapper.xml new file mode 100644 index 0000000..d46baf8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsArticleMapper.xml @@ -0,0 +1,187 @@ + + + + + + + SELECT a.*,b.title as categoryName,b.parent_Id as parentId, b.model,c.title as parentName,u.nickname,u.avatar + FROM cms_article a + LEFT JOIN cms_navigation b ON a.category_id = b.navigation_id + LEFT JOIN cms_navigation c ON b.parent_id = c.navigation_id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.article_id = #{param.articleId} + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.type = #{param.type} + + + AND a.lang = #{param.lang} + + + AND a.model = #{param.model} + + + AND a.code = #{param.code} + + + AND a.detail = #{param.detail} + + + AND a.show_type = #{param.showType} + + + AND a.topic LIKE CONCAT('%', #{param.topic}, '%') + + + AND a.category_id = #{param.categoryId} + + + AND a.category_id IN + + #{item} + + + + AND a.image LIKE CONCAT('%', #{param.image}, '%') + + + AND a.image != '' + + + AND a.source LIKE CONCAT('%', #{param.source}, '%') + + + AND a.virtual_views = #{param.virtualViews} + + + AND a.actual_views = #{param.actualViews} + + + AND a.platform LIKE CONCAT('%', #{param.platform}, '%') + + + AND a.files LIKE CONCAT('%', #{param.files}, '%') + + + AND a.video LIKE CONCAT('%', #{param.video}, '%') + + + AND a.accept LIKE CONCAT('%', #{param.accept}, '%') + + + AND a.longitude LIKE CONCAT('%', #{param.longitude}, '%') + + + AND a.latitude LIKE CONCAT('%', #{param.latitude}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.likes = #{param.likes} + + + AND a.comment_numbers = #{param.commentNumbers} + + + AND a.to_users LIKE CONCAT('%', #{param.toUsers}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.project_id = #{param.projectId} + + + AND a.tags LIKE CONCAT('%', #{param.tags}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND a.article_id IN + + #{item} + + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.article_id = #{param.keywords} + OR a.detail = #{param.keywords} + OR a.title LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsDesignMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsDesignMapper.xml new file mode 100644 index 0000000..def6547 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsDesignMapper.xml @@ -0,0 +1,93 @@ + + + + + + + SELECT a.*,b.lang_category_id, b.title as categoryName + FROM cms_design a + LEFT JOIN cms_navigation b ON a.category_id = b.navigation_id + + + AND a.page_id = #{param.pageId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.lang = #{param.lang} + + + AND a.category_id = #{param.categoryId} + + + AND a.model = #{param.model} + + + AND a.keywords LIKE CONCAT('%', #{param.keywords}, '%') + + + AND a.description LIKE CONCAT('%', #{param.description}, '%') + + + AND a.photo LIKE CONCAT('%', #{param.photo}, '%') + + + AND a.buy_url LIKE CONCAT('%', #{param.buyUrl}, '%') + + + AND a.style LIKE CONCAT('%', #{param.style}, '%') + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.show_layout = #{param.showLayout} + + + AND a.layout LIKE CONCAT('%', #{param.layout}, '%') + + + AND a.parent_id = #{param.parentId} + + + AND a.user_id = #{param.userId} + + + AND a.home = #{param.home} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsDesignRecordMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsDesignRecordMapper.xml new file mode 100644 index 0000000..0ff62ef --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsDesignRecordMapper.xml @@ -0,0 +1,71 @@ + + + + + + + SELECT a.* + FROM cms_design_record a + + + AND a.id = #{param.id} + + + AND a.navigation_id = #{param.navigationId} + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.dict_code LIKE CONCAT('%', #{param.dictCode}, '%') + + + AND a.styles LIKE CONCAT('%', #{param.styles}, '%') + + + AND a.shadow LIKE CONCAT('%', #{param.shadow}, '%') + + + AND a.keywords LIKE CONCAT('%', #{param.keywords}, '%') + + + AND a.description LIKE CONCAT('%', #{param.description}, '%') + + + AND a.path LIKE CONCAT('%', #{param.path}, '%') + + + AND a.photo LIKE CONCAT('%', #{param.photo}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsDomainMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsDomainMapper.xml new file mode 100644 index 0000000..dc39215 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsDomainMapper.xml @@ -0,0 +1,65 @@ + + + + + + + SELECT a.* + FROM cms_domain a + + + AND a.id = #{param.id} + + + AND a.type = #{param.type} + + + AND a.domain LIKE CONCAT('%', #{param.domain}, '%') + + + AND a.host_name LIKE CONCAT('%', #{param.hostName}, '%') + + + AND a.host_value LIKE CONCAT('%', #{param.hostValue}, '%') + + + AND a.status = #{param.status} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.website_id = #{param.websiteId} + + + AND a.app_id = #{param.appId} + + + AND a.user_id = #{param.userId} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsFormMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsFormMapper.xml new file mode 100644 index 0000000..5b2d2b1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsFormMapper.xml @@ -0,0 +1,83 @@ + + + + + + + SELECT a.* + FROM cms_form a + + + AND a.form_id = #{param.formId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.photo LIKE CONCAT('%', #{param.photo}, '%') + + + AND a.background LIKE CONCAT('%', #{param.background}, '%') + + + AND a.video LIKE CONCAT('%', #{param.video}, '%') + + + AND a.submit_number = #{param.submitNumber} + + + AND a.layout LIKE CONCAT('%', #{param.layout}, '%') + + + AND a.hide_photo = #{param.hidePhoto} + + + AND a.hide_background = #{param.hideBackground} + + + AND a.hide_video = #{param.hideVideo} + + + AND a.opacity = #{param.opacity} + + + AND a.user_id = #{param.userId} + + + AND a.merchant_id = #{param.merchantId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsFormRecordMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsFormRecordMapper.xml new file mode 100644 index 0000000..f646c1e --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsFormRecordMapper.xml @@ -0,0 +1,65 @@ + + + + + + + SELECT a.* + FROM cms_form_record a + + + AND a.form_record_id = #{param.formRecordId} + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.form_data LIKE CONCAT('%', #{param.formData}, '%') + + + AND a.form_id = #{param.formId} + + + AND a.user_id = #{param.userId} + + + AND a.merchant_id = #{param.merchantId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsLangLogMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsLangLogMapper.xml new file mode 100644 index 0000000..97d9bcb --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsLangLogMapper.xml @@ -0,0 +1,54 @@ + + + + + + + SELECT a.*, b.user_id as websiteUserId + FROM cms_lang_log a + LEFT JOIN cms_website b ON a.tenant_id = b.tenant_id + + + AND a.id = #{param.id} + + + AND a.lang LIKE CONCAT('%', #{param.lang}, '%') + + + AND a.lang_id = #{param.langId} + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND b.user_id = #{param.websiteUserId} + + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsLangMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsLangMapper.xml new file mode 100644 index 0000000..0dc0bed --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsLangMapper.xml @@ -0,0 +1,57 @@ + + + + + + + SELECT a.* + FROM cms_lang a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsLinkMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsLinkMapper.xml new file mode 100644 index 0000000..6102242 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsLinkMapper.xml @@ -0,0 +1,86 @@ + + + + + + + SELECT a.*, b.user_id as websiteUserId,c.title as categoryName + FROM cms_link a + LEFT JOIN cms_website b ON a.tenant_id = b.tenant_id + LEFT JOIN cms_navigation c ON a.category_id = c.navigation_id + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.lang = #{param.lang} + + + AND a.icon LIKE CONCAT('%', #{param.icon}, '%') + + + AND a.url LIKE CONCAT('%', #{param.url}, '%') + + + AND a.category_id LIKE CONCAT('%', #{param.categoryId}, '%') + + + AND a.app_id = #{param.appId} + + + AND a.user_id = #{param.userId} + + + AND b.user_id = #{param.websiteUserId} + + + AND a.recommend = #{param.recommend} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.id = #{param.keywords} + OR a.name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsModelMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsModelMapper.xml new file mode 100644 index 0000000..a948d9c --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsModelMapper.xml @@ -0,0 +1,89 @@ + + + + + + + SELECT a.*, b.user_id as websiteUserId + FROM cms_model a + LEFT JOIN cms_website b ON a.tenant_id = b.tenant_id + + + AND a.model_id = #{param.modelId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.model LIKE CONCAT('%', #{param.model}, '%') + + + AND a.component_detail LIKE CONCAT('%', #{param.componentDetail}, '%') + + + AND a.component LIKE CONCAT('%', #{param.component}, '%') + + + AND a.banner LIKE CONCAT('%', #{param.banner}, '%') + + + AND a.image_width = #{param.imageWidth} + + + AND a.image_height = #{param.imageHeight} + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.show_type = #{param.showType} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.user_id = #{param.userId} + + + AND b.user_id = #{param.websiteUserId} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsNavigationMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsNavigationMapper.xml new file mode 100644 index 0000000..20903aa --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsNavigationMapper.xml @@ -0,0 +1,162 @@ + + + + + + + SELECT a.*, b.title as parentName, b.position as parentPosition, c.name as modelName + FROM cms_navigation a + LEFT JOIN cms_navigation b ON a.parent_id = b.navigation_id + LEFT JOIN cms_model c ON a.model = c.model + + + AND a.navigation_id = #{param.navigationId} + + + AND a.parent_id = #{param.parentId} + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.model LIKE CONCAT('%', #{param.model}, '%') + + + AND a.lang = #{param.lang} + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.path LIKE CONCAT('%', #{param.path}, '%') + + + AND a.component LIKE CONCAT('%', #{param.component}, '%') + + + AND a.target LIKE CONCAT('%', #{param.target}, '%') + + + AND a.icon LIKE CONCAT('%', #{param.icon}, '%') + + + AND a.color LIKE CONCAT('%', #{param.color}, '%') + + + AND a.hide = #{param.hide} + + + AND a.permission = #{param.permission} + + + AND a.password LIKE CONCAT('%', #{param.password}, '%') + + + AND a.position = #{param.position} + + + AND a.top = #{param.top} + + + AND a.bottom = #{param.bottom} + + + AND a.active LIKE CONCAT('%', #{param.active}, '%') + + + AND a.meta LIKE CONCAT('%', #{param.meta}, '%') + + + AND a.style LIKE CONCAT('%', #{param.style}, '%') + + + AND a.parent_path LIKE CONCAT('%', #{param.parentPath}, '%') + + + AND a.parent_name LIKE CONCAT('%', #{param.parentName}, '%') + + + AND a.model_name LIKE CONCAT('%', #{param.modelName}, '%') + + + AND a.type = #{param.type} + + + AND a.page_id = #{param.pageId} + + + AND a.is_mp_weixin = #{param.isMpWeixin} + + + AND a.user_id = #{param.userId} + + + AND a.home = #{param.home} + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.path LIKE CONCAT('%', #{param.keywords}, '%') + OR a.title LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsOrderMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsOrderMapper.xml new file mode 100644 index 0000000..384388b --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsOrderMapper.xml @@ -0,0 +1,258 @@ + + + + + + + SELECT a.* + FROM cms_order a + + + AND a.id = #{param.id} + + + AND a.type = #{param.type} + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.company LIKE CONCAT('%', #{param.company}, '%') + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%') + + + AND a.delivery_type = #{param.deliveryType} + + + AND a.channel = #{param.channel} + + + AND a.transaction_id LIKE CONCAT('%', #{param.transactionId}, '%') + + + AND a.refund_order LIKE CONCAT('%', #{param.refundOrder}, '%') + + + AND a.merchant_id = #{param.merchantId} + + + AND a.merchant_name LIKE CONCAT('%', #{param.merchantName}, '%') + + + AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%') + + + AND a.coupon_id = #{param.couponId} + + + AND a.card_id LIKE CONCAT('%', #{param.cardId}, '%') + + + AND a.admin_id = #{param.adminId} + + + AND a.confirm_id = #{param.confirmId} + + + AND a.ic_card LIKE CONCAT('%', #{param.icCard}, '%') + + + AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') + + + AND a.address_id = #{param.addressId} + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.address_lat LIKE CONCAT('%', #{param.addressLat}, '%') + + + AND a.address_lng LIKE CONCAT('%', #{param.addressLng}, '%') + + + AND a.self_take_merchant_id = #{param.selfTakeMerchantId} + + + AND a.self_take_merchant_name LIKE CONCAT('%', #{param.selfTakeMerchantName}, '%') + + + AND a.send_start_time LIKE CONCAT('%', #{param.sendStartTime}, '%') + + + AND a.send_end_time LIKE CONCAT('%', #{param.sendEndTime}, '%') + + + AND a.express_merchant_id = #{param.expressMerchantId} + + + AND a.express_merchant_name LIKE CONCAT('%', #{param.expressMerchantName}, '%') + + + AND a.total_price = #{param.totalPrice} + + + AND a.reduce_price = #{param.reducePrice} + + + AND a.pay_price = #{param.payPrice} + + + AND a.price = #{param.price} + + + AND a.money = #{param.money} + + + AND a.cancel_time LIKE CONCAT('%', #{param.cancelTime}, '%') + + + AND a.cancel_reason LIKE CONCAT('%', #{param.cancelReason}, '%') + + + AND a.refund_money = #{param.refundMoney} + + + AND a.coach_price = #{param.coachPrice} + + + AND a.total_num = #{param.totalNum} + + + AND a.coach_id = #{param.coachId} + + + AND a.form_id = #{param.formId} + + + AND a.pay_user_id = #{param.payUserId} + + + AND a.pay_type = #{param.payType} + + + AND a.wechat_pay_type LIKE CONCAT('%', #{param.wechatPayType}, '%') + + + AND a.friend_pay_type = #{param.friendPayType} + + + AND a.pay_status = #{param.payStatus} + + + AND a.order_status = #{param.orderStatus} + + + AND a.delivery_status = #{param.deliveryStatus} + + + AND a.delivery_note LIKE CONCAT('%', #{param.deliveryNote}, '%') + + + AND a.delivery_time LIKE CONCAT('%', #{param.deliveryTime}, '%') + + + AND a.evaluate_status = #{param.evaluateStatus} + + + AND a.evaluate_time LIKE CONCAT('%', #{param.evaluateTime}, '%') + + + AND a.coupon_type = #{param.couponType} + + + AND a.coupon_desc LIKE CONCAT('%', #{param.couponDesc}, '%') + + + AND a.qrcode LIKE CONCAT('%', #{param.qrcode}, '%') + + + AND a.return_num = #{param.returnNum} + + + AND a.return_money = #{param.returnMoney} + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.is_invoice = #{param.isInvoice} + + + AND a.invoice_no LIKE CONCAT('%', #{param.invoiceNo}, '%') + + + AND a.merchant_remarks LIKE CONCAT('%', #{param.merchantRemarks}, '%') + + + AND a.pay_time LIKE CONCAT('%', #{param.payTime}, '%') + + + AND a.refund_time LIKE CONCAT('%', #{param.refundTime}, '%') + + + AND a.refund_apply_time LIKE CONCAT('%', #{param.refundApplyTime}, '%') + + + AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') + + + AND a.self_take_code LIKE CONCAT('%', #{param.selfTakeCode}, '%') + + + AND a.has_take_gift = #{param.hasTakeGift} + + + AND a.check_bill = #{param.checkBill} + + + AND a.is_settled = #{param.isSettled} + + + AND a.version = #{param.version} + + + AND a.user_id = #{param.userId} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsStatisticsMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsStatisticsMapper.xml new file mode 100644 index 0000000..6662a86 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsStatisticsMapper.xml @@ -0,0 +1,120 @@ + + + + + + + SELECT a.* + FROM cms_statistics a + + + AND a.id = #{param.id} + + + AND a.website_id = #{param.websiteId} + + + AND a.user_count = #{param.userCount} + + + AND a.order_count = #{param.orderCount} + + + AND a.product_count = #{param.productCount} + + + AND a.total_sales = #{param.totalSales} + + + AND a.month_sales = #{param.monthSales} + + + AND a.today_sales = #{param.todaySales} + + + AND a.yesterday_sales = #{param.yesterdaySales} + + + AND a.week_sales = #{param.weekSales} + + + AND a.year_sales = #{param.yearSales} + + + AND a.today_orders = #{param.todayOrders} + + + AND a.month_orders = #{param.monthOrders} + + + AND a.today_users = #{param.todayUsers} + + + AND a.month_users = #{param.monthUsers} + + + AND a.today_visits = #{param.todayVisits} + + + AND a.total_visits = #{param.totalVisits} + + + AND a.merchant_count = #{param.merchantCount} + + + AND a.active_users = #{param.activeUsers} + + + AND a.conversion_rate = #{param.conversionRate} + + + AND a.avg_order_amount = #{param.avgOrderAmount} + + + AND a.statistics_date LIKE CONCAT('%', #{param.statisticsDate}, '%') + + + AND a.statistics_type = #{param.statisticsType} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.user_id = #{param.userId} + + + AND a.merchant_id = #{param.merchantId} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsTemplateMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsTemplateMapper.xml new file mode 100644 index 0000000..c7319c0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsTemplateMapper.xml @@ -0,0 +1,93 @@ + + + + + + + SELECT a.* + FROM cms_template a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.image LIKE CONCAT('%', #{param.image}, '%') + + + AND a.type = #{param.type} + + + AND a.keywords LIKE CONCAT('%', #{param.keywords}, '%') + + + AND a.prefix LIKE CONCAT('%', #{param.prefix}, '%') + + + AND a.domain LIKE CONCAT('%', #{param.domain}, '%') + + + AND a.down_url LIKE CONCAT('%', #{param.downUrl}, '%') + + + AND a.color LIKE CONCAT('%', #{param.color}, '%') + + + AND a.version = #{param.version} + + + AND a.industry_parent LIKE CONCAT('%', #{param.industryParent}, '%') + + + AND a.industry_child LIKE CONCAT('%', #{param.industryChild}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.share = #{param.share} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.user_id = #{param.userId} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsWebsiteFieldMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsWebsiteFieldMapper.xml new file mode 100644 index 0000000..dc903bc --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsWebsiteFieldMapper.xml @@ -0,0 +1,82 @@ + + + + + + + SELECT a.*, b.user_id + FROM cms_website_field a + LEFT JOIN cms_website b ON a.tenant_id = b.tenant_id + + + AND a.id = #{param.id} + + + AND a.type = #{param.type} + + + AND a.lang = #{param.lang} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.default_value LIKE CONCAT('%', #{param.defaultValue}, '%') + + + AND a.modify_range LIKE CONCAT('%', #{param.modifyRange}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.style LIKE CONCAT('%', #{param.style}, '%') + + + AND a.value LIKE CONCAT('%', #{param.value}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND b.user_id = #{param.userId} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.value LIKE CONCAT('%', #{param.keywords}, '%') + OR a.name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsWebsiteMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsWebsiteMapper.xml new file mode 100644 index 0000000..577c1c6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsWebsiteMapper.xml @@ -0,0 +1,454 @@ + + + + + + + SELECT a.*, b.tenant_name as tenantName + FROM cms_website a + LEFT JOIN gxwebsoft_core.sys_tenant b ON a.tenant_id = b.tenant_id + + + AND a.website_id = #{param.websiteId} + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.website_name LIKE CONCAT('%', #{param.websiteName}, '%') + + + AND a.website_code LIKE CONCAT('%', #{param.websiteCode}, '%') + + + AND a.website_icon LIKE CONCAT('%', #{param.websiteIcon}, '%') + + + AND a.website_logo LIKE CONCAT('%', #{param.websiteLogo}, '%') + + + AND a.website_dark_logo LIKE CONCAT('%', #{param.websiteDarkLogo}, '%') + + + AND a.website_type LIKE CONCAT('%', #{param.websiteType}, '%') + + + AND a.prefix LIKE CONCAT('%', #{param.prefix}, '%') + + + AND a.domain LIKE CONCAT('%', #{param.domain}, '%') + + + AND a.style LIKE CONCAT('%', #{param.style}, '%') + + + AND a.admin_url LIKE CONCAT('%', #{param.adminUrl}, '%') + + + AND a.version = #{param.version} + + + AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') + + + AND a.template_id = #{param.templateId} + + + AND a.industry_parent LIKE CONCAT('%', #{param.industryParent}, '%') + + + AND a.industry_child LIKE CONCAT('%', #{param.industryChild}, '%') + + + AND a.category_id = #{param.categoryId} + + + AND a.company_id = #{param.companyId} + + + AND a.country LIKE CONCAT('%', #{param.country}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.longitude LIKE CONCAT('%', #{param.longitude}, '%') + + + AND a.latitude LIKE CONCAT('%', #{param.latitude}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.email LIKE CONCAT('%', #{param.email}, '%') + + + AND a.icp_no LIKE CONCAT('%', #{param.icpNo}, '%') + + + AND a.police_no LIKE CONCAT('%', #{param.policeNo}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.official = #{param.official} + + + AND a.market = #{param.market} + + + AND a.plugin = #{param.plugin} + + + AND a.search = #{param.search} + + + AND a.color = #{param.color} + + + AND a.status = #{param.status} + + + AND a.status_text LIKE CONCAT('%', #{param.statusText}, '%') + + + AND a.status_close LIKE CONCAT('%', #{param.statusClose}, '%') + + + AND a.styles LIKE CONCAT('%', #{param.styles}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.user_id = #{param.userId} + + + AND (a.website_name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.website_code LIKE CONCAT('%', #{param.keywords}, '%') + OR a.domain LIKE CONCAT('%', #{param.keywords}, '%') + OR a.tenant_id = #{param.keywords} + ) + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + + + + + + + UPDATE cms_website + + + type = #{param.type}, + + + website_name = #{param.websiteName}, + + + website_logo = #{param.websiteLogo}, + + + website_code = #{param.websiteCode}, + + + website_type = #{param.websiteType}, + + + template_id = #{param.templateId}, + + + company_id = #{param.companyId}, + + + admin_url = #{param.adminUrl}, + + + running = #{param.running}, + + + domain = #{param.domain}, + + + market = #{param.market}, + + + plugin = #{param.plugin}, + + + `search` = #{param.search}, + + + developer = #{param.developer}, + + + color = #{param.color}, + + + recommend = #{param.recommend}, + + + official = #{param.official}, + + + prefix = #{param.prefix}, + + + version = #{param.version}, + + + files = #{param.files}, + + + price = #{param.price}, + + + delivery_method = #{param.deliveryMethod}, + + + charging_method = #{param.chargingMethod}, + + + keywords = #{param.keywords}, + + + comments = #{param.comments}, + + + content = #{param.content}, + + + deleted = #{param.deleted}, + + + deleted = 0, + + + + website_id = #{param.websiteId} + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsWebsiteSettingMapper.xml b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsWebsiteSettingMapper.xml new file mode 100644 index 0000000..2164b44 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/mapper/xml/CmsWebsiteSettingMapper.xml @@ -0,0 +1,81 @@ + + + + + + + SELECT a.* + FROM cms_website_setting a + + + AND a.id = #{param.id} + + + AND a.website_id = #{param.websiteId} + + + AND a.official = #{param.official} + + + AND a.market = #{param.market} + + + AND a.search = #{param.search} + + + AND a.share = #{param.share} + + + AND a.plugin = #{param.plugin} + + + AND a.editor = #{param.editor} + + + AND a.search_btn = #{param.searchBtn} + + + AND a.login_btn = #{param.loginBtn} + + + AND a.float_tool = #{param.floatTool} + + + AND a.copyright_link = #{param.copyrightLink} + + + AND a.max_menu_num = #{param.maxMenuNum} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsAdParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsAdParam.java new file mode 100644 index 0000000..59d077f --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsAdParam.java @@ -0,0 +1,92 @@ +package com.gxwebsoft.cms.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 广告位查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsAdParam对象", description = "广告位查询参数") +public class CmsAdParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer adId; + + @Schema(description = "类型") + private Integer type; + + @Schema(description = "唯一标识") + @QueryField(type = QueryType.EQ) + private String code; + + @Schema(description = "栏目ID") + @QueryField(type = QueryType.EQ) + private Integer categoryId; + + @Schema(description = "页面ID") + @QueryField(type = QueryType.EQ) + private Integer designId; + + @Schema(description = "广告类型(废弃)") + private String adType; + + @Schema(description = "广告位名称") + private String name; + + @Schema(description = "宽") + private String width; + + @Schema(description = "高") + private String height; + + @Schema(description = "广告图片") + private String images; + + @Schema(description = "路由/链接地址") + private String path; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "页面ID") + @QueryField(type = QueryType.EQ) + private Integer pageId; + + @Schema(description = "页面名称") + private String pageName; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "网站创建者ID") + @QueryField(type = QueryType.EQ) + private Integer websiteUserId; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsAdRecordParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsAdRecordParam.java new file mode 100644 index 0000000..dd125c0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsAdRecordParam.java @@ -0,0 +1,53 @@ +package com.gxwebsoft.cms.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 广告图片查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsAdRecordParam对象", description = "广告图片查询参数") +public class CmsAdRecordParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer adRecordId; + + @Schema(description = "广告标题") + private String title; + + @Schema(description = "图片地址") + private String path; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "广告位ID") + @QueryField(type = QueryType.EQ) + private Integer adId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsArticleCategoryParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsArticleCategoryParam.java new file mode 100644 index 0000000..601236c --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsArticleCategoryParam.java @@ -0,0 +1,91 @@ +package com.gxwebsoft.cms.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 文章分类表查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsArticleCategoryParam对象", description = "文章分类表查询参数") +public class CmsArticleCategoryParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "文章分类ID") + @QueryField(type = QueryType.EQ) + private Integer categoryId; + + @Schema(description = "分类标识") + private String categoryCode; + + @Schema(description = "分类名称") + private String title; + + @Schema(description = "类型 0列表 1单页 2外链") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "分类图片") + private String image; + + @Schema(description = "上级分类ID") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "路由/链接地址") + private String path; + + @Schema(description = "组件路径") + private String component; + + @Schema(description = "绑定的页面") + @QueryField(type = QueryType.EQ) + private Integer pageId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "文章数量") + @QueryField(type = QueryType.EQ) + private Integer count; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") + @QueryField(type = QueryType.EQ) + private Integer hide; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "是否显示在首页") + @QueryField(type = QueryType.EQ) + private Integer showIndex; + + @Schema(description = "状态, 0正常, 1禁用") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsArticleCommentParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsArticleCommentParam.java new file mode 100644 index 0000000..e185eaf --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsArticleCommentParam.java @@ -0,0 +1,75 @@ +package com.gxwebsoft.cms.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 文章评论表查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsArticleCommentParam对象", description = "文章评论表查询参数") +public class CmsArticleCommentParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "评价ID") + @QueryField(type = QueryType.EQ) + private Integer commentId; + + @Schema(description = "文章ID") + @QueryField(type = QueryType.EQ) + private Integer articleId; + + @Schema(description = "评分 (10好评 20中评 30差评)") + @QueryField(type = QueryType.EQ) + private Integer score; + + @Schema(description = "评价内容") + private String content; + + @Schema(description = "是否为图片评价") + @QueryField(type = QueryType.EQ) + private Integer isPicture; + + @Schema(description = "评论者ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "被评价者ID") + @QueryField(type = QueryType.EQ) + private Integer toUserId; + + @Schema(description = "回复的评论ID") + @QueryField(type = QueryType.EQ) + private Integer replyCommentId; + + @Schema(description = "回复者ID") + @QueryField(type = QueryType.EQ) + private Integer replyUserId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0未读, 1已读") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsArticleContentParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsArticleContentParam.java new file mode 100644 index 0000000..4976eff --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsArticleContentParam.java @@ -0,0 +1,35 @@ +package com.gxwebsoft.cms.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 文章记录表查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsArticleContentParam对象", description = "文章记录表查询参数") +public class CmsArticleContentParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "文章ID") + @QueryField(type = QueryType.EQ) + private Integer articleId; + + @Schema(description = "文章内容") + private String content; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsArticleCountParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsArticleCountParam.java new file mode 100644 index 0000000..9878abe --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsArticleCountParam.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.cms.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 点赞文章查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsArticleCountParam对象", description = "点赞文章查询参数") +public class CmsArticleCountParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "文章ID") + @QueryField(type = QueryType.EQ) + private Integer articleId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsArticleImportParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsArticleImportParam.java new file mode 100644 index 0000000..d39650f --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsArticleImportParam.java @@ -0,0 +1,122 @@ +package com.gxwebsoft.cms.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 用户导入参数 + * + * @author WebSoft + * @since 2011-10-15 17:33:34 + */ +@Data +public class CmsArticleImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "文章ID") + private Integer articleId; + + @Excel(name = "文章标题") + private String title; + + @Excel(name = "封面图片") + private String image; + + @Excel(name = "所属栏目") + @TableField(exist = false) + private String categoryName; + + @Excel(name = "栏目ID") + private String categoryId; + + @Excel(name = "父级栏目名称") + private String parentName; + + @Excel(name = "父级栏目ID") + private Integer parentId; + + @Excel(name = "文章内容") + private String content; + + @Excel(name = "摘要") + private String comments; + + @Excel(name = "文章来源") + private String source; + + @Excel(name = "实际阅读量") + private String actualViews; + + @Excel(name = "作者") + private String author; + + @Excel(name = "发布时间") + private LocalDateTime createTime; + + @Excel(name = "类型") + private Integer type; + + @Excel(name = "模型") + private String model; + + @Excel(name = "详情页模板") + private String detail; + + @Excel(name = "话题") + private String topic; + + @Excel(name = "关键词") + private String tags; + + @Excel(name = "产品概述") + private String overview; + + @Excel(name = "显示方式") + private Integer showType; + + @Excel(name = "客户端") + private String platform; + + @Excel(name = "文件列表") + private String files; + + @Excel(name = "视频地址") + private String video; + + @Excel(name = "点赞数") + private Integer likes; + + @Excel(name = "评论数") + private Integer commentNumbers; + + @Excel(name = "推荐") + private Integer recommend; + + @Excel(name = "查看密码") + private String password; + + @Excel(name = "权限") + private Integer permission; + + @Excel(name = "用户ID") + private Integer userId; + + @Excel(name = "商户ID") + private Long merchantId; + + @Excel(name = "语言") + private String lang; + + @Excel(name = "排序") + private Integer sortNumber; + + @Excel(name = "状态") + private Integer status; + + @Excel(name = "租户ID") + private Integer tenantId; +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsArticleLikeParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsArticleLikeParam.java new file mode 100644 index 0000000..435d6da --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsArticleLikeParam.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.cms.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 点赞文章查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsArticleLikeParam对象", description = "点赞文章查询参数") +public class CmsArticleLikeParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "文章ID") + @QueryField(type = QueryType.EQ) + private Integer articleId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsArticleParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsArticleParam.java new file mode 100644 index 0000000..5a7d12f --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsArticleParam.java @@ -0,0 +1,189 @@ +package com.gxwebsoft.cms.param; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.util.Set; + +/** + * 文章查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsArticleParam对象", description = "文章查询参数") +public class CmsArticleParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "文章ID") + @QueryField(type = QueryType.EQ) + private Integer articleId; + + @Schema(description = "父级栏目ID") + @TableField(exist = false) + private Set categoryIds; + + @Schema(description = "文章标题") + private String title; + + @Schema(description = "文章类型 0常规 1视频") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "文章模型") + @QueryField(type = QueryType.EQ) + private String model; + + @Schema(description = "文章编号") + @QueryField(type = QueryType.EQ) + private String code; + + @Schema(description = "详情页标识") + @QueryField(type = QueryType.EQ) + private String detail; + + @Schema(description = "列表显示方式(10小图展示 20大图展示)") + @QueryField(type = QueryType.EQ) + private Integer showType; + + @Schema(description = "话题") + @QueryField(type = QueryType.LIKE) + private String topic; + + @Schema(description = "标签") + @QueryField(type = QueryType.EQ) + private String tags; + + @Schema(description = "栏目ID") + @QueryField(type = QueryType.EQ) + private Integer navigationId; + + @Schema(description = "文章分类ID") + @QueryField(type = QueryType.EQ) + private Integer categoryId; + + @Schema(description = "父级栏目ID") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "封面图") + private String image; + + @Schema(description = "是否包含封面图") + @QueryField(type = QueryType.EQ) + private Boolean hasImage; + + @Schema(description = "价格") + private BigDecimal price; + + @Schema(description = "来源") + private String source; + + @Schema(description = "虚拟阅读量(仅用作展示)") + @QueryField(type = QueryType.EQ) + private Integer virtualViews; + + @Schema(description = "实际阅读量") + @QueryField(type = QueryType.EQ) + private Integer actualViews; + + @Schema(description = "可见类型 0所有人 1登录可见 2密码可见") + @QueryField(type = QueryType.EQ) + private Integer permission; + + @Schema(description = "访问密码") + @QueryField(type = QueryType.EQ) + private String password; + + @Schema(description = "访问密码") + @QueryField(type = QueryType.EQ) + private String password2; + + @Schema(description = "发布来源客户端 (APP、H5、小程序等)") + private String platform; + + @Schema(description = "文章附件") + private String files; + + @Schema(description = "视频地址") + private String video; + + @Schema(description = "接受的文件类型") + private String accept; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "点赞数") + @QueryField(type = QueryType.EQ) + private Integer likes; + + @Schema(description = "评论数") + @QueryField(type = QueryType.EQ) + private Integer commentNumbers; + + @Schema(description = "提醒谁看") + private String toUsers; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "项目ID") + @QueryField(type = QueryType.EQ) + private Long projectId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "文章ID集查询") + @TableField(exist = false) + private Set articleIds; + + @Schema(description = "网站创建者ID") + @QueryField(type = QueryType.EQ) + private Integer websiteUserId; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsDesignParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsDesignParam.java new file mode 100644 index 0000000..3a131b6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsDesignParam.java @@ -0,0 +1,91 @@ +package com.gxwebsoft.cms.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 页面管理记录表查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsDesignParam对象", description = "页面管理记录表查询参数") +public class CmsDesignParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer pageId; + + @Schema(description = "页面标题") + private String name; + + @Schema(description = "所属栏目ID") + @QueryField(type = QueryType.EQ) + private Integer categoryId; + + @Schema(description = "页面模型") + private String model; + + @Schema(description = "页面关键词") + private String keywords; + + @Schema(description = "页面描述") + private String description; + + @Schema(description = "缩列图") + private String photo; + + @Schema(description = "购买链接") + private String buyUrl; + + @Schema(description = "页面样式") + private String style; + + @Schema(description = "页面内容") + private String content; + + @Schema(description = "是否开启布局") + @QueryField(type = QueryType.EQ) + private Integer showLayout; + + @Schema(description = "页面布局") + private String layout; + + @Schema(description = "上级id, 0是顶级") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "设为首页") + @QueryField(type = QueryType.EQ) + private Integer home; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsDesignRecordParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsDesignRecordParam.java new file mode 100644 index 0000000..eaeb6f4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsDesignRecordParam.java @@ -0,0 +1,72 @@ +package com.gxwebsoft.cms.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 页面组件表查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsDesignRecordParam对象", description = "页面组件表查询参数") +public class CmsDesignRecordParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "关联导航ID") + @QueryField(type = QueryType.EQ) + private Integer navigationId; + + @Schema(description = "组件") + private String title; + + @Schema(description = "组件标识") + private String dictCode; + + @Schema(description = "组件样式") + private String styles; + + @Schema(description = "卡片阴影显示时机") + private String shadow; + + @Schema(description = "页面关键词") + private String keywords; + + @Schema(description = "页面描述") + private String description; + + @Schema(description = "页面路由地址") + private String path; + + @Schema(description = "缩列图") + private String photo; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsDomainParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsDomainParam.java new file mode 100644 index 0000000..d1cacfb --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsDomainParam.java @@ -0,0 +1,66 @@ +package com.gxwebsoft.cms.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 网站域名记录表查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsDomainParam对象", description = "网站域名记录表查询参数") +public class CmsDomainParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "类型 0赠送域名 1绑定域名 ") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "域名") + private String domain; + + @Schema(description = "主机记录") + private String hostName; + + @Schema(description = "记录值") + private String hostValue; + + @Schema(description = "状态") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "网站ID") + @QueryField(type = QueryType.EQ) + private Integer websiteId; + + @Schema(description = "租户ID") + @QueryField(type = QueryType.EQ) + private Integer appId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsFormParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsFormParam.java new file mode 100644 index 0000000..1ce4c88 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsFormParam.java @@ -0,0 +1,89 @@ +package com.gxwebsoft.cms.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 表单设计表查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsFormParam对象", description = "表单设计表查询参数") +public class CmsFormParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer formId; + + @Schema(description = "表单标题") + private String name; + + @Schema(description = "顶部图片") + private String photo; + + @Schema(description = "背景图片") + private String background; + + @Schema(description = "视频文件") + private String video; + + @Schema(description = "提交次数") + @QueryField(type = QueryType.EQ) + private Integer submitNumber; + + @Schema(description = "页面布局") + private String layout; + + @Schema(description = "是否隐藏顶部图片") + @QueryField(type = QueryType.EQ) + private Integer hidePhoto; + + @Schema(description = "是否隐藏背景图片") + @QueryField(type = QueryType.EQ) + private Integer hideBackground; + + @Schema(description = "是否隐藏视频") + @QueryField(type = QueryType.EQ) + private Integer hideVideo; + + @Schema(description = "背景图片透明度") + @QueryField(type = QueryType.EQ) + private BigDecimal opacity; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "商户ID") + @QueryField(type = QueryType.EQ) + private Long merchantId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsFormRecordParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsFormRecordParam.java new file mode 100644 index 0000000..d070843 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsFormRecordParam.java @@ -0,0 +1,65 @@ +package com.gxwebsoft.cms.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 表单数据记录表查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsFormRecordParam对象", description = "表单数据记录表查询参数") +public class CmsFormRecordParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer formRecordId; + + @Schema(description = "手机号") + private String phone; + + @Schema(description = "表单数据") + private String formData; + + @Schema(description = "表单ID") + @QueryField(type = QueryType.EQ) + private Integer formId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "商户ID") + @QueryField(type = QueryType.EQ) + private Long merchantId; + + @Schema(description = "姓名") + private String name; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsLangLogParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsLangLogParam.java new file mode 100644 index 0000000..4145cee --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsLangLogParam.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.cms.param; + +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 国际化记录启用查询参数 + * + * @author 科技小王子 + * @since 2025-01-06 19:29:26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsLangLogParam对象", description = "国际化记录启用查询参数") +public class CmsLangLogParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "名称") + private String lang; + + @Schema(description = "关联ID") + @QueryField(type = QueryType.EQ) + private Integer langId; + + @Schema(description = "编码") + private String code; + + @Schema(description = "名称") + private String name; + + @Schema(description = "创建者UID") + @TableField(exist = false) + private Integer websiteUserId; +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsLangParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsLangParam.java new file mode 100644 index 0000000..a6e1d56 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsLangParam.java @@ -0,0 +1,51 @@ +package com.gxwebsoft.cms.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 国际化查询参数 + * + * @author 科技小王子 + * @since 2025-01-06 19:29:26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsLangParam对象", description = "国际化查询参数") +public class CmsLangParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "名称") + private String name; + + @Schema(description = "编码") + private String code; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsLinkParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsLinkParam.java new file mode 100644 index 0000000..c27da58 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsLinkParam.java @@ -0,0 +1,72 @@ +package com.gxwebsoft.cms.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 常用链接查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsLinkParam对象", description = "常用链接查询参数") +public class CmsLinkParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "链接名称") + private String name; + + @Schema(description = "图标") + private String icon; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "栏目ID") + private Integer categoryId; + + @Schema(description = "应用ID") + @QueryField(type = QueryType.EQ) + private Integer appId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "状态, 0正常, 1待确认") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "网站创建者ID") + @QueryField(type = QueryType.EQ) + private Integer websiteUserId; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsModelParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsModelParam.java new file mode 100644 index 0000000..345c253 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsModelParam.java @@ -0,0 +1,83 @@ +package com.gxwebsoft.cms.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 模型查询参数 + * + * @author 科技小王子 + * @since 2024-11-26 15:44:53 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsModelParam对象", description = "模型查询参数") +public class CmsModelParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer modelId; + + @Schema(description = "模型名称") + private String name; + + @Schema(description = "唯一标识") + private String model; + + @Schema(description = "菜单路由地址") + private String componentDetail; + + @Schema(description = "菜单组件地址, 目录可为空") + private String component; + + @Schema(description = "模型banner图片") + private String banner; + + @Schema(description = "封面图宽") + @QueryField(type = QueryType.EQ) + private String imageWidth; + + @Schema(description = "封面图高") + @QueryField(type = QueryType.EQ) + private String imageHeight; + + @Schema(description = "Banner上的标题") + private String title; + + @Schema(description = "列表显示方式(10小图展示 20大图展示)") + @QueryField(type = QueryType.EQ) + private Integer showType; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "创建者用户ID") + @QueryField(type = QueryType.EQ) + private Integer websiteUserId; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsNavigationImportParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsNavigationImportParam.java new file mode 100644 index 0000000..7f37bd6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsNavigationImportParam.java @@ -0,0 +1,123 @@ +package com.gxwebsoft.cms.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 网站导航导入参数(Excel 批量导入) + */ +@Data +public class CmsNavigationImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "导航ID") + private Integer navigationId; + + @Excel(name = "类型") + private Integer type; + + @Excel(name = "菜单名称") + private String title; + + @Excel(name = "上级id") + private Integer parentId; + + @Excel(name = "模型") + private String model; + + @Excel(name = "标识") + private String code; + + @Excel(name = "菜单路由地址") + private String path; + + @Excel(name = "菜单组件地址") + private String component; + + @Excel(name = "打开位置") + private String target; + + @Excel(name = "菜单图标") + private String icon; + + @Excel(name = "图标颜色") + private String color; + + @Excel(name = "是否隐藏") + private Integer hide; + + @Excel(name = "可见类型") + private Integer permission; + + @Excel(name = "访问密码") + private String password; + + @Excel(name = "位置") + private Integer position; + + @Excel(name = "仅在顶部显示") + private Integer top; + + @Excel(name = "仅在底部显示") + private Integer bottom; + + @Excel(name = "选中path") + private String active; + + @Excel(name = "其它路由元信息") + private String meta; + + @Excel(name = "css样式") + private String style; + + @Excel(name = "模型名称") + private String modelName; + + @Excel(name = "页面ID") + private Integer pageId; + + @Excel(name = "详情页ID") + private Integer itemId; + + @Excel(name = "是否微信小程序菜单") + private Boolean isMpWeixin; + + @Excel(name = "菜单间距") + private Integer gutter; + + @Excel(name = "菜单宽度") + private Integer span; + + @Excel(name = "阅读量") + private Integer readNum; + + @Excel(name = "商户ID") + private Long merchantId; + + @Excel(name = "国际化语言") + private String lang; + + @Excel(name = "设为首页") + private Integer home; + + @Excel(name = "是否推荐") + private Boolean recommend; + + @Excel(name = "排序") + private Integer sortNumber; + + @Excel(name = "备注") + private String comments; + + @Excel(name = "状态") + private Integer status; + + @Excel(name = "用户ID") + private Integer userId; + + @Excel(name = "租户ID") + private Integer tenantId; +} + diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsNavigationParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsNavigationParam.java new file mode 100644 index 0000000..83f9e07 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsNavigationParam.java @@ -0,0 +1,154 @@ +package com.gxwebsoft.cms.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 网站导航记录表查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsNavigationParam对象", description = "网站导航记录表查询参数") +public class CmsNavigationParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer navigationId; + + @Schema(description = "上级id, 0是顶级") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "菜单名称") + private String title; + + @Schema(description = "模型") + private String model; + + @Schema(description = "标识") + private String code; + + @Schema(description = "菜单路由地址") + private String path; + + @Schema(description = "菜单组件地址, 目录可为空") + private String component; + + @Schema(description = "打开位置") + private String target; + + @Schema(description = "菜单图标") + private String icon; + + @Schema(description = "图标颜色") + private String color; + + @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") + @QueryField(type = QueryType.EQ) + private Integer hide; + + @Schema(description = "可见类型 0所有人 1登录可见 2密码可见") + @QueryField(type = QueryType.EQ) + private Integer permission; + + @Schema(description = "访问密码") + @QueryField(type = QueryType.EQ) + private String password; + + @Schema(description = "访问密码") + @QueryField(type = QueryType.EQ) + private String password2; + + @Schema(description = "位置 0不限 1顶部 2底部") + @QueryField(type = QueryType.EQ) + private Integer position; + + @Schema(description = "仅在顶部显示") + @QueryField(type = QueryType.EQ) + private Integer top; + + @Schema(description = "仅在底部显示") + @QueryField(type = QueryType.EQ) + private Integer bottom; + + @Schema(description = "菜单侧栏选中的path") + private String active; + + @Schema(description = "其它路由元信息") + private String meta; + + @Schema(description = "css样式") + private String style; + + @Schema(description = "父级栏目路由") + private String parentPath; + + @Schema(description = "父级栏目名称") + private String parentName; + + @Schema(description = "模型名称") + private String modelName; + + @Schema(description = "类型(已废弃)") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "绑定的页面(已废弃)") + @QueryField(type = QueryType.EQ) + private Integer pageId; + + @Schema(description = "是否微信小程序菜单") + @QueryField(type = QueryType.EQ) + private Boolean isMpWeixin; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "设为首页") + @QueryField(type = QueryType.EQ) + private Integer home; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Boolean recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否开启布局") + @QueryField(type = QueryType.EQ) + private Boolean showLayout; + + @Schema(description = "是否查询单页内容") + @QueryField(type = QueryType.EQ) + private Boolean queryContent; + + @Schema(description = "网站创建者用户ID") + @QueryField(type = QueryType.EQ) + private Integer websiteUserId; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsOrderParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsOrderParam.java new file mode 100644 index 0000000..aff69a7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsOrderParam.java @@ -0,0 +1,284 @@ +package com.gxwebsoft.cms.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 网站订单查询参数 + * + * @author 科技小王子 + * @since 2026-01-27 13:03:24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsOrderParam对象", description = "网站订单查询参数") +public class CmsOrderParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "id") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "订单类型,0售前咨询 1售后服务 2意见反馈") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "订单标题") + private String title; + + @Schema(description = "公司/团队名称") + private String company; + + @Schema(description = "订单内容") + private String content; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "快递/自提") + @QueryField(type = QueryType.EQ) + private Integer deliveryType; + + @Schema(description = "下单渠道,0网站 1微信小程序 2其他") + @QueryField(type = QueryType.EQ) + private Integer channel; + + @Schema(description = "微信支付交易号号") + private String transactionId; + + @Schema(description = "微信退款订单号") + private String refundOrder; + + @Schema(description = "商户ID") + @QueryField(type = QueryType.EQ) + private Long merchantId; + + @Schema(description = "商户名称") + private String merchantName; + + @Schema(description = "商户编号") + private String merchantCode; + + @Schema(description = "使用的优惠券id") + @QueryField(type = QueryType.EQ) + private Integer couponId; + + @Schema(description = "使用的会员卡id") + private String cardId; + + @Schema(description = "关联管理员id") + @QueryField(type = QueryType.EQ) + private Integer adminId; + + @Schema(description = "核销管理员id") + @QueryField(type = QueryType.EQ) + private Integer confirmId; + + @Schema(description = "IC卡号") + private String icCard; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "关联收货地址") + @QueryField(type = QueryType.EQ) + private Integer addressId; + + @Schema(description = "收货地址") + private String address; + + private String addressLat; + + private String addressLng; + + @Schema(description = "自提店铺id") + @QueryField(type = QueryType.EQ) + private Integer selfTakeMerchantId; + + @Schema(description = "自提店铺") + private String selfTakeMerchantName; + + @Schema(description = "配送开始时间") + private String sendStartTime; + + @Schema(description = "配送结束时间") + private String sendEndTime; + + @Schema(description = "发货店铺id") + @QueryField(type = QueryType.EQ) + private Integer expressMerchantId; + + @Schema(description = "发货店铺") + private String expressMerchantName; + + @Schema(description = "订单总额") + @QueryField(type = QueryType.EQ) + private BigDecimal totalPrice; + + @Schema(description = "减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格") + @QueryField(type = QueryType.EQ) + private BigDecimal reducePrice; + + @Schema(description = "实际付款") + @QueryField(type = QueryType.EQ) + private BigDecimal payPrice; + + @Schema(description = "用于统计") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "价钱,用于积分赠送") + @QueryField(type = QueryType.EQ) + private BigDecimal money; + + @Schema(description = "取消时间") + private String cancelTime; + + @Schema(description = "取消原因") + private String cancelReason; + + @Schema(description = "退款金额") + @QueryField(type = QueryType.EQ) + private BigDecimal refundMoney; + + @Schema(description = "教练价格") + @QueryField(type = QueryType.EQ) + private BigDecimal coachPrice; + + @Schema(description = "购买数量") + @QueryField(type = QueryType.EQ) + private Integer totalNum; + + @Schema(description = "教练id") + @QueryField(type = QueryType.EQ) + private Integer coachId; + + @Schema(description = "商品ID") + @QueryField(type = QueryType.EQ) + private Integer formId; + + @Schema(description = "支付的用户id") + @QueryField(type = QueryType.EQ) + private Integer payUserId; + + @Schema(description = "0余额支付,1微信支付,2支付宝支付,3银联支付,4现金支付,5POS机支付,6免费,7积分支付") + @QueryField(type = QueryType.EQ) + private Integer payType; + + @Schema(description = "微信支付子类型:JSAPI小程序支付,NATIVE扫码支付") + private String wechatPayType; + + @Schema(description = "0余额支付,1微信支付,2支付宝支付,3银联支付,4现金支付,5POS机支付,6免费,7积分支付") + @QueryField(type = QueryType.EQ) + private Integer friendPayType; + + @Schema(description = "0未付款,1已付款") + @QueryField(type = QueryType.EQ) + private Integer payStatus; + + @Schema(description = "0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款") + @QueryField(type = QueryType.EQ) + private Integer orderStatus; + + @Schema(description = "发货状态(10未发货 20已发货 30部分发货)") + @QueryField(type = QueryType.EQ) + private Integer deliveryStatus; + + @Schema(description = "无需发货备注") + private String deliveryNote; + + @Schema(description = "发货时间") + private String deliveryTime; + + @Schema(description = "评价状态(0未评价 1已评价)") + @QueryField(type = QueryType.EQ) + private Integer evaluateStatus; + + @Schema(description = "评价时间") + private String evaluateTime; + + @Schema(description = "优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡") + @QueryField(type = QueryType.EQ) + private Integer couponType; + + @Schema(description = "优惠说明") + private String couponDesc; + + @Schema(description = "二维码地址,保存订单号,支付成功后才生成") + private String qrcode; + + @Schema(description = "vip月卡年卡、ic月卡年卡回退次数") + @QueryField(type = QueryType.EQ) + private Integer returnNum; + + @Schema(description = "vip充值回退金额") + @QueryField(type = QueryType.EQ) + private BigDecimal returnMoney; + + @Schema(description = "预约详情开始时间数组") + private String startTime; + + @Schema(description = "是否已开具发票:0未开发票,1已开发票,2不能开具发票") + @QueryField(type = QueryType.EQ) + private Integer isInvoice; + + @Schema(description = "发票流水号") + private String invoiceNo; + + @Schema(description = "商家留言") + private String merchantRemarks; + + @Schema(description = "支付时间") + private String payTime; + + @Schema(description = "退款时间") + private String refundTime; + + @Schema(description = "申请退款时间") + private String refundApplyTime; + + @Schema(description = "过期时间") + private String expirationTime; + + @Schema(description = "自提码") + private String selfTakeCode; + + @Schema(description = "是否已收到赠品") + @QueryField(type = QueryType.EQ) + private Boolean hasTakeGift; + + @Schema(description = "对账情况:0=未对账;1=已对账;3=已对账,金额对不上;4=未查询到该订单") + @QueryField(type = QueryType.EQ) + private Integer checkBill; + + @Schema(description = "订单是否已结算(0未结算 1已结算)") + @QueryField(type = QueryType.EQ) + private Integer isSettled; + + @Schema(description = "系统版本号 0当前版本 value=其他版本") + @QueryField(type = QueryType.EQ) + private Integer version; + + @Schema(description = "用户id") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsStatisticsParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsStatisticsParam.java new file mode 100644 index 0000000..a15d63e --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsStatisticsParam.java @@ -0,0 +1,137 @@ +package com.gxwebsoft.cms.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 站点统计信息表查询参数 + * + * @author 科技小王子 + * @since 2025-07-25 12:32:06 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsStatisticsParam对象", description = "站点统计信息表查询参数") +public class CmsStatisticsParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "站点ID") + @QueryField(type = QueryType.EQ) + private Integer websiteId; + + @Schema(description = "用户总数") + @QueryField(type = QueryType.EQ) + private Integer userCount; + + @Schema(description = "订单总数") + @QueryField(type = QueryType.EQ) + private Integer orderCount; + + @Schema(description = "商品总数") + @QueryField(type = QueryType.EQ) + private Integer productCount; + + @Schema(description = "总销售额") + @QueryField(type = QueryType.EQ) + private BigDecimal totalSales; + + @Schema(description = "本月销售额") + @QueryField(type = QueryType.EQ) + private BigDecimal monthSales; + + @Schema(description = "今日销售额") + @QueryField(type = QueryType.EQ) + private BigDecimal todaySales; + + @Schema(description = "昨日销售额") + @QueryField(type = QueryType.EQ) + private BigDecimal yesterdaySales; + + @Schema(description = "本周销售额") + @QueryField(type = QueryType.EQ) + private BigDecimal weekSales; + + @Schema(description = "本年销售额") + @QueryField(type = QueryType.EQ) + private BigDecimal yearSales; + + @Schema(description = "今日订单数") + @QueryField(type = QueryType.EQ) + private Integer todayOrders; + + @Schema(description = "本月订单数") + @QueryField(type = QueryType.EQ) + private Integer monthOrders; + + @Schema(description = "今日新增用户") + @QueryField(type = QueryType.EQ) + private Integer todayUsers; + + @Schema(description = "本月新增用户") + @QueryField(type = QueryType.EQ) + private Integer monthUsers; + + @Schema(description = "今日访问量") + @QueryField(type = QueryType.EQ) + private Integer todayVisits; + + @Schema(description = "总访问量") + @QueryField(type = QueryType.EQ) + private Integer totalVisits; + + @Schema(description = "商户总数") + @QueryField(type = QueryType.EQ) + private Integer merchantCount; + + @Schema(description = "活跃用户数") + @QueryField(type = QueryType.EQ) + private Integer activeUsers; + + @Schema(description = "转化率(%)") + @QueryField(type = QueryType.EQ) + private BigDecimal conversionRate; + + @Schema(description = "平均订单金额") + @QueryField(type = QueryType.EQ) + private BigDecimal avgOrderAmount; + + @Schema(description = "统计日期") + private String statisticsDate; + + @Schema(description = "统计类型: 1日统计, 2月统计, 3年统计") + @QueryField(type = QueryType.EQ) + private Integer statisticsType; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "操作用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "商户ID") + @QueryField(type = QueryType.EQ) + private Long merchantId; + + @Schema(description = "状态: 0禁用, 1启用") + @QueryField(type = QueryType.EQ) + private Boolean status; + + @Schema(description = "是否删除: 0否, 1是") + @QueryField(type = QueryType.EQ) + private Boolean deleted; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsTemplateParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsTemplateParam.java new file mode 100644 index 0000000..176e0a9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsTemplateParam.java @@ -0,0 +1,91 @@ +package com.gxwebsoft.cms.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 网站模版查询参数 + * + * @author 科技小王子 + * @since 2025-01-21 14:21:16 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsTemplateParam对象", description = "网站模版查询参数") +public class CmsTemplateParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "模版名称") + private String name; + + @Schema(description = "模版标识") + private String code; + + @Schema(description = "缩列图") + private String image; + + @Schema(description = "类型 1企业官网 2其他") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "网站关键词") + private String keywords; + + @Schema(description = "域名前缀") + private String prefix; + + @Schema(description = "预览地址") + private String domain; + + @Schema(description = "模版下载地址") + private String downUrl; + + @Schema(description = "色系") + private String color; + + @Schema(description = "应用版本 10免费版 20授权版 30永久授权") + @QueryField(type = QueryType.EQ) + private Integer version; + + @Schema(description = "行业类型(父级)") + private String industryParent; + + @Schema(description = "行业类型(子级)") + private String industryChild; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Boolean recommend; + + @Schema(description = "是否共享模板") + @QueryField(type = QueryType.EQ) + private Boolean share; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsWebsiteFieldImportParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsWebsiteFieldImportParam.java new file mode 100644 index 0000000..5bf56d3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsWebsiteFieldImportParam.java @@ -0,0 +1,56 @@ +package com.gxwebsoft.cms.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 应用参数导入参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +@Data +public class CmsWebsiteFieldImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "自增ID") + private Integer id; + + @Excel(name = "类型") + private Integer type; + + @Excel(name = "名称") + private String name; + + @Excel(name = "默认值") + private String defaultValue; + + @Excel(name = "可修改的值") + private String modifyRange; + + @Excel(name = "备注") + private String comments; + + @Excel(name = "css样式") + private String style; + + @Excel(name = "值") + private String value; + + @Excel(name = "国际化语言") + private String lang; + + @Excel(name = "加密") + private Boolean encrypted; + + @Excel(name = "商户ID") + private Long merchantId; + + @Excel(name = "排序") + private Integer sortNumber; + + @Excel(name = "租户ID") + private Integer tenantId; +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsWebsiteFieldParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsWebsiteFieldParam.java new file mode 100644 index 0000000..9bb0e57 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsWebsiteFieldParam.java @@ -0,0 +1,66 @@ +package com.gxwebsoft.cms.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 应用参数查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsWebsiteFieldParam对象", description = "应用参数查询参数") +public class CmsWebsiteFieldParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "类型,0文本 1图片 2其他") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "名称") + private String name; + + @Schema(description = "默认值") + private String defaultValue; + + @Schema(description = "可修改的值 [on|off]") + private String modifyRange; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "css样式") + private String style; + + @Schema(description = "名称") + private String value; + + @Schema(description = "是否加密") + private Boolean encrypted; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "创建者") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsWebsiteParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsWebsiteParam.java new file mode 100644 index 0000000..cafb74d --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsWebsiteParam.java @@ -0,0 +1,225 @@ +package com.gxwebsoft.cms.param; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; +import java.util.Set; + +/** + * 网站信息记录表查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsWebsiteParam对象", description = "网站信息记录表查询参数") +public class CmsWebsiteParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "站点ID") + @QueryField(type = QueryType.EQ) + private Integer websiteId; + + @Schema(description = "站点类型") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "网站名称") + private String websiteName; + + @Schema(description = "网站标识") + private String websiteCode; + + @Schema(description = "网站密钥") + private String websiteSecret; + + @Schema(description = "网站LOGO") + private String websiteIcon; + + @Schema(description = "网站LOGO") + private String websiteLogo; + + @Schema(description = "网站LOGO(深色模式)") + private String websiteDarkLogo; + + @Schema(description = "网站类型") + private String websiteType; + + @Schema(description = "栏目ID") + @QueryField(type = QueryType.EQ) + private Integer categoryId; + + @Schema(description = "网站截图") + private String files; + + @Schema(description = "网站关键词") + private String keywords; + + @Schema(description = "域名前缀") + private String prefix; + + @Schema(description = "绑定域名") + private String domain; + + @Schema(description = "全局样式") + private String style; + + @Schema(description = "后台管理地址") + private String adminUrl; + + @Schema(description = "应用版本 10免费版 20授权版 30永久授权") + @QueryField(type = QueryType.EQ) + private Integer version; + + @Schema(description = "服务到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private String expirationTime; + + @Schema(description = "模版ID") + @QueryField(type = QueryType.EQ) + private Integer templateId; + + @Schema(description = "行业类型(父级)") + private String industryParent; + + @Schema(description = "行业类型(子级)") + private String industryChild; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "开发者名称") + private String developer; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "联系电话") + private String phone; + + @Schema(description = "电子邮箱") + private String email; + + @Schema(description = "ICP备案号") + private String icpNo; + + @Schema(description = "公安备案") + private String policeNo; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "是否官方产品") + @QueryField(type = QueryType.EQ) + private Boolean official; + + @Schema(description = "是否查询超管账号") + @QueryField(type = QueryType.EQ) + private Boolean showAdminPhone; + + @Schema(description = "允许展示到插件市场") + @QueryField(type = QueryType.EQ) + private Boolean market; + + @Schema(description = "是否插件类型 0应用 1插件") + @QueryField(type = QueryType.EQ) + private Boolean plugin; + + @Schema(description = "允许被搜索") + @QueryField(type = QueryType.EQ) + private Boolean search; + + @Schema(description = "主题色") + private String color; + + @Schema(description = "点赞数量") + private Integer likes; + + @Schema(description = "点击数量") + private Integer clicks; + + @Schema(description = "购买数量") + private Integer buys; + + @Schema(description = "下载数量") + private Integer downloads; + + @Schema(description = "状态 0未开通 1运行中 2维护中 3已关闭 4已欠费停机 5违规关停") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "维护说明") + private String statusText; + + @Schema(description = "关闭说明") + private String statusClose; + + @Schema(description = "全局样式") + private String styles; + + @Schema(description = "运行状态") + @QueryField(type = QueryType.EQ) + private Integer running; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "按userId集搜索") + @QueryField(type = QueryType.EQ) + private Set userIds; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "按WebsiteIds集搜索") + private Set websiteIds; + + @Schema(description = "当前登录用户ID") + @QueryField(type = QueryType.EQ) + private Integer loginUserId; + + @Schema(description = "管理员手机号") + @QueryField(type = QueryType.EQ) + private String adminPhone; + +} diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsWebsiteSettingParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsWebsiteSettingParam.java new file mode 100644 index 0000000..6d195a6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/param/CmsWebsiteSettingParam.java @@ -0,0 +1,86 @@ +package com.gxwebsoft.cms.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 网站设置查询参数 + * + * @author 科技小王子 + * @since 2025-02-19 01:35:44 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CmsWebsiteSettingParam对象", description = "网站设置查询参数") +public class CmsWebsiteSettingParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "关联网站ID") + @QueryField(type = QueryType.EQ) + private Integer websiteId; + + @Schema(description = "是否官方插件") + @QueryField(type = QueryType.EQ) + private Boolean official; + + @Schema(description = "是否展示在插件市场") + @QueryField(type = QueryType.EQ) + private Boolean market; + + @Schema(description = "是否允许被搜索") + @QueryField(type = QueryType.EQ) + private Boolean search; + + @Schema(description = "是否共享") + @QueryField(type = QueryType.EQ) + private Boolean share; + + @Schema(description = "是否插件 0应用1 插件 ") + @QueryField(type = QueryType.EQ) + private Boolean plugin; + + @Schema(description = "编辑器类型 1 md-editor-v3, 2 tinymce-editor") + @QueryField(type = QueryType.EQ) + private Boolean editor; + + @Schema(description = "显示站内搜索") + @QueryField(type = QueryType.EQ) + private Boolean searchBtn; + + @Schema(description = "显示登录注册功能") + @QueryField(type = QueryType.EQ) + private Boolean loginBtn; + + @Schema(description = "显示悬浮客服工具") + @QueryField(type = QueryType.EQ) + private Boolean floatTool; + + @Schema(description = "显示版权链接") + @QueryField(type = QueryType.EQ) + private Boolean copyrightLink; + + @Schema(description = "导航栏最多显示数量") + @QueryField(type = QueryType.EQ) + private Boolean maxMenuNum; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsAdRecordService.java b/src/main/java/com/gxwebsoft/cms/service/CmsAdRecordService.java new file mode 100644 index 0000000..5610204 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsAdRecordService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsAdRecord; +import com.gxwebsoft.cms.param.CmsAdRecordParam; + +import java.util.List; + +/** + * 广告图片Service + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsAdRecordService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsAdRecordParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsAdRecordParam param); + + /** + * 根据id查询 + * + * @param adRecordId ID + * @return CmsAdRecord + */ + CmsAdRecord getByIdRel(Integer adRecordId); + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsAdService.java b/src/main/java/com/gxwebsoft/cms/service/CmsAdService.java new file mode 100644 index 0000000..9cef726 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsAdService.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsAd; +import com.gxwebsoft.cms.param.CmsAdParam; + +import java.util.List; + +/** + * 广告位Service + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsAdService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsAdParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsAdParam param); + + /** + * 根据id查询 + * + * @param adId ID + * @return CmsAd + */ + CmsAd getByIdRel(Integer adId); + + /** + * 根据code查询 + * + * @return CmsAd + */ + CmsAd getByIdCode(String code); +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsArticleCategoryService.java b/src/main/java/com/gxwebsoft/cms/service/CmsArticleCategoryService.java new file mode 100644 index 0000000..38d55be --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsArticleCategoryService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsArticleCategory; +import com.gxwebsoft.cms.param.CmsArticleCategoryParam; + +import java.util.List; + +/** + * 文章分类表Service + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsArticleCategoryService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsArticleCategoryParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsArticleCategoryParam param); + + /** + * 根据id查询 + * + * @param categoryId 文章分类ID + * @return CmsArticleCategory + */ + CmsArticleCategory getByIdRel(Integer categoryId); + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsArticleCommentService.java b/src/main/java/com/gxwebsoft/cms/service/CmsArticleCommentService.java new file mode 100644 index 0000000..68b4fd8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsArticleCommentService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsArticleComment; +import com.gxwebsoft.cms.param.CmsArticleCommentParam; + +import java.util.List; + +/** + * 文章评论表Service + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsArticleCommentService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsArticleCommentParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsArticleCommentParam param); + + /** + * 根据id查询 + * + * @param commentId 评价ID + * @return CmsArticleComment + */ + CmsArticleComment getByIdRel(Integer commentId); + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsArticleContentService.java b/src/main/java/com/gxwebsoft/cms/service/CmsArticleContentService.java new file mode 100644 index 0000000..640ad80 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsArticleContentService.java @@ -0,0 +1,40 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.cms.entity.CmsArticle; +import com.gxwebsoft.cms.entity.TranslateDataVo; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsArticleContent; +import com.gxwebsoft.cms.param.CmsArticleContentParam; + +import java.util.List; + +/** + * 文章记录表Service + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsArticleContentService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsArticleContentParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsArticleContentParam param); + + + CmsArticleContent getByIdRel(Integer id); + + void translate(CmsArticle article); +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsArticleCountService.java b/src/main/java/com/gxwebsoft/cms/service/CmsArticleCountService.java new file mode 100644 index 0000000..c9cd3b1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsArticleCountService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsArticleCount; +import com.gxwebsoft.cms.param.CmsArticleCountParam; + +import java.util.List; + +/** + * 点赞文章Service + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsArticleCountService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsArticleCountParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsArticleCountParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return CmsArticleCount + */ + CmsArticleCount getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsArticleLikeService.java b/src/main/java/com/gxwebsoft/cms/service/CmsArticleLikeService.java new file mode 100644 index 0000000..08cd5a3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsArticleLikeService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsArticleLike; +import com.gxwebsoft.cms.param.CmsArticleLikeParam; + +import java.util.List; + +/** + * 点赞文章Service + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsArticleLikeService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsArticleLikeParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsArticleLikeParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return CmsArticleLike + */ + CmsArticleLike getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsArticleService.java b/src/main/java/com/gxwebsoft/cms/service/CmsArticleService.java new file mode 100644 index 0000000..1d13e3c --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsArticleService.java @@ -0,0 +1,50 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsArticle; +import com.gxwebsoft.cms.param.CmsArticleParam; + +import javax.validation.Valid; +import java.util.List; + +/** + * 文章Service + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsArticleService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsArticleParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsArticleParam param); + + /** + * 根据id查询 + * + * @param articleId 文章ID + * @return CmsArticle + */ + CmsArticle getByIdRel(Integer articleId); + + void saveInc(Integer formId); + + boolean saveRel(@Valid CmsArticle article); + + boolean updateByIdRel(CmsArticle article); + + CmsArticle getByIdCode(String code); +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsDesignRecordService.java b/src/main/java/com/gxwebsoft/cms/service/CmsDesignRecordService.java new file mode 100644 index 0000000..e9e3465 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsDesignRecordService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsDesignRecord; +import com.gxwebsoft.cms.param.CmsDesignRecordParam; + +import java.util.List; + +/** + * 页面组件表Service + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsDesignRecordService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsDesignRecordParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsDesignRecordParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CmsDesignRecord + */ + CmsDesignRecord getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsDesignService.java b/src/main/java/com/gxwebsoft/cms/service/CmsDesignService.java new file mode 100644 index 0000000..6a895d3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsDesignService.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsDesign; +import com.gxwebsoft.cms.param.CmsDesignParam; + +import java.util.List; + +/** + * 页面管理记录表Service + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsDesignService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsDesignParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsDesignParam param); + + /** + * 根据id查询 + * + * @param pageId ID + * @return CmsDesign + */ + CmsDesign getByIdRel(Integer pageId); + + void translate(CmsDesign cmsDesign); +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsDomainService.java b/src/main/java/com/gxwebsoft/cms/service/CmsDomainService.java new file mode 100644 index 0000000..bdb1944 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsDomainService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsDomain; +import com.gxwebsoft.cms.param.CmsDomainParam; + +import java.util.List; + +/** + * 网站域名记录表Service + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +public interface CmsDomainService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsDomainParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsDomainParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CmsDomain + */ + CmsDomain getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsFormRecordService.java b/src/main/java/com/gxwebsoft/cms/service/CmsFormRecordService.java new file mode 100644 index 0000000..86b1b2f --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsFormRecordService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsFormRecord; +import com.gxwebsoft.cms.param.CmsFormRecordParam; + +import java.util.List; + +/** + * 表单数据记录表Service + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsFormRecordService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsFormRecordParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsFormRecordParam param); + + /** + * 根据id查询 + * + * @param formRecordId ID + * @return CmsFormRecord + */ + CmsFormRecord getByIdRel(Integer formRecordId); + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsFormService.java b/src/main/java/com/gxwebsoft/cms/service/CmsFormService.java new file mode 100644 index 0000000..a6c98fd --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsFormService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsForm; +import com.gxwebsoft.cms.param.CmsFormParam; + +import java.util.List; + +/** + * 表单设计表Service + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsFormService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsFormParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsFormParam param); + + /** + * 根据id查询 + * + * @param formId ID + * @return CmsForm + */ + CmsForm getByIdRel(Integer formId); + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsLangLogService.java b/src/main/java/com/gxwebsoft/cms/service/CmsLangLogService.java new file mode 100644 index 0000000..d3e59ff --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsLangLogService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsLangLog; +import com.gxwebsoft.cms.param.CmsLangLogParam; + +import java.util.List; + +/** + * 国际化记录启用Service + * + * @author 科技小王子 + * @since 2025-01-06 19:29:26 + */ +public interface CmsLangLogService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsLangLogParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsLangLogParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CmsLangLog + */ + CmsLangLog getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsLangService.java b/src/main/java/com/gxwebsoft/cms/service/CmsLangService.java new file mode 100644 index 0000000..d1c1fa3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsLangService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsLang; +import com.gxwebsoft.cms.param.CmsLangParam; + +import java.util.List; + +/** + * 国际化Service + * + * @author 科技小王子 + * @since 2025-01-06 19:29:26 + */ +public interface CmsLangService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsLangParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsLangParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CmsLang + */ + CmsLang getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsLinkService.java b/src/main/java/com/gxwebsoft/cms/service/CmsLinkService.java new file mode 100644 index 0000000..e65eee7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsLinkService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsLink; +import com.gxwebsoft.cms.param.CmsLinkParam; + +import java.util.List; + +/** + * 常用链接Service + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsLinkService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsLinkParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsLinkParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return CmsLink + */ + CmsLink getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsModelService.java b/src/main/java/com/gxwebsoft/cms/service/CmsModelService.java new file mode 100644 index 0000000..1fe9778 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsModelService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsModel; +import com.gxwebsoft.cms.param.CmsModelParam; + +import java.util.List; + +/** + * 模型Service + * + * @author 科技小王子 + * @since 2024-11-26 15:44:53 + */ +public interface CmsModelService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsModelParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsModelParam param); + + /** + * 根据id查询 + * + * @param modelId ID + * @return CmsModel + */ + CmsModel getByIdRel(Integer modelId); + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsNavigationService.java b/src/main/java/com/gxwebsoft/cms/service/CmsNavigationService.java new file mode 100644 index 0000000..cb867f6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsNavigationService.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsNavigation; +import com.gxwebsoft.cms.param.CmsNavigationParam; + +import java.util.List; + +/** + * 网站导航记录表Service + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +public interface CmsNavigationService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsNavigationParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsNavigationParam param); + + /** + * 根据id查询 + * + * @param navigationId ID + * @return CmsNavigation + */ + CmsNavigation getByIdRel(Integer navigationId); + + void saveAsync(CmsNavigation cmsNavigation); + + CmsNavigation getByIdRelByCodeRel(String code); +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsOrderService.java b/src/main/java/com/gxwebsoft/cms/service/CmsOrderService.java new file mode 100644 index 0000000..4b3c6d4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsOrderService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsOrder; +import com.gxwebsoft.cms.param.CmsOrderParam; + +import java.util.List; + +/** + * 网站订单Service + * + * @author 科技小王子 + * @since 2026-01-27 13:03:24 + */ +public interface CmsOrderService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsOrderParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsOrderParam param); + + /** + * 根据id查询 + * + * @param id id + * @return CmsOrder + */ + CmsOrder getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsStatisticsService.java b/src/main/java/com/gxwebsoft/cms/service/CmsStatisticsService.java new file mode 100644 index 0000000..948d780 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsStatisticsService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsStatistics; +import com.gxwebsoft.cms.param.CmsStatisticsParam; + +import java.util.List; + +/** + * 站点统计信息表Service + * + * @author 科技小王子 + * @since 2025-07-25 12:32:06 + */ +public interface CmsStatisticsService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsStatisticsParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsStatisticsParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return CmsStatistics + */ + CmsStatistics getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsTemplateService.java b/src/main/java/com/gxwebsoft/cms/service/CmsTemplateService.java new file mode 100644 index 0000000..979fa0c --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsTemplateService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsTemplate; +import com.gxwebsoft.cms.param.CmsTemplateParam; + +import java.util.List; + +/** + * 网站模版Service + * + * @author 科技小王子 + * @since 2025-01-21 14:21:16 + */ +public interface CmsTemplateService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsTemplateParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsTemplateParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CmsTemplate + */ + CmsTemplate getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsWebsiteFieldService.java b/src/main/java/com/gxwebsoft/cms/service/CmsWebsiteFieldService.java new file mode 100644 index 0000000..e062ee3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsWebsiteFieldService.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsWebsiteField; +import com.gxwebsoft.cms.param.CmsWebsiteFieldParam; + +import java.util.List; + +/** + * 应用参数Service + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +public interface CmsWebsiteFieldService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsWebsiteFieldParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsWebsiteFieldParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return CmsWebsiteField + */ + CmsWebsiteField getByIdRel(Integer id); + + CmsWebsiteField getByCodeRel(String code); +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsWebsiteService.java b/src/main/java/com/gxwebsoft/cms/service/CmsWebsiteService.java new file mode 100644 index 0000000..a78dfa2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsWebsiteService.java @@ -0,0 +1,70 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsWebsite; +import com.gxwebsoft.cms.param.CmsWebsiteParam; +import com.gxwebsoft.shop.vo.ShopVo; + +import java.util.List; + +/** + * 网站信息记录表Service + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +public interface CmsWebsiteService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsWebsiteParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsWebsiteParam param); + + /** + * 根据id查询 + * + * @param websiteId 站点ID + * @return CmsWebsite + */ + CmsWebsite getByIdRel(Integer websiteId); + + PageResult pageRelAll(CmsWebsiteParam param); + + // 创建站点 + CmsWebsite create(CmsWebsite cmsWebsite); + + CmsWebsite getByIdRelAll(Integer id); + + boolean updateByIdAll(CmsWebsite cmsWebsite); + + boolean removeByIdAll(Integer id); + + CmsWebsite getByTenantId(Integer tenantId); + + /** + * 获取网站基本信息(VO格式) + * + * @param tenantId 租户ID + * @return 网站信息VO + */ + ShopVo getSiteInfo(Integer tenantId); + + /** + * 清除网站信息缓存 + * + * @param tenantId 租户ID + */ + void clearSiteInfoCache(Integer tenantId); +} diff --git a/src/main/java/com/gxwebsoft/cms/service/CmsWebsiteSettingService.java b/src/main/java/com/gxwebsoft/cms/service/CmsWebsiteSettingService.java new file mode 100644 index 0000000..610a7c1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/CmsWebsiteSettingService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.cms.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.cms.entity.CmsWebsiteSetting; +import com.gxwebsoft.cms.param.CmsWebsiteSettingParam; + +import java.util.List; + +/** + * 网站设置Service + * + * @author 科技小王子 + * @since 2025-02-19 01:35:44 + */ +public interface CmsWebsiteSettingService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CmsWebsiteSettingParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CmsWebsiteSettingParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return CmsWebsiteSetting + */ + CmsWebsiteSetting getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsAdRecordServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsAdRecordServiceImpl.java new file mode 100644 index 0000000..d82d016 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsAdRecordServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsAdRecordMapper; +import com.gxwebsoft.cms.service.CmsAdRecordService; +import com.gxwebsoft.cms.entity.CmsAdRecord; +import com.gxwebsoft.cms.param.CmsAdRecordParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 广告图片Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Service +public class CmsAdRecordServiceImpl extends ServiceImpl implements CmsAdRecordService { + + @Override + public PageResult pageRel(CmsAdRecordParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsAdRecordParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public CmsAdRecord getByIdRel(Integer adRecordId) { + CmsAdRecordParam param = new CmsAdRecordParam(); + param.setAdRecordId(adRecordId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsAdServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsAdServiceImpl.java new file mode 100644 index 0000000..370d48d --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsAdServiceImpl.java @@ -0,0 +1,57 @@ +package com.gxwebsoft.cms.service.impl; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsAdMapper; +import com.gxwebsoft.cms.service.CmsAdService; +import com.gxwebsoft.cms.entity.CmsAd; +import com.gxwebsoft.cms.param.CmsAdParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 广告位Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Service +public class CmsAdServiceImpl extends ServiceImpl implements CmsAdService { + + @Override + public PageResult pageRel(CmsAdParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time asc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsAdParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time asc"); + return page.sortRecords(list); + } + + @Override + public CmsAd getByIdRel(Integer adId) { + CmsAdParam param = new CmsAdParam(); + param.setAdId(adId); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public CmsAd getByIdCode(String code) { + CmsAdParam param = new CmsAdParam(); + param.setCode(code); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsArticleCategoryServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsArticleCategoryServiceImpl.java new file mode 100644 index 0000000..e52e243 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsArticleCategoryServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsArticleCategoryMapper; +import com.gxwebsoft.cms.service.CmsArticleCategoryService; +import com.gxwebsoft.cms.entity.CmsArticleCategory; +import com.gxwebsoft.cms.param.CmsArticleCategoryParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 文章分类表Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Service +public class CmsArticleCategoryServiceImpl extends ServiceImpl implements CmsArticleCategoryService { + + @Override + public PageResult pageRel(CmsArticleCategoryParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsArticleCategoryParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public CmsArticleCategory getByIdRel(Integer categoryId) { + CmsArticleCategoryParam param = new CmsArticleCategoryParam(); + param.setCategoryId(categoryId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsArticleCommentServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsArticleCommentServiceImpl.java new file mode 100644 index 0000000..cc41aed --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsArticleCommentServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsArticleCommentMapper; +import com.gxwebsoft.cms.service.CmsArticleCommentService; +import com.gxwebsoft.cms.entity.CmsArticleComment; +import com.gxwebsoft.cms.param.CmsArticleCommentParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 文章评论表Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Service +public class CmsArticleCommentServiceImpl extends ServiceImpl implements CmsArticleCommentService { + + @Override + public PageResult pageRel(CmsArticleCommentParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsArticleCommentParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public CmsArticleComment getByIdRel(Integer commentId) { + CmsArticleCommentParam param = new CmsArticleCommentParam(); + param.setCommentId(commentId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsArticleContentServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsArticleContentServiceImpl.java new file mode 100644 index 0000000..36f47c6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsArticleContentServiceImpl.java @@ -0,0 +1,189 @@ +package com.gxwebsoft.cms.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.entity.*; +import com.gxwebsoft.cms.mapper.CmsArticleContentMapper; +import com.gxwebsoft.cms.service.CmsArticleContentService; +import com.gxwebsoft.cms.param.CmsArticleContentParam; +import com.gxwebsoft.cms.service.CmsArticleService; +import com.gxwebsoft.cms.service.CmsLangLogService; +import com.gxwebsoft.cms.service.CmsNavigationService; +import com.gxwebsoft.common.core.utils.AliYunSender; +import com.gxwebsoft.common.core.utils.JSONUtil; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 文章记录表Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Service +public class CmsArticleContentServiceImpl extends ServiceImpl implements CmsArticleContentService { + @Resource + @Lazy + private CmsNavigationService cmsNavigationService; + @Resource + @Lazy + private CmsArticleService cmsArticleService; + @Resource + private CmsLangLogService cmsLangLogService; + @Override + public PageResult pageRel(CmsArticleContentParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsArticleContentParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public CmsArticleContent getByIdRel(Integer id) { + CmsArticleContentParam param = new CmsArticleContentParam(); + param.setArticleId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public void translate(CmsArticle article) { + // 未开启多语言 + if(cmsLangLogService.count() == 0){ + return; + } + // 仅限定新增简体中文才会同步翻译其他目标语言 + if(!article.getLang().equals("zh_CN")){ + return; + } + // 是否启用自动翻译 + if(!article.getTranslation()){ + return; + } + // 查询关联的默认语言栏目ID + CmsNavigation navigation = cmsNavigationService.getOne(new LambdaQueryWrapper().eq(CmsNavigation::getLangCategoryId, article.getCategoryId()).last("limit 1")); + if (ObjectUtil.isNotEmpty(navigation)) { + TranslateDataVo vo = new TranslateDataVo(); + vo.setFormatType("text"); + vo.setSourceLanguage("auto"); + vo.setTargetLanguage("en"); + + // 翻译标题 + vo.setScene("title"); + vo.setSourceText(article.getTitle()); + article.setTitle(getTranslateApi(vo)); + + // 翻译摘要 + vo.setSourceText(article.getComments()); + vo.setScene("description"); + article.setComments(getTranslateApi(vo)); + + // 翻译产品概述 + vo.setSourceText(article.getOverview()); + article.setOverview(getTranslateApi(vo)); + + // 翻译关键词 + vo.setScene("title"); + vo.setSourceText(article.getTags()); + article.setTags(getTranslateApi(vo)); + + // 翻译话题 + vo.setScene("title"); + vo.setSourceText(article.getTopic()); + article.setTopic(getTranslateApi(vo)); + + // 翻译来源 + vo.setScene("title"); + vo.setSourceText(article.getSource()); + article.setSource(getTranslateApi(vo)); + + // 翻译内容 + vo.setScene(null); + vo.setSourceText(article.getContent()); + article.setContent(getTranslateApi(vo)); + + // 其他参数 + article.setLang("en"); + article.setCategoryId(navigation.getNavigationId()); + + + CmsArticle target = cmsArticleService.getOne(new LambdaQueryWrapper().eq(CmsArticle::getLangArticleId,article.getArticleId()).last("limit 1")); + if(article.getIsUpdate() != null && target != null){ + // 更新操作 + if (ObjectUtil.isNotEmpty(target)) { + target.setTitle(article.getTitle()); + target.setImage(article.getImage()); + target.setFiles(article.getFiles()); + target.setComments(article.getComments()); + target.setTags(article.getTags()); + target.setRecommend(article.getRecommend()); + target.setOverview(article.getOverview()); + target.setContent(article.getContent()); + cmsArticleService.updateById(target); + this.update(new LambdaUpdateWrapper().eq(CmsArticleContent::getArticleId, target.getArticleId()).set(CmsArticleContent::getContent,target.getContent())); + } + }else { + // 新增操作 + article.setLangArticleId(article.getArticleId()); + cmsArticleService.save(article); + final CmsArticleContent content = new CmsArticleContent(); + content.setArticleId(article.getArticleId()); + content.setContent(article.getContent()); + content.setTenantId(article.getTenantId()); + this.save(content); + } + } + + } + + /** + * 机器翻译 + * 阿里云接口 + * ... + */ + public String getTranslateApi(TranslateDataVo item){ + String serviceURL = "http://mt.cn-hangzhou.aliyuncs.com/api/translate/web/ecommerce"; + String accessKeyId = "LTAI5tEsyhW4GCKbds1qsopg";// 使用您的阿里云访问密钥 AccessKeyId + String accessKeySecret = "zltFlQrYVAoq2KMFDWgLa3GhkMNeyO"; // 使用您的阿里云访问密钥 + + final Map map = new HashMap<>(); + map.put("FormatType","text"); + map.put("SourceLanguage","auto"); + map.put("TargetLanguage","en"); + map.put("SourceText",item.getSourceText()); + map.put("Scene","description"); + map.put("Context","产品介绍"); + // Sender代码请参考帮助文档“签名方法” + String result = AliYunSender.sendPost(serviceURL, JSONUtil.toJSONString(map), accessKeyId, accessKeySecret); + JSONObject jsonObject = JSON.parseObject(result); + final Object code = jsonObject.get("Code"); + if (code.equals("200")) { + final Object data = jsonObject.get("Data"); + JSONObject data1 = JSON.parseObject(data.toString()); + final Object translated = data1.get("Translated"); + final Object wordCount = data1.get("WordCount"); + return translated.toString(); + } + return ""; + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsArticleCountServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsArticleCountServiceImpl.java new file mode 100644 index 0000000..f5804d4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsArticleCountServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsArticleCountMapper; +import com.gxwebsoft.cms.service.CmsArticleCountService; +import com.gxwebsoft.cms.entity.CmsArticleCount; +import com.gxwebsoft.cms.param.CmsArticleCountParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 点赞文章Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Service +public class CmsArticleCountServiceImpl extends ServiceImpl implements CmsArticleCountService { + + @Override + public PageResult pageRel(CmsArticleCountParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsArticleCountParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public CmsArticleCount getByIdRel(Integer id) { + CmsArticleCountParam param = new CmsArticleCountParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsArticleLikeServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsArticleLikeServiceImpl.java new file mode 100644 index 0000000..26d7521 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsArticleLikeServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsArticleLikeMapper; +import com.gxwebsoft.cms.service.CmsArticleLikeService; +import com.gxwebsoft.cms.entity.CmsArticleLike; +import com.gxwebsoft.cms.param.CmsArticleLikeParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 点赞文章Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Service +public class CmsArticleLikeServiceImpl extends ServiceImpl implements CmsArticleLikeService { + + @Override + public PageResult pageRel(CmsArticleLikeParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsArticleLikeParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public CmsArticleLike getByIdRel(Integer id) { + CmsArticleLikeParam param = new CmsArticleLikeParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsArticleServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsArticleServiceImpl.java new file mode 100644 index 0000000..46b128b --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsArticleServiceImpl.java @@ -0,0 +1,250 @@ +package com.gxwebsoft.cms.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.entity.*; +import com.gxwebsoft.cms.mapper.CmsArticleMapper; +import com.gxwebsoft.cms.param.CmsAdParam; +import com.gxwebsoft.cms.service.CmsArticleContentService; +import com.gxwebsoft.cms.service.CmsArticleService; +import com.gxwebsoft.cms.param.CmsArticleParam; +import com.gxwebsoft.cms.service.CmsModelService; +import com.gxwebsoft.cms.service.CmsNavigationService; +import com.gxwebsoft.common.core.utils.JSONUtil; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.service.UserService; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +import static com.gxwebsoft.common.core.constants.ArticleConstants.CACHE_KEY_ARTICLE; + +/** + * 文章Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Service +public class CmsArticleServiceImpl extends ServiceImpl implements CmsArticleService { + @Resource + @Lazy + private CmsNavigationService cmsNavigationService; + @Resource + private CmsArticleContentService cmsArticleContentService; + @Resource + private UserService userService; + @Resource + private CmsModelService cmsModelService; + @Resource + private RedisUtil redisUtil; + + private static final int PERMISSION_PASSWORD = 2; + private static final long CACHE_MINUTES = 30L; + + @Override + public PageResult pageRel(CmsArticleParam param) { + if (param.getParentId() != null && !param.getParentId().equals(0)) { + final List cmsNavigations = cmsNavigationService.list(new LambdaQueryWrapper().eq(CmsNavigation::getParentId, param.getParentId())); + if (!CollectionUtils.isEmpty(cmsNavigations)) { + param.setCategoryIds(cmsNavigations.stream().map(CmsNavigation::getNavigationId).collect(Collectors.toSet())); + } + } + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc,create_time desc"); + List list = baseMapper.selectPageRel(page, param); + + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsArticleParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc,create_time desc"); + + if (StrUtil.isNotBlank(param.getSceneType())) { + // 导出数据 + if (param.getSceneType().equals("Content")) { + final Set collectIds = list.stream().map(CmsArticle::getArticleId).collect(Collectors.toSet()); + final List contents = cmsArticleContentService.list(new LambdaQueryWrapper().in(CmsArticleContent::getArticleId, collectIds)); + final Map> collect = contents.stream().collect(Collectors.groupingBy(CmsArticleContent::getArticleId)); + list.forEach(d -> { + final List cmsArticleContents = collect.get(d.getArticleId()); + final CmsArticleContent content = cmsArticleContents.get(0); + if (ObjectUtil.isNotEmpty(content)) { + d.setContent(content.getContent()); + } + }); + } + } + return page.sortRecords(list); + } + + @Override + public CmsArticle getByIdRel(Integer articleId) { +// String key = CACHE_KEY_ARTICLE + articleId; +// final String cacheInfo = redisUtil.get(key); +// if (StrUtil.isNotBlank(cacheInfo)) { +// final CmsArticle article = JSONUtil.parseObject(cacheInfo, CmsArticle.class); +// // 更新阅读数量 +// assert article != null; +// article.setActualViews(article.getActualViews() + 1); +// updateById(article); +// return article; +// } + // 缓存不存在 + CmsArticleParam param = new CmsArticleParam(); + param.setArticleId(articleId); + final CmsArticle article = param.getOne(baseMapper.selectListRel(param)); + if (ObjectUtil.isNotEmpty(article)) { + // 更新阅读数量 + article.setActualViews(article.getActualViews() + 1); + updateById(article); + // 读取Banner +// final CmsModel model = cmsModelService.getOne(new LambdaQueryWrapper().eq(CmsModel::getModel, article.getModel()).last("limit 1")); +// if (ObjectUtil.isNotEmpty(model)) { +// article.setBanner(model.getBanner()); +// } + // 附加文字内容 + CmsArticleContent content = cmsArticleContentService.getOne(new LambdaQueryWrapper().eq(CmsArticleContent::getArticleId, article.getArticleId()).last("limit 1")); + if (content != null) { + article.setContent(content.getContent()); + } +// redisUtil.set(key, article, CACHE_MINUTES, TimeUnit.MINUTES); + return article; + } + return null; + } + + @Override + public void saveInc(Integer formId) { + final CmsArticle article = getById(formId); + if (ObjectUtil.isNull(article)) { + return; + } + article.setBmUsers(article.getBmUsers() + 1); + updateById(article); + } + + @Override + public boolean saveRel(CmsArticle article) { + try { + // 保存文章模型 + final CmsNavigation cmsNavigation = cmsNavigationService.getByIdRel(article.getCategoryId()); + final CmsModel modelInfo = cmsNavigation.getModelInfo(); + final String componentDetail = modelInfo.getComponentDetail(); + if (ObjectUtil.isNotEmpty(componentDetail)) { + final String[] split = componentDetail.split("/"); + article.setModel(modelInfo.getModel()); + if (split[2].equals(modelInfo.getModel())) { + article.setDetail(split[2].concat("/").concat(split[3])); + } else { + article.setDetail(split[2]); + } + } + // 是否密码可见 + if (article.getPermission() != null && article.getPermission() == PERMISSION_PASSWORD) { + article.setPassword(userService.encodePassword(article.getPassword())); + } + // 保存文章内容 + final boolean save = save(article); + if(StrUtil.isBlank(article.getContent())){ + return true; + } + if (save) { + final CmsArticleContent content = new CmsArticleContent(); + content.setArticleId(article.getArticleId()); + content.setContent(article.getContent()); + content.setTenantId(article.getTenantId()); + cmsArticleContentService.save(content); + // 同步翻译并保存 + cmsArticleContentService.translate(article); + return true; + } + } catch (Exception e) { + throw new RuntimeException(e); + } + return false; + } + + @Override + public boolean updateByIdRel(CmsArticle article) { + // 是否密码可见 + if (article.getPermission() == PERMISSION_PASSWORD) { + article.setPassword(userService.encodePassword(article.getPassword())); + } + try { + // 保存文章模型 + final CmsNavigation cmsNavigation = cmsNavigationService.getByIdRel(article.getCategoryId()); + // 模型信息 + if (ObjectUtil.isNotEmpty(cmsNavigation)) { + final CmsModel modelInfo = cmsNavigation.getModelInfo(); + final String componentDetail = modelInfo.getComponentDetail(); + if (ObjectUtil.isNotEmpty(componentDetail)) { + final String[] split = componentDetail.split("/"); + article.setModel(modelInfo.getModel()); + if (split[2].equals(modelInfo.getModel())) { + article.setDetail(split[2].concat("/").concat(split[3])); + } else { + article.setDetail(split[2]); + } + } + } + // 修正父级栏目ID + if (article.getParentId().equals(0)) { + final CmsNavigation current = cmsNavigationService.getById(article.getCategoryId()); + if (ObjectUtil.isNotEmpty(current)) { + article.setParentId(current.getParentId()); + } + } + if (updateById(article)) { + if (StrUtil.isBlank(article.getContent())) { + return true; + } + // 删除缓存 + String key = CACHE_KEY_ARTICLE + article.getArticleId(); + redisUtil.delete(key); + // 更新内容 + final boolean update = cmsArticleContentService.update(new LambdaUpdateWrapper().eq(CmsArticleContent::getArticleId, article.getArticleId()).set(CmsArticleContent::getContent, article.getContent())); + if (update) { + // 同步翻译并保存 + article.setIsUpdate(true); + cmsArticleContentService.translate(article); + return true; + } else { + // 添加内容 + final CmsArticleContent content = new CmsArticleContent(); + content.setArticleId(article.getArticleId()); + content.setContent(article.getContent()); + content.setTenantId(article.getTenantId()); + cmsArticleContentService.save(content); + } + return true; + } + } catch (Exception e) { + throw new RuntimeException(e); + } + return false; + } + + @Override + public CmsArticle getByIdCode(String code) { + CmsArticleParam param = new CmsArticleParam(); + param.setCode(code); + return param.getOne(baseMapper.selectListRel(param)); + } +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsDesignRecordServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsDesignRecordServiceImpl.java new file mode 100644 index 0000000..f1810c4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsDesignRecordServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsDesignRecordMapper; +import com.gxwebsoft.cms.service.CmsDesignRecordService; +import com.gxwebsoft.cms.entity.CmsDesignRecord; +import com.gxwebsoft.cms.param.CmsDesignRecordParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 页面组件表Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Service +public class CmsDesignRecordServiceImpl extends ServiceImpl implements CmsDesignRecordService { + + @Override + public PageResult pageRel(CmsDesignRecordParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsDesignRecordParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public CmsDesignRecord getByIdRel(Integer id) { + CmsDesignRecordParam param = new CmsDesignRecordParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsDesignServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsDesignServiceImpl.java new file mode 100644 index 0000000..ed53a12 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsDesignServiceImpl.java @@ -0,0 +1,157 @@ +package com.gxwebsoft.cms.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.entity.CmsNavigation; +import com.gxwebsoft.cms.entity.TranslateDataVo; +import com.gxwebsoft.cms.mapper.CmsDesignMapper; +import com.gxwebsoft.cms.service.CmsArticleContentService; +import com.gxwebsoft.cms.service.CmsDesignService; +import com.gxwebsoft.cms.entity.CmsDesign; +import com.gxwebsoft.cms.param.CmsDesignParam; +import com.gxwebsoft.cms.service.CmsLangLogService; +import com.gxwebsoft.cms.service.CmsNavigationService; +import com.gxwebsoft.common.core.utils.AliYunSender; +import com.gxwebsoft.common.core.utils.JSONUtil; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; + + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 页面管理记录表Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Service +public class CmsDesignServiceImpl extends ServiceImpl implements CmsDesignService { + @Resource + private CmsLangLogService cmsLangLogService; + @Resource + @Lazy + private CmsNavigationService cmsNavigationService; + @Resource + @Lazy + private CmsArticleContentService cmsArticleContentService; + + @Override + public PageResult pageRel(CmsDesignParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time asc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsDesignParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time asc"); + return page.sortRecords(list); + } + + @Override + public CmsDesign getByIdRel(Integer pageId) { + CmsDesignParam param = new CmsDesignParam(); + param.setPageId(pageId); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public void translate(CmsDesign cmsDesign) { + // 是否启用自动翻译 + if (!cmsDesign.getTranslation()) { + return; + } + // 未开启多语言 + if (cmsLangLogService.count() == 0) { + return; + } + // 查询关联的默认语言栏目ID + CmsNavigation navigation = cmsNavigationService.getOne(new LambdaQueryWrapper().eq(CmsNavigation::getLangCategoryId, cmsDesign.getCategoryId()).last("limit 1")); + if (ObjectUtil.isEmpty(navigation)) { + return; + } + // 仅限定新增简体中文才会同步翻译其他目标语言 + if (!navigation.getLang().equals("en")) { + return; + } + // 查找要翻译的单页面信息 + final CmsDesign design = getOne(new LambdaQueryWrapper().eq(CmsDesign::getCategoryId, navigation.getNavigationId()).last("limit 1")); + if (ObjectUtil.isNotEmpty(design)) { + + TranslateDataVo vo = new TranslateDataVo(); + vo.setFormatType("text"); + vo.setSourceLanguage("auto"); + vo.setTargetLanguage("en"); + + // 翻译标题 + vo.setScene("title"); + vo.setSourceText(cmsDesign.getName()); + design.setName(getTranslateApi(vo)); + + // 翻译关键词 + vo.setSourceText(cmsDesign.getKeywords()); + design.setKeywords(getTranslateApi(vo)); + + // 翻译描述 + vo.setSourceText(cmsDesign.getDescription()); + design.setDescription(getTranslateApi(vo)); + + // 翻译页面内容 + vo.setScene(null); + vo.setSourceText(cmsDesign.getContent()); + design.setContent(getTranslateApi(vo)); + design.setShowBanner(cmsDesign.getShowBanner()); + design.setStyle(cmsDesign.getStyle()); + design.setShowButton(cmsDesign.getShowButton()); + design.setBuyUrl(cmsDesign.getBuyUrl()); + updateById(design); + } + } + + /** + * 机器翻译 + * 阿里云接口 + * ... + */ + public String getTranslateApi(TranslateDataVo item) { + String serviceURL = "http://mt.cn-hangzhou.aliyuncs.com/api/translate/web/ecommerce"; + String accessKeyId = "LTAI5tEsyhW4GCKbds1qsopg";// 使用您的阿里云访问密钥 AccessKeyId + String accessKeySecret = "zltFlQrYVAoq2KMFDWgLa3GhkMNeyO"; // 使用您的阿里云访问密钥 + + final Map map = new HashMap<>(); + map.put("FormatType", "text"); + map.put("SourceLanguage", "auto"); + map.put("TargetLanguage", "en"); + map.put("SourceText", item.getSourceText()); + map.put("Scene", "description"); + map.put("Context", "产品介绍"); + // Sender代码请参考帮助文档“签名方法” + String result = AliYunSender.sendPost(serviceURL, JSONUtil.toJSONString(map), accessKeyId, accessKeySecret); + JSONObject jsonObject = JSON.parseObject(result); + final Object code = jsonObject.get("Code"); + if (code.equals("200")) { + final Object data = jsonObject.get("Data"); + JSONObject data1 = JSON.parseObject(data.toString()); + final Object translated = data1.get("Translated"); + final Object wordCount = data1.get("WordCount"); + return translated.toString(); + } + return ""; + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsDomainServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsDomainServiceImpl.java new file mode 100644 index 0000000..dea153f --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsDomainServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsDomainMapper; +import com.gxwebsoft.cms.service.CmsDomainService; +import com.gxwebsoft.cms.entity.CmsDomain; +import com.gxwebsoft.cms.param.CmsDomainParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 网站域名记录表Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +@Service +public class CmsDomainServiceImpl extends ServiceImpl implements CmsDomainService { + + @Override + public PageResult pageRel(CmsDomainParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsDomainParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public CmsDomain getByIdRel(Integer id) { + CmsDomainParam param = new CmsDomainParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsFormRecordServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsFormRecordServiceImpl.java new file mode 100644 index 0000000..4156faf --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsFormRecordServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsFormRecordMapper; +import com.gxwebsoft.cms.service.CmsFormRecordService; +import com.gxwebsoft.cms.entity.CmsFormRecord; +import com.gxwebsoft.cms.param.CmsFormRecordParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 表单数据记录表Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Service +public class CmsFormRecordServiceImpl extends ServiceImpl implements CmsFormRecordService { + + @Override + public PageResult pageRel(CmsFormRecordParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsFormRecordParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public CmsFormRecord getByIdRel(Integer formRecordId) { + CmsFormRecordParam param = new CmsFormRecordParam(); + param.setFormRecordId(formRecordId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsFormServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsFormServiceImpl.java new file mode 100644 index 0000000..b42ffb1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsFormServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsFormMapper; +import com.gxwebsoft.cms.service.CmsFormService; +import com.gxwebsoft.cms.entity.CmsForm; +import com.gxwebsoft.cms.param.CmsFormParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 表单设计表Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Service +public class CmsFormServiceImpl extends ServiceImpl implements CmsFormService { + + @Override + public PageResult pageRel(CmsFormParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsFormParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public CmsForm getByIdRel(Integer formId) { + CmsFormParam param = new CmsFormParam(); + param.setFormId(formId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsLangLogServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsLangLogServiceImpl.java new file mode 100644 index 0000000..f8627cb --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsLangLogServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsLangLogMapper; +import com.gxwebsoft.cms.service.CmsLangLogService; +import com.gxwebsoft.cms.entity.CmsLangLog; +import com.gxwebsoft.cms.param.CmsLangLogParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 国际化记录启用Service实现 + * + * @author 科技小王子 + * @since 2025-01-06 19:29:26 + */ +@Service +public class CmsLangLogServiceImpl extends ServiceImpl implements CmsLangLogService { + + @Override + public PageResult pageRel(CmsLangLogParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsLangLogParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public CmsLangLog getByIdRel(Integer id) { + CmsLangLogParam param = new CmsLangLogParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsLangServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsLangServiceImpl.java new file mode 100644 index 0000000..4e27908 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsLangServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsLangMapper; +import com.gxwebsoft.cms.service.CmsLangService; +import com.gxwebsoft.cms.entity.CmsLang; +import com.gxwebsoft.cms.param.CmsLangParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 国际化Service实现 + * + * @author 科技小王子 + * @since 2025-01-06 19:29:26 + */ +@Service +public class CmsLangServiceImpl extends ServiceImpl implements CmsLangService { + + @Override + public PageResult pageRel(CmsLangParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsLangParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CmsLang getByIdRel(Integer id) { + CmsLangParam param = new CmsLangParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsLinkServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsLinkServiceImpl.java new file mode 100644 index 0000000..b85d845 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsLinkServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsLinkMapper; +import com.gxwebsoft.cms.service.CmsLinkService; +import com.gxwebsoft.cms.entity.CmsLink; +import com.gxwebsoft.cms.param.CmsLinkParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 常用链接Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Service +public class CmsLinkServiceImpl extends ServiceImpl implements CmsLinkService { + + @Override + public PageResult pageRel(CmsLinkParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc,create_time asc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsLinkParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time asc"); + return page.sortRecords(list); + } + + @Override + public CmsLink getByIdRel(Integer id) { + CmsLinkParam param = new CmsLinkParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsModelServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsModelServiceImpl.java new file mode 100644 index 0000000..071f7fa --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsModelServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsModelMapper; +import com.gxwebsoft.cms.service.CmsModelService; +import com.gxwebsoft.cms.entity.CmsModel; +import com.gxwebsoft.cms.param.CmsModelParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 模型Service实现 + * + * @author 科技小王子 + * @since 2024-11-26 15:44:53 + */ +@Service +public class CmsModelServiceImpl extends ServiceImpl implements CmsModelService { + + @Override + public PageResult pageRel(CmsModelParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time asc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsModelParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time asc"); + return page.sortRecords(list); + } + + @Override + public CmsModel getByIdRel(Integer modelId) { + CmsModelParam param = new CmsModelParam(); + param.setModelId(modelId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsNavigationServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsNavigationServiceImpl.java new file mode 100644 index 0000000..7a541ba --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsNavigationServiceImpl.java @@ -0,0 +1,190 @@ +package com.gxwebsoft.cms.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.entity.CmsDesign; +import com.gxwebsoft.cms.entity.CmsModel; +import com.gxwebsoft.cms.mapper.CmsNavigationMapper; +import com.gxwebsoft.cms.service.CmsDesignService; +import com.gxwebsoft.cms.service.CmsModelService; +import com.gxwebsoft.cms.service.CmsNavigationService; +import com.gxwebsoft.cms.entity.CmsNavigation; +import com.gxwebsoft.cms.param.CmsNavigationParam; +import com.gxwebsoft.common.core.exception.BusinessException; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.service.UserService; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.text.MessageFormat; +import java.util.List; + +/** + * 网站导航记录表Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:47:57 + */ +@Service +public class CmsNavigationServiceImpl extends ServiceImpl implements CmsNavigationService { + @Resource + @Lazy + private CmsDesignService cmsDesignService; + @Resource + private CmsModelService cmsModelService; + @Resource + private UserService userService; + + @Override + public PageResult pageRel(CmsNavigationParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, position asc, navigation_id asc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsNavigationParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, position asc,navigation_id asc"); + return page.sortRecords(list); + } + + @Override + public CmsNavigation getByIdRel(Integer navigationId) { + CmsNavigationParam param = new CmsNavigationParam(); + param.setNavigationId(navigationId); + CmsNavigation navigation; + navigation = param.getOne(baseMapper.selectListRel(param)); + if (ObjectUtil.isEmpty(navigation)) { + return null; + } + // 父级栏目并且是page模型则读取子项目第一条 + if (navigation.getParentId().equals(0) && navigation.getModel().equals("page")) { + final CmsNavigation parent = this.getOne(new LambdaQueryWrapper().eq(CmsNavigation::getParentId, navigation.getNavigationId()).last("limit 1")); + if (ObjectUtil.isNotEmpty(parent)) { + navigation = parent; + } + } + // 所属页面 + navigation.setDesign(cmsDesignService.getOne(new LambdaQueryWrapper().eq(CmsDesign::getCategoryId, navigation.getNavigationId()).last("limit 1"))); + // 所属模型 + if (StrUtil.isNotBlank(navigation.getModel())) { + navigation.setModelInfo(cmsModelService.getOne(new LambdaQueryWrapper().eq(CmsModel::getModel, navigation.getModel()).last("limit 1"))); + if (StrUtil.isBlank(navigation.getBanner())) { + navigation.setBanner(navigation.getModelInfo().getBanner()); + navigation.setMpBanner(navigation.getModelInfo().getThumb()); + } + } + return navigation; + } + + /** + * 配置路由生成规则 + * path:/模型/导航ID + * component: /pages/模型/index.vue + */ + @Override + public void saveAsync(CmsNavigation navigation) { + // TODO 1.设计path和component生产规则 + final String path = navigation.getPath(); + final CmsModel model = cmsModelService.getOne(new LambdaQueryWrapper().eq(CmsModel::getModel, navigation.getModel()).last("limit 1")); + // 1.自动配置 + navigation.setPath("/" + navigation.getModel() + "/" + navigation.getNavigationId()); + navigation.setTarget("_self"); + navigation.setComponent(MessageFormat.format("/pages/{0}/{1}", navigation.getModel(), "[id].vue")); + + // 1.2自定义文件后缀 + if(!navigation.getModel().equals("index") && model.getSuffix() != null){ + navigation.setPath(navigation.getPath() + model.getSuffix()); + } + + // 2.特例:默认首页 + if (navigation.getPath().equals("/") || navigation.getModel().equals("index")) { + final long count = count(new LambdaQueryWrapper().eq(CmsNavigation::getPath, "/").eq(CmsNavigation::getLang,navigation.getLang())); + if(count > 1){ + throw new BusinessException("路由地址已存在!"); + } + navigation.setPath("/"); + navigation.setComponent("/pages/index.vue"); + navigation.setModel("index"); + navigation.setHome(1); + } + // 3.外链模型 + if (navigation.getModel().equals("links")) { + navigation.setPath(path); + navigation.setTarget("_blank"); + navigation.setComponent(null); + } + + // 4.密码可见 + if(StrUtil.isNotBlank(navigation.getPassword())){ + navigation.setPassword(userService.encodePassword(navigation.getPassword())); + } + + // 更新操作 + updateById(navigation); + + // TODO 2.同步添加页面 + final CmsDesign one = cmsDesignService.getOne(new LambdaQueryWrapper().eq(CmsDesign::getCategoryId, navigation.getNavigationId()).eq(CmsDesign::getDeleted, 0).last("limit 1")); + if (ObjectUtil.isEmpty(one)) { + final CmsDesign design = new CmsDesign(); + design.setName(navigation.getTitle()); + design.setCategoryId(navigation.getNavigationId()); + design.setKeywords(navigation.getTitle()); + design.setDescription(navigation.getComments()); + design.setPath(navigation.getPath()); + design.setComponent(navigation.getComponent()); + design.setTenantId(navigation.getTenantId()); + if (StrUtil.isNotBlank(navigation.getContent())) { + design.setContent(navigation.getContent()); + } + cmsDesignService.save(design); + } + + // 面包屑 +// final CmsNavigation parent = getById(navigation.getParentId()); +// if (ObjectUtil.isNotEmpty(parent) && navigation.getParentId() > 0) { +// navigation.setParentName(parent.getTitle()); +// navigation.setParentPath(parent.getPath()); +// navigation.setParentId(parent.getNavigationId()); +// updateById(parent); +// } + } + + @Override + public CmsNavigation getByIdRelByCodeRel(String code) { + CmsNavigationParam param = new CmsNavigationParam(); + param.setCode(code); + CmsNavigation navigation; + navigation = param.getOne(baseMapper.selectListRel(param)); + if (ObjectUtil.isEmpty(navigation)) { + return null; + } + // 父级栏目并且是page模型则读取子项目第一条 + if (navigation.getParentId().equals(0) && navigation.getModel().equals("page")) { + final CmsNavigation parent = this.getOne(new LambdaQueryWrapper().eq(CmsNavigation::getParentId, navigation.getNavigationId()).last("limit 1")); + if (ObjectUtil.isNotEmpty(parent)) { + navigation = parent; + } + } + // 所属页面 + navigation.setDesign(cmsDesignService.getOne(new LambdaQueryWrapper().eq(CmsDesign::getCategoryId, navigation.getNavigationId()).last("limit 1"))); + // 所属模型 + if (StrUtil.isNotBlank(navigation.getModel())) { + navigation.setModelInfo(cmsModelService.getOne(new LambdaQueryWrapper().eq(CmsModel::getModel, navigation.getModel()).last("limit 1"))); + if (StrUtil.isBlank(navigation.getBanner())) { + navigation.setBanner(navigation.getModelInfo().getBanner()); + navigation.setMpBanner(navigation.getModelInfo().getThumb()); + } + } + return navigation; + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsOrderServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsOrderServiceImpl.java new file mode 100644 index 0000000..736ba73 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsOrderServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsOrderMapper; +import com.gxwebsoft.cms.service.CmsOrderService; +import com.gxwebsoft.cms.entity.CmsOrder; +import com.gxwebsoft.cms.param.CmsOrderParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 网站订单Service实现 + * + * @author 科技小王子 + * @since 2026-01-27 13:03:24 + */ +@Service +public class CmsOrderServiceImpl extends ServiceImpl implements CmsOrderService { + + @Override + public PageResult pageRel(CmsOrderParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsOrderParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CmsOrder getByIdRel(Integer id) { + CmsOrderParam param = new CmsOrderParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsStatisticsServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsStatisticsServiceImpl.java new file mode 100644 index 0000000..b965b41 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsStatisticsServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsStatisticsMapper; +import com.gxwebsoft.cms.service.CmsStatisticsService; +import com.gxwebsoft.cms.entity.CmsStatistics; +import com.gxwebsoft.cms.param.CmsStatisticsParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 站点统计信息表Service实现 + * + * @author 科技小王子 + * @since 2025-07-25 12:32:06 + */ +@Service +public class CmsStatisticsServiceImpl extends ServiceImpl implements CmsStatisticsService { + + @Override + public PageResult pageRel(CmsStatisticsParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsStatisticsParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CmsStatistics getByIdRel(Integer id) { + CmsStatisticsParam param = new CmsStatisticsParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsTemplateServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsTemplateServiceImpl.java new file mode 100644 index 0000000..3be39e4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsTemplateServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsTemplateMapper; +import com.gxwebsoft.cms.service.CmsTemplateService; +import com.gxwebsoft.cms.entity.CmsTemplate; +import com.gxwebsoft.cms.param.CmsTemplateParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 网站模版Service实现 + * + * @author 科技小王子 + * @since 2025-01-21 14:21:16 + */ +@Service +public class CmsTemplateServiceImpl extends ServiceImpl implements CmsTemplateService { + + @Override + public PageResult pageRel(CmsTemplateParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsTemplateParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CmsTemplate getByIdRel(Integer id) { + CmsTemplateParam param = new CmsTemplateParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsWebsiteFieldServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsWebsiteFieldServiceImpl.java new file mode 100644 index 0000000..81a8259 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsWebsiteFieldServiceImpl.java @@ -0,0 +1,54 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsWebsiteFieldMapper; +import com.gxwebsoft.cms.service.CmsWebsiteFieldService; +import com.gxwebsoft.cms.entity.CmsWebsiteField; +import com.gxwebsoft.cms.param.CmsWebsiteFieldParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 应用参数Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +@Service +public class CmsWebsiteFieldServiceImpl extends ServiceImpl implements CmsWebsiteFieldService { + + @Override + public PageResult pageRel(CmsWebsiteFieldParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time asc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsWebsiteFieldParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time asc"); + return page.sortRecords(list); + } + + @Override + public CmsWebsiteField getByIdRel(Integer id) { + CmsWebsiteFieldParam param = new CmsWebsiteFieldParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public CmsWebsiteField getByCodeRel(String code) { + CmsWebsiteFieldParam param = new CmsWebsiteFieldParam(); + param.setName(code); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsWebsiteServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsWebsiteServiceImpl.java new file mode 100644 index 0000000..0bc0566 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsWebsiteServiceImpl.java @@ -0,0 +1,428 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.entity.*; +import com.gxwebsoft.cms.mapper.*; +import com.gxwebsoft.cms.param.*; +import com.gxwebsoft.cms.service.*; +import com.gxwebsoft.common.core.utils.JSONUtil; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.service.CompanyService; +import com.gxwebsoft.common.system.service.UserService; +import com.gxwebsoft.project.entity.Project; +import com.gxwebsoft.project.service.ProjectService; +import com.gxwebsoft.shop.vo.ShopVo; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import lombok.extern.slf4j.Slf4j; + +/** + * 网站信息记录表Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +@Slf4j +@Service +public class CmsWebsiteServiceImpl extends ServiceImpl implements CmsWebsiteService { + + private static final String SITE_INFO_KEY_PREFIX = "SiteInfo:"; + @Resource + private CmsWebsiteFieldMapper cmsWebsiteFieldMapper; + @Resource + private CmsModelMapper cmsModelMapper; + @Resource + private CmsNavigationMapper cmsNavigationMapper; + @Resource + private CmsLangLogMapper cmsLangLogMapper; + @Resource + private CmsAdMapper cmsAdMapper; + @Resource + private CmsLinkMapper cmsLinkMapper; + @Resource + private CmsArticleMapper cmsArticleMapper; + @Resource + private CmsWebsiteFieldService cmsWebsiteFieldService; + @Resource + private CmsModelService cmsModelService; + @Resource + private CmsNavigationService cmsNavigationService; + @Resource + private CmsLangLogService cmsLangLogService; + @Resource + private CmsAdService cmsAdService; + @Resource + private CmsLinkService cmsLinkService; + @Resource + private CmsArticleService cmsArticleService; + @Resource + private CmsArticleContentService cmsArticleContentService; + @Resource + private CmsWebsiteMapper cmsWebsiteMapper; + @Resource + private ProjectService projectService; + @Resource + private RedisUtil redisUtil; + @Resource + private UserService userService; + @Resource + private CompanyService companyService; + + @Override + public PageResult pageRel(CmsWebsiteParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + list.forEach(d -> { + LocalDateTime now = LocalDateTime.now(); + if (d.getExpirationTime() != null) { + // 将Date转换为LocalDateTime进行计算 + LocalDateTime expirationTime = d.getExpirationTime().toInstant() + .atZone(java.time.ZoneId.systemDefault()) + .toLocalDateTime(); + // 即将过期(30天内过期的) + d.setSoon(expirationTime.minusDays(30).compareTo(now)); + // 是否过期 -1已过期 大于0 未过期 + d.setStatus(expirationTime.compareTo(now)); + } else { + d.setSoon(0); + d.setStatus(1); + } + }); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsWebsiteParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public CmsWebsite getByIdRel(Integer websiteId) { + CmsWebsiteParam param = new CmsWebsiteParam(); + param.setWebsiteId(websiteId); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public PageResult pageRelAll(CmsWebsiteParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRelAll(page, param); + list.forEach(d -> { + LocalDateTime now = LocalDateTime.now(); + if (d.getExpirationTime() != null) { + // 将Date转换为LocalDateTime进行计算 + LocalDateTime expirationTime = d.getExpirationTime().toInstant() + .atZone(java.time.ZoneId.systemDefault()) + .toLocalDateTime(); + // 即将过期(30天内过期的) + d.setSoon(expirationTime.minusDays(30).compareTo(now)); + // 是否过期 -1已过期 大于0 未过期 + d.setStatus(expirationTime.compareTo(now)); + } else { + d.setSoon(0); + d.setStatus(1); + } + }); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public CmsWebsite create(CmsWebsite website) { + final User loginUser = website.getLoginUser(); + // 创建站点 +// website.setWebsiteName("网站名称"); + website.setWebsiteCode("site-".concat(loginUser.getTenantId().toString())); +// if (StrUtil.isBlank(website.getWebsiteLogo())) { +// website.setWebsiteLogo("https://oss.wsdns.cn/20240822/0252ad4ed46449cdafe12f8d3d96c2ea.svg"); +// } + website.setWebsiteIcon("/favicon.ico"); + website.setWebsiteType("云·企业官网"); + website.setAdminUrl("site.websoft.top"); + website.setVersion(10); + website.setExpirationTime(java.util.Date.from(LocalDateTime.now().plusMonths(1) + .atZone(java.time.ZoneId.systemDefault()).toInstant())); + website.setUserId(loginUser.getUserId()); + website.setDeveloper(loginUser.getNickname()); + website.setTenantId(loginUser.getTenantId()); + website.setTemplateId(loginUser.getTemplateId()); + website.setCompanyId(loginUser.getCompanyId()); + + // 初始化数据 + if(save(website)){ + // 插入网站设置记录 +// final CmsWebsiteSetting setting = new CmsWebsiteSetting(); +// setting.setWebsiteId(website.getWebsiteId()); +// setting.setCreateTime(DateUtil.date()); +// setting.setUpdateTime(DateUtil.date()); +// cmsWebsiteSettingService.save(setting); + + // 将网站创建者的userId做为查询条件 10257(4716),10324(6978),10398(26564) + Integer websiteUserId = website.getTemplateId(); + + // 只有当templateId存在时才执行复制操作 + if (websiteUserId != null && websiteUserId > 0) { + // TODO 国际化 + final CmsLangLogParam cmsLangLogParam = new CmsLangLogParam(); + cmsLangLogParam.setWebsiteUserId(websiteUserId); + final List logs = cmsLangLogMapper.selectListAllRel(cmsLangLogParam); + logs.forEach(d->{ + d.setTenantId(loginUser.getTenantId()); + }); + cmsLangLogService.saveBatch(logs); + + // TODO 复制参数 + final CmsWebsiteFieldParam param = new CmsWebsiteFieldParam(); + param.setUserId(websiteUserId); + final List fields = cmsWebsiteFieldMapper.selectListAllRel(param); + fields.forEach(d->{ + d.setTenantId(loginUser.getTenantId()); + }); + cmsWebsiteFieldService.saveBatch(fields); + + // TODO 复制模型 + final CmsModelParam modelParam = new CmsModelParam(); + modelParam.setWebsiteUserId(websiteUserId); + final List models = cmsModelMapper.selectListAllRel(modelParam); + models.forEach(d->{ + d.setUserId(loginUser.getUserId()); + d.setTenantId(loginUser.getTenantId()); + }); + cmsModelService.saveBatch(models); + + // TODO 复制广告 + final CmsAdParam cmsAdParam = new CmsAdParam(); + cmsAdParam.setWebsiteUserId(websiteUserId); + final List ads = cmsAdMapper.selectListAllRel(cmsAdParam); + ads.forEach(d -> { + d.setUserId(loginUser.getUserId()); + d.setTenantId(loginUser.getTenantId()); + }); + cmsAdService.saveBatch(ads); + + // TODO 复制链接 + CmsLinkParam cmsLinkParam = new CmsLinkParam(); + cmsLinkParam.setWebsiteUserId(websiteUserId); + final List links = cmsLinkMapper.selectListAllRel(cmsLinkParam); + links.forEach(d -> { + d.setUserId(loginUser.getUserId()); + d.setTenantId(loginUser.getTenantId()); + }); + cmsLinkService.saveBatch(links); + + // TODO 复制栏目和文章、文章内容 + CmsNavigationParam cmsNavigationParam = new CmsNavigationParam(); + cmsNavigationParam.setWebsiteUserId(websiteUserId); + cmsNavigationParam.setParentId(0); + final List parents = cmsNavigationMapper.selectListAllRel(cmsNavigationParam); + parents.forEach(d -> { + Integer navigationId = d.getNavigationId(); + // 复制顶级栏目 + d.setTenantId(loginUser.getTenantId()); + d.setUserId(loginUser.getUserId()); + if (cmsNavigationService.save(d)) { + cmsNavigationService.saveAsync(d); + // 复制栏目文章 + CmsArticleParam cmsArticleParam = new CmsArticleParam(); + cmsArticleParam.setWebsiteUserId(websiteUserId); + cmsArticleParam.setCategoryId(navigationId); + final List articles = cmsArticleMapper.selectListAllRel(cmsArticleParam); + articles.forEach(a -> { + a.setCategoryId(d.getNavigationId()); + a.setUserId(loginUser.getUserId()); + a.setTenantId(loginUser.getTenantId()); + if (cmsArticleService.save(a)) { + final CmsArticleContent content = new CmsArticleContent(); + content.setArticleId(a.getArticleId()); + content.setContent(a.getContent()); + cmsArticleContentService.save(content); + } + }); + // 复制子栏目 + cmsNavigationParam.setParentId(navigationId); + final List navigations = cmsNavigationMapper.selectListAllRel(cmsNavigationParam); + navigations.forEach(c -> { + cmsArticleParam.setCategoryId(c.getNavigationId()); + c.setParentId(d.getNavigationId()); + c.setTenantId(loginUser.getTenantId()); + c.setUserId(loginUser.getUserId()); + cmsNavigationService.save(c); + cmsNavigationService.saveAsync(c); + // 复制子栏目文章 + final List articles2 = cmsArticleMapper.selectListAllRel(cmsArticleParam); + articles2.forEach(a2 -> { + a2.setCategoryId(c.getNavigationId()); + a2.setParentId(c.getParentId()); + a2.setUserId(loginUser.getUserId()); + a2.setTenantId(loginUser.getTenantId()); + if (cmsArticleService.save(a2)) { + final CmsArticleContent content = new CmsArticleContent(); + content.setArticleId(a2.getArticleId()); + content.setContent(a2.getContent()); + cmsArticleContentService.save(content); + } + }); + }); + } + }); + } else { + log.warn("没有有效的模板ID,跳过复制操作"); + } + + // 新增项目 + final Project project = new Project(); + project.setUserId(website.getUserId()); + project.setAppName(website.getWebsiteName()); + project.setAppIcon(website.getWebsiteIcon()); + project.setAppCode(website.getWebsiteCode()); + project.setAdminUrl(website.getAdminUrl()); + project.setRenewMoney(website.getPrice()); + project.setWebsiteId(website.getWebsiteId()); + project.setAdminUrl(website.getAdminUrl()); + project.setAppType(website.getWebsiteType()); + project.setAppIcon(website.getWebsiteLogo()); + project.setAppUrl(website.getDomain()); + project.setCompanyId(website.getUserId()); + project.setTenantId(5); + projectService.save(project); + } + return website; + } + + @Override + public CmsWebsite getByIdRelAll(Integer id) { + return cmsWebsiteMapper.getByIdRelAll(id); + } + + @Override + public boolean updateByIdAll(CmsWebsite cmsWebsite) { + return baseMapper.updateByIdAll(cmsWebsite); + } + + @Override + public boolean removeByIdAll(Integer id) { + return baseMapper.removeByIdAll(id); + } + + @Override + public CmsWebsite getByTenantId(Integer tenantId) { + return baseMapper.getByTenantId(tenantId); + } + + @Override + public ShopVo getSiteInfo(Integer tenantId) { + // 参数验证 + if (ObjectUtil.isEmpty(tenantId)) { + throw new IllegalArgumentException("租户ID不能为空"); + } + + // 尝试从缓存获取 + String cacheKey = SITE_INFO_KEY_PREFIX + tenantId; + String siteInfo = redisUtil.get(cacheKey); + if (StrUtil.isNotBlank(siteInfo)) { + log.info("从缓存获取网站信息,租户ID: {}", tenantId); + try { + return JSONUtil.parseObject(siteInfo, ShopVo.class); + } catch (Exception e) { + log.warn("缓存解析失败,从数据库重新获取: {}", e.getMessage()); + } + } + + // 从数据库获取站点信息 + CmsWebsite website = getWebsiteFromDatabase(tenantId); + + + if (website == null) { + throw new RuntimeException("请先创建站点"); + } + + // 构建完整的网站信息 + buildCompleteWebsiteInfo(website); + + // 处理过期时间 + CmsWebsiteServiceImplHelper.processExpirationTime(website); + + // 转换为VO对象 + ShopVo websiteVO = CmsWebsiteServiceImplHelper.convertToVO(website); + + // 缓存结果 + try { + redisUtil.set(cacheKey, websiteVO, 1L, TimeUnit.DAYS); + } catch (Exception e) { + log.warn("缓存网站信息失败: {}", e.getMessage()); + } + + log.info("获取网站信息成功,网站ID: {}, 租户ID: {}", website.getWebsiteId(), tenantId); + return websiteVO; + } + + @Override + public void clearSiteInfoCache(Integer tenantId) { + if (tenantId != null) { + String cacheKey = SITE_INFO_KEY_PREFIX + tenantId; + redisUtil.delete(cacheKey); + log.info("清除网站信息缓存成功,租户ID: {}", tenantId); + } + } + + /** + * 从数据库获取网站信息 + */ + private CmsWebsite getWebsiteFromDatabase(Integer tenantId) { + return getByTenantId(tenantId); + } + + /** + * 构建完整的网站信息 + */ + private void buildCompleteWebsiteInfo(CmsWebsite website) { + // 设置网站状态 + CmsWebsiteServiceImplHelper.setWebsiteStatus(website); + + // 设置网站配置 + CmsWebsiteServiceImplHelper.setWebsiteConfig(website); + + // 设置网站导航 + setWebsiteNavigation(website); + + // 设置网站设置信息 + CmsWebsiteServiceImplHelper.setWebsiteSetting(website); + + // 设置服务器时间信息 + CmsWebsiteServiceImplHelper.setServerTimeInfo(website); + } + + /** + * 设置网站导航 + */ + private void setWebsiteNavigation(CmsWebsite website) { + // 获取顶部导航 + CmsNavigationParam navigationParam = new CmsNavigationParam(); + navigationParam.setHide(0); + navigationParam.setTop(0); + navigationParam.setBottom(null); + List topNavs = cmsNavigationService.listRel(navigationParam); + website.setTopNavs(topNavs); + + // 获取底部导航 + navigationParam.setTop(null); + navigationParam.setBottom(0); + List bottomNavs = cmsNavigationService.listRel(navigationParam); + website.setBottomNavs(bottomNavs); + } +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsWebsiteServiceImplHelper.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsWebsiteServiceImplHelper.java new file mode 100644 index 0000000..85647df --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsWebsiteServiceImplHelper.java @@ -0,0 +1,239 @@ +package com.gxwebsoft.cms.service.impl; + +import com.gxwebsoft.cms.entity.CmsNavigation; +import com.gxwebsoft.cms.entity.CmsWebsite; +import com.gxwebsoft.shop.vo.MenuVo; +import com.gxwebsoft.shop.vo.ShopVo; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; + +/** + * CmsWebsiteServiceImpl 辅助方法 + * 包含转换和处理逻辑 + */ +public class CmsWebsiteServiceImplHelper { + + /** + * 处理过期时间,只处理真正需要的字段 + */ + public static void processExpirationTime(CmsWebsite website) { + if (website.getExpirationTime() != null) { + LocalDateTime now = LocalDateTime.now(); + Date expirationTimeDate = website.getExpirationTime(); + + // 将Date转换为LocalDateTime进行计算 + LocalDateTime expirationTime = expirationTimeDate.toInstant() + .atZone(java.time.ZoneId.systemDefault()) + .toLocalDateTime(); + + // 计算是否即将过期(30天内过期) + LocalDateTime thirtyDaysLater = now.plusDays(30); + website.setSoon(expirationTime.isBefore(thirtyDaysLater) ? 1 : 0); + + // 计算是否已过期 + website.setExpired(expirationTime.isBefore(now) ? -1 : 1); + + // 计算剩余天数 + long daysBetween = ChronoUnit.DAYS.between(now, expirationTime); + website.setExpiredDays(daysBetween); + } else { + // 没有过期时间的默认值 + website.setSoon(0); + website.setExpired(1); + website.setExpiredDays(0L); + } + } + + /** + * 将实体对象转换为VO对象 + */ + public static ShopVo convertToVO(CmsWebsite website) { + ShopVo vo = new ShopVo(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + // 基本信息 + vo.setAppId(website.getTenantId()); + vo.setAppName(website.getTenantName()); + vo.setTitle(website.getWebsiteName()); + vo.setKeywords(website.getKeywords()); + vo.setDescription(website.getComments()); + vo.setLogo(website.getWebsiteLogo()); + vo.setMpQrCode(website.getWebsiteDarkLogo()); + vo.setDomain(website.getDomain()); + vo.setAdminUrl(website.getAdminUrl()); + vo.setApiUrl(website.getApiUrl()); + vo.setRunning(website.getRunning()); + vo.setVersion(website.getVersion()); + if (website.getCreateTime() != null) { + // 将Date转换为LocalDateTime后格式化 + LocalDateTime createTime = website.getCreateTime().toInstant() + .atZone(java.time.ZoneId.systemDefault()) + .toLocalDateTime(); + vo.setCreateTime(createTime.format(formatter)); + } + + // 时间字段 - 格式化为字符串 + if (website.getExpirationTime() != null) { + // 将Date转换为LocalDateTime后格式化 + LocalDateTime expirationTime = website.getExpirationTime().toInstant() + .atZone(java.time.ZoneId.systemDefault()) + .toLocalDateTime(); + vo.setExpirationTime(expirationTime.format(formatter)); + } + + // 过期相关信息 + vo.setExpired(website.getExpired()); + vo.setExpiredDays(website.getExpiredDays()); + vo.setSoon(website.getSoon()); + + // 状态信息 + vo.setStatusIcon(website.getStatusIcon()); + vo.setStatusText(website.getStatusText()); + + // 复杂对象 + vo.setConfig(website.getConfig()); + vo.setServerTime(website.getServerTime()); + vo.setSetting(website.getSetting()); // CmsWebsiteSetting对象可以直接设置给Object类型 + + // 导航信息 + vo.setTopNavs(convertNavigationToVO(website.getTopNavs())); + vo.setBottomNavs(convertNavigationToVO(website.getBottomNavs())); + + return vo; + } + + /** + * 安全转换 target 字段为整数 + * + * @param target 字符串类型的 target 值 + * @return 对应的整数值 + */ + private static Integer convertTargetToInteger(String target) { + if (target == null) { + return 0; // 默认值:当前窗口 + } + + switch (target.toLowerCase()) { + case "_self": + return 0; // 当前窗口 + case "_blank": + return 1; // 新窗口 + default: + // 如果是数字字符串,尝试直接转换 + try { + return Integer.valueOf(target); + } catch (NumberFormatException e) { + // 转换失败时返回默认值 + return 0; + } + } + } + + /** + * 转换导航列表为VO + * 整理导航栏目录结构(ShopInfo) + */ + public static List convertNavigationToVO(List navigations) { + if (navigations == null) { + return null; + } + + return navigations.stream().map(nav -> { + MenuVo navVO = new MenuVo(); + navVO.setNavigationId(nav.getNavigationId()); + navVO.setTitle(nav.getTitle()); + navVO.setPath(nav.getPath()); + navVO.setIcon(nav.getIcon()); + navVO.setColor(nav.getColor()); + navVO.setParentId(nav.getParentId()); + navVO.setSort(nav.getSortNumber()); + navVO.setHide(nav.getHide()); + navVO.setTop(nav.getTop()); + navVO.setPath(nav.getPath()); + navVO.setTarget(convertTargetToInteger(nav.getTarget())); + navVO.setModel(nav.getModel()); + + // 递归处理子导航 + if (nav.getChildren() != null) { + navVO.setChildren(convertNavigationToVO(nav.getChildren())); + } + + return navVO; + }).collect(Collectors.toList()); + } + + /** + * 设置网站状态 + */ + public static void setWebsiteStatus(CmsWebsite website) { + if (website.getRunning() != null) { + switch (website.getRunning()) { + case 0: + website.setStatusIcon("🔴"); + website.setStatusText("未开通"); + break; + case 1: + website.setStatusIcon("🟢"); + website.setStatusText("正常运行"); + break; + case 2: + website.setStatusIcon("🟡"); + website.setStatusText("维护中"); + break; + case 3: + website.setStatusIcon("🔴"); + website.setStatusText("违规关停"); + break; + default: + website.setStatusIcon("❓"); + website.setStatusText("未知状态"); + } + } + } + + /** + * 设置网站配置 + */ + public static void setWebsiteConfig(CmsWebsite website) { + HashMap config = new HashMap<>(); + config.put("websiteName", website.getWebsiteName()); + config.put("websiteComments", website.getComments()); + config.put("websiteTitle", website.getWebsiteName()); + config.put("websiteKeywords", website.getKeywords()); + config.put("websiteDescription", website.getContent()); // 使用 content 字段作为描述 + config.put("websiteLogo", website.getWebsiteLogo()); + config.put("websiteIcon", website.getWebsiteIcon()); + config.put("domain", website.getDomain()); + website.setConfig(config); + } + + /** + * 设置服务器时间信息 + */ + public static void setServerTimeInfo(CmsWebsite website) { + HashMap serverTime = new HashMap<>(); + LocalDateTime now = LocalDateTime.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + serverTime.put("currentTime", now.format(formatter)); + serverTime.put("timestamp", System.currentTimeMillis()); + serverTime.put("timezone", "Asia/Shanghai"); + + website.setServerTime(serverTime); + } + + /** + * 设置网站设置信息 + */ + public static void setWebsiteSetting(CmsWebsite website) { + // 这里可以根据需要设置网站的其他设置信息 + // 暂时设置为null,因为setting字段类型是CmsWebsiteSetting而不是HashMap + website.setSetting(null); + } +} diff --git a/src/main/java/com/gxwebsoft/cms/service/impl/CmsWebsiteSettingServiceImpl.java b/src/main/java/com/gxwebsoft/cms/service/impl/CmsWebsiteSettingServiceImpl.java new file mode 100644 index 0000000..2788563 --- /dev/null +++ b/src/main/java/com/gxwebsoft/cms/service/impl/CmsWebsiteSettingServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.cms.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.mapper.CmsWebsiteSettingMapper; +import com.gxwebsoft.cms.service.CmsWebsiteSettingService; +import com.gxwebsoft.cms.entity.CmsWebsiteSetting; +import com.gxwebsoft.cms.param.CmsWebsiteSettingParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 网站设置Service实现 + * + * @author 科技小王子 + * @since 2025-02-19 01:35:44 + */ +@Service +public class CmsWebsiteSettingServiceImpl extends ServiceImpl implements CmsWebsiteSettingService { + + @Override + public PageResult pageRel(CmsWebsiteSettingParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CmsWebsiteSettingParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CmsWebsiteSetting getByIdRel(Integer id) { + CmsWebsiteSettingParam param = new CmsWebsiteSettingParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/Constants.java b/src/main/java/com/gxwebsoft/common/core/Constants.java new file mode 100644 index 0000000..be48387 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/Constants.java @@ -0,0 +1,93 @@ +package com.gxwebsoft.common.core; + +/** + * 系统常量 + * Created by WebSoft on 2019-10-29 15:55 + */ +public class Constants { + /** + * 默认成功码 + */ + public static final int RESULT_OK_CODE = 0; + + /** + * 默认失败码 + */ + public static final int RESULT_ERROR_CODE = 1; + + /** + * 默认成功信息 + */ + public static final String RESULT_OK_MSG = "操作成功"; + + /** + * 默认失败信息 + */ + public static final String RESULT_ERROR_MSG = "操作失败"; + + /** + * 无权限错误码 + */ + public static final int UNAUTHORIZED_CODE = 403; + + /** + * 无权限提示信息 + */ + public static final String UNAUTHORIZED_MSG = "没有访问权限"; + + /** + * 未认证错误码 + */ + public static final int UNAUTHENTICATED_CODE = 401; + + /** + * 未认证提示信息 + */ + public static final String UNAUTHENTICATED_MSG = "请先登录"; + + /** + * 登录过期错误码 + */ + public static final int TOKEN_EXPIRED_CODE = 401; + + /** + * 登录过期提示信息 + */ + public static final String TOKEN_EXPIRED_MSG = "登录已过期"; + + /** + * 非法token错误码 + */ + public static final int BAD_CREDENTIALS_CODE = 401; + + /** + * 非法token提示信息 + */ + public static final String BAD_CREDENTIALS_MSG = "请退出重新登录"; + + /** + * 表示升序的值 + */ + public static final String ORDER_ASC_VALUE = "asc"; + + /** + * 表示降序的值 + */ + public static final String ORDER_DESC_VALUE = "desc"; + + /** + * token通过header传递的名称 + */ + public static final String TOKEN_HEADER_NAME = "Authorization"; + + /** + * token通过参数传递的名称 + */ + public static final String TOKEN_PARAM_NAME = "access_token"; + + /** + * token认证类型 + */ + public static final String TOKEN_TYPE = "Bearer"; + +} diff --git a/src/main/java/com/gxwebsoft/common/core/annotation/IgnoreTenant.java b/src/main/java/com/gxwebsoft/common/core/annotation/IgnoreTenant.java new file mode 100644 index 0000000..ace48fa --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/annotation/IgnoreTenant.java @@ -0,0 +1,29 @@ +package com.gxwebsoft.common.core.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 忽略租户隔离注解 + * + * 用于标记需要跨租户操作的方法,如定时任务、系统管理等场景 + * + * @author WebSoft + * @since 2025-01-26 + */ +@Target({ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface IgnoreTenant { + + /** + * 说明信息,用于记录为什么需要忽略租户隔离 + */ + String value() default ""; + + /** + * 是否记录日志 + */ + boolean logAccess() default true; +} diff --git a/src/main/java/com/gxwebsoft/common/core/annotation/OperationLog.java b/src/main/java/com/gxwebsoft/common/core/annotation/OperationLog.java new file mode 100644 index 0000000..87bdf2c --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/annotation/OperationLog.java @@ -0,0 +1,41 @@ +package com.gxwebsoft.common.core.annotation; + +import java.lang.annotation.*; + +/** + * 操作日志记录注解 + * + * @author WebSoft + * @since 2020-03-21 17:03:08 + */ +@Documented +@Target({ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface OperationLog { + + /** + * 操作功能 + */ + String value() default ""; + + /** + * 操作模块 + */ + String module() default ""; + + /** + * 备注 + */ + String comments() default ""; + + /** + * 是否记录请求参数 + */ + boolean param() default true; + + /** + * 是否记录返回结果 + */ + boolean result() default true; + +} diff --git a/src/main/java/com/gxwebsoft/common/core/annotation/OperationModule.java b/src/main/java/com/gxwebsoft/common/core/annotation/OperationModule.java new file mode 100644 index 0000000..60ab018 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/annotation/OperationModule.java @@ -0,0 +1,21 @@ +package com.gxwebsoft.common.core.annotation; + +import java.lang.annotation.*; + +/** + * 操作日志模块注解 + * + * @author WebSoft + * @since 2021-09-01 20:48:16 + */ +@Documented +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface OperationModule { + + /** + * 模块名称 + */ + String value(); + +} diff --git a/src/main/java/com/gxwebsoft/common/core/annotation/QueryField.java b/src/main/java/com/gxwebsoft/common/core/annotation/QueryField.java new file mode 100644 index 0000000..9377b9b --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/annotation/QueryField.java @@ -0,0 +1,22 @@ +package com.gxwebsoft.common.core.annotation; + +import java.lang.annotation.*; + +/** + * 查询条件注解 + * + * @author WebSoft + * @since 2021-09-01 20:48:16 + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE}) +public @interface QueryField { + + // 字段名称 + String value() default ""; + + // 查询方式 + QueryType type() default QueryType.LIKE; + +} diff --git a/src/main/java/com/gxwebsoft/common/core/annotation/QueryType.java b/src/main/java/com/gxwebsoft/common/core/annotation/QueryType.java new file mode 100644 index 0000000..3eb540e --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/annotation/QueryType.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.common.core.annotation; + +/** + * 查询方式 + * + * @author WebSoft + * @since 2021-09-01 20:48:16 + */ +public enum QueryType { + // 等于 + EQ, + // 不等于 + NE, + // 大于 + GT, + // 大于等于 + GE, + // 小于 + LT, + // 小于等于 + LE, + // 包含 + LIKE, + // 不包含 + NOT_LIKE, + // 结尾等于 + LIKE_LEFT, + // 开头等于 + LIKE_RIGHT, + // 为NULL + IS_NULL, + // 不为空 + IS_NOT_NULL, + // IN + IN, + // NOT IN + NOT_IN, + // IN条件解析逗号分割 + IN_STR, + // NOT IN条件解析逗号分割 + NOT_IN_STR +} diff --git a/src/main/java/com/gxwebsoft/common/core/aspect/IgnoreTenantAspect.java b/src/main/java/com/gxwebsoft/common/core/aspect/IgnoreTenantAspect.java new file mode 100644 index 0000000..da58a3b --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/aspect/IgnoreTenantAspect.java @@ -0,0 +1,63 @@ +package com.gxwebsoft.common.core.aspect; + +import com.gxwebsoft.common.core.annotation.IgnoreTenant; +import com.gxwebsoft.common.core.context.TenantContext; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Method; + +/** + * 忽略租户隔离切面 + * + * 自动处理 @IgnoreTenant 注解标记的方法,临时禁用租户隔离 + * + * @author WebSoft + * @since 2025-01-26 + */ +@Slf4j +@Aspect +@Component +@Order(1) // 确保在其他切面之前执行 +public class IgnoreTenantAspect { + + @Around("@annotation(com.gxwebsoft.common.core.annotation.IgnoreTenant)") + public Object around(ProceedingJoinPoint joinPoint) throws Throwable { + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Method method = signature.getMethod(); + IgnoreTenant ignoreTenant = method.getAnnotation(IgnoreTenant.class); + + // 记录原始状态 + boolean originalIgnore = TenantContext.isIgnoreTenant(); + + try { + // 设置忽略租户隔离 + TenantContext.setIgnoreTenant(true); + + // 记录日志 + if (ignoreTenant.logAccess()) { + String className = joinPoint.getTarget().getClass().getSimpleName(); + String methodName = method.getName(); + String reason = ignoreTenant.value(); + + if (reason.isEmpty()) { + log.debug("执行跨租户操作: {}.{}", className, methodName); + } else { + log.debug("执行跨租户操作: {}.{} - {}", className, methodName, reason); + } + } + + // 执行目标方法 + return joinPoint.proceed(); + + } finally { + // 恢复原始状态 + TenantContext.setIgnoreTenant(originalIgnore); + } + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/aspect/OperationLogAspect.java b/src/main/java/com/gxwebsoft/common/core/aspect/OperationLogAspect.java new file mode 100644 index 0000000..4b15358 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/aspect/OperationLogAspect.java @@ -0,0 +1,227 @@ +package com.gxwebsoft.common.core.aspect; + +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.servlet.ServletUtil; +import cn.hutool.http.useragent.UserAgent; +import cn.hutool.http.useragent.UserAgentUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.annotation.OperationModule; +import com.gxwebsoft.common.core.utils.JSONUtil; +import com.gxwebsoft.common.system.entity.OperationRecord; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.service.OperationRecordService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.*; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.lang.reflect.Method; +import java.util.Map; + +/** + * 操作日志记录 + * + * @author WebSoft + * @since 2020-03-21 16:58:16:05 + */ +@Aspect +@Component +public class OperationLogAspect { + @Resource + private OperationRecordService operationRecordService; + + // 参数、返回结果、错误信息等最大保存长度 + private static final int MAX_LENGTH = 1000; + // 用于记录请求耗时 + private final ThreadLocal startTime = new ThreadLocal<>(); + + @Pointcut("@annotation(com.gxwebsoft.common.core.annotation.OperationLog)") + public void operationLog() { + } + + @Before("operationLog()") + public void doBefore(JoinPoint joinPoint) throws Throwable { + startTime.set(System.currentTimeMillis()); + } + + @AfterReturning(pointcut = "operationLog()", returning = "result") + public void doAfterReturning(JoinPoint joinPoint, Object result) { + saveLog(joinPoint, result, null); + } + + @AfterThrowing(value = "operationLog()", throwing = "e") + public void doAfterThrowing(JoinPoint joinPoint, Exception e) { + saveLog(joinPoint, null, e); + } + + /** + * 保存操作记录 + */ + private void saveLog(JoinPoint joinPoint, Object result, Exception e) { + OperationRecord record = new OperationRecord(); + // 记录操作耗时 + if (startTime.get() != null) { + record.setSpendTime(System.currentTimeMillis() - startTime.get()); + } + // 记录当前登录用户id、租户id + User user = getLoginUser(); + if (user != null) { + record.setUserId(user.getUserId()); + record.setTenantId(user.getTenantId()); + } + // 记录请求地址、请求方式、ip + ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + HttpServletRequest request = (attributes == null ? null : attributes.getRequest()); + if (request != null) { + record.setUrl(request.getRequestURI()); + record.setRequestMethod(request.getMethod()); + UserAgent ua = UserAgentUtil.parse(ServletUtil.getHeaderIgnoreCase(request, "User-Agent")); + record.setOs(ua.getPlatform().toString()); + record.setDevice(ua.getOs().toString()); + record.setBrowser(ua.getBrowser().toString()); + record.setIp(ServletUtil.getClientIP(request)); + } + // 记录异常信息 + if (e != null) { + record.setStatus(1); + record.setError(StrUtil.sub(e.toString(), 0, MAX_LENGTH)); + } + // 记录模块名、操作功能、请求方法、请求参数、返回结果 + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + record.setMethod(joinPoint.getTarget().getClass().getName() + "." + signature.getName()); + Method method = signature.getMethod(); + if (method != null) { + OperationLog ol = method.getAnnotation(OperationLog.class); + if (ol != null) { + // 记录操作功能 + record.setDescription(getDescription(method, ol)); + // 记录操作模块 + record.setModule(getModule(joinPoint, ol)); + // 记录备注 + if (StrUtil.isNotEmpty(ol.comments())) { + record.setComments(ol.comments()); + } + // 记录请求参数 + if (ol.param() && request != null) { + record.setParams(StrUtil.sub(getParams(joinPoint, request), 0, MAX_LENGTH)); + } + // 记录请求结果 + if (ol.result() && result != null) { + record.setResult(StrUtil.sub(JSONUtil.toJSONString(result), 0, MAX_LENGTH)); + } + } + } + + // 记录访客日志 +// System.out.println("record = " + record); +// if (record.getMethod().equals("com.gxwebsoft.love.controller.UserProfileController.detail")) { +// final Integer toUserId = Integer.valueOf(StrUtil.removeSuffix(record.getParams()," ")); +// if (userLookService.count(new LambdaQueryWrapper().eq(UserLook::getUserId,record.getUserId()).eq(UserLook::getToUserId,toUserId)) == 0) { +// final UserLook userLook = new UserLook(); +// userLook.setUserId(record.getUserId()); +// userLook.setToUserId(toUserId); +// userLookService.save(userLook); +// } +// } + + operationRecordService.saveAsync(record); + } + + /** + * 获取当前登录用户 + */ + private User getLoginUser() { + Authentication subject = SecurityContextHolder.getContext().getAuthentication(); + if (subject != null) { + Object object = subject.getPrincipal(); + if (object instanceof User) { + return (User) object; + } + } + return null; + } + + /** + * 获取请求参数 + * + * @param joinPoint JoinPoint + * @param request HttpServletRequest + * @return String + */ + private String getParams(JoinPoint joinPoint, HttpServletRequest request) { + String params; + Map paramsMap = ServletUtil.getParamMap(request); + if (paramsMap.keySet().size() > 0) { + params = JSONUtil.toJSONString(paramsMap); + } else { + StringBuilder sb = new StringBuilder(); + for (Object arg : joinPoint.getArgs()) { + if (ObjectUtil.isNull(arg) + || arg instanceof MultipartFile + || arg instanceof HttpServletRequest + || arg instanceof HttpServletResponse) { + continue; + } + sb.append(JSONUtil.toJSONString(arg)).append(" "); + } + params = sb.toString(); + } + return params; + } + + /** + * 获取操作模块 + * + * @param joinPoint JoinPoint + * @param ol OperationLog + * @return String + */ + private String getModule(JoinPoint joinPoint, OperationLog ol) { + if (StrUtil.isNotEmpty(ol.module())) { + return ol.module(); + } + OperationModule om = joinPoint.getTarget().getClass().getAnnotation(OperationModule.class); + if (om != null && StrUtil.isNotEmpty(om.value())) { + return om.value(); + } + // 尝试获取 SpringDoc 的 @Tag 注解 + io.swagger.v3.oas.annotations.tags.Tag tag = joinPoint.getTarget().getClass().getAnnotation(io.swagger.v3.oas.annotations.tags.Tag.class); + if (tag != null && StrUtil.isNotEmpty(tag.name())) { + return tag.name(); + } + return null; + } + + /** + * 获取操作功能 + * + * @param method Method + * @param ol OperationLog + * @return String + */ + private String getDescription(Method method, OperationLog ol) { + if (StrUtil.isNotEmpty(ol.value())) { + return ol.value(); + } + // 尝试获取 SpringDoc 的 @Operation 注解 + io.swagger.v3.oas.annotations.Operation operation = method.getAnnotation(io.swagger.v3.oas.annotations.Operation.class); + if (operation != null && StrUtil.isNotEmpty(operation.summary())) { + return operation.summary(); + } + return null; + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/config/BigDecimalDeserializer.java b/src/main/java/com/gxwebsoft/common/core/config/BigDecimalDeserializer.java new file mode 100644 index 0000000..ed76d34 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/config/BigDecimalDeserializer.java @@ -0,0 +1,41 @@ +package com.gxwebsoft.common.core.config; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import lombok.extern.slf4j.Slf4j; + +import java.io.IOException; +import java.math.BigDecimal; + +/** + * BigDecimal 自定义反序列化器 + * 处理null值和空字符串,避免反序列化异常 + * + * @author WebSoft + * @since 2025-01-15 + */ +@Slf4j +public class BigDecimalDeserializer extends JsonDeserializer { + + @Override + public BigDecimal deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + + if (value == null || value.trim().isEmpty() || "null".equals(value)) { + return null; + } + + try { + return new BigDecimal(value); + } catch (NumberFormatException e) { + log.warn("无法解析BigDecimal值: {}, 返回null", value); + return null; + } + } + + @Override + public BigDecimal getNullValue(DeserializationContext ctxt) { + return null; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/config/CertificateProperties.java b/src/main/java/com/gxwebsoft/common/core/config/CertificateProperties.java new file mode 100644 index 0000000..a13c9d3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/config/CertificateProperties.java @@ -0,0 +1,217 @@ +package com.gxwebsoft.common.core.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * 证书配置属性类 + * 支持开发环境从classpath加载证书,生产环境从Docker挂载卷加载证书 + * + * @author 科技小王子 + * @since 2024-07-26 + */ +@Data +@Component +@ConfigurationProperties(prefix = "certificate") +public class CertificateProperties { + + /** + * 证书加载模式 + * CLASSPATH: 从classpath加载(开发环境) + * FILESYSTEM: 从文件系统加载(生产环境) + * VOLUME: 从Docker挂载卷加载(容器环境) + */ + private LoadMode loadMode = LoadMode.CLASSPATH; + + /** + * Docker挂载卷证书根路径 + */ + private String certRootPath = "/www/wwwroot/file.ws"; + + /** + * 开发环境证书路径前缀 + */ + private String devCertPath = "dev"; + + /** + * 微信支付证书配置 + */ + private WechatPayConfig wechatPay = new WechatPayConfig(); + + /** + * 支付宝证书配置 + */ + private AlipayConfig alipay = new AlipayConfig(); + + /** + * 证书加载模式枚举 + */ + public enum LoadMode { + CLASSPATH, // 从classpath加载 + FILESYSTEM, // 从文件系统加载 + VOLUME // 从Docker挂载卷加载 + } + + /** + * 微信支付证书配置 + */ + @Data + public static class WechatPayConfig { + /** + * 开发环境配置 + */ + private DevConfig dev = new DevConfig(); + + /** + * 生产环境基础路径 + */ + private String prodBasePath = "/"; + + /** + * 微信支付证书目录名 + */ + private String certDir = "wechat"; + + @Data + public static class DevConfig { + /** + * APIv3密钥 + */ + private String apiV3Key; + + /** + * 商户私钥证书文件名 + */ + private String privateKeyFile = "apiclient_key.pem"; + + /** + * 商户证书文件名 + */ + private String apiclientCertFile = "apiclient_cert.pem"; + + /** + * 微信支付平台证书文件名 + */ + private String wechatpayCertFile = "wechatpay_cert.pem"; + } + } + + /** + * 支付宝证书配置 + */ + @Data + public static class AlipayConfig { + /** + * 支付宝证书目录名 + */ + private String certDir = "alipay"; + + /** + * 应用私钥文件名 + */ + private String appPrivateKeyFile = "app_private_key.pem"; + + /** + * 应用公钥证书文件名 + */ + private String appCertPublicKeyFile = "appCertPublicKey.crt"; + + /** + * 支付宝公钥证书文件名 + */ + private String alipayCertPublicKeyFile = "alipayCertPublicKey.crt"; + + /** + * 支付宝根证书文件名 + */ + private String alipayRootCertFile = "alipayRootCert.crt"; + } + + /** + * 获取证书文件的完整路径 + * + * @param certType 证书类型(wechat/alipay) + * @param fileName 文件名 + * @return 完整路径 + */ + public String getCertificatePath(String certType, String fileName) { + switch (loadMode) { + case CLASSPATH: + return devCertPath + "/" + certType + "/" + fileName; + case FILESYSTEM: + return System.getProperty("user.dir") + "/certs/" + certType + "/" + fileName; + case VOLUME: + return certRootPath + "/" + certType + "/" + fileName; + default: + throw new IllegalArgumentException("不支持的证书加载模式: " + loadMode); + } + } + + /** + * 获取微信支付证书路径 + * + * @param fileName 文件名 + * @return 完整路径 + */ + public String getWechatPayCertPath(String fileName) { + // 生产环境特殊处理:数据库中存储的路径直接拼接到根路径 + if (loadMode == LoadMode.VOLUME) { + // 生产环境已经没有/file目录,所有路径都直接拼接到根路径 + // 处理数据库中可能存在的历史路径格式 + String cleanFileName = fileName; + if (fileName.startsWith("/file/")) { + // 去掉历史的 /file/ 前缀 + cleanFileName = fileName.substring(6); + } else if (fileName.startsWith("file/")) { + // 去掉历史的 file/ 前缀 + cleanFileName = fileName.substring(5); + } + // 确保路径以 / 开头 + if (!cleanFileName.startsWith("/")) { + cleanFileName = "/" + cleanFileName; + } + return certRootPath + cleanFileName; + } else { + // 开发环境和文件系统模式使用原有逻辑 + return getCertificatePath(wechatPay.getCertDir(), fileName); + } + } + + /** + * 获取支付宝证书路径 + * + * @param fileName 文件名 + * @return 完整路径 + */ + public String getAlipayCertPath(String fileName) { + return getCertificatePath(alipay.getCertDir(), fileName); + } + + /** + * 检查证书加载模式是否为classpath模式 + * + * @return true if classpath mode + */ + public boolean isClasspathMode() { + return LoadMode.CLASSPATH.equals(loadMode); + } + + /** + * 检查证书加载模式是否为文件系统模式 + * + * @return true if filesystem mode + */ + public boolean isFilesystemMode() { + return LoadMode.FILESYSTEM.equals(loadMode); + } + + /** + * 检查证书加载模式是否为挂载卷模式 + * + * @return true if volume mode + */ + public boolean isVolumeMode() { + return LoadMode.VOLUME.equals(loadMode); + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/config/ConfigProperties.java b/src/main/java/com/gxwebsoft/common/core/config/ConfigProperties.java new file mode 100644 index 0000000..d500177 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/config/ConfigProperties.java @@ -0,0 +1,105 @@ +package com.gxwebsoft.common.core.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * 系统配置属性 + * + * @author WebSoft + * @since 2021-08-30 17:58:16 + */ +@Data +@ConfigurationProperties(prefix = "config") +public class ConfigProperties { + /** + * 文件上传磁盘位置 + */ + private Integer uploadLocation = 0; + + /** + * 文件上传是否使用uuid命名 + */ + private Boolean uploadUuidName = true; + + /** + * 文件上传生成缩略图的大小(kb) + */ + private Integer thumbnailSize = 60; + + /** + * OpenOffice的安装目录 + */ + private String openOfficeHome; + + /** + * swagger扫描包 + */ + private String swaggerBasePackage; + + /** + * swagger文档标题 + */ + private String swaggerTitle; + + /** + * swagger文档描述 + */ + private String swaggerDescription; + + /** + * swagger文档版本号 + */ + private String swaggerVersion; + + /** + * swagger地址 + */ + private String swaggerHost; + + /** + * token过期时间, 单位秒 + */ + private Long tokenExpireTime = 60 * 60 * 365 * 24L; + + /** + * token快要过期自动刷新时间, 单位分钟 + */ + private int tokenRefreshTime = 30; + + /** + * 生成token的密钥Key的base64字符 + */ + private String tokenKey; + + /** + * 文件上传目录 + */ + private String uploadPath; + + /** + * 本地文件上传目录(开发环境) + */ + private String localUploadPath; + + /** + * 文件服务器 + */ + private String fileServer; + + /** + * 网关地址 + */ + private String serverUrl; + + /** + * 阿里云存储 OSS + * Endpoint + */ + private String endpoint; + private String accessKeyId; + private String accessKeySecret; + private String bucketName; + private String bucketDomain; + +} diff --git a/src/main/java/com/gxwebsoft/common/core/config/HttpMessageConverter.java b/src/main/java/com/gxwebsoft/common/core/config/HttpMessageConverter.java new file mode 100644 index 0000000..6bae59d --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/config/HttpMessageConverter.java @@ -0,0 +1,15 @@ +package com.gxwebsoft.common.core.config; + +import org.springframework.http.MediaType; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; + +import java.util.ArrayList; +import java.util.List; + +public class HttpMessageConverter extends MappingJackson2HttpMessageConverter { + public HttpMessageConverter(){ + List mediaTypes = new ArrayList<>(); + mediaTypes.add(MediaType.APPLICATION_FORM_URLENCODED); + setSupportedMediaTypes(mediaTypes); + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/config/JacksonConfig.java b/src/main/java/com/gxwebsoft/common/core/config/JacksonConfig.java new file mode 100644 index 0000000..f087274 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/config/JacksonConfig.java @@ -0,0 +1,78 @@ +package com.gxwebsoft.common.core.config; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.TimeZone; + +/** + * Jackson配置类 - 强制配置版本 + * 确保JavaTimeModule被正确注册并覆盖Spring Boot的自动配置 + * + * @author WebSoft + * @since 2025-09-08 + */ +@Configuration +public class JacksonConfig { + + /** + * 日期时间格式 + */ + private static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; + + /** + * 使用Jackson2ObjectMapperBuilder构建ObjectMapper + * 确保与Spring Boot完全兼容 + */ + @Bean + @Primary + public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) { + ObjectMapper mapper = builder.build(); + + // 创建并配置JavaTimeModule + JavaTimeModule javaTimeModule = new JavaTimeModule(); + + // 配置LocalDateTime的序列化和反序列化格式 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_TIME_FORMAT); + javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(formatter)); + javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(formatter)); + + // 注册JavaTimeModule - 这是关键 + mapper.registerModule(javaTimeModule); + + // 禁用将日期写为时间戳 + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + + // 忽略未知属性 + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + // 设置时区 + mapper.setTimeZone(TimeZone.getTimeZone("GMT+8")); + + return mapper; + } + + /** + * 备用JavaTimeModule Bean + */ + @Bean + public JavaTimeModule javaTimeModule() { + JavaTimeModule module = new JavaTimeModule(); + + // 配置LocalDateTime的序列化和反序列化格式 + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_TIME_FORMAT); + module.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(formatter)); + module.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(formatter)); + + return module; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/config/JacksonConfigChecker.java b/src/main/java/com/gxwebsoft/common/core/config/JacksonConfigChecker.java new file mode 100644 index 0000000..6af29f2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/config/JacksonConfigChecker.java @@ -0,0 +1,59 @@ +package com.gxwebsoft.common.core.config; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.Map; + +/** + * Jackson配置检查器 + * 在应用启动时检查Jackson配置是否正确 + * + * @author WebSoft + * @since 2025-09-08 + */ +@Component +public class JacksonConfigChecker implements CommandLineRunner { + + private static final Logger logger = LoggerFactory.getLogger(JacksonConfigChecker.class); + + @Autowired + private ObjectMapper objectMapper; + + @Override + public void run(String... args) throws Exception { + logger.info("=== Jackson配置检查开始 ==="); + + try { + // 检查JavaTimeModule是否注册 + boolean hasJavaTimeModule = objectMapper.getRegisteredModuleIds() + .contains(JavaTimeModule.class.getName()); + logger.info("JavaTimeModule是否注册: {}", hasJavaTimeModule); + + // 测试LocalDateTime序列化 + Map testData = new HashMap<>(); + testData.put("currentTime", LocalDateTime.now()); + testData.put("message", "Jackson配置测试"); + + String json = objectMapper.writeValueAsString(testData); + logger.info("LocalDateTime序列化测试成功: {}", json); + + // 测试反序列化 + Map result = objectMapper.readValue(json, Map.class); + logger.info("反序列化测试成功: {}", result); + + logger.info("=== Jackson配置检查完成 - 配置正常 ==="); + + } catch (Exception e) { + logger.error("=== Jackson配置检查失败 ===", e); + logger.error("请检查Jackson配置是否正确"); + } + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/config/LocalDateTimeDeserializer.java b/src/main/java/com/gxwebsoft/common/core/config/LocalDateTimeDeserializer.java new file mode 100644 index 0000000..36aca47 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/config/LocalDateTimeDeserializer.java @@ -0,0 +1,61 @@ +package com.gxwebsoft.common.core.config; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; + +import java.io.IOException; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; + +/** + * LocalDateTime自定义反序列化器 + * + * @author WebSoft + * @since 2025-01-12 + */ +public class LocalDateTimeDeserializer extends JsonDeserializer { + + private final DateTimeFormatter formatter; + + public LocalDateTimeDeserializer() { + this(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + } + + public LocalDateTimeDeserializer(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + @Override + public LocalDateTime deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + JsonToken t = p.currentToken(); + ZoneId zoneId = ctxt.getTimeZone() != null ? ctxt.getTimeZone().toZoneId() : ZoneId.systemDefault(); + + // Accept epoch timestamps (seconds or millis) for compatibility with frontends that send numbers. + if (t == JsonToken.VALUE_NUMBER_INT) { + long ts = p.getLongValue(); + // Heuristic: 10+ digits is seconds; 13+ digits is millis (most common in JS). + Instant instant = (String.valueOf(Math.abs(ts)).length() >= 13) + ? Instant.ofEpochMilli(ts) + : Instant.ofEpochSecond(ts); + return LocalDateTime.ofInstant(instant, zoneId); + } + + String value = p.getValueAsString(); + if (value == null || value.isEmpty()) { + return null; + } + + // Handle numeric timestamps passed as strings, e.g. "1769618486000" + if (value.chars().allMatch(Character::isDigit)) { + long ts = Long.parseLong(value); + Instant instant = (value.length() >= 13) ? Instant.ofEpochMilli(ts) : Instant.ofEpochSecond(ts); + return LocalDateTime.ofInstant(instant, zoneId); + } + + return LocalDateTime.parse(value, formatter); + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/config/LocalDateTimeSerializer.java b/src/main/java/com/gxwebsoft/common/core/config/LocalDateTimeSerializer.java new file mode 100644 index 0000000..d3849e7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/config/LocalDateTimeSerializer.java @@ -0,0 +1,27 @@ +package com.gxwebsoft.common.core.config; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +/** + * LocalDateTime自定义序列化器 + * + * @author WebSoft + * @since 2025-01-12 + */ +public class LocalDateTimeSerializer extends JsonSerializer { + + private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + @Override + public void serialize(LocalDateTime value, JsonGenerator gen, SerializerProvider serializers) throws IOException { + if (value != null) { + gen.writeString(value.format(FORMATTER)); + } + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/config/MqttProperties.java b/src/main/java/com/gxwebsoft/common/core/config/MqttProperties.java new file mode 100644 index 0000000..cfc882d --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/config/MqttProperties.java @@ -0,0 +1,72 @@ +package com.gxwebsoft.common.core.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * MQTT配置属性 + * + * @author 科技小王子 + * @since 2025-07-02 + */ +@Data +@Component +@ConfigurationProperties(prefix = "mqtt") +public class MqttProperties { + + /** + * 是否启用MQTT服务 + */ + private boolean enabled = false; + + /** + * MQTT服务器地址 + */ + private String host = "tcp://127.0.0.1:1883"; + + /** + * 用户名 + */ + private String username = ""; + + /** + * 密码 + */ + private String password = ""; + + /** + * 客户端ID前缀 + */ + private String clientIdPrefix = "mqtt_client_"; + + /** + * 订阅主题 + */ + private String topic = "/SW_GPS/#"; + + /** + * QoS等级 + */ + private int qos = 2; + + /** + * 连接超时时间(秒) + */ + private int connectionTimeout = 10; + + /** + * 心跳间隔(秒) + */ + private int keepAliveInterval = 20; + + /** + * 是否自动重连 + */ + private boolean autoReconnect = true; + + /** + * 是否清除会话 + */ + private boolean cleanSession = false; +} diff --git a/src/main/java/com/gxwebsoft/common/core/config/MybatisPlusConfig.java b/src/main/java/com/gxwebsoft/common/core/config/MybatisPlusConfig.java new file mode 100644 index 0000000..b3655bc --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/config/MybatisPlusConfig.java @@ -0,0 +1,155 @@ +package com.gxwebsoft.common.core.config; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.annotation.DbType; +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; +import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler; +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; +import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.context.TenantContext; +import com.gxwebsoft.common.system.entity.User; +import net.sf.jsqlparser.expression.Expression; +import net.sf.jsqlparser.expression.LongValue; +import net.sf.jsqlparser.expression.NullValue; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.Arrays; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +/** + * MybatisPlus配置 + * + * @author WebSoft + * @since 2018-02-22 11:29:28 + */ +@Configuration +public class MybatisPlusConfig { + @Resource + private RedisUtil redisUtil; + + @Bean + public MybatisPlusInterceptor mybatisPlusInterceptor() { + MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); + + // 多租户插件配置 + TenantLineHandler tenantLineHandler = new TenantLineHandler() { + @Override + public Expression getTenantId() { + String tenantId = null; + try { + // 从Spring上下文获取当前请求 + HttpServletRequest request = getCurrentRequest(); + if (request != null) { + // 从请求头拿ID + tenantId = request.getHeader("tenantId"); + if(tenantId != null && !tenantId.trim().isEmpty()){ + return new LongValue(tenantId); + } + // 从域名拿ID + String Domain = request.getHeader("Domain"); + if (StrUtil.isNotBlank(Domain)) { + String key = "Domain:" + Domain; + tenantId = redisUtil.get(key); + if(tenantId != null && !tenantId.trim().isEmpty()){ + System.out.println("从域名拿TID = " + tenantId); + return new LongValue(tenantId); + } + } + } + } catch (Exception e) { + // 忽略异常,使用默认逻辑 + System.err.println("获取租户ID异常: " + e.getMessage()); + } + + // 最后尝试从登录用户获取 + Expression loginUserTenantId = getLoginUserTenantId(); + if (loginUserTenantId instanceof LongValue) { + return loginUserTenantId; + } + + // 如果都获取不到,返回null而不是undefined + return new NullValue(); + } + + @Override + public boolean ignoreTable(String tableName) { + // 如果当前上下文设置了忽略租户隔离,则忽略所有表的租户隔离 + if (TenantContext.isIgnoreTenant()) { + return true; + } + + // 系统级别的表始终忽略租户隔离 + return Arrays.asList( + "sys_tenant", + "sys_dictionary", + "sys_dictionary_data", + "apps_test_data", + "cms_lang" +// "hjm_car", +// "hjm_fence" +// "cms_website" +// "sys_user" +// "cms_domain" +// "shop_order_goods", +// "shop_goods" +// "shop_users", +// "shop_order" // 移除shop_order,改为通过注解控制 +// "shop_order_info", +// "booking_user_invoice" + ).contains(tableName); + } + }; + TenantLineInnerInterceptor tenantLineInnerInterceptor = new TenantLineInnerInterceptor(tenantLineHandler); + interceptor.addInnerInterceptor(tenantLineInnerInterceptor); + + // 分页插件配置 + PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(DbType.MYSQL); + paginationInnerInterceptor.setMaxLimit(2000L); + interceptor.addInnerInterceptor(paginationInnerInterceptor); + + return interceptor; + } + + /** + * 获取当前登录用户的租户id + * + * @return Integer + */ + public Expression getLoginUserTenantId() { + try { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication != null) { + Object object = authentication.getPrincipal(); + if (object instanceof User) { + Integer tenantId = ((User) object).getTenantId(); + if (tenantId != null) { + return new LongValue(tenantId); + } + } + } + } catch (Exception e) { + System.err.println("获取登录用户租户ID异常: " + e.getMessage()); + } + return new NullValue(); + } + + /** + * 获取当前HTTP请求 + */ + private HttpServletRequest getCurrentRequest() { + try { + ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + return attributes != null ? attributes.getRequest() : null; + } catch (Exception e) { + return null; + } + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/config/RestTemplateConfig.java b/src/main/java/com/gxwebsoft/common/core/config/RestTemplateConfig.java new file mode 100644 index 0000000..786798f --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/config/RestTemplateConfig.java @@ -0,0 +1,29 @@ +package com.gxwebsoft.common.core.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + + +@Configuration +public class RestTemplateConfig { + + @Bean + public RestTemplate restTemplate(ClientHttpRequestFactory factory) { + RestTemplate restTemplate = new RestTemplate(factory); + restTemplate.getMessageConverters().add(new HttpMessageConverter()); + return restTemplate; + } + @Bean + public ClientHttpRequestFactory simpleClientHttpRequestFactory() { + SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); + // ms + factory.setReadTimeout(60000); + // ms + factory.setConnectTimeout(60000); + + return factory; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/config/SpringContextUtil.java b/src/main/java/com/gxwebsoft/common/core/config/SpringContextUtil.java new file mode 100644 index 0000000..4e6d883 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/config/SpringContextUtil.java @@ -0,0 +1,62 @@ +package com.gxwebsoft.common.core.config; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +/** + * @Author ds + * @Date 2022-05-05 + */ +@Component +public class SpringContextUtil implements ApplicationContextAware { + /** + * spring的应用上下文 + */ + private static ApplicationContext applicationContext; + + /** + * 初始化时将应用上下文设置进applicationContext + * @param applicationContext + * @throws BeansException + */ + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + SpringContextUtil.applicationContext=applicationContext; + } + + public static ApplicationContext getApplicationContext(){ + return applicationContext; + } + + /** + * 根据bean名称获取某个bean对象 + * + * @param name bean名称 + * @return Object + * @throws BeansException + */ + public static Object getBean(String name) throws BeansException { + return applicationContext.getBean(name); + } + + /** + * 根据bean的class获取某个bean对象 + * @param beanClass + * @param + * @return + * @throws BeansException + */ + public static T getBean(Class beanClass) throws BeansException { + return applicationContext.getBean(beanClass); + } + + /** + * 获取spring.profiles.active + * @return + */ + public static String getProfile(){ + return getApplicationContext().getEnvironment().getActiveProfiles()[0]; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/config/SwaggerConfig.java b/src/main/java/com/gxwebsoft/common/core/config/SwaggerConfig.java new file mode 100644 index 0000000..376d71d --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/config/SwaggerConfig.java @@ -0,0 +1,112 @@ +package com.gxwebsoft.common.core.config; + +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Contact; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.security.SecurityRequirement; +import io.swagger.v3.oas.models.security.SecurityScheme; +import io.swagger.v3.oas.models.Components; +import org.springdoc.core.GroupedOpenApi; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.annotation.Resource; + +/** + * SpringDoc OpenAPI 配置 + * + * @author WebSoft + * @since 2018-02-22 11:29:05 + */ +@Configuration +public class SwaggerConfig { + @Resource + private ConfigProperties config; + + /** + * 全局 OpenAPI 配置 + */ + @Bean + public OpenAPI customOpenAPI() { + return new OpenAPI() + .info(new Info() + .title(config.getSwaggerTitle()) + .description(config.getSwaggerDescription()) + .version(config.getSwaggerVersion()) + .contact(new Contact() + .name("科技小王子") + .url("https://www.gxwebsoft.com") + .email("170083662@qq.com")) + .termsOfService(config.getServerUrl() + "/system")) + .components(new Components() + .addSecuritySchemes("Authorization", + new SecurityScheme() + .type(SecurityScheme.Type.HTTP) + .scheme("bearer") + .bearerFormat("JWT") + .name("Authorization") + .description("JWT Authorization header using the Bearer scheme"))) + .addSecurityItem(new SecurityRequirement().addList("Authorization")); + } + + /** + * Common 模块分组 + */ + @Bean + public GroupedOpenApi commonApi() { + return GroupedOpenApi.builder() + .group("common") + .pathsToMatch("/api/common/**", "/api/system/**", "/api/user/**", "/api/role/**", "/api/menu/**") + .packagesToScan("com.gxwebsoft.common") + .build(); + } + + /** + * CMS 模块分组 + */ + @Bean + public GroupedOpenApi cmsApi() { + return GroupedOpenApi.builder() + .group("cms") + .pathsToMatch("/api/cms/**") + .packagesToScan("com.gxwebsoft.cms") + .build(); + } + + /** + * Shop 模块分组 + */ + @Bean + public GroupedOpenApi shopApi() { + return GroupedOpenApi.builder() + .group("shop") + // 订单等用户侧接口在 shop 包内,但路径使用 /api/user/**(前端统一 user 侧 API 前缀) + .pathsToMatch("/api/shop/**", "/api/user/**") + .packagesToScan("com.gxwebsoft.shop") + .build(); + } + + /** + * OA 模块分组 + */ + @Bean + public GroupedOpenApi oaApi() { + return GroupedOpenApi.builder() + .group("oa") + .pathsToMatch("/api/oa/**") + .packagesToScan("com.gxwebsoft.oa") + .build(); + } + + /** + * 其他模块分组 + */ + @Bean + public GroupedOpenApi otherApi() { + return GroupedOpenApi.builder() + .group("other") + .pathsToMatch("/api/docs/**", "/api/project/**", "/api/pwl/**", "/api/bszx/**", "/api/hjm/**") + .packagesToScan("com.gxwebsoft.docs", "com.gxwebsoft.project", "com.gxwebsoft.pwl", "com.gxwebsoft.bszx", "com.gxwebsoft.hjm") + .build(); + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/config/WebMvcConfig.java b/src/main/java/com/gxwebsoft/common/core/config/WebMvcConfig.java new file mode 100644 index 0000000..2ed9d8b --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/config/WebMvcConfig.java @@ -0,0 +1,31 @@ +package com.gxwebsoft.common.core.config; + +import com.gxwebsoft.common.core.Constants; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * WebMvc配置, 拦截器、资源映射等都在此配置 + * + * @author WebSoft + * @since 2019-06-12 10:11:16 + */ +@Configuration +public class WebMvcConfig implements WebMvcConfigurer { + + /** + * 支持跨域访问 + */ + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOriginPatterns("*") + .allowedHeaders("*") + .exposedHeaders(Constants.TOKEN_HEADER_NAME) + .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH") + .allowCredentials(true) + .maxAge(3600); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/constants/AppUserConstants.java b/src/main/java/com/gxwebsoft/common/core/constants/AppUserConstants.java new file mode 100644 index 0000000..538e295 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/constants/AppUserConstants.java @@ -0,0 +1,8 @@ +package com.gxwebsoft.common.core.constants; + +public class AppUserConstants { + // 成员角色 + public static final Integer TRIAL = 10; // 体验成员 + public static final Integer DEVELOPER = 20; // 开发者 + public static final Integer ADMINISTRATOR = 30; // 管理员 +} diff --git a/src/main/java/com/gxwebsoft/common/core/constants/ArticleConstants.java b/src/main/java/com/gxwebsoft/common/core/constants/ArticleConstants.java new file mode 100644 index 0000000..62a38cc --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/constants/ArticleConstants.java @@ -0,0 +1,6 @@ +package com.gxwebsoft.common.core.constants; + +public class ArticleConstants extends BaseConstants { + public static final String[] ARTICLE_STATUS = {"已发布","待审核","已驳回","违规内容"}; + public static final String CACHE_KEY_ARTICLE = "Article:"; +} diff --git a/src/main/java/com/gxwebsoft/common/core/constants/BalanceConstants.java b/src/main/java/com/gxwebsoft/common/core/constants/BalanceConstants.java new file mode 100644 index 0000000..6857250 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/constants/BalanceConstants.java @@ -0,0 +1,10 @@ +package com.gxwebsoft.common.core.constants; + +public class BalanceConstants { + // 余额变动场景 + public static final Integer BALANCE_RECHARGE = 10; // 用户充值 + public static final Integer BALANCE_USE = 20; // 用户消费 + public static final Integer BALANCE_RE_LET = 21; // 续租 + public static final Integer BALANCE_ADMIN = 30; // 管理员操作 + public static final Integer BALANCE_REFUND = 40; // 订单退款 +} diff --git a/src/main/java/com/gxwebsoft/common/core/constants/BaseConstants.java b/src/main/java/com/gxwebsoft/common/core/constants/BaseConstants.java new file mode 100644 index 0000000..66cf4c0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/constants/BaseConstants.java @@ -0,0 +1,5 @@ +package com.gxwebsoft.common.core.constants; + +public class BaseConstants { + public static final String[] STATUS = {"未定义","显示","隐藏"}; +} diff --git a/src/main/java/com/gxwebsoft/common/core/constants/OrderConstants.java b/src/main/java/com/gxwebsoft/common/core/constants/OrderConstants.java new file mode 100644 index 0000000..e866654 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/constants/OrderConstants.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.common.core.constants; + +public class OrderConstants { + // 支付方式 + public static final String PAY_METHOD_BALANCE = "10"; // 余额支付 + public static final String PAY_METHOD_WX = "20"; // 微信支付 + public static final String PAY_METHOD_ALIPAY = "30"; // 支付宝支付 + public static final String PAY_METHOD_OTHER = "40"; // 其他支付 + + // 付款状态 + public static final Integer PAY_STATUS_NO_PAY = 10; // 未付款 + public static final Integer PAY_STATUS_SUCCESS = 20; // 已付款 + + // 发货状态 + public static final Integer DELIVERY_STATUS_NO = 10; // 未发货 + public static final Integer DELIVERY_STATUS_YES = 20; // 已发货 + public static final Integer DELIVERY_STATUS_30 = 30; // 部分发货 + + // 收货状态 + public static final Integer RECEIPT_STATUS_NO = 10; // 未收货 + public static final Integer RECEIPT_STATUS_YES = 20; // 已收货 + public static final Integer RECEIPT_STATUS_RETURN = 30; // 已退货 + + // 订单状态 + public static final Integer ORDER_STATUS_DOING = 10; // 进行中 + public static final Integer ORDER_STATUS_CANCEL = 20; // 已取消 + public static final Integer ORDER_STATUS_TO_CANCEL = 21; // 待取消 + public static final Integer ORDER_STATUS_COMPLETED = 30; // 已完成 + + // 订单结算状态 + public static final Integer ORDER_SETTLED_YES = 1; // 已结算 + public static final Integer ORDER_SETTLED_NO = 0; // 未结算 + + + + +} diff --git a/src/main/java/com/gxwebsoft/common/core/constants/PlatformConstants.java b/src/main/java/com/gxwebsoft/common/core/constants/PlatformConstants.java new file mode 100644 index 0000000..896f8e3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/constants/PlatformConstants.java @@ -0,0 +1,12 @@ +package com.gxwebsoft.common.core.constants; + +public class PlatformConstants { + public static final String MP_OFFICIAL = "MP-OFFICIAL"; // 微信公众号 + public static final String MP_WEIXIN = "MP-WEIXIN"; // 微信小程序 + public static final String MP_ALIPAY = "MP-ALIPAY"; // 支付宝小程序 + public static final String WEB = "WEB"; // web(同H5) + public static final String H5 = "H5"; // H5(推荐使用 WEB) + public static final String APP = "APP"; // App + public static final String MP_BAIDU = "MP-BAIDU"; // 百度小程序 + public static final String MP_TOUTIAO = "MP-TOUTIAO"; // 百度小程序 +} diff --git a/src/main/java/com/gxwebsoft/common/core/constants/ProfitConstants.java b/src/main/java/com/gxwebsoft/common/core/constants/ProfitConstants.java new file mode 100644 index 0000000..2cb60fd --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/constants/ProfitConstants.java @@ -0,0 +1,9 @@ +package com.gxwebsoft.common.core.constants; + +public class ProfitConstants { + // 收益类型 + public static final Integer PROFIT_TYPE10 = 10; // 推广收益 + public static final Integer PROFIT_TYPE20 = 20; // 团队收益 + public static final Integer PROFIT_TYPE30 = 30; // 门店收益 + public static final Integer PROFIT_TYPE40 = 30; // 区域收益 +} diff --git a/src/main/java/com/gxwebsoft/common/core/constants/QRCodeConstants.java b/src/main/java/com/gxwebsoft/common/core/constants/QRCodeConstants.java new file mode 100644 index 0000000..1b30868 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/constants/QRCodeConstants.java @@ -0,0 +1,10 @@ +package com.gxwebsoft.common.core.constants; + +public class QRCodeConstants { + // 二维码类型 + public static final String USER_QRCODE = "user"; // 用户二维码 + public static final String TASK_QRCODE = "task"; // 工单二维码 + public static final String ARTICLE_QRCODE = "article"; // 文章二维码 + public static final String GOODS_QRCODE = "goods"; // 商品二维码 + public static final String DIY_QRCODE = "diy"; // 工单二维码 +} diff --git a/src/main/java/com/gxwebsoft/common/core/constants/RedisConstants.java b/src/main/java/com/gxwebsoft/common/core/constants/RedisConstants.java new file mode 100644 index 0000000..d1f4435 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/constants/RedisConstants.java @@ -0,0 +1,49 @@ +package com.gxwebsoft.common.core.constants; + +public class RedisConstants { + // 短信验证码Key + public static final String SMS_CODE_KEY = "sms"; + // 验证码过期时间 + public static final Long SMS_CODE_TTL = 5L; + // 微信凭证access-token + public static final String ACCESS_TOKEN_KEY = "access-token"; + // 空值防止击穿数据库 + public static final Long CACHE_NULL_TTL = 2L; + // 商户信息 + public static final String MERCHANT_KEY = "merchant"; + // 添加商户定位点 + public static final String MERCHANT_GEO_KEY = "merchant-geo"; + + // token + public static final String TOKEN_USER_ID = "cache:token:"; + // 排行榜 + public static final String USER_RANKING_BY_APPS = "userRankingByApps"; + // 搜索历史 + public static final String SEARCH_HISTORY = "searchHistory"; + // 租户系统设置信息 + public static final String TEN_ANT_SETTING_KEY = "setting"; + // 排行榜Key + public static final String USER_RANKING_BY_APPS_5 = "cache5:userRankingByApps"; + // 微信小程序Key + public static final String MP_WX_KEY = "mp-weixin:"; + + + + // 扫码登录相关key + public static final String QR_LOGIN_TOKEN_KEY = "qr-login:token:"; // 扫码登录token前缀 + public static final Long QR_LOGIN_TOKEN_TTL = 300L; // 扫码登录token过期时间(5分钟) + public static final String QR_LOGIN_STATUS_PENDING = "pending"; // 等待扫码 + public static final String QR_LOGIN_STATUS_SCANNED = "scanned"; // 已扫码 + public static final String QR_LOGIN_STATUS_CONFIRMED = "confirmed"; // 已确认 + public static final String QR_LOGIN_STATUS_EXPIRED = "expired"; // 已过期 + + // 哗啦啦key + public static final String getAllShop = "allShop"; + public static final String getBaseInfo = "baseInfo"; + public static final String getFoodClassCategory = "foodCategory"; + public static final String getOpenFood = "openFood"; + public static final String haulalaGeoKey = "cache10:hualala-geo"; + public static final String HLL_CART_KEY = "hll-cart"; // hll-cart[shopId]:[userId] + public static final String HLL_CART_FOOD_KEY = "hll-cart-list"; // hll-cart-list[shopId]:[userId] + +} diff --git a/src/main/java/com/gxwebsoft/common/core/constants/TaskConstants.java b/src/main/java/com/gxwebsoft/common/core/constants/TaskConstants.java new file mode 100644 index 0000000..42cec5e --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/constants/TaskConstants.java @@ -0,0 +1,22 @@ +package com.gxwebsoft.common.core.constants; + +public class TaskConstants { + // 工单进度 + public static final Integer TOBEARRANGED = 0; // 待安排 + public static final Integer PENDING = 1; // 待处理 + public static final Integer PROCESSING = 2; // 处理中 + public static final Integer TOBECONFIRMED = 3; // 待评价 + public static final Integer COMPLETED = 4; // 已完成 + public static final Integer CLOSED = 5; // 已关闭 + + // 工单状态 + public static final Integer TASK_STATUS_0 = 0; // 待处理 + public static final Integer TASK_STATUS_1 = 1; // 已完成 + + // 操作类型 + public static final String ACTION_1 = "派单"; + public static final String ACTION_2 = "已解决"; + public static final String ACTION_3 = "关单"; + public static final String ACTION_4 = "分享"; + public static final String ACTION_5 = "编辑"; +} diff --git a/src/main/java/com/gxwebsoft/common/core/constants/WebsiteConstants.java b/src/main/java/com/gxwebsoft/common/core/constants/WebsiteConstants.java new file mode 100644 index 0000000..a49f4ba --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/constants/WebsiteConstants.java @@ -0,0 +1,14 @@ +package com.gxwebsoft.common.core.constants; + +public class WebsiteConstants extends BaseConstants { + // 运行状态 0未开通 1运行中 2维护中 3已关闭 4已欠费停机 5违规关停 + public static final String[] WEBSITE_STATUS_NAME = {"未开通","运行中","维护中","已关闭","已欠费停机","违规关停"}; + // 状态图标 + public static final String[] WEBSITE_STATUS_ICON = {"error","success","warning","error","error","error"}; + // 关闭原因 + public static final String[] WEBSITE_STATUS_TEXT = {"产品未开通","","系统升级维护","","已欠费停机","违规关停"}; + // 跳转地址 + public static final String[] WEBSITE_STATUS_URL = {"https://websoft.top","","","","https://websoft.top/user","https://websoft.top/user"}; + // 跳转按钮文字 + public static final String[] WEBSITE_STATUS_BTN_TEXT = {"立即开通","","","","立即续费","申请解封"}; +} diff --git a/src/main/java/com/gxwebsoft/common/core/constants/WxOfficialConstants.java b/src/main/java/com/gxwebsoft/common/core/constants/WxOfficialConstants.java new file mode 100644 index 0000000..a025610 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/constants/WxOfficialConstants.java @@ -0,0 +1,6 @@ +package com.gxwebsoft.common.core.constants; + +public class WxOfficialConstants { + // 获取 Access token + public static final String GET_ACCESS_TOKEN_API = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET"; +} diff --git a/src/main/java/com/gxwebsoft/common/core/context/TenantContext.java b/src/main/java/com/gxwebsoft/common/core/context/TenantContext.java new file mode 100644 index 0000000..42adb46 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/context/TenantContext.java @@ -0,0 +1,67 @@ +package com.gxwebsoft.common.core.context; + +/** + * 租户上下文管理器 + * + * 用于在特定场景下临时禁用租户隔离 + * + * @author WebSoft + * @since 2025-01-26 + */ +public class TenantContext { + + private static final ThreadLocal IGNORE_TENANT = new ThreadLocal<>(); + + /** + * 设置忽略租户隔离 + */ + public static void setIgnoreTenant(boolean ignore) { + IGNORE_TENANT.set(ignore); + } + + /** + * 是否忽略租户隔离 + */ + public static boolean isIgnoreTenant() { + Boolean ignore = IGNORE_TENANT.get(); + return ignore != null && ignore; + } + + /** + * 清除租户上下文 + */ + public static void clear() { + IGNORE_TENANT.remove(); + } + + /** + * 在忽略租户隔离的上下文中执行操作 + * + * @param runnable 要执行的操作 + */ + public static void runIgnoreTenant(Runnable runnable) { + boolean originalIgnore = isIgnoreTenant(); + try { + setIgnoreTenant(true); + runnable.run(); + } finally { + setIgnoreTenant(originalIgnore); + } + } + + /** + * 在忽略租户隔离的上下文中执行操作并返回结果 + * + * @param supplier 要执行的操作 + * @return 操作结果 + */ + public static T callIgnoreTenant(java.util.function.Supplier supplier) { + boolean originalIgnore = isIgnoreTenant(); + try { + setIgnoreTenant(true); + return supplier.get(); + } finally { + setIgnoreTenant(originalIgnore); + } + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/controller/CertificateController.java b/src/main/java/com/gxwebsoft/common/core/controller/CertificateController.java new file mode 100644 index 0000000..d3dee92 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/controller/CertificateController.java @@ -0,0 +1,187 @@ +package com.gxwebsoft.common.core.controller; + +import com.gxwebsoft.common.core.service.CertificateHealthService; +import com.gxwebsoft.common.core.service.CertificateService; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import lombok.extern.slf4j.Slf4j; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Map; + +/** + * 证书管理控制器 + * 提供证书状态查询、健康检查等功能 + * + * @author 科技小王子 + * @since 2024-07-26 + */ +@Slf4j +@Tag(name = "证书管理") +@RestController +@RequestMapping("/api/system/certificate") +public class CertificateController extends BaseController { + + @Resource + private CertificateService certificateService; + + @Resource + private CertificateHealthService certificateHealthService; + + @Operation(summary = "获取所有证书状态") + @GetMapping("/status") + @PreAuthorize("hasAuthority('system:certificate:view')") + public ApiResult> getCertificateStatus() { + try { + Map status = certificateService.getAllCertificateStatus(); + return success("获取证书状态成功", status); + } catch (Exception e) { + log.error("获取证书状态失败", e); + return new ApiResult<>(1, "获取证书状态失败: " + e.getMessage()); + } + } + + @Operation(summary = "证书健康检查") + @GetMapping("/health") + @PreAuthorize("hasAuthority('system:certificate:view')") + public ApiResult> healthCheck() { + try { + CertificateHealthService.HealthResult health = certificateHealthService.health(); + Map result = Map.of( + "status", health.getStatus(), + "details", health.getDetails() + ); + return success("证书健康检查完成", result); + } catch (Exception e) { + log.error("证书健康检查失败", e); + return new ApiResult<>(1, "证书健康检查失败: " + e.getMessage()); + } + } + + @Operation(summary = "获取证书诊断信息") + @GetMapping("/diagnostic") + @PreAuthorize("hasAuthority('system:certificate:view')") + public ApiResult> getDiagnosticInfo() { + try { + Map diagnostic = certificateHealthService.getDiagnosticInfo(); + return success("获取证书诊断信息成功", diagnostic); + } catch (Exception e) { + log.error("获取证书诊断信息失败", e); + return new ApiResult<>(1, "获取证书诊断信息失败: " + e.getMessage()); + } + } + + @Operation(summary = "检查特定证书") + @GetMapping("/check/{certType}/{fileName}") + @PreAuthorize("hasAuthority('system:certificate:view')") + public ApiResult> checkSpecificCertificate( + @Parameter(description = "证书类型", example = "wechat") @PathVariable String certType, + @Parameter(description = "文件名", example = "apiclient_key.pem") @PathVariable String fileName) { + try { + Map result = certificateHealthService.checkSpecificCertificate(certType, fileName); + return success("检查证书完成", result); + } catch (Exception e) { + log.error("检查证书失败: {}/{}", certType, fileName, e); + return new ApiResult<>(1, "检查证书失败: " + e.getMessage()); + } + } + + @Operation(summary = "验证证书文件") + @GetMapping("/validate/{certType}/{fileName}") + @PreAuthorize("hasAuthority('system:certificate:view')") + public ApiResult validateCertificate( + @Parameter(description = "证书类型", example = "wechat") @PathVariable String certType, + @Parameter(description = "文件名", example = "apiclient_cert.pem") @PathVariable String fileName) { + try { + CertificateService.CertificateInfo certInfo = + certificateService.validateX509Certificate(certType, fileName); + + if (certInfo != null) { + return success("证书验证成功", certInfo); + } else { + return new ApiResult<>(1, "证书验证失败,可能不是有效的X509证书"); + } + } catch (Exception e) { + log.error("验证证书失败: {}/{}", certType, fileName, e); + return new ApiResult<>(1, "验证证书失败: " + e.getMessage()); + } + } + + @Operation(summary = "检查证书文件是否存在") + @GetMapping("/exists/{certType}/{fileName}") + @PreAuthorize("hasAuthority('system:certificate:view')") + public ApiResult checkCertificateExists( + @Parameter(description = "证书类型", example = "alipay") @PathVariable String certType, + @Parameter(description = "文件名", example = "appCertPublicKey.crt") @PathVariable String fileName) { + try { + boolean exists = certificateService.certificateExists(certType, fileName); + String message = exists ? "证书文件存在" : "证书文件不存在"; + return success(message, exists); + } catch (Exception e) { + log.error("检查证书文件存在性失败: {}/{}", certType, fileName, e); + return new ApiResult<>(1, "检查证书文件存在性失败: " + e.getMessage()); + } + } + + @Operation(summary = "获取证书文件路径") + @GetMapping("/path/{certType}/{fileName}") + @PreAuthorize("hasAuthority('system:certificate:view')") + public ApiResult getCertificatePath( + @Parameter(description = "证书类型", example = "wechat") @PathVariable String certType, + @Parameter(description = "文件名", example = "wechatpay_cert.pem") @PathVariable String fileName) { + try { + String path = certificateService.getCertificateFilePath(certType, fileName); + return success("获取证书路径成功", path); + } catch (Exception e) { + log.error("获取证书路径失败: {}/{}", certType, fileName, e); + return new ApiResult<>(1, "获取证书路径失败: " + e.getMessage()); + } + } + + @Operation(summary = "获取微信支付证书路径") + @GetMapping("/wechat-path/{fileName}") + @PreAuthorize("hasAuthority('system:certificate:view')") + public ApiResult getWechatPayCertPath( + @Parameter(description = "文件名", example = "apiclient_key.pem") @PathVariable String fileName) { + try { + String path = certificateService.getWechatPayCertPath(fileName); + return success("获取微信支付证书路径成功", path); + } catch (Exception e) { + log.error("获取微信支付证书路径失败: {}", fileName, e); + return new ApiResult<>(1, "获取微信支付证书路径失败: " + e.getMessage()); + } + } + + @Operation(summary = "获取支付宝证书路径") + @GetMapping("/alipay-path/{fileName}") + @PreAuthorize("hasAuthority('system:certificate:view')") + public ApiResult getAlipayCertPath( + @Parameter(description = "文件名", example = "appCertPublicKey.crt") @PathVariable String fileName) { + try { + String path = certificateService.getAlipayCertPath(fileName); + return success("获取支付宝证书路径成功", path); + } catch (Exception e) { + log.error("获取支付宝证书路径失败: {}", fileName, e); + return new ApiResult<>(1, "获取支付宝证书路径失败: " + e.getMessage()); + } + } + + @Operation(summary = "刷新证书缓存") + @PostMapping("/refresh") + @PreAuthorize("hasAuthority('system:certificate:manage')") + public ApiResult refreshCertificateCache() { + try { + // 这里可以添加刷新证书缓存的逻辑 + log.info("证书缓存刷新请求,操作用户: {}", getLoginUser().getUsername()); + return new ApiResult<>(0, "证书缓存刷新成功", "success"); + } catch (Exception e) { + log.error("刷新证书缓存失败", e); + return new ApiResult<>(1, "刷新证书缓存失败: " + e.getMessage()); + } + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/controller/DatabaseFixController.java b/src/main/java/com/gxwebsoft/common/core/controller/DatabaseFixController.java new file mode 100644 index 0000000..166e9cd --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/controller/DatabaseFixController.java @@ -0,0 +1,204 @@ +package com.gxwebsoft.common.core.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.entity.ShopCoupon; +import com.gxwebsoft.shop.entity.ShopUserCoupon; +import com.gxwebsoft.shop.service.ShopCouponService; +import com.gxwebsoft.shop.service.ShopUserCouponService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.web.bind.annotation.*; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 数据库修复工具控制器 + * 仅在开发环境启用,用于修复数据库问题 + * + * @author WebSoft + * @since 2025-01-15 + */ +@Slf4j +@Tag(name = "数据库修复工具") +@RestController +@RequestMapping("/api/database-fix") +// @ConditionalOnProperty(name = "spring.profiles.active", havingValue = "dev") +public class DatabaseFixController extends BaseController { + + @Autowired + private ShopUserCouponService shopUserCouponService; + + @Autowired + private ShopCouponService shopCouponService; + + @Operation(summary = "检查BigDecimal null值问题") + @GetMapping("/check-bigdecimal-nulls") + public ApiResult> checkBigDecimalNulls() { + try { + Map result = new HashMap<>(); + + // 检查用户优惠券表 + List userCoupons = shopUserCouponService.list(); + long userCouponNullReducePrice = userCoupons.stream() + .mapToLong(c -> c.getReducePrice() == null ? 1 : 0) + .sum(); + long userCouponNullMinPrice = userCoupons.stream() + .mapToLong(c -> c.getMinPrice() == null ? 1 : 0) + .sum(); + + // 检查优惠券模板表 + List coupons = shopCouponService.list(); + long couponNullReducePrice = coupons.stream() + .mapToLong(c -> c.getReducePrice() == null ? 1 : 0) + .sum(); + long couponNullMinPrice = coupons.stream() + .mapToLong(c -> c.getMinPrice() == null ? 1 : 0) + .sum(); + + Map userCouponStats = new HashMap<>(); + userCouponStats.put("totalRecords", userCoupons.size()); + userCouponStats.put("nullReducePrice", userCouponNullReducePrice); + userCouponStats.put("nullMinPrice", userCouponNullMinPrice); + + Map couponStats = new HashMap<>(); + couponStats.put("totalRecords", coupons.size()); + couponStats.put("nullReducePrice", couponNullReducePrice); + couponStats.put("nullMinPrice", couponNullMinPrice); + + result.put("shopUserCoupon", userCouponStats); + result.put("shopCoupon", couponStats); + result.put("needsFix", userCouponNullReducePrice > 0 || userCouponNullMinPrice > 0 || + couponNullReducePrice > 0 || couponNullMinPrice > 0); + + return success("检查完成", result); + + } catch (Exception e) { + log.error("检查BigDecimal null值失败", e); + return fail("检查失败: " + e.getMessage(),null); + } + } + + @Operation(summary = "修复BigDecimal null值问题") + @PostMapping("/fix-bigdecimal-nulls") + public ApiResult> fixBigDecimalNulls() { + try { + Map result = new HashMap<>(); + int userCouponFixed = 0; + int couponFixed = 0; + + // 修复用户优惠券表 + List userCoupons = shopUserCouponService.list(); + for (ShopUserCoupon userCoupon : userCoupons) { + boolean needUpdate = false; + + if (userCoupon.getReducePrice() == null) { + userCoupon.setReducePrice(BigDecimal.ZERO); + needUpdate = true; + } + + if (userCoupon.getMinPrice() == null) { + userCoupon.setMinPrice(BigDecimal.ZERO); + needUpdate = true; + } + + if (needUpdate) { + shopUserCouponService.updateById(userCoupon); + userCouponFixed++; + } + } + + // 修复优惠券模板表 + List coupons = shopCouponService.list(); + for (ShopCoupon coupon : coupons) { + boolean needUpdate = false; + + if (coupon.getReducePrice() == null) { + coupon.setReducePrice(BigDecimal.ZERO); + needUpdate = true; + } + + if (coupon.getMinPrice() == null) { + coupon.setMinPrice(BigDecimal.ZERO); + needUpdate = true; + } + + if (needUpdate) { + shopCouponService.updateById(coupon); + couponFixed++; + } + } + + result.put("userCouponFixed", userCouponFixed); + result.put("couponFixed", couponFixed); + result.put("totalFixed", userCouponFixed + couponFixed); + + log.info("BigDecimal null值修复完成: 用户优惠券{}条, 优惠券模板{}条", userCouponFixed, couponFixed); + + return success("修复完成", result); + + } catch (Exception e) { + log.error("修复BigDecimal null值失败", e); + return fail("修复失败: " + e.getMessage(), null); + } + } + + @Operation(summary = "测试优惠券接口") + @GetMapping("/test-coupon-api") + public ApiResult> testCouponApi() { + try { + Map result = new HashMap<>(); + + // 测试查询用户优惠券 + List userCoupons = shopUserCouponService.list( + new QueryWrapper().last("LIMIT 5") + ); + + // 测试查询优惠券模板 + List coupons = shopCouponService.list( + new QueryWrapper().last("LIMIT 5") + ); + + result.put("userCouponsCount", userCoupons.size()); + result.put("couponsCount", coupons.size()); + result.put("userCouponsSample", userCoupons); + result.put("couponsSample", coupons); + result.put("testStatus", "SUCCESS"); + + return success("测试成功", result); + + } catch (Exception e) { + log.error("测试优惠券接口失败", e); + Map errorResult = new HashMap<>(); + errorResult.put("testStatus", "FAILED"); + errorResult.put("errorMessage", e.getMessage()); + errorResult.put("errorType", e.getClass().getSimpleName()); + + return fail("测试失败: " + e.getMessage(), errorResult); + } + } + + @Operation(summary = "获取修复指南") + @GetMapping("/guide") + public ApiResult> getFixGuide() { + Map guide = new HashMap<>(); + + guide.put("step1", "GET /api/database-fix/check-bigdecimal-nulls - 检查null值问题"); + guide.put("step2", "POST /api/database-fix/fix-bigdecimal-nulls - 修复null值问题"); + guide.put("step3", "GET /api/database-fix/test-coupon-api - 测试修复效果"); + guide.put("step4", "重启应用,验证优惠券功能正常"); + + guide.put("note1", "此工具仅在开发环境可用"); + guide.put("note2", "修复前建议备份数据库"); + guide.put("note3", "修复完成后可以删除此控制器"); + + return success("获取成功", guide); + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/controller/DevEnvironmentController.java b/src/main/java/com/gxwebsoft/common/core/controller/DevEnvironmentController.java new file mode 100644 index 0000000..8e30a34 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/controller/DevEnvironmentController.java @@ -0,0 +1,236 @@ +package com.gxwebsoft.common.core.controller; + +import com.gxwebsoft.common.core.service.EnvironmentAwarePaymentService; +import com.gxwebsoft.common.core.service.PaymentCacheService; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.Payment; +import com.gxwebsoft.common.system.service.PaymentService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.Map; + +/** + * 开发环境管理控制器 + * 仅在开发环境启用,用于管理开发调试配置 + * + * @author WebSoft + * @since 2025-01-15 + */ +@Slf4j +@Tag(name = "开发环境管理") +@RestController +@RequestMapping("/api/dev") +// @ConditionalOnProperty(name = "spring.profiles.active", havingValue = "dev") +public class DevEnvironmentController extends BaseController { + + @Autowired + private EnvironmentAwarePaymentService environmentAwarePaymentService; + + @Autowired + private PaymentCacheService paymentCacheService; + + @Autowired + private PaymentService paymentService; + + @Value("${spring.profiles.active:dev}") + private String activeProfile; + + @Operation(summary = "获取当前环境信息") + @GetMapping("/environment/info") + public ApiResult> getEnvironmentInfo() { + Map info = new HashMap<>(); + info.put("activeProfile", activeProfile); + info.put("isDevelopment", environmentAwarePaymentService.isDevelopmentEnvironment()); + info.put("isProduction", environmentAwarePaymentService.isProductionEnvironment()); + info.put("currentEnvironment", environmentAwarePaymentService.getCurrentEnvironment()); + + return success("获取成功", info); + } + + @Operation(summary = "获取环境感知的支付配置") + @GetMapping("/payment/config/{payType}") + public ApiResult> getPaymentConfig(@PathVariable Integer payType) { + try { + Integer tenantId = getTenantId(); + + // 获取原始配置 + Payment originalConfig = paymentCacheService.getPaymentConfig(payType, tenantId); + + // 获取环境感知配置 + Payment envConfig = environmentAwarePaymentService.getEnvironmentAwarePaymentConfig(payType, tenantId); + + Map result = new HashMap<>(); + result.put("tenantId", tenantId); + result.put("payType", payType); + result.put("environment", activeProfile); + result.put("originalConfig", originalConfig); + result.put("environmentAwareConfig", envConfig); + + if (originalConfig != null && envConfig != null) { + result.put("notifyUrlChanged", !originalConfig.getNotifyUrl().equals(envConfig.getNotifyUrl())); + result.put("originalNotifyUrl", originalConfig.getNotifyUrl()); + result.put("environmentNotifyUrl", envConfig.getNotifyUrl()); + } + + return success("获取成功", result); + + } catch (Exception e) { + log.error("获取支付配置失败", e); + return fail("获取失败: " + e.getMessage(),null); + } + } + + @Operation(summary = "切换开发环境回调地址") + @PostMapping("/payment/switch-notify-url") + public ApiResult switchNotifyUrl(@RequestBody Map request) { + try { + String newNotifyUrl = request.get("notifyUrl"); + Integer payType = Integer.valueOf(request.getOrDefault("payType", "0")); + + if (newNotifyUrl == null || newNotifyUrl.trim().isEmpty()) { + return fail("回调地址不能为空"); + } + + Integer tenantId = getTenantId(); + + // 获取当前配置 + Payment payment = paymentCacheService.getPaymentConfig(payType, tenantId); + if (payment == null) { + return fail("未找到支付配置"); + } + + // 更新回调地址 + payment.setNotifyUrl(newNotifyUrl); + + // 更新数据库 + boolean updated = paymentService.updateById(payment); + + if (updated) { + // 清除缓存,强制重新加载 + paymentCacheService.removePaymentConfig(payType.toString(), tenantId); + + log.info("开发环境回调地址已更新: {} -> {}", payment.getNotifyUrl(), newNotifyUrl); + + Map result = new HashMap<>(); + result.put("oldNotifyUrl", payment.getNotifyUrl()); + result.put("newNotifyUrl", newNotifyUrl); + result.put("payType", payType); + result.put("tenantId", tenantId); + + return success("回调地址更新成功", result); + } else { + return fail("更新失败"); + } + + } catch (Exception e) { + log.error("切换回调地址失败", e); + return fail("切换失败: " + e.getMessage()); + } + } + + @Operation(summary = "重置为生产环境回调地址") + @PostMapping("/payment/reset-to-prod") + public ApiResult resetToProdNotifyUrl(@RequestParam(defaultValue = "0") Integer payType) { + try { + Integer tenantId = getTenantId(); + + // 获取当前配置 + Payment payment = paymentCacheService.getPaymentConfig(payType, tenantId); + if (payment == null) { + return fail("未找到支付配置"); + } + + // 设置为生产环境回调地址 + String prodNotifyUrl = "https://cms-api.websoft.top/api/shop/shop-order/notify"; + String oldNotifyUrl = payment.getNotifyUrl(); + + payment.setNotifyUrl(prodNotifyUrl); + + // 更新数据库 + boolean updated = paymentService.updateById(payment); + + if (updated) { + // 清除缓存 + paymentCacheService.removePaymentConfig(payType.toString(), tenantId); + + log.info("回调地址已重置为生产环境: {} -> {}", oldNotifyUrl, prodNotifyUrl); + + Map result = new HashMap<>(); + result.put("oldNotifyUrl", oldNotifyUrl); + result.put("newNotifyUrl", prodNotifyUrl); + result.put("payType", payType); + result.put("tenantId", tenantId); + + return success("已重置为生产环境回调地址", result); + } else { + return fail("重置失败"); + } + + } catch (Exception e) { + log.error("重置回调地址失败", e); + return fail("重置失败: " + e.getMessage()); + } + } + + @Operation(summary = "清除支付配置缓存") + @PostMapping("/payment/clear-cache") + public ApiResult clearPaymentCache(@RequestParam(defaultValue = "0") Integer payType) { + try { + Integer tenantId = getTenantId(); + + paymentCacheService.removePaymentConfig(payType.toString(), tenantId); + + log.info("支付配置缓存已清除: payType={}, tenantId={}", payType, tenantId); + + return success("缓存清除成功"); + + } catch (Exception e) { + log.error("清除缓存失败", e); + return fail("清除失败: " + e.getMessage()); + } + } + + @Operation(summary = "获取开发环境使用指南") + @GetMapping("/guide") + public ApiResult> getDevGuide() { + Map guide = new HashMap<>(); + + guide.put("title", "开发环境支付调试指南"); + guide.put("environment", activeProfile); + + Map steps = new HashMap<>(); + steps.put("step1", "使用 /api/dev/payment/switch-notify-url 切换到本地回调地址"); + steps.put("step2", "进行支付功能调试和测试"); + steps.put("step3", "调试完成后使用 /api/dev/payment/reset-to-prod 恢复生产环境配置"); + steps.put("step4", "或者直接在后台管理界面修改回调地址"); + + guide.put("steps", steps); + + Map apis = new HashMap<>(); + apis.put("环境信息", "GET /api/dev/environment/info"); + apis.put("查看配置", "GET /api/dev/payment/config/{payType}"); + apis.put("切换回调", "POST /api/dev/payment/switch-notify-url"); + apis.put("重置生产", "POST /api/dev/payment/reset-to-prod"); + apis.put("清除缓存", "POST /api/dev/payment/clear-cache"); + + guide.put("apis", apis); + + Map tips = new HashMap<>(); + tips.put("tip1", "此控制器仅在开发环境启用"); + tips.put("tip2", "生产环境不会加载这些接口"); + tips.put("tip3", "建议使用环境感知服务自动切换"); + tips.put("tip4", "记得在调试完成后恢复生产配置"); + + guide.put("tips", tips); + + return success("获取成功", guide); + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/controller/JacksonTestController.java b/src/main/java/com/gxwebsoft/common/core/controller/JacksonTestController.java new file mode 100644 index 0000000..2a58aea --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/controller/JacksonTestController.java @@ -0,0 +1,90 @@ +package com.gxwebsoft.common.core.controller; + +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.Map; + +/** + * Jackson序列化测试控制器 + * 用于测试LocalDateTime序列化是否正常工作 + * + * @author WebSoft + * @since 2025-09-08 + */ +@Tag(name = "Jackson测试") +@RestController +@RequestMapping("/api/test/jackson") +public class JacksonTestController extends BaseController { + + @Operation(summary = "测试LocalDateTime序列化") + @GetMapping("/datetime") + public ApiResult> testDateTime() { + Map result = new HashMap<>(); + result.put("currentTime", LocalDateTime.now()); + result.put("message", "如果您能看到格式化的时间,说明Jackson配置正常"); + result.put("timestamp", System.currentTimeMillis()); + return success(result); + } + + @Operation(summary = "测试实体类序列化") + @GetMapping("/entity") + public ApiResult testEntity() { + TestEntity entity = new TestEntity(); + entity.setId(1); + entity.setName("测试实体"); + entity.setCreateTime(LocalDateTime.now()); + entity.setUpdateTime(LocalDateTime.now()); + return success(entity); + } + + /** + * 测试实体类 + */ + public static class TestEntity { + private Integer id; + private String name; + private LocalDateTime createTime; + private LocalDateTime updateTime; + + // Getters and Setters + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public LocalDateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(LocalDateTime createTime) { + this.createTime = createTime; + } + + public LocalDateTime getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(LocalDateTime updateTime) { + this.updateTime = updateTime; + } + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/controller/PaymentConfigController.java b/src/main/java/com/gxwebsoft/common/core/controller/PaymentConfigController.java new file mode 100644 index 0000000..37706fd --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/controller/PaymentConfigController.java @@ -0,0 +1,149 @@ +package com.gxwebsoft.common.core.controller; + +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.Payment; +import com.gxwebsoft.common.system.service.PaymentService; +import com.gxwebsoft.common.core.service.PaymentCacheService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.Map; + +/** + * 支付配置管理控制器 + * 用于检查和管理支付配置 + * + * @author 科技小王子 + * @since 2025-07-27 + */ +@Slf4j +@Tag(name = "支付配置管理") +@RestController +@RequestMapping("/api/system/payment-config") +public class PaymentConfigController extends BaseController { + + @Autowired + private PaymentService paymentService; + + @Autowired + private PaymentCacheService paymentCacheService; + + @Operation(summary = "检查支付配置") + @GetMapping("/check/{payType}") + @PreAuthorize("hasAuthority('sys:payment:list')") + public ApiResult> checkPaymentConfig(@PathVariable Integer payType) { + try { + Map result = new HashMap<>(); + + // 获取支付配置 + Payment payment = paymentCacheService.getPaymentConfig(payType, getTenantId()); + + if (payment == null) { + result.put("status", "error"); + result.put("message", "未找到支付配置"); + return success("检查完成", result); + } + + // 检查配置完整性 + Map configCheck = new HashMap<>(); + configCheck.put("id", payment.getId()); + configCheck.put("name", payment.getName()); + configCheck.put("type", payment.getType()); + configCheck.put("code", payment.getCode()); + configCheck.put("appId", payment.getAppId()); + configCheck.put("mchId", payment.getMchId()); + configCheck.put("apiKeyConfigured", payment.getApiKey() != null && !payment.getApiKey().trim().isEmpty()); + configCheck.put("apiKeyLength", payment.getApiKey() != null ? payment.getApiKey().length() : 0); + configCheck.put("merchantSerialNumber", payment.getMerchantSerialNumber()); + configCheck.put("status", payment.getStatus()); + configCheck.put("tenantId", payment.getTenantId()); + + // 检查必要字段 + boolean isValid = true; + StringBuilder errors = new StringBuilder(); + + if (payment.getMchId() == null || payment.getMchId().trim().isEmpty()) { + isValid = false; + errors.append("商户号(mchId)未配置; "); + } + + if (payment.getApiKey() == null || payment.getApiKey().trim().isEmpty()) { + isValid = false; + errors.append("API密钥(apiKey)未配置; "); + } + + if (payment.getMerchantSerialNumber() == null || payment.getMerchantSerialNumber().trim().isEmpty()) { + isValid = false; + errors.append("商户证书序列号(merchantSerialNumber)未配置; "); + } + + if (payment.getAppId() == null || payment.getAppId().trim().isEmpty()) { + isValid = false; + errors.append("应用ID(appId)未配置; "); + } + + result.put("status", isValid ? "success" : "error"); + result.put("valid", isValid); + result.put("errors", errors.toString()); + result.put("config", configCheck); + + return success("检查完成", result); + + } catch (Exception e) { + log.error("检查支付配置失败", e); + Map result = new HashMap<>(); + result.put("status", "error"); + result.put("message", "检查失败: " + e.getMessage()); + return success("检查完成", result); + } + } + + @Operation(summary = "初始化微信支付配置") + @PostMapping("/init-wechat") + @PreAuthorize("hasAuthority('sys:payment:save')") + public ApiResult initWechatPayConfig(@RequestBody Map config) { + try { + Payment payment = new Payment(); + payment.setName("微信支付"); + payment.setType(0); // 微信支付类型为0 + payment.setCode("0"); + payment.setAppId(config.get("appId")); + payment.setMchId(config.get("mchId")); + payment.setApiKey(config.get("apiKey")); + payment.setMerchantSerialNumber(config.get("merchantSerialNumber")); + payment.setStatus(true); + payment.setTenantId(getTenantId()); + + if (paymentService.save(payment)) { + // 缓存配置 + paymentCacheService.cachePaymentConfig(payment, getTenantId()); + return success("微信支付配置初始化成功"); + } else { + return fail("微信支付配置初始化失败"); + } + + } catch (Exception e) { + log.error("初始化微信支付配置失败", e); + return fail("初始化失败: " + e.getMessage()); + } + } + + @Operation(summary = "清除支付配置缓存") + @DeleteMapping("/cache/{payType}") + @PreAuthorize("hasAuthority('sys:payment:update')") + public ApiResult clearPaymentCache(@PathVariable Integer payType) { + try { + paymentCacheService.removePaymentConfig(payType.toString(), getTenantId()); + return success("缓存清除成功"); + } catch (Exception e) { + log.error("清除支付配置缓存失败", e); + return fail("清除缓存失败: " + e.getMessage()); + } + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/controller/QrCodeController.java b/src/main/java/com/gxwebsoft/common/core/controller/QrCodeController.java new file mode 100644 index 0000000..b589901 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/controller/QrCodeController.java @@ -0,0 +1,258 @@ +package com.gxwebsoft.common.core.controller; + +import cn.hutool.extra.qrcode.QrCodeUtil; +import cn.hutool.extra.qrcode.QrConfig; +import com.gxwebsoft.common.core.dto.qr.*; +import com.gxwebsoft.common.core.utils.EncryptedQrCodeUtil; +import com.gxwebsoft.common.core.utils.QrCodeDecryptResult; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.awt.*; +import java.io.IOException; +import java.util.Base64; +import java.util.Map; + +/** + * 二维码生成控制器 + * + * @author WebSoft + * @since 2025-08-18 + */ +@RestController +@RequestMapping("/api/qr-code") +@Tag(name = "二维码生成API") +@Validated +public class QrCodeController extends BaseController { + + @Autowired + private EncryptedQrCodeUtil encryptedQrCodeUtil; + + @Operation(summary = "生成普通二维码") + @GetMapping("/create-qr-code") + public void createQrCode( + @Parameter(description = "要编码的数据") @RequestParam("data") String data, + @Parameter(description = "二维码尺寸,格式:宽x高 或 单个数字") @RequestParam(value = "size", defaultValue = "200x200") String size, + HttpServletResponse response) throws IOException { + + try { + // 解析尺寸 + String[] dimensions = size.split("x"); + int width = Integer.parseInt(dimensions[0]); + int height = dimensions.length > 1 ? Integer.parseInt(dimensions[1]) : width; + + // 验证尺寸范围,防止过大的图片 + if (width < 50 || width > 1000 || height < 50 || height > 1000) { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + response.getWriter().write("尺寸必须在50-1000像素之间"); + return; + } + + // 配置二维码 + QrConfig config = new QrConfig(width, height); + config.setMargin(1); + config.setForeColor(Color.BLACK); + config.setBackColor(Color.WHITE); + + // 设置响应头 + response.setContentType("image/png"); + response.setHeader("Cache-Control", "no-cache"); + response.setHeader("Content-Disposition", "inline; filename=qrcode.png"); + + // 生成二维码并直接输出到响应流 + QrCodeUtil.generate(data, config, "png", response.getOutputStream()); + + } catch (NumberFormatException e) { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + response.getWriter().write("尺寸格式错误,请使用如:200x200 的格式"); + } catch (Exception e) { + response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + response.getWriter().write("生成二维码失败:" + e.getMessage()); + } + } + + @Operation(summary = "生成加密二维码") + @PostMapping("/create-encrypted-qr-code") + public ApiResult createEncryptedQrCode(@Valid @RequestBody CreateEncryptedQrCodeRequest request) { + + try { + // 生成加密二维码 + Map result = encryptedQrCodeUtil.generateEncryptedQrCode( + request.getData(), + request.getWidth(), + request.getHeight(), + request.getExpireMinutes(), + request.getBusinessType()); + + return success("生成加密二维码成功", result); + + } catch (Exception e) { + return fail("生成加密二维码失败:" + e.getMessage()); + } + } + + @Operation(summary = "生成加密二维码图片流") + @GetMapping("/create-encrypted-qr-image") + public void createEncryptedQrImage( + @Parameter(description = "要加密的数据") @RequestParam("data") String data, + @Parameter(description = "二维码尺寸") @RequestParam(value = "size", defaultValue = "200x200") String size, + @Parameter(description = "过期时间(分钟)") @RequestParam(value = "expireMinutes", defaultValue = "30") Long expireMinutes, + @Parameter(description = "业务类型(可选)") @RequestParam(value = "businessType", required = false) String businessType, + HttpServletResponse response) throws IOException { + + try { + // 解析尺寸 + String[] dimensions = size.split("x"); + int width = Integer.parseInt(dimensions[0]); + int height = dimensions.length > 1 ? Integer.parseInt(dimensions[1]) : width; + + // 验证尺寸范围 + if (width < 50 || width > 1000 || height < 50 || height > 1000) { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + response.getWriter().write("尺寸必须在50-1000像素之间"); + return; + } + + // 验证过期时间 + if (expireMinutes <= 0 || expireMinutes > 1440) { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + response.getWriter().write("过期时间必须在1-1440分钟之间"); + return; + } + + // 生成加密二维码 + Map result = encryptedQrCodeUtil.generateEncryptedQrCode(data, width, height, expireMinutes, businessType); + String base64Image = (String) result.get("qrCodeBase64"); + + // 解码Base64图片 + byte[] imageBytes = Base64.getDecoder().decode(base64Image); + + // 设置响应头 + response.setContentType("image/png"); + response.setHeader("Cache-Control", "no-cache"); + response.setHeader("Content-Disposition", "inline; filename=encrypted_qrcode.png"); + response.setHeader("X-QR-Token", (String) result.get("token")); + response.setHeader("X-QR-Expire-Minutes", result.get("expireMinutes").toString()); + + // 输出图片 + response.getOutputStream().write(imageBytes); + + } catch (NumberFormatException e) { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + response.getWriter().write("尺寸格式错误,请使用如:200x200 的格式"); + } catch (Exception e) { + response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + response.getWriter().write("生成加密二维码失败:" + e.getMessage()); + } + } + + @Operation(summary = "解密二维码数据") + @PostMapping("/decrypt-qr-data") + public ApiResult decryptQrData(@Valid @RequestBody DecryptQrDataRequest request) { + + try { + String decryptedData = encryptedQrCodeUtil.decryptData(request.getToken(), request.getEncryptedData()); + return success("解密成功", decryptedData); + + } catch (Exception e) { + return fail("解密失败:" + e.getMessage()); + } + } + + @Operation(summary = "验证并解密二维码内容(自包含模式)") + @PostMapping("/verify-and-decrypt-qr") + public ApiResult verifyAndDecryptQr(@Valid @RequestBody VerifyQrContentRequest request) { + + try { + String originalData = encryptedQrCodeUtil.verifyAndDecryptQrCode(request.getQrContent()); + return success("验证和解密成功", originalData); + + } catch (Exception e) { + return fail("验证和解密失败:" + e.getMessage()); + } + } + + @Operation(summary = "验证并解密二维码内容(返回完整结果,包含业务类型)") + @PostMapping("/verify-and-decrypt-qr-with-type") + public ApiResult verifyAndDecryptQrWithType(@Valid @RequestBody VerifyQrContentRequest request) { + + try { + QrCodeDecryptResult result = encryptedQrCodeUtil.verifyAndDecryptQrCodeWithResult(request.getQrContent()); + return success("验证和解密成功", result); + + } catch (Exception e) { + return fail("验证和解密失败:" + e.getMessage(),null); + } + } + + @Operation(summary = "生成业务加密二维码(门店核销模式)") + @PostMapping("/create-business-encrypted-qr-code") + public ApiResult createBusinessEncryptedQrCode(@Valid @RequestBody CreateBusinessEncryptedQrCodeRequest request) { + + try { + // 生成业务加密二维码 + Map result = encryptedQrCodeUtil.generateBusinessEncryptedQrCode( + request.getData(), + request.getWidth(), + request.getHeight(), + request.getBusinessKey(), + request.getExpireMinutes(), + request.getBusinessType()); + + return success("生成业务加密二维码成功", result); + + } catch (Exception e) { + return fail("生成业务加密二维码失败:" + e.getMessage()); + } + } + + @Operation(summary = "门店核销二维码(业务模式)") + @PostMapping("/verify-business-qr") + public ApiResult verifyBusinessQr(@Valid @RequestBody VerifyBusinessQrRequest request) { + + try { + String originalData = encryptedQrCodeUtil.verifyAndDecryptQrCodeWithBusinessKey( + request.getQrContent(), request.getBusinessKey()); + return success("核销成功", originalData); + + } catch (Exception e) { + return fail("核销失败:" + e.getMessage()); + } + } + + @Operation(summary = "检查token是否有效") + @GetMapping("/check-token") + public ApiResult checkToken( + @Parameter(description = "要检查的token") @RequestParam("token") String token) { + + try { + boolean isValid = encryptedQrCodeUtil.isTokenValid(token); + return success("检查完成", isValid); + + } catch (Exception e) { + return fail("检查token失败:" + e.getMessage()); + } + } + + @Operation(summary = "使token失效") + @PostMapping("/invalidate-token") + public ApiResult invalidateToken(@Valid @RequestBody InvalidateTokenRequest request) { + + try { + encryptedQrCodeUtil.invalidateToken(request.getToken()); + return success("token已失效"); + + } catch (Exception e) { + return fail("使token失效失败:" + e.getMessage()); + } + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/controller/TestController.java b/src/main/java/com/gxwebsoft/common/core/controller/TestController.java new file mode 100644 index 0000000..05c4246 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/controller/TestController.java @@ -0,0 +1,302 @@ +package com.gxwebsoft.common.core.controller; + +import com.gxwebsoft.common.core.service.PaymentCacheService; +import com.gxwebsoft.common.system.entity.Payment; +import com.gxwebsoft.common.system.service.PaymentService; +import com.gxwebsoft.common.system.param.PaymentParam; +import com.gxwebsoft.common.core.web.ApiResult; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; + +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.Map; + +/** + * 测试控制器 + * 用于测试LocalDateTime序列化 + * + * @author WebSoft + * @since 2025-01-12 + */ +@Tag(name = "测试接口") +@RestController +@RequestMapping("/api/test") +public class TestController extends BaseController { + + @Autowired + private PaymentCacheService paymentCacheService; + + @Autowired + private PaymentService paymentService; + + @Operation(summary = "测试LocalDateTime序列化") + @GetMapping("/datetime") + public ApiResult> testDateTime() { + Map result = new HashMap<>(); + // 使用字符串格式避免序列化问题 + result.put("currentTime", LocalDateTime.now().toString()); + result.put("currentTimeFormatted", LocalDateTime.now().format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + result.put("message", "LocalDateTime序列化测试"); + result.put("timestamp", System.currentTimeMillis()); + return success(result); + } + + @Operation(summary = "基础诊断 - 不依赖支付服务") + @GetMapping("/basic-debug/{tenantId}") + public ApiResult basicDebug(@PathVariable Integer tenantId) { + try { + System.out.println("=== 基础诊断开始 ==="); + System.out.println("接收到的租户ID: " + tenantId); + + if (tenantId == null) { + return fail("租户ID为null",null); + } + + return success("基础诊断通过,租户ID: " + tenantId,null); + + } catch (Exception e) { + System.err.println("基础诊断异常: " + e.getMessage()); + e.printStackTrace(); + return fail("基础诊断异常: " + e.getMessage(),null); + } + } + + @Operation(summary = "快速诊断支付配置") + @GetMapping("/payment-debug/{tenantId}") + public ApiResult debugPaymentConfig(@PathVariable Integer tenantId) { + try { + System.out.println("=== 开始诊断租户 " + tenantId + " 的支付配置 ==="); + + // 检查基础参数 + if (tenantId == null) { + return fail("租户ID为null",null); + } + + // 检查服务是否可用 + if (paymentCacheService == null) { + return fail("PaymentCacheService未注入",null); + } + + System.out.println("准备调用 paymentCacheService.getWechatPayConfig(" + tenantId + ")"); + + // 获取支付配置 + Payment payment = null; + try { + payment = paymentCacheService.getWechatPayConfig(tenantId); + System.out.println("成功调用 getWechatPayConfig,结果: " + (payment != null ? "非null" : "null")); + } catch (Exception e) { + System.err.println("调用 getWechatPayConfig 异常: " + e.getMessage()); + e.printStackTrace(); + return fail("获取支付配置异常: " + e.getMessage() + " (类型: " + e.getClass().getName() + ")",null); + } + + if (payment == null) { + System.out.println("❌ 支付配置不存在"); + return fail("支付配置不存在,租户ID: " + tenantId,null); + } + + // 构建诊断信息字符串,避免序列化问题 + StringBuilder diagnosis = new StringBuilder(); + diagnosis.append("=== 支付配置诊断结果 ===\n"); + diagnosis.append("租户ID: ").append(tenantId).append("\n"); + diagnosis.append("商户号: ").append(payment.getMchId()).append("\n"); + diagnosis.append("应用ID: ").append(payment.getAppId()).append("\n"); + diagnosis.append("证书序列号: ").append(payment.getMerchantSerialNumber()).append("\n"); + diagnosis.append("API密钥: ").append(payment.getApiKey() != null ? "已配置(长度:" + payment.getApiKey().length() + ")" : "未配置").append("\n"); + diagnosis.append("状态: ").append(payment.getStatus()).append("\n"); + diagnosis.append("私钥文件: ").append(payment.getApiclientKey()).append("\n"); + diagnosis.append("证书文件: ").append(payment.getApiclientCert()).append("\n"); + diagnosis.append("公钥文件: ").append(payment.getPubKey()).append("\n"); + diagnosis.append("公钥ID: ").append(payment.getPubKeyId()).append("\n"); + + // 检查问题 + StringBuilder issues = new StringBuilder(); + if (payment.getMchId() == null || payment.getMchId().trim().isEmpty()) { + issues.append("❌ 商户号为空\n"); + } + if (payment.getAppId() == null || payment.getAppId().trim().isEmpty()) { + issues.append("❌ 应用ID为空\n"); + } + if (payment.getMerchantSerialNumber() == null || payment.getMerchantSerialNumber().trim().isEmpty()) { + issues.append("❌ 证书序列号为空\n"); + } + if (payment.getApiKey() == null || payment.getApiKey().trim().isEmpty()) { + issues.append("❌ API密钥为空\n"); + } else if (payment.getApiKey().length() != 32) { + issues.append("❌ API密钥长度错误(").append(payment.getApiKey().length()).append("位)\n"); + } + if (payment.getStatus() == null || !payment.getStatus()) { + issues.append("❌ 支付配置未启用\n"); + } + + if (issues.length() > 0) { + diagnosis.append("\n=== 发现的问题 ===\n"); + diagnosis.append(issues.toString()); + } else { + diagnosis.append("\n✅ 配置检查通过,无问题发现"); + } + + // 打印到控制台 + System.out.println(diagnosis.toString()); + + if (issues.length() > 0) { + return fail(diagnosis.toString(),null); + } else { + return success(diagnosis.toString(),null); + } + + } catch (Exception e) { + String errorMsg = "诊断失败: " + e.getMessage() + " (类型: " + e.getClass().getName() + ")"; + System.err.println(errorMsg); + e.printStackTrace(); + return fail(errorMsg,null); + } + } + + @Operation(summary = "直接数据库查询支付配置") + @GetMapping("/db-payment-check/{tenantId}") + public ApiResult checkPaymentFromDB(@PathVariable Integer tenantId) { + try { + System.out.println("=== 直接数据库查询支付配置 ==="); + System.out.println("租户ID: " + tenantId); + + if (tenantId == null) { + return fail("租户ID为null",null); + } + + if (paymentService == null) { + return fail("PaymentService未注入",null); + } + + // 直接查询数据库,不使用缓存 + PaymentParam param = new PaymentParam(); + param.setType(0); // 微信支付 + param.setTenantId(tenantId); + + System.out.println("准备查询数据库,参数: type=0, tenantId=" + tenantId); + + java.util.List payments = paymentService.listRel(param); + + System.out.println("查询结果数量: " + (payments != null ? payments.size() : "null")); + + if (payments == null || payments.isEmpty()) { + return fail("数据库中没有找到租户 " + tenantId + " 的微信支付配置",null); + } + + Payment payment = payments.get(0); + + StringBuilder result = new StringBuilder(); + result.append("=== 数据库查询结果 ===\n"); + result.append("租户ID: ").append(payment.getTenantId()).append("\n"); + result.append("支付方式: ").append(payment.getName()).append("\n"); + result.append("类型: ").append(payment.getType()).append("\n"); + result.append("商户号: ").append(payment.getMchId()).append("\n"); + result.append("应用ID: ").append(payment.getAppId()).append("\n"); + result.append("证书序列号: ").append(payment.getMerchantSerialNumber()).append("\n"); + result.append("API密钥状态: ").append(payment.getApiKey() != null ? "已配置(长度:" + payment.getApiKey().length() + ")" : "未配置").append("\n"); + result.append("状态: ").append(payment.getStatus()).append("\n"); + result.append("是否删除: ").append(payment.getDeleted()).append("\n"); + + System.out.println(result.toString()); + + return success(result.toString(),null); + + } catch (Exception e) { + String errorMsg = "数据库查询异常: " + e.getMessage() + " (类型: " + e.getClass().getName() + ")"; + System.err.println(errorMsg); + e.printStackTrace(); + return fail(errorMsg,null); + } + } + + @Operation(summary = "清理支付配置缓存") + @GetMapping("/clear-payment-cache/{tenantId}") + public String clearPaymentCache(@PathVariable Integer tenantId) { + try { + System.out.println("=== 清理支付配置缓存 ==="); + System.out.println("租户ID: " + tenantId); + + if (tenantId == null) { + return "错误: 租户ID为null"; + } + + // 清理可能的缓存键 + paymentCacheService.removePaymentConfig("0", tenantId); // 微信支付 + paymentCacheService.removePaymentConfig("wechat", tenantId); // 可能的其他格式 + + String result = "✅ 缓存已清理,租户ID: " + tenantId; + System.out.println(result); + return result; + + } catch (Exception e) { + String errorMsg = "❌ 清理缓存异常: " + e.getMessage(); + System.err.println(errorMsg); + e.printStackTrace(); + return errorMsg; + } + } + + @Operation(summary = "最简单的测试接口") + @GetMapping("/simple-test") + public String simpleTest() { + return "✅ 测试接口正常工作,时间: " + System.currentTimeMillis(); + } + + @Operation(summary = "测试支付配置是否存在") + @GetMapping("/check-payment-exists/{tenantId}") + public String checkPaymentExists(@PathVariable Integer tenantId) { + try { + System.out.println("=== 检查支付配置是否存在 ==="); + System.out.println("租户ID: " + tenantId); + + if (tenantId == null) { + return "❌ 租户ID为null"; + } + + if (paymentService == null) { + return "❌ PaymentService未注入"; + } + + // 使用最简单的查询 + PaymentParam param = new PaymentParam(); + param.setType(0); + param.setTenantId(tenantId); + + java.util.List payments = paymentService.listRel(param); + + if (payments == null) { + return "❌ 查询结果为null"; + } + + if (payments.isEmpty()) { + return "❌ 没有找到支付配置,租户ID: " + tenantId; + } + + Payment payment = payments.get(0); + StringBuilder result = new StringBuilder(); + result.append("✅ 找到支付配置\n"); + result.append("租户ID: ").append(payment.getTenantId()).append("\n"); + result.append("商户号: ").append(payment.getMchId() != null ? payment.getMchId() : "NULL").append("\n"); + result.append("应用ID: ").append(payment.getAppId() != null ? payment.getAppId() : "NULL").append("\n"); + result.append("状态: ").append(payment.getStatus()).append("\n"); + + return result.toString(); + + } catch (Exception e) { + String error = "❌ 检查异常: " + e.getMessage(); + System.err.println(error); + e.printStackTrace(); + return error; + } + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/controller/TranslateController.java b/src/main/java/com/gxwebsoft/common/core/controller/TranslateController.java new file mode 100644 index 0000000..7fe1400 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/controller/TranslateController.java @@ -0,0 +1,160 @@ +package com.gxwebsoft.common.core.controller; + +import com.gxwebsoft.common.core.utils.AliyunTranslateUtil; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +/** + * 翻译控制器 + * 提供文本翻译和批量翻译功能 + */ +@Slf4j +@Tag(name = "翻译管理") +@RestController +@RequestMapping("/api/translate") +public class TranslateController extends BaseController { + + @Resource + private AliyunTranslateUtil translateUtil; + + @Operation(summary = "单文本翻译") + @PostMapping("/text") + public ApiResult translateText(@RequestBody TranslateRequest request) { + try { + String translated = translateUtil.translate( + request.getText(), + request.getTargetLang(), + request.getSourceLang() != null ? request.getSourceLang() : "auto" + ); + + TranslateResponse response = new TranslateResponse(); + response.setSourceText(request.getText()); + response.setTranslatedText(translated); + response.setSourceLang(request.getSourceLang()); + response.setTargetLang(request.getTargetLang()); + + return success("翻译成功", response); + } catch (Exception e) { + log.error("翻译失败", e); + return new ApiResult<>(1, "翻译失败: " + e.getMessage()); + } + } + + @Operation(summary = "批量翻译") + @PostMapping("/batch") + public ApiResult batchTranslate(@RequestBody BatchTranslateRequest request) { + try { + log.info("收到批量翻译请求: {}", request); + + // 参数校验 + if (request.getTexts() == null || request.getTexts().isEmpty()) { + return new ApiResult<>(1, "待翻译文本列表不能为空"); + } + + if (request.getTargetLang() == null || request.getTargetLang().isEmpty()) { + return new ApiResult<>(1, "目标语言不能为空"); + } + + List results = new ArrayList<>(); + + for (String text : request.getTexts()) { + if (text == null || text.trim().isEmpty()) { + continue; // 跳过空文本 + } + + String translated = translateUtil.translate( + text, + request.getTargetLang(), + request.getSourceLang() != null ? request.getSourceLang() : "auto" + ); + + TranslateResponse response = new TranslateResponse(); + response.setSourceText(text); + response.setTranslatedText(translated); + response.setSourceLang(request.getSourceLang()); + response.setTargetLang(request.getTargetLang()); + + results.add(response); + } + + BatchTranslateResponse batchResponse = new BatchTranslateResponse(); + batchResponse.setResults(results); + batchResponse.setTotal(results.size()); + + return success("批量翻译成功", batchResponse); + } catch (Exception e) { + log.error("批量翻译失败,请求参数: {}", request, e); + return new ApiResult<>(1, "批量翻译失败: " + e.getMessage()); + } + } + + /** + * 单文本翻译请求 + */ + @Data + public static class TranslateRequest { + @Parameter(description = "待翻译文本") + private String text; + + @Parameter(description = "目标语言(如:en, zh, ja, ko)") + private String targetLang; + + @Parameter(description = "源语言(如:zh, en, auto)默认auto自动检测") + private String sourceLang; + } + + /** + * 批量翻译请求 + */ + @Data + public static class BatchTranslateRequest { + @Parameter(description = "待翻译文本列表") + private List texts; + + @Parameter(description = "目标语言(如:en, zh, ja, ko)") + private String targetLang; + + @Parameter(description = "源语言(如:zh, en, auto)默认auto自动检测") + private String sourceLang; + } + + /** + * 翻译响应 + */ + @Data + public static class TranslateResponse { + @Parameter(description = "原文") + private String sourceText; + + @Parameter(description = "译文") + private String translatedText; + + @Parameter(description = "源语言") + private String sourceLang; + + @Parameter(description = "目标语言") + private String targetLang; + } + + /** + * 批量翻译响应 + */ + @Data + public static class BatchTranslateResponse { + @Parameter(description = "翻译结果列表") + private List results; + + @Parameter(description = "总数") + private Integer total; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/controller/WechatCertTestController.java b/src/main/java/com/gxwebsoft/common/core/controller/WechatCertTestController.java new file mode 100644 index 0000000..148ece5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/controller/WechatCertTestController.java @@ -0,0 +1,211 @@ +package com.gxwebsoft.common.core.controller; + +import com.gxwebsoft.common.core.utils.WechatCertAutoConfig; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.wechat.pay.java.core.Config; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.Map; + +/** + * 微信支付证书自动配置测试控制器 + * + * @author 科技小王子 + * @since 2024-07-26 + */ +@Slf4j +@RestController +@RequestMapping("/api/wechat-cert-test") +@Tag(name = "微信支付证书自动配置测试") +public class WechatCertTestController extends BaseController { + + @Autowired + private WechatCertAutoConfig wechatCertAutoConfig; + + @Operation(summary = "测试默认开发环境证书配置") + @PostMapping("/test-default") + public ApiResult> testDefaultConfig() { + Map result = new HashMap<>(); + + try { + log.info("开始测试默认开发环境证书配置..."); + + // 创建自动证书配置 + Config config = wechatCertAutoConfig.createDefaultDevConfig(); + + // 测试配置 + boolean testResult = wechatCertAutoConfig.testConfig(config); + + result.put("success", true); + result.put("configCreated", config != null); + result.put("testPassed", testResult); + result.put("message", "默认证书配置测试完成"); + result.put("instructions", wechatCertAutoConfig.getUsageInstructions()); + + log.info("✅ 默认证书配置测试成功"); + return success("测试成功", result); + + } catch (Exception e) { + log.error("❌ 默认证书配置测试失败: {}", e.getMessage(), e); + + result.put("success", false); + result.put("error", e.getMessage()); + result.put("message", "证书配置测试失败"); + result.put("troubleshooting", getTroubleshootingInfo()); + + return fail("测试失败: " + e.getMessage(), result); + } + } + + @Operation(summary = "测试自定义证书配置") + @PostMapping("/test-custom") + public ApiResult> testCustomConfig( + @Parameter(description = "商户号") @RequestParam String merchantId, + @Parameter(description = "私钥文件路径") @RequestParam String privateKeyPath, + @Parameter(description = "证书序列号") @RequestParam String merchantSerialNumber, + @Parameter(description = "APIv3密钥") @RequestParam String apiV3Key) { + + Map result = new HashMap<>(); + + try { + log.info("开始测试自定义证书配置..."); + log.info("商户号: {}", merchantId); + log.info("私钥路径: {}", privateKeyPath); + + // 创建自动证书配置 + Config config = wechatCertAutoConfig.createAutoConfig( + merchantId, privateKeyPath, merchantSerialNumber, apiV3Key); + + // 测试配置 + boolean testResult = wechatCertAutoConfig.testConfig(config); + + result.put("success", true); + result.put("configCreated", config != null); + result.put("testPassed", testResult); + result.put("message", "自定义证书配置测试完成"); + result.put("merchantId", merchantId); + result.put("privateKeyPath", privateKeyPath); + + log.info("✅ 自定义证书配置测试成功"); + return success("测试成功", result); + + } catch (Exception e) { + log.error("❌ 自定义证书配置测试失败: {}", e.getMessage(), e); + + result.put("success", false); + result.put("error", e.getMessage()); + result.put("message", "证书配置测试失败"); + result.put("troubleshooting", getTroubleshootingInfo()); + + return fail("测试失败: " + e.getMessage(), result); + } + } + + @Operation(summary = "获取使用说明") + @GetMapping("/instructions") + public ApiResult getInstructions() { + String instructions = wechatCertAutoConfig.getUsageInstructions(); + return success("获取使用说明成功", instructions); + } + + @Operation(summary = "获取故障排除信息") + @GetMapping("/troubleshooting") + public ApiResult> getTroubleshooting() { + Map troubleshooting = getTroubleshootingInfo(); + return success("获取故障排除信息成功", troubleshooting); + } + + /** + * 获取故障排除信息 + */ + private Map getTroubleshootingInfo() { + Map info = new HashMap<>(); + + info.put("commonIssues", Map.of( + "404错误", "商户平台未开启API安全功能或未申请使用微信支付公钥", + "证书序列号错误", "请检查商户平台中的证书序列号是否正确", + "APIv3密钥错误", "请确认APIv3密钥是否正确设置", + "私钥文件不存在", "请检查私钥文件路径是否正确", + "网络连接问题", "请检查网络连接是否正常" + )); + + info.put("solutions", Map.of( + "开启API安全", "登录微信商户平台 -> 账户中心 -> API安全 -> 申请使用微信支付公钥", + "获取证书序列号", "在API安全页面查看或重新下载证书", + "设置APIv3密钥", "在API安全页面设置APIv3密钥", + "检查私钥文件", "确保apiclient_key.pem文件存在且路径正确" + )); + + info.put("advantages", Map.of( + "自动下载", "RSAAutoCertificateConfig会自动下载平台证书", + "自动更新", "证书过期时会自动更新", + "简化管理", "无需手动管理wechatpay_cert.pem文件", + "官方推荐", "微信支付官方推荐的证书管理方式" + )); + + info.put("documentation", "https://pay.weixin.qq.com/doc/v3/merchant/4012153196"); + + return info; + } + + @Operation(summary = "检查商户平台配置状态") + @PostMapping("/check-merchant-config") + public ApiResult> checkMerchantConfig( + @RequestParam String merchantId, + @RequestParam String privateKeyPath, + @RequestParam String merchantSerialNumber, + @RequestParam String apiV3Key) { + + Map result = new HashMap<>(); + + try { + log.info("开始检查商户平台配置状态..."); + log.info("商户号: {}", merchantId); + + // 尝试创建自动证书配置 + Config config = wechatCertAutoConfig.createAutoConfig( + merchantId, privateKeyPath, merchantSerialNumber, apiV3Key); + + result.put("success", true); + result.put("configCreated", true); + result.put("message", "商户平台配置正常,自动证书配置创建成功"); + result.put("merchantId", merchantId); + result.put("recommendation", "配置正常,可以正常使用微信支付功能"); + + log.info("✅ 商户平台配置检查成功"); + return success("配置检查成功", result); + + } catch (Exception e) { + log.error("❌ 商户平台配置检查失败: {}", e.getMessage(), e); + + result.put("success", false); + result.put("configCreated", false); + result.put("error", e.getMessage()); + result.put("merchantId", merchantId); + + // 分析错误类型并提供解决方案 + if (e.getMessage().contains("404") || e.getMessage().contains("RESOURCE_NOT_EXISTS")) { + result.put("errorType", "商户平台配置问题"); + result.put("solution", "请在微信支付商户平台完成以下配置:\n" + + "1. 登录商户平台:https://pay.weixin.qq.com/\n" + + "2. 进入:产品中心 → 开发配置 → API安全\n" + + "3. 申请API证书\n" + + "4. 申请使用微信支付公钥\n" + + "5. 确保API证书和微信支付公钥状态为\"已生效\""); + result.put("documentUrl", "https://pay.weixin.qq.com/doc/v3/merchant/4012153196"); + } else { + result.put("errorType", "其他配置问题"); + result.put("solution", "请检查商户号、证书序列号、API密钥等配置是否正确"); + } + + return success("配置检查完成(发现问题)", result); + } + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/controller/WechatPayDiagnosticController.java b/src/main/java/com/gxwebsoft/common/core/controller/WechatPayDiagnosticController.java new file mode 100644 index 0000000..18c75a1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/controller/WechatPayDiagnosticController.java @@ -0,0 +1,318 @@ +package com.gxwebsoft.common.core.controller; + +import com.gxwebsoft.common.core.utils.WechatPayCertificateDiagnostic; +import com.gxwebsoft.common.core.utils.WechatPayConfigChecker; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.system.entity.Payment; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.Map; + +/** + * 微信支付诊断控制器 + * 用于诊断和解决微信支付证书相关问题 + * + * @author 科技小王子 + * @since 2025-07-29 + */ +@Slf4j +@RestController +@RequestMapping("/system/wechat-pay-diagnostic") +@Tag(name = "微信支付诊断", description = "微信支付证书诊断和问题排查") +public class WechatPayDiagnosticController extends com.gxwebsoft.common.core.web.BaseController { + + @Autowired + private WechatPayCertificateDiagnostic certificateDiagnostic; + + @Autowired + private com.gxwebsoft.common.core.service.PaymentCacheService paymentCacheService; + + @Autowired + private WechatPayConfigChecker configChecker; + + @Value("${spring.profiles.active:dev}") + private String activeProfile; + + @Operation(summary = "诊断租户微信支付证书配置") + @GetMapping("/diagnose/{tenantId}") + @PreAuthorize("hasAuthority('system:payment:view')") + public ApiResult> diagnoseTenantCertificate( + @Parameter(description = "租户ID", example = "10550") @PathVariable Integer tenantId) { + + try { + log.info("开始诊断租户 {} 的微信支付证书配置", tenantId); + + // 获取支付配置 (微信支付类型为0) + Payment payment = paymentCacheService.getWechatPayConfig(tenantId); + if (payment == null) { + Map errorResponse = new HashMap<>(); + errorResponse.put("tenantId", tenantId); + errorResponse.put("error", "支付配置不存在"); + return fail("租户 " + tenantId + " 的微信支付配置不存在", errorResponse); + } + + // 执行诊断 + WechatPayCertificateDiagnostic.DiagnosticResult result = + certificateDiagnostic.diagnoseCertificateConfig(payment, tenantId, activeProfile); + + Map response = new HashMap<>(); + response.put("tenantId", tenantId); + response.put("environment", activeProfile); + response.put("hasErrors", result.hasErrors()); + response.put("errors", result.getErrors()); + response.put("warnings", result.getWarnings()); + response.put("info", result.getInfo()); + response.put("recommendations", result.getRecommendations()); + response.put("fullReport", result.getFullReport()); + + if (result.hasErrors()) { + return fail("诊断发现问题", response); + } else { + return success("诊断完成", response); + } + + } catch (Exception e) { + log.error("诊断租户 {} 证书配置时发生异常", tenantId, e); + Map errorResponse = new HashMap<>(); + errorResponse.put("tenantId", tenantId); + errorResponse.put("exception", e.getMessage()); + return fail("诊断过程中发生异常: " + e.getMessage(), errorResponse); + } + } + + @Operation(summary = "获取证书问题解决方案") + @GetMapping("/solutions") + @PreAuthorize("hasAuthority('system:payment:view')") + public ApiResult> getCertificateSolutions() { + Map solutions = new HashMap<>(); + + solutions.put("commonIssues", Map.of( + "X509Certificate.getSerialNumber() null", "证书对象为空,通常是自动证书配置失败导致", + "404错误", "商户平台未开启API安全功能或未申请使用微信支付公钥", + "证书序列号错误", "请检查商户平台中的证书序列号是否正确", + "APIv3密钥错误", "请确认APIv3密钥是否正确设置", + "私钥文件不存在", "请检查私钥文件路径是否正确", + "网络连接问题", "请检查网络连接是否正常" + )); + + solutions.put("stepByStepSolutions", Map.of( + "开启API安全", "登录微信商户平台 -> 账户中心 -> API安全 -> 申请使用微信支付公钥", + "获取证书序列号", "在API安全页面查看或重新下载证书", + "设置APIv3密钥", "在API安全页面设置APIv3密钥(32位字符串)", + "检查私钥文件", "确保apiclient_key.pem文件存在且路径正确", + "使用自动证书配置", "推荐使用RSAAutoCertificateConfig,可自动管理平台证书" + )); + + solutions.put("configurationAdvice", Map.of( + "开发环境", "证书文件放在 src/main/resources/dev/wechat/{tenantId}/ 目录下", + "生产环境", "证书文件放在 Docker 挂载卷或指定的文件系统路径", + "证书文件要求", "需要 apiclient_key.pem(私钥)和 apiclient_cert.pem(商户证书)", + "自动配置优势", "无需手动管理微信支付平台证书,自动下载和更新" + )); + + solutions.put("troubleshootingSteps", new String[]{ + "1. 检查商户平台是否已开启API安全功能", + "2. 确认已申请使用微信支付公钥", + "3. 验证商户证书序列号是否正确", + "4. 检查APIv3密钥是否为32位字符串", + "5. 确认私钥文件路径正确且文件存在", + "6. 测试网络连接是否正常", + "7. 查看详细错误日志进行进一步诊断" + }); + + return success("获取解决方案成功", solutions); + } + + @Operation(summary = "测试证书配置") + @PostMapping("/test/{tenantId}") + @PreAuthorize("hasAuthority('system:payment:edit')") + public ApiResult> testCertificateConfig( + @Parameter(description = "租户ID", example = "10550") @PathVariable Integer tenantId) { + + try { + log.info("开始测试租户 {} 的证书配置", tenantId); + + // 获取支付配置 (微信支付类型为0) + Payment payment = paymentCacheService.getWechatPayConfig(tenantId); + if (payment == null) { + Map errorResponse = new HashMap<>(); + errorResponse.put("tenantId", tenantId); + errorResponse.put("error", "支付配置不存在"); + return fail("租户 " + tenantId + " 的微信支付配置不存在", errorResponse); + } + + // 执行诊断 + WechatPayCertificateDiagnostic.DiagnosticResult result = + certificateDiagnostic.diagnoseCertificateConfig(payment, tenantId, activeProfile); + + Map testResult = new HashMap<>(); + testResult.put("tenantId", tenantId); + testResult.put("configurationValid", !result.hasErrors()); + testResult.put("testTime", System.currentTimeMillis()); + testResult.put("environment", activeProfile); + + if (result.hasErrors()) { + testResult.put("status", "FAILED"); + testResult.put("errors", result.getErrors()); + testResult.put("recommendations", result.getRecommendations()); + return fail("证书配置测试失败", testResult); + } else { + testResult.put("status", "SUCCESS"); + testResult.put("message", "证书配置正常"); + return success("证书配置测试通过", testResult); + } + + } catch (Exception e) { + log.error("测试租户 {} 证书配置时发生异常", tenantId, e); + Map errorResponse = new HashMap<>(); + errorResponse.put("tenantId", tenantId); + errorResponse.put("exception", e.getMessage()); + return fail("测试过程中发生异常: " + e.getMessage(), errorResponse); + } + } + + @Operation(summary = "获取环境信息") + @GetMapping("/environment") + @PreAuthorize("hasAuthority('system:payment:view')") + public ApiResult> getEnvironmentInfo() { + Map envInfo = new HashMap<>(); + envInfo.put("activeProfile", activeProfile); + envInfo.put("javaVersion", System.getProperty("java.version")); + envInfo.put("osName", System.getProperty("os.name")); + envInfo.put("userDir", System.getProperty("user.dir")); + envInfo.put("timestamp", System.currentTimeMillis()); + + return success("获取环境信息成功", envInfo); + } + + @Operation(summary = "获取证书配置指南") + @GetMapping("/guide") + public ApiResult> getCertificateGuide() { + Map guide = new HashMap<>(); + + guide.put("overview", "微信支付证书配置完整指南"); + + guide.put("prerequisites", new String[]{ + "1. 拥有微信支付商户账号", + "2. 已完成商户入驻和资质审核", + "3. 具备开发者权限" + }); + + guide.put("merchantPlatformSteps", new String[]{ + "1. 登录微信商户平台 (pay.weixin.qq.com)", + "2. 进入【账户中心】->【API安全】", + "3. 点击【申请使用微信支付公钥】", + "4. 下载商户证书(apiclient_cert.pem 和 apiclient_key.pem)", + "5. 设置APIv3密钥(32位字符串)", + "6. 记录商户证书序列号" + }); + + guide.put("developmentSetup", new String[]{ + "1. 在项目中创建证书目录:src/main/resources/dev/wechat/{tenantId}/", + "2. 将 apiclient_key.pem 放入该目录", + "3. 将 apiclient_cert.pem 放入该目录(可选,自动配置不需要)", + "4. 在数据库中配置支付信息:商户号、应用ID、证书序列号、APIv3密钥" + }); + + guide.put("productionSetup", new String[]{ + "1. 将证书文件上传到服务器指定目录", + "2. 确保应用有读取证书文件的权限", + "3. 在数据库中配置正确的证书文件路径", + "4. 测试证书配置是否正常" + }); + + guide.put("bestPractices", new String[]{ + "1. 使用RSAAutoCertificateConfig自动证书配置", + "2. 定期检查证书有效期", + "3. 妥善保管私钥文件", + "4. 使用HTTPS传输敏感信息", + "5. 定期更新微信支付SDK版本" + }); + + return success("获取配置指南成功", guide); + } + + @Operation(summary = "快速检查租户配置状态") + @GetMapping("/check/{tenantId}") + @PreAuthorize("hasAuthority('system:payment:view')") + public ApiResult> quickCheckConfig( + @Parameter(description = "租户ID", example = "10547") @PathVariable Integer tenantId) { + + try { + log.info("快速检查租户 {} 的配置状态", tenantId); + + WechatPayConfigChecker.ConfigStatus status = configChecker.checkTenantConfig(tenantId); + + Map response = new HashMap<>(); + response.put("tenantId", status.tenantId); + response.put("environment", status.environment); + response.put("configMode", status.configMode); + response.put("configComplete", status.configComplete); + response.put("hasError", status.hasError); + response.put("errorMessage", status.errorMessage); + response.put("recommendation", status.recommendation); + response.put("issues", status.issues); + + // 详细配置信息 + Map configDetails = new HashMap<>(); + configDetails.put("merchantId", status.merchantId); + configDetails.put("appId", status.appId); + configDetails.put("serialNumber", status.serialNumber); + configDetails.put("hasApiKey", status.hasApiKey); + configDetails.put("apiKeyLength", status.apiKeyLength); + configDetails.put("hasPublicKey", status.hasPublicKey); + configDetails.put("publicKeyFile", status.publicKeyFile); + configDetails.put("publicKeyId", status.publicKeyId); + configDetails.put("publicKeyExists", status.publicKeyExists); + configDetails.put("privateKeyExists", status.privateKeyExists); + configDetails.put("merchantCertExists", status.merchantCertExists); + response.put("configDetails", configDetails); + + if (status.hasError || !status.configComplete) { + return fail("配置检查发现问题", response); + } else { + return success("配置检查通过", response); + } + + } catch (Exception e) { + log.error("检查租户 {} 配置状态时发生异常", tenantId, e); + Map errorResponse = new HashMap<>(); + errorResponse.put("tenantId", tenantId); + errorResponse.put("exception", e.getMessage()); + return fail("检查过程中发生异常: " + e.getMessage(), errorResponse); + } + } + + @Operation(summary = "获取配置建议") + @GetMapping("/advice/{tenantId}") + @PreAuthorize("hasAuthority('system:payment:view')") + public ApiResult> getConfigAdvice( + @Parameter(description = "租户ID", example = "10547") @PathVariable Integer tenantId) { + + try { + String advice = configChecker.generateConfigAdvice(tenantId); + + Map response = new HashMap<>(); + response.put("tenantId", tenantId); + response.put("advice", advice); + response.put("timestamp", System.currentTimeMillis()); + + return success("获取配置建议成功", response); + + } catch (Exception e) { + log.error("获取租户 {} 配置建议时发生异常", tenantId, e); + Map errorResponse = new HashMap<>(); + errorResponse.put("tenantId", tenantId); + errorResponse.put("exception", e.getMessage()); + return fail("获取建议过程中发生异常: " + e.getMessage(), errorResponse); + } + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/dto/qr/CreateBusinessEncryptedQrCodeRequest.java b/src/main/java/com/gxwebsoft/common/core/dto/qr/CreateBusinessEncryptedQrCodeRequest.java new file mode 100644 index 0000000..bae53d8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/dto/qr/CreateBusinessEncryptedQrCodeRequest.java @@ -0,0 +1,114 @@ +package com.gxwebsoft.common.core.dto.qr; + +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.validation.constraints.*; + +/** + * 创建业务加密二维码请求DTO + * + * @author WebSoft + * @since 2025-08-18 + */ +@Schema(description = "创建业务加密二维码请求") +public class CreateBusinessEncryptedQrCodeRequest { + + @Schema(description = "要加密的数据", required = true, example = "订单ID:ORDER123") + @NotBlank(message = "数据不能为空") + private String data; + + @Schema(description = "业务密钥(如门店密钥)", required = true, example = "store_key_123") + @NotBlank(message = "业务密钥不能为空") + private String businessKey; + + @Schema(description = "二维码宽度", example = "200") + @Min(value = 50, message = "宽度不能小于50像素") + @Max(value = 1000, message = "宽度不能大于1000像素") + private Integer width = 200; + + @Schema(description = "二维码高度", example = "200") + @Min(value = 50, message = "高度不能小于50像素") + @Max(value = 1000, message = "高度不能大于1000像素") + private Integer height = 200; + + @Schema(description = "过期时间(分钟)", example = "30") + @Min(value = 1, message = "过期时间不能小于1分钟") + @Max(value = 1440, message = "过期时间不能大于1440分钟") + private Long expireMinutes = 30L; + + @Schema(description = "业务类型(可选)", example = "ORDER") + private String businessType; + + // 构造函数 + public CreateBusinessEncryptedQrCodeRequest() {} + + public CreateBusinessEncryptedQrCodeRequest(String data, String businessKey, Integer width, Integer height, Long expireMinutes, String businessType) { + this.data = data; + this.businessKey = businessKey; + this.width = width; + this.height = height; + this.expireMinutes = expireMinutes; + this.businessType = businessType; + } + + // Getter和Setter方法 + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + + public String getBusinessKey() { + return businessKey; + } + + public void setBusinessKey(String businessKey) { + this.businessKey = businessKey; + } + + public Integer getWidth() { + return width; + } + + public void setWidth(Integer width) { + this.width = width; + } + + public Integer getHeight() { + return height; + } + + public void setHeight(Integer height) { + this.height = height; + } + + public Long getExpireMinutes() { + return expireMinutes; + } + + public void setExpireMinutes(Long expireMinutes) { + this.expireMinutes = expireMinutes; + } + + public String getBusinessType() { + return businessType; + } + + public void setBusinessType(String businessType) { + this.businessType = businessType; + } + + @Override + public String toString() { + return "CreateBusinessEncryptedQrCodeRequest{" + + "data='" + data + '\'' + + ", businessKey='" + businessKey + '\'' + + ", width=" + width + + ", height=" + height + + ", expireMinutes=" + expireMinutes + + ", businessType='" + businessType + '\'' + + '}'; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/dto/qr/CreateEncryptedQrCodeRequest.java b/src/main/java/com/gxwebsoft/common/core/dto/qr/CreateEncryptedQrCodeRequest.java new file mode 100644 index 0000000..f81c9d1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/dto/qr/CreateEncryptedQrCodeRequest.java @@ -0,0 +1,100 @@ +package com.gxwebsoft.common.core.dto.qr; + +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.validation.constraints.*; + +/** + * 创建加密二维码请求DTO + * + * @author WebSoft + * @since 2025-08-18 + */ +@Schema(description = "创建加密二维码请求") +public class CreateEncryptedQrCodeRequest { + + @Schema(description = "要加密的数据", required = true, example = "用户ID:12345") + @NotBlank(message = "数据不能为空") + private String data; + + @Schema(description = "二维码宽度", example = "200") + @Min(value = 50, message = "宽度不能小于50像素") + @Max(value = 1000, message = "宽度不能大于1000像素") + private Integer width = 200; + + @Schema(description = "二维码高度", example = "200") + @Min(value = 50, message = "高度不能小于50像素") + @Max(value = 1000, message = "高度不能大于1000像素") + private Integer height = 200; + + @Schema(description = "过期时间(分钟)", example = "30") + @Min(value = 1, message = "过期时间不能小于1分钟") + @Max(value = 1440, message = "过期时间不能大于1440分钟") + private Long expireMinutes = 30L; + + @Schema(description = "业务类型(可选)", example = "LOGIN") + private String businessType; + + // 构造函数 + public CreateEncryptedQrCodeRequest() {} + + public CreateEncryptedQrCodeRequest(String data, Integer width, Integer height, Long expireMinutes, String businessType) { + this.data = data; + this.width = width; + this.height = height; + this.expireMinutes = expireMinutes; + this.businessType = businessType; + } + + // Getter和Setter方法 + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + + public Integer getWidth() { + return width; + } + + public void setWidth(Integer width) { + this.width = width; + } + + public Integer getHeight() { + return height; + } + + public void setHeight(Integer height) { + this.height = height; + } + + public Long getExpireMinutes() { + return expireMinutes; + } + + public void setExpireMinutes(Long expireMinutes) { + this.expireMinutes = expireMinutes; + } + + public String getBusinessType() { + return businessType; + } + + public void setBusinessType(String businessType) { + this.businessType = businessType; + } + + @Override + public String toString() { + return "CreateEncryptedQrCodeRequest{" + + "data='" + data + '\'' + + ", width=" + width + + ", height=" + height + + ", expireMinutes=" + expireMinutes + + ", businessType='" + businessType + '\'' + + '}'; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/dto/qr/DecryptQrDataRequest.java b/src/main/java/com/gxwebsoft/common/core/dto/qr/DecryptQrDataRequest.java new file mode 100644 index 0000000..3d35550 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/dto/qr/DecryptQrDataRequest.java @@ -0,0 +1,56 @@ +package com.gxwebsoft.common.core.dto.qr; + +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.validation.constraints.NotBlank; + +/** + * 解密二维码数据请求DTO + * + * @author WebSoft + * @since 2025-08-18 + */ +@Schema(description = "解密二维码数据请求") +public class DecryptQrDataRequest { + + @Schema(description = "token密钥", required = true, example = "abc123def456") + @NotBlank(message = "token不能为空") + private String token; + + @Schema(description = "加密的数据", required = true, example = "encrypted_data_string") + @NotBlank(message = "加密数据不能为空") + private String encryptedData; + + // 构造函数 + public DecryptQrDataRequest() {} + + public DecryptQrDataRequest(String token, String encryptedData) { + this.token = token; + this.encryptedData = encryptedData; + } + + // Getter和Setter方法 + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public String getEncryptedData() { + return encryptedData; + } + + public void setEncryptedData(String encryptedData) { + this.encryptedData = encryptedData; + } + + @Override + public String toString() { + return "DecryptQrDataRequest{" + + "token='" + token + '\'' + + ", encryptedData='" + encryptedData + '\'' + + '}'; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/dto/qr/InvalidateTokenRequest.java b/src/main/java/com/gxwebsoft/common/core/dto/qr/InvalidateTokenRequest.java new file mode 100644 index 0000000..1e8aa67 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/dto/qr/InvalidateTokenRequest.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.common.core.dto.qr; + +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.validation.constraints.NotBlank; + +/** + * 使token失效请求DTO + * + * @author WebSoft + * @since 2025-08-18 + */ +@Schema(description = "使token失效请求") +public class InvalidateTokenRequest { + + @Schema(description = "要使失效的token", required = true, example = "abc123def456") + @NotBlank(message = "token不能为空") + private String token; + + // 构造函数 + public InvalidateTokenRequest() {} + + public InvalidateTokenRequest(String token) { + this.token = token; + } + + // Getter和Setter方法 + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + @Override + public String toString() { + return "InvalidateTokenRequest{" + + "token='" + token + '\'' + + '}'; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/dto/qr/VerifyBusinessQrRequest.java b/src/main/java/com/gxwebsoft/common/core/dto/qr/VerifyBusinessQrRequest.java new file mode 100644 index 0000000..fbdfe3a --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/dto/qr/VerifyBusinessQrRequest.java @@ -0,0 +1,56 @@ +package com.gxwebsoft.common.core.dto.qr; + +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.validation.constraints.NotBlank; + +/** + * 门店核销二维码请求DTO + * + * @author WebSoft + * @since 2025-08-18 + */ +@Schema(description = "门店核销二维码请求") +public class VerifyBusinessQrRequest { + + @Schema(description = "二维码扫描得到的完整内容", required = true, example = "qr_content_string") + @NotBlank(message = "二维码内容不能为空") + private String qrContent; + + @Schema(description = "门店业务密钥", required = true, example = "store_key_123") + @NotBlank(message = "业务密钥不能为空") + private String businessKey; + + // 构造函数 + public VerifyBusinessQrRequest() {} + + public VerifyBusinessQrRequest(String qrContent, String businessKey) { + this.qrContent = qrContent; + this.businessKey = businessKey; + } + + // Getter和Setter方法 + public String getQrContent() { + return qrContent; + } + + public void setQrContent(String qrContent) { + this.qrContent = qrContent; + } + + public String getBusinessKey() { + return businessKey; + } + + public void setBusinessKey(String businessKey) { + this.businessKey = businessKey; + } + + @Override + public String toString() { + return "VerifyBusinessQrRequest{" + + "qrContent='" + qrContent + '\'' + + ", businessKey='" + businessKey + '\'' + + '}'; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/dto/qr/VerifyQrContentRequest.java b/src/main/java/com/gxwebsoft/common/core/dto/qr/VerifyQrContentRequest.java new file mode 100644 index 0000000..eb60b09 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/dto/qr/VerifyQrContentRequest.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.common.core.dto.qr; + +import io.swagger.v3.oas.annotations.media.Schema; + +import javax.validation.constraints.NotBlank; + +/** + * 验证二维码内容请求DTO + * + * @author WebSoft + * @since 2025-08-18 + */ +@Schema(description = "验证二维码内容请求") +public class VerifyQrContentRequest { + + @Schema(description = "二维码扫描得到的完整内容", required = true, example = "qr_content_string") + @NotBlank(message = "二维码内容不能为空") + private String qrContent; + + // 构造函数 + public VerifyQrContentRequest() {} + + public VerifyQrContentRequest(String qrContent) { + this.qrContent = qrContent; + } + + // Getter和Setter方法 + public String getQrContent() { + return qrContent; + } + + public void setQrContent(String qrContent) { + this.qrContent = qrContent; + } + + @Override + public String toString() { + return "VerifyQrContentRequest{" + + "qrContent='" + qrContent + '\'' + + '}'; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/exception/BusinessException.java b/src/main/java/com/gxwebsoft/common/core/exception/BusinessException.java new file mode 100644 index 0000000..8e10e82 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/exception/BusinessException.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.common.core.exception; + +import com.gxwebsoft.common.core.Constants; + +/** + * 自定义业务异常 + * + * @author WebSoft + * @since 2018-02-22 11:29:28 + */ +public class BusinessException extends RuntimeException { + private static final long serialVersionUID = 1L; + + private Integer code; + + public BusinessException() { + this(Constants.RESULT_ERROR_MSG); + } + + public BusinessException(String message) { + this(Constants.RESULT_ERROR_CODE, message); + } + + public BusinessException(Integer code, String message) { + super(message); + this.code = code; + } + + public BusinessException(Integer code, String message, Throwable cause) { + super(message, cause); + this.code = code; + } + + public BusinessException(Integer code, String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + this.code = code; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/exception/GlobalExceptionHandler.java b/src/main/java/com/gxwebsoft/common/core/exception/GlobalExceptionHandler.java new file mode 100644 index 0000000..7fb4c8c --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/exception/GlobalExceptionHandler.java @@ -0,0 +1,89 @@ +package com.gxwebsoft.common.core.exception; + +import com.gxwebsoft.common.core.Constants; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.web.ApiResult; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.validation.BindException; +import org.springframework.validation.FieldError; +import org.springframework.web.HttpRequestMethodNotSupportedException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; +import java.util.Set; + +/** + * 全局异常处理器 + * + * @author WebSoft + * @since 2018-02-22 11:29:30 + */ +@ControllerAdvice +public class GlobalExceptionHandler { + private final Logger logger = LoggerFactory.getLogger(getClass()); + + @ResponseBody + @ExceptionHandler(HttpRequestMethodNotSupportedException.class) + public ApiResult methodNotSupportedExceptionHandler(HttpRequestMethodNotSupportedException e, + HttpServletResponse response) { + CommonUtil.addCrossHeaders(response); + return new ApiResult<>(Constants.RESULT_ERROR_CODE, "请求方式不正确").setError(e.toString()); + } + + @ResponseBody + @ExceptionHandler(AccessDeniedException.class) + public ApiResult accessDeniedExceptionHandler(AccessDeniedException e, HttpServletResponse response) { + CommonUtil.addCrossHeaders(response); + return new ApiResult<>(Constants.UNAUTHORIZED_CODE, Constants.UNAUTHORIZED_MSG).setError(e.toString()); + } + + @ResponseBody + @ExceptionHandler(BusinessException.class) + public ApiResult businessExceptionHandler(BusinessException e, HttpServletResponse response) { + CommonUtil.addCrossHeaders(response); + return new ApiResult<>(e.getCode(), e.getMessage()); + } + + @ResponseBody + @ExceptionHandler(MethodArgumentNotValidException.class) + public ApiResult methodArgumentNotValidExceptionHandler(MethodArgumentNotValidException e, HttpServletResponse response) { + CommonUtil.addCrossHeaders(response); + FieldError fieldError = e.getBindingResult().getFieldError(); + String message = fieldError != null ? fieldError.getDefaultMessage() : "参数验证失败"; + return new ApiResult<>(Constants.RESULT_ERROR_CODE, message); + } + + @ResponseBody + @ExceptionHandler(BindException.class) + public ApiResult bindExceptionHandler(BindException e, HttpServletResponse response) { + CommonUtil.addCrossHeaders(response); + FieldError fieldError = e.getBindingResult().getFieldError(); + String message = fieldError != null ? fieldError.getDefaultMessage() : "参数绑定失败"; + return new ApiResult<>(Constants.RESULT_ERROR_CODE, message); + } + + @ResponseBody + @ExceptionHandler(ConstraintViolationException.class) + public ApiResult constraintViolationExceptionHandler(ConstraintViolationException e, HttpServletResponse response) { + CommonUtil.addCrossHeaders(response); + Set> violations = e.getConstraintViolations(); + String message = violations.isEmpty() ? "参数验证失败" : violations.iterator().next().getMessage(); + return new ApiResult<>(Constants.RESULT_ERROR_CODE, message); + } + + @ResponseBody + @ExceptionHandler(Throwable.class) + public ApiResult exceptionHandler(Throwable e, HttpServletResponse response) { + logger.error(e.getMessage(), e); + CommonUtil.addCrossHeaders(response); + return new ApiResult<>(Constants.RESULT_ERROR_CODE, Constants.RESULT_ERROR_MSG).setError(e.toString()); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/security/JwtAccessDeniedHandler.java b/src/main/java/com/gxwebsoft/common/core/security/JwtAccessDeniedHandler.java new file mode 100644 index 0000000..66acb5c --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/security/JwtAccessDeniedHandler.java @@ -0,0 +1,29 @@ +package com.gxwebsoft.common.core.security; + +import com.gxwebsoft.common.core.Constants; +import com.gxwebsoft.common.core.utils.CommonUtil; +import org.springframework.security.access.AccessDeniedException; +import org.springframework.security.web.access.AccessDeniedHandler; +import org.springframework.stereotype.Component; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * 没有访问权限异常处理 + * + * @author WebSoft + * @since 2020-03-25 00:35:03 + */ +@Component +public class JwtAccessDeniedHandler implements AccessDeniedHandler { + + @Override + public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException e) + throws IOException, ServletException { + CommonUtil.responseError(response, Constants.UNAUTHORIZED_CODE, Constants.UNAUTHORIZED_MSG, e.getMessage()); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/security/JwtAuthenticationEntryPoint.java b/src/main/java/com/gxwebsoft/common/core/security/JwtAuthenticationEntryPoint.java new file mode 100644 index 0000000..3be2908 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/security/JwtAuthenticationEntryPoint.java @@ -0,0 +1,30 @@ +package com.gxwebsoft.common.core.security; + +import com.gxwebsoft.common.core.Constants; +import com.gxwebsoft.common.core.utils.CommonUtil; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.stereotype.Component; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * 没有登录异常处理 + * + * @author WebSoft + * @since 2020-03-25 00:35:03 + */ +@Component +public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint { + + @Override + public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) + throws IOException, ServletException { +// CommonUtil.responseError(response, Constants.UNAUTHENTICATED_CODE, Constants.UNAUTHENTICATED_MSG, +// e.getMessage()); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/security/JwtAuthenticationFilter.java b/src/main/java/com/gxwebsoft/common/core/security/JwtAuthenticationFilter.java new file mode 100644 index 0000000..e910c6d --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/security/JwtAuthenticationFilter.java @@ -0,0 +1,118 @@ +package com.gxwebsoft.common.core.security; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSONObject; +import com.gxwebsoft.common.core.Constants; +import com.gxwebsoft.common.core.config.ConfigProperties; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.utils.JSONUtil; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.utils.SignCheckUtil; +import com.gxwebsoft.common.system.entity.Menu; +import com.gxwebsoft.common.system.entity.User; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.ExpiredJwtException; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; + +import javax.annotation.Resource; +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 处理携带token的请求过滤器 + * + * @author WebSoft + * @since 2020-03-30 20:48:05 + */ +@Component +public class JwtAuthenticationFilter extends OncePerRequestFilter { + @Resource + private ConfigProperties configProperties; + @Value("${spring.profiles.active}") + String active; + @Resource + private RedisUtil redisUtil; + // 是否读取用户信息 + public static Boolean isReadUserInfo = true; + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) + throws ServletException, IOException { + String access_token = JwtUtil.getAccessToken(request); + if (StrUtil.isNotBlank(access_token)) { + try { + // 解析token + Claims claims = JwtUtil.parseToken(access_token, configProperties.getTokenKey()); + JwtSubject jwtSubject = JwtUtil.getJwtSubject(claims); + + // 请求主服务器获取用户信息 + if (isReadUserInfo) { + HashMap map = new HashMap<>(); + map.put("username", jwtSubject.getUsername()); + map.put("tenantId", jwtSubject.getTenantId()); + // 链式构建请求 + String result = HttpRequest.post(configProperties.getServerUrl() + "/auth/user") + .header("Authorization", access_token) + .header("Tenantid", jwtSubject.getTenantId().toString()) + .body(JSONUtil.toJSONString(map))//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + + // 校验服务器域名白名单 + final SignCheckUtil checkUtil = new SignCheckUtil(); + String key = "WhiteDomain:" + jwtSubject.getTenantId(); + List whiteDomains = redisUtil.get(key, List.class); + // 生产环境 + if (active.equals("prod") && !checkUtil.checkWhiteDomains(whiteDomains, request.getServerName())) { + throw new UsernameNotFoundException("The requested domain name is not on the whitelist"); + } + + JSONObject jsonObject = JSONObject.parseObject(result); + if(jsonObject.getString("code").equals("401")){ + throw new UsernameNotFoundException("Username not found"); + } + final String data = jsonObject.getString("data"); + final User user = JSONObject.parseObject(data, User.class); + List authorities = user.getAuthorities().stream() + .filter(m -> StrUtil.isNotBlank(m.getAuthority())).collect(Collectors.toList()); + UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken( + user, null, authorities); + SecurityContextHolder.getContext().setAuthentication(authentication); + + // token将要过期签发新token, 防止突然退出登录 +// long expiration = (claims.getExpiration().getTime() - new Date().getTime()) / 1000 / 60; +// if (expiration < configProperties.getTokenRefreshTime()) { +// String token = JwtUtil.buildToken(jwtSubject, configProperties.getTokenExpireTime(), +// configProperties.getTokenKey()); +// response.addHeader(Constants.TOKEN_HEADER_NAME, token); +// loginRecordService.saveAsync(user.getUsername(), LoginRecord.TYPE_REFRESH, null, +// user.getTenantId(), request); +// } + + } + } catch (ExpiredJwtException e) { + CommonUtil.responseError(response, Constants.TOKEN_EXPIRED_CODE, Constants.TOKEN_EXPIRED_MSG, + e.getMessage()); + return; + } catch (Exception e) { + CommonUtil.responseError(response, Constants.BAD_CREDENTIALS_CODE, Constants.BAD_CREDENTIALS_MSG, + e.toString()); + return; + } + } + chain.doFilter(request, response); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/security/JwtSubject.java b/src/main/java/com/gxwebsoft/common/core/security/JwtSubject.java new file mode 100644 index 0000000..1a0ff7d --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/security/JwtSubject.java @@ -0,0 +1,31 @@ +package com.gxwebsoft.common.core.security; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * Jwt载体 + * + * @author WebSoft + * @since 2021-09-03 00:11:12 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class JwtSubject implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 账号 + */ + private String username; + + /** + * 租户id + */ + private Integer tenantId; + +} diff --git a/src/main/java/com/gxwebsoft/common/core/security/JwtUtil.java b/src/main/java/com/gxwebsoft/common/core/security/JwtUtil.java new file mode 100644 index 0000000..2f05d23 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/security/JwtUtil.java @@ -0,0 +1,141 @@ +package com.gxwebsoft.common.core.security; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.servlet.ServletUtil; +import com.gxwebsoft.common.core.Constants; +import com.gxwebsoft.common.core.utils.JSONUtil; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; +import io.jsonwebtoken.io.Decoders; +import io.jsonwebtoken.io.Encoders; +import io.jsonwebtoken.security.Keys; + +import javax.servlet.http.HttpServletRequest; +import java.security.Key; +import java.util.Date; + +/** + * JWT工具类 + * + * @author WebSoft + * @since 2018-01-21 16:30:59 + */ +public class JwtUtil { + + /** + * 获取请求中的access_token + * + * @param request HttpServletRequest + * @return String + */ + public static String getAccessToken(HttpServletRequest request) { + String access_token = ServletUtil.getHeaderIgnoreCase(request, Constants.TOKEN_HEADER_NAME); + if (StrUtil.isNotBlank(access_token)) { + if (access_token.startsWith(Constants.TOKEN_TYPE)) { + access_token = StrUtil.removePrefix(access_token, Constants.TOKEN_TYPE).trim(); + } + } else { + access_token = request.getParameter(Constants.TOKEN_PARAM_NAME); + } + return access_token; + } + + /** + * 生成token + * + * @param subject 载体 + * @param expire 过期时间 + * @param base64EncodedKey base64编码的Key + * @return token + */ + public static String buildToken(JwtSubject subject, Long expire, String base64EncodedKey) { + return buildToken(JSONUtil.toJSONString(subject), expire, decodeKey(base64EncodedKey)); + } + + /** + * 生成token + * + * @param subject 载体 + * @param expire 过期时间 + * @param key 密钥 + * @return token + */ + public static String buildToken(String subject, Long expire, Key key) { + Date expireDate = new Date(new Date().getTime() + 1000 * expire); + return Jwts.builder() + .setSubject(subject) + .setExpiration(expireDate) + .setIssuedAt(new Date()) + .signWith(key) + .compact(); + } + + /** + * 解析token + * + * @param token token + * @param base64EncodedKey base64编码的Key + * @return Claims + */ + public static Claims parseToken(String token, String base64EncodedKey) { + return parseToken(token, decodeKey(base64EncodedKey)); + } + + /** + * 解析token + * + * @param token token + * @param key 密钥 + * @return Claims + */ + public static Claims parseToken(String token, Key key) { + return Jwts.parserBuilder() + .setSigningKey(key) + .build() + .parseClaimsJws(token) + .getBody(); + } + + /** + * 获取JwtSubject + * + * @param claims Claims + * @return JwtSubject + */ + public static JwtSubject getJwtSubject(Claims claims) { + return JSONUtil.parseObject(claims.getSubject(), JwtSubject.class); + } + + /** + * 生成Key + * + * @return Key + */ + public static Key randomKey() { + return Keys.secretKeyFor(SignatureAlgorithm.HS256); + } + + /** + * base64编码key + * + * @return String + */ + public static String encodeKey(Key key) { + return Encoders.BASE64.encode(key.getEncoded()); + } + + /** + * base64编码Key + * + * @param base64EncodedKey base64编码的key + * @return Key + */ + public static Key decodeKey(String base64EncodedKey) { + if (StrUtil.isBlank(base64EncodedKey)) { + return null; + } + return Keys.hmacShaKeyFor(Decoders.BASE64.decode(base64EncodedKey)); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/security/SecurityConfig.java b/src/main/java/com/gxwebsoft/common/core/security/SecurityConfig.java new file mode 100644 index 0000000..9864eaa --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/security/SecurityConfig.java @@ -0,0 +1,114 @@ +package com.gxwebsoft.common.core.security; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpMethod; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; + +import javax.annotation.Resource; + +/** + * Spring Security配置 + * + * @author WebSoft + * @since 2020-03-23 18:04:52 + */ +@Configuration +@EnableWebSecurity +@EnableGlobalMethodSecurity(prePostEnabled = true) +public class SecurityConfig { + @Resource + private JwtAccessDeniedHandler jwtAccessDeniedHandler; + @Resource + private JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint; + @Resource + private JwtAuthenticationFilter jwtAuthenticationFilter; + + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + return http.authorizeRequests() + .antMatchers(HttpMethod.OPTIONS, "/**") + .permitAll() + .antMatchers(HttpMethod.GET, "/api/file/**", "/**", "/api/captcha", "/") + .permitAll() + .antMatchers( + "/api/login", + "/api/qr-login/**", + "/api/register", + "/api/cms/website/createWebsite", + "/druid/**", + "/swagger-ui.html", + "/swagger-resources/**", + "/webjars/**", + "/v2/api-docs", + "/v3/api-docs", + "/swagger-ui/**", + "/doc.html", + "/api/open/**", + "/hxz/v1/**", + "/api/sendSmsCaptcha", + "/api/login-alipay/*", + "/api/wx-login/loginByMpWxPhone", + "/api/shop/payment/mp-alipay/notify", + "/api/shop/payment/mp-alipay/test/**", + "/api/shop/payment/mp-alipay/getPhoneNumber", + "/api/cms/cms-order/**", + "/api/shop/shop-order/notify/**", + "/api/mp/mp/component_verify_ticket", + "/api/mp/mp/callback", + "/api/shop/test/**", + "/api/test/payment-debug/**", + "/api/shop/wx-login/**", + "/api/shop/wx-native-pay/**", + "/api/shop/wx-pay/**", + "/api/bszx/bszx-pay/notify/**", + "/api/wxWorkQrConnect", + "/WW_verify_QMv7HoblYU6z63bb.txt", + "/5zbYEPkyV4.txt", + "/api/love/user-plan-log/wx-pay/**", + "/api/cms/form-record", + "/api/shop/merchant-account/getMerchantAccountByPhone", + "/api/hjm/hjm-car/**", + "/api/chat/**", + "/api/shop/getShopInfo", + "/api/shop/shop-order/test", + "/api/qr-code/**", + "/api/shop/order-delivery/notify" + ) + .permitAll() + .anyRequest() + .authenticated() + .and() + .sessionManagement() + .sessionCreationPolicy(SessionCreationPolicy.STATELESS) + .and() + .csrf() + .disable() + .cors() + .and() + .logout() + .disable() + .headers() + .frameOptions() + .disable() + .and() + .exceptionHandling() + .accessDeniedHandler(jwtAccessDeniedHandler) + .authenticationEntryPoint(jwtAuthenticationEntryPoint) + .and() + .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) + .build(); + } + + @Bean + public BCryptPasswordEncoder bCryptPasswordEncoder() { + return new BCryptPasswordEncoder(); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/service/CertificateHealthService.java b/src/main/java/com/gxwebsoft/common/core/service/CertificateHealthService.java new file mode 100644 index 0000000..e37bb05 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/service/CertificateHealthService.java @@ -0,0 +1,253 @@ +package com.gxwebsoft.common.core.service; + +import com.gxwebsoft.common.core.config.CertificateProperties; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.Map; + +/** + * 证书健康检查服务 + * 提供证书状态检查和健康监控功能 + * + * @author 科技小王子 + * @since 2024-07-26 + */ +@Slf4j +@Service +public class CertificateHealthService { + + private final CertificateService certificateService; + private final CertificateProperties certificateProperties; + + public CertificateHealthService(CertificateService certificateService, + CertificateProperties certificateProperties) { + this.certificateService = certificateService; + this.certificateProperties = certificateProperties; + } + + /** + * 自定义健康检查结果类 + */ + public static class HealthResult { + private final String status; + private final Map details; + + public HealthResult(String status, Map details) { + this.status = status; + this.details = details; + } + + public String getStatus() { + return status; + } + + public Map getDetails() { + return details; + } + + public static HealthResult up(Map details) { + return new HealthResult("UP", details); + } + + public static HealthResult down(Map details) { + return new HealthResult("DOWN", details); + } + } + + public HealthResult health() { + try { + Map details = new HashMap<>(); + boolean allHealthy = true; + + // 检查微信支付证书 + Map wechatHealth = checkWechatPayCertificates(); + details.put("wechatPay", wechatHealth); + if (!(Boolean) wechatHealth.get("healthy")) { + allHealthy = false; + } + + // 检查支付宝证书 + Map alipayHealth = checkAlipayCertificates(); + details.put("alipay", alipayHealth); + if (!(Boolean) alipayHealth.get("healthy")) { + allHealthy = false; + } + + // 添加系统信息 + details.put("loadMode", certificateProperties.getLoadMode()); + details.put("certRootPath", certificateProperties.getCertRootPath()); + + if (allHealthy) { + return HealthResult.up(details); + } else { + return HealthResult.down(details); + } + + } catch (Exception e) { + log.error("证书健康检查失败", e); + Map errorDetails = new HashMap<>(); + errorDetails.put("error", e.getMessage()); + return HealthResult.down(errorDetails); + } + } + + /** + * 检查微信支付证书健康状态 + */ + private Map checkWechatPayCertificates() { + Map health = new HashMap<>(); + boolean healthy = true; + Map certificates = new HashMap<>(); + + CertificateProperties.WechatPayConfig wechatConfig = certificateProperties.getWechatPay(); + + // 检查私钥证书 + String privateKeyFile = wechatConfig.getDev().getPrivateKeyFile(); + boolean privateKeyExists = certificateService.certificateExists("wechat", privateKeyFile); + certificates.put("privateKey", Map.of( + "file", privateKeyFile, + "exists", privateKeyExists, + "path", certificateService.getWechatPayCertPath(privateKeyFile) + )); + if (!privateKeyExists) healthy = false; + + // 检查商户证书 + String apiclientCertFile = wechatConfig.getDev().getApiclientCertFile(); + boolean apiclientCertExists = certificateService.certificateExists("wechat", apiclientCertFile); + certificates.put("apiclientCert", Map.of( + "file", apiclientCertFile, + "exists", apiclientCertExists, + "path", certificateService.getWechatPayCertPath(apiclientCertFile) + )); + if (!apiclientCertExists) healthy = false; + + // 检查微信支付平台证书 + String wechatpayCertFile = wechatConfig.getDev().getWechatpayCertFile(); + boolean wechatpayCertExists = certificateService.certificateExists("wechat", wechatpayCertFile); + certificates.put("wechatpayCert", Map.of( + "file", wechatpayCertFile, + "exists", wechatpayCertExists, + "path", certificateService.getWechatPayCertPath(wechatpayCertFile) + )); + if (!wechatpayCertExists) healthy = false; + + health.put("healthy", healthy); + health.put("certificates", certificates); + return health; + } + + /** + * 检查支付宝证书健康状态 + */ + private Map checkAlipayCertificates() { + Map health = new HashMap<>(); + boolean healthy = true; + Map certificates = new HashMap<>(); + + CertificateProperties.AlipayConfig alipayConfig = certificateProperties.getAlipay(); + + // 检查应用私钥 + String appPrivateKeyFile = alipayConfig.getAppPrivateKeyFile(); + boolean appPrivateKeyExists = certificateService.certificateExists("alipay", appPrivateKeyFile); + certificates.put("appPrivateKey", Map.of( + "file", appPrivateKeyFile, + "exists", appPrivateKeyExists, + "path", certificateService.getAlipayCertPath(appPrivateKeyFile) + )); + if (!appPrivateKeyExists) healthy = false; + + // 检查应用公钥证书 + String appCertPublicKeyFile = alipayConfig.getAppCertPublicKeyFile(); + boolean appCertExists = certificateService.certificateExists("alipay", appCertPublicKeyFile); + certificates.put("appCertPublicKey", Map.of( + "file", appCertPublicKeyFile, + "exists", appCertExists, + "path", certificateService.getAlipayCertPath(appCertPublicKeyFile) + )); + if (!appCertExists) healthy = false; + + // 检查支付宝公钥证书 + String alipayCertPublicKeyFile = alipayConfig.getAlipayCertPublicKeyFile(); + boolean alipayCertExists = certificateService.certificateExists("alipay", alipayCertPublicKeyFile); + certificates.put("alipayCertPublicKey", Map.of( + "file", alipayCertPublicKeyFile, + "exists", alipayCertExists, + "path", certificateService.getAlipayCertPath(alipayCertPublicKeyFile) + )); + if (!alipayCertExists) healthy = false; + + // 检查支付宝根证书 + String alipayRootCertFile = alipayConfig.getAlipayRootCertFile(); + boolean rootCertExists = certificateService.certificateExists("alipay", alipayRootCertFile); + certificates.put("alipayRootCert", Map.of( + "file", alipayRootCertFile, + "exists", rootCertExists, + "path", certificateService.getAlipayCertPath(alipayRootCertFile) + )); + if (!rootCertExists) healthy = false; + + health.put("healthy", healthy); + health.put("certificates", certificates); + return health; + } + + /** + * 获取详细的证书诊断信息 + */ + public Map getDiagnosticInfo() { + Map diagnostic = new HashMap<>(); + + try { + // 基本系统信息 + diagnostic.put("loadMode", certificateProperties.getLoadMode()); + diagnostic.put("certRootPath", certificateProperties.getCertRootPath()); + diagnostic.put("devCertPath", certificateProperties.getDevCertPath()); + + // 获取所有证书状态 + diagnostic.put("certificateStatus", certificateService.getAllCertificateStatus()); + + // 健康检查结果 + HealthResult health = health(); + diagnostic.put("healthStatus", health.getStatus()); + diagnostic.put("healthDetails", health.getDetails()); + + } catch (Exception e) { + log.error("获取证书诊断信息失败", e); + diagnostic.put("error", e.getMessage()); + } + + return diagnostic; + } + + /** + * 检查特定证书的详细信息 + */ + public Map checkSpecificCertificate(String certType, String fileName) { + Map result = new HashMap<>(); + + try { + boolean exists = certificateService.certificateExists(certType, fileName); + String path = certificateService.getCertificateFilePath(certType, fileName); + + result.put("certType", certType); + result.put("fileName", fileName); + result.put("exists", exists); + result.put("path", path); + + if (exists && (fileName.endsWith(".crt") || fileName.endsWith(".pem"))) { + // 尝试验证证书 + CertificateService.CertificateInfo certInfo = + certificateService.validateX509Certificate(certType, fileName); + result.put("certificateInfo", certInfo); + } + + } catch (Exception e) { + log.error("检查证书失败: {}/{}", certType, fileName, e); + result.put("error", e.getMessage()); + } + + return result; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/service/CertificateService.java b/src/main/java/com/gxwebsoft/common/core/service/CertificateService.java new file mode 100644 index 0000000..e12854a --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/service/CertificateService.java @@ -0,0 +1,281 @@ +package com.gxwebsoft.common.core.service; + +import com.gxwebsoft.common.core.config.CertificateProperties; +import lombok.extern.slf4j.Slf4j; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; +import org.springframework.stereotype.Service; + +import javax.annotation.PostConstruct; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * 证书管理服务 + * 负责处理不同环境下的证书加载、验证和管理 + * + * @author 科技小王子 + * @since 2024-07-26 + */ +@Slf4j +@Service +public class CertificateService { + + private final CertificateProperties certificateProperties; + + public CertificateService(CertificateProperties certificateProperties) { + this.certificateProperties = certificateProperties; + } + + @PostConstruct + public void init() { + log.info("证书服务初始化,当前加载模式: {}", certificateProperties.getLoadMode()); + log.info("证书根路径: {}", certificateProperties.getCertRootPath()); + + // 检查证书目录和文件 + checkCertificateDirectories(); + } + + /** + * 获取证书文件的输入流 + * + * @param certType 证书类型(wechat/alipay) + * @param fileName 文件名 + * @return 输入流 + * @throws IOException 文件读取异常 + */ + public InputStream getCertificateInputStream(String certType, String fileName) throws IOException { + String certPath = certificateProperties.getCertificatePath(certType, fileName); + + if (certificateProperties.isClasspathMode()) { + // 从classpath加载 + Resource resource = new ClassPathResource(certPath); + if (!resource.exists()) { + throw new IOException("证书文件不存在: " + certPath); + } + log.debug("从classpath加载证书: {}", certPath); + return resource.getInputStream(); + } else { + // 从文件系统加载 + File file = new File(certPath); + if (!file.exists()) { + throw new IOException("证书文件不存在: " + certPath); + } + log.debug("从文件系统加载证书: {}", certPath); + return Files.newInputStream(file.toPath()); + } + } + + /** + * 获取证书文件路径 + * + * @param certType 证书类型 + * @param fileName 文件名 + * @return 文件路径 + */ + public String getCertificateFilePath(String certType, String fileName) { + return certificateProperties.getCertificatePath(certType, fileName); + } + + /** + * 检查证书文件是否存在 + * + * @param certType 证书类型 + * @param fileName 文件名 + * @return 是否存在 + */ + public boolean certificateExists(String certType, String fileName) { + try { + String certPath = certificateProperties.getCertificatePath(certType, fileName); + + if (certificateProperties.isClasspathMode()) { + Resource resource = new ClassPathResource(certPath); + return resource.exists(); + } else { + File file = new File(certPath); + return file.exists() && file.isFile(); + } + } catch (Exception e) { + log.error("检查证书文件存在性时出错: {}", e.getMessage()); + return false; + } + } + + /** + * 获取微信支付证书路径 + * + * @param fileName 文件名 + * @return 证书路径 + */ + public String getWechatPayCertPath(String fileName) { + return certificateProperties.getWechatPayCertPath(fileName); + } + + /** + * 获取支付宝证书路径 + * + * @param fileName 文件名 + * @return 证书路径 + */ + public String getAlipayCertPath(String fileName) { + return certificateProperties.getAlipayCertPath(fileName); + } + + /** + * 验证X509证书 + * + * @param certType 证书类型 + * @param fileName 文件名 + * @return 证书信息 + */ + public CertificateInfo validateX509Certificate(String certType, String fileName) { + try (InputStream inputStream = getCertificateInputStream(certType, fileName)) { + CertificateFactory cf = CertificateFactory.getInstance("X.509"); + X509Certificate cert = (X509Certificate) cf.generateCertificate(inputStream); + + CertificateInfo info = new CertificateInfo(); + info.setSubject(cert.getSubjectX500Principal().toString()); + info.setIssuer(cert.getIssuerX500Principal().toString()); + info.setNotBefore(convertToLocalDateTime(cert.getNotBefore())); + info.setNotAfter(convertToLocalDateTime(cert.getNotAfter())); + info.setSerialNumber(cert.getSerialNumber().toString()); + info.setValid(isValidDate(cert.getNotBefore(), cert.getNotAfter())); + + return info; + } catch (Exception e) { + log.error("验证证书失败: {}/{}, 错误: {}", certType, fileName, e.getMessage()); + return null; + } + } + + /** + * 检查证书目录结构 + */ + private void checkCertificateDirectories() { + String[] certTypes = {"wechat", "alipay"}; + + for (String certType : certTypes) { + if (!certificateProperties.isClasspathMode()) { + // 检查文件系统目录 + String dirPath = certificateProperties.getCertificatePath(certType, ""); + File dir = new File(dirPath); + if (!dir.exists()) { + log.warn("证书目录不存在: {}", dirPath); + } else { + log.info("证书目录存在: {}", dirPath); + } + } + } + } + + /** + * 获取所有证书状态 + * + * @return 证书状态映射 + */ + public Map getAllCertificateStatus() { + Map status = new HashMap<>(); + + // 微信支付证书状态 + Map wechatStatus = new HashMap<>(); + CertificateProperties.WechatPayConfig wechatConfig = certificateProperties.getWechatPay(); + wechatStatus.put("privateKey", getCertStatus("wechat", wechatConfig.getDev().getPrivateKeyFile())); + wechatStatus.put("apiclientCert", getCertStatus("wechat", wechatConfig.getDev().getApiclientCertFile())); + wechatStatus.put("wechatpayCert", getCertStatus("wechat", wechatConfig.getDev().getWechatpayCertFile())); + status.put("wechat", wechatStatus); + + // 支付宝证书状态 + Map alipayStatus = new HashMap<>(); + CertificateProperties.AlipayConfig alipayConfig = certificateProperties.getAlipay(); + alipayStatus.put("appPrivateKey", getCertStatus("alipay", alipayConfig.getAppPrivateKeyFile())); + alipayStatus.put("appCertPublicKey", getCertStatus("alipay", alipayConfig.getAppCertPublicKeyFile())); + alipayStatus.put("alipayCertPublicKey", getCertStatus("alipay", alipayConfig.getAlipayCertPublicKeyFile())); + alipayStatus.put("alipayRootCert", getCertStatus("alipay", alipayConfig.getAlipayRootCertFile())); + status.put("alipay", alipayStatus); + + // 系统信息 + Map systemInfo = new HashMap<>(); + systemInfo.put("loadMode", certificateProperties.getLoadMode()); + systemInfo.put("certRootPath", certificateProperties.getCertRootPath()); + systemInfo.put("devCertPath", certificateProperties.getDevCertPath()); + status.put("system", systemInfo); + + return status; + } + + /** + * 获取单个证书状态 + */ + private Map getCertStatus(String certType, String fileName) { + Map status = new HashMap<>(); + status.put("fileName", fileName); + status.put("exists", certificateExists(certType, fileName)); + status.put("path", getCertificateFilePath(certType, fileName)); + + // 如果是.crt或.pem文件,尝试验证证书 + if (fileName.endsWith(".crt") || fileName.endsWith(".pem")) { + CertificateInfo certInfo = validateX509Certificate(certType, fileName); + status.put("certificateInfo", certInfo); + } + + return status; + } + + /** + * 检查日期是否有效 + */ + private boolean isValidDate(Date notBefore, Date notAfter) { + Date now = new Date(); + return now.after(notBefore) && now.before(notAfter); + } + + /** + * 将Date转换为LocalDateTime + */ + private LocalDateTime convertToLocalDateTime(Date date) { + if (date == null) { + return null; + } + return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); + } + + /** + * 证书信息类 + */ + public static class CertificateInfo { + private String subject; + private String issuer; + private LocalDateTime notBefore; + private LocalDateTime notAfter; + private String serialNumber; + private boolean valid; + + // Getters and Setters + public String getSubject() { return subject; } + public void setSubject(String subject) { this.subject = subject; } + + public String getIssuer() { return issuer; } + public void setIssuer(String issuer) { this.issuer = issuer; } + + public LocalDateTime getNotBefore() { return notBefore; } + public void setNotBefore(LocalDateTime notBefore) { this.notBefore = notBefore; } + + public LocalDateTime getNotAfter() { return notAfter; } + public void setNotAfter(LocalDateTime notAfter) { this.notAfter = notAfter; } + + public String getSerialNumber() { return serialNumber; } + public void setSerialNumber(String serialNumber) { this.serialNumber = serialNumber; } + + public boolean isValid() { return valid; } + public void setValid(boolean valid) { this.valid = valid; } + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/service/EnvironmentAwarePaymentService.java b/src/main/java/com/gxwebsoft/common/core/service/EnvironmentAwarePaymentService.java new file mode 100644 index 0000000..2155cc9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/service/EnvironmentAwarePaymentService.java @@ -0,0 +1,143 @@ +package com.gxwebsoft.common.core.service; + +import com.gxwebsoft.common.system.entity.Payment; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +/** + * 环境感知的支付配置服务 + * 根据不同环境自动切换支付回调地址 + * + * @author WebSoft + * @since 2025-01-15 + */ +@Slf4j +@Service +public class EnvironmentAwarePaymentService { + + @Autowired + private PaymentCacheService paymentCacheService; + + @Value("${spring.profiles.active:dev}") + private String activeProfile; + + @Value("${config.server-url:}") + private String serverUrl; + + // 开发环境回调地址配置 + @Value("${payment.dev.notify-url:http://frps-10550.s209.websoft.top/api/shop/shop-order/notify}") + private String devNotifyUrl; + + // 生产环境回调地址配置 + @Value("${payment.prod.notify-url:https://cms-api.websoft.top/api/shop/shop-order/notify}") + private String prodNotifyUrl; + + /** + * 获取环境感知的支付配置 + * 根据当前环境自动调整回调地址 + * + * @param payType 支付类型 + * @param tenantId 租户ID + * @return 支付配置 + */ + public Payment getEnvironmentAwarePaymentConfig(Integer payType, Integer tenantId) { + // 获取原始支付配置 + Payment payment = paymentCacheService.getPaymentConfig(payType, tenantId); + + if (payment == null) { + return null; + } + + // 根据环境调整回调地址 + Payment envPayment = clonePayment(payment); + String notifyUrl = getEnvironmentNotifyUrl(); + + log.info("环境感知支付配置 - 环境: {}, 原始回调: {}, 调整后回调: {}", + activeProfile, payment.getNotifyUrl(), notifyUrl); + + envPayment.setNotifyUrl(notifyUrl); + + return envPayment; + } + + /** + * 根据当前环境获取回调地址 + */ + private String getEnvironmentNotifyUrl() { + if ("dev".equals(activeProfile) || "test".equals(activeProfile)) { + // 开发/测试环境使用本地回调地址 + return devNotifyUrl; + } else if ("prod".equals(activeProfile)) { + // 生产环境使用生产回调地址 + return prodNotifyUrl; + } else { + // 默认使用配置的服务器地址 + return serverUrl + "/shop/shop-order/notify"; + } + } + + /** + * 克隆支付配置对象 + */ + private Payment clonePayment(Payment original) { + Payment cloned = new Payment(); + cloned.setId(original.getId()); + cloned.setName(original.getName()); + cloned.setType(original.getType()); + cloned.setCode(original.getCode()); + cloned.setImage(original.getImage()); + cloned.setWechatType(original.getWechatType()); + cloned.setAppId(original.getAppId()); + cloned.setMchId(original.getMchId()); + cloned.setApiKey(original.getApiKey()); + cloned.setApiclientCert(original.getApiclientCert()); + cloned.setApiclientKey(original.getApiclientKey()); + cloned.setPubKey(original.getPubKey()); + cloned.setPubKeyId(original.getPubKeyId()); + cloned.setMerchantSerialNumber(original.getMerchantSerialNumber()); + cloned.setNotifyUrl(original.getNotifyUrl()); // 这个会被后续覆盖 + cloned.setComments(original.getComments()); + cloned.setSortNumber(original.getSortNumber()); + cloned.setStatus(original.getStatus()); + cloned.setDeleted(original.getDeleted()); + cloned.setTenantId(original.getTenantId()); + return cloned; + } + + /** + * 获取微信支付配置(环境感知) + */ + public Payment getWechatPayConfig(Integer tenantId) { + return getEnvironmentAwarePaymentConfig(0, tenantId); + } + + /** + * 获取支付宝配置(环境感知) + */ + public Payment getAlipayConfig(Integer tenantId) { + return getEnvironmentAwarePaymentConfig(1, tenantId); + } + + /** + * 检查当前环境 + */ + public String getCurrentEnvironment() { + return activeProfile; + } + + /** + * 是否为开发环境 + */ + public boolean isDevelopmentEnvironment() { + return "dev".equals(activeProfile) || "test".equals(activeProfile); + } + + /** + * 是否为生产环境 + */ + public boolean isProductionEnvironment() { + return "prod".equals(activeProfile); + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/service/PaymentCacheService.java b/src/main/java/com/gxwebsoft/common/core/service/PaymentCacheService.java new file mode 100644 index 0000000..17a8e32 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/service/PaymentCacheService.java @@ -0,0 +1,174 @@ +package com.gxwebsoft.common.core.service; + +import cn.hutool.core.util.ObjectUtil; +import com.gxwebsoft.common.core.exception.BusinessException; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.system.entity.Payment; +import com.gxwebsoft.common.system.param.PaymentParam; +import com.gxwebsoft.common.system.service.PaymentService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 支付配置缓存服务 + * 统一管理支付配置的缓存读取,支持 Payment:1* 格式 + * + * @author 科技小王子 + * @since 2025-07-27 + */ +@Slf4j +@Service +public class PaymentCacheService { + + @Autowired + private RedisUtil redisUtil; + + @Autowired + private PaymentService paymentService; + + /** + * 根据支付类型获取支付配置 + * 优先从 Payment:1{payType} 格式的缓存读取 + * + * @param payType 支付类型 (0=微信支付, 1=支付宝, 2=其他) + * @param tenantId 租户ID (用于兜底查询) + * @return Payment 支付配置 + */ + public Payment getPaymentConfig(Integer payType, Integer tenantId) { + // 1. 优先使用 Payment:1{payType} 格式的缓存键 + String primaryKey = "Payment:1:" + tenantId; + Payment payment = redisUtil.get(primaryKey, Payment.class); + + if (ObjectUtil.isNotEmpty(payment)) { + log.debug("从缓存获取支付配置成功: {}", primaryKey); + return payment; + } + + // 2. 如果 Payment:1* 格式不存在,尝试原有格式 + String fallbackKey = "Payment:" + payType + ":" + tenantId; + payment = redisUtil.get(fallbackKey, Payment.class); + + if (ObjectUtil.isNotEmpty(payment)) { + log.debug("从兜底缓存获取支付配置成功: {}", fallbackKey); + // 将查询结果缓存到 Payment:1* 格式 + redisUtil.set(primaryKey, payment); + return payment; + } + + // 3. 最后从数据库查询 + log.debug("从数据库查询支付配置, payType: {}, tenantId: {}", payType, tenantId); + PaymentParam paymentParam = new PaymentParam(); + paymentParam.setType(payType); + paymentParam.setTenantId(tenantId); // 设置租户ID进行过滤 + List payments = paymentService.listRel(paymentParam); + + if (payments.isEmpty()) { + throw new BusinessException("请完成支付配置,支付类型: " + payType); + } + + Payment dbPayment = payments.get(0); + + // 清理时间字段,避免序列化问题 + Payment cachePayment = cleanPaymentForCache(dbPayment); + + // 将查询结果缓存到 Payment:1* 格式 + redisUtil.set(primaryKey, cachePayment); + log.debug("支付配置已缓存到: {}", primaryKey); + + return dbPayment; // 返回原始对象,不影响业务逻辑 + } + + /** + * 缓存支付配置 + * 同时缓存到 Payment:1{payType} 和原有格式 + * + * @param payment 支付配置 + * @param tenantId 租户ID + */ + public void cachePaymentConfig(Payment payment, Integer tenantId) { + // 缓存到 Payment:1* 格式 + String primaryKey = "Payment:1" + payment.getCode(); + redisUtil.set(primaryKey, payment); + log.debug("支付配置已缓存到: {}", primaryKey); + + // 兼容原有格式 + String legacyKey = "Payment:" + payment.getCode() + ":" + tenantId; + redisUtil.set(legacyKey, payment); + log.debug("支付配置已缓存到兼容格式: {}", legacyKey); + } + + /** + * 删除支付配置缓存 + * 同时删除 Payment:1{payType} 和原有格式 + * + * @param paymentCode 支付代码 (可以是String或Integer) + * @param tenantId 租户ID + */ + public void removePaymentConfig(String paymentCode, Integer tenantId) { + // 删除 Payment:1* 格式缓存 + String primaryKey = "Payment:1" + paymentCode; + redisUtil.delete(primaryKey); + log.debug("已删除支付配置缓存: {}", primaryKey); + + // 删除原有格式缓存 + String legacyKey = "Payment:" + paymentCode + ":" + tenantId; + redisUtil.delete(legacyKey); + log.debug("已删除兼容格式缓存: {}", legacyKey); + } + + /** + * 获取微信支付配置 (payType = 0) + */ + public Payment getWechatPayConfig(Integer tenantId) { + return getPaymentConfig(0, tenantId); + } + + /** + * 获取支付宝配置 (payType = 1) + */ + public Payment getAlipayConfig(Integer tenantId) { + return getPaymentConfig(1, tenantId); + } + + /** + * 清理Payment对象用于缓存 + * 移除可能导致序列化问题的时间字段 + */ + private Payment cleanPaymentForCache(Payment original) { + if (original == null) { + return null; + } + + Payment cleaned = new Payment(); + // 复制所有业务相关字段 + cleaned.setId(original.getId()); + cleaned.setName(original.getName()); + cleaned.setType(original.getType()); + cleaned.setCode(original.getCode()); + cleaned.setImage(original.getImage()); + cleaned.setWechatType(original.getWechatType()); + cleaned.setAppId(original.getAppId()); + cleaned.setMchId(original.getMchId()); + cleaned.setApiKey(original.getApiKey()); + cleaned.setApiclientCert(original.getApiclientCert()); + cleaned.setApiclientKey(original.getApiclientKey()); + cleaned.setPubKey(original.getPubKey()); + cleaned.setPubKeyId(original.getPubKeyId()); + cleaned.setMerchantSerialNumber(original.getMerchantSerialNumber()); + cleaned.setNotifyUrl(original.getNotifyUrl()); + cleaned.setComments(original.getComments()); + cleaned.setSortNumber(original.getSortNumber()); + cleaned.setStatus(original.getStatus()); + cleaned.setDeleted(original.getDeleted()); + cleaned.setTenantId(original.getTenantId()); + + // 不设置时间字段,避免序列化问题 + // cleaned.setCreateTime(null); + // cleaned.setUpdateTime(null); + + return cleaned; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/AliYunSender.java b/src/main/java/com/gxwebsoft/common/core/utils/AliYunSender.java new file mode 100644 index 0000000..80fe4b1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/AliYunSender.java @@ -0,0 +1,145 @@ +package com.gxwebsoft.common.core.utils; +import cn.hutool.core.codec.Base64; +import org.springframework.stereotype.Component; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLConnection; +import java.security.MessageDigest; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; +import java.util.UUID; + +@Component +public class AliYunSender { + /* + * 计算MD5+BASE64 + */ + public static String MD5Base64(String s) { + if (s == null) + return null; + String encodeStr = ""; + byte[] utfBytes = s.getBytes(); + MessageDigest mdTemp; + try { + mdTemp = MessageDigest.getInstance("MD5"); + mdTemp.update(utfBytes); + byte[] md5Bytes = mdTemp.digest(); + encodeStr = Base64.encode(md5Bytes); + } catch (Exception e) { + throw new Error("Failed to generate MD5 : " + e.getMessage()); + } + return encodeStr; + } + /* + * 计算 HMAC-SHA1 + */ + public static String HMACSha1(String data, String key) { + String result; + try { + SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(), "HmacSHA1"); + Mac mac = Mac.getInstance("HmacSHA1"); + mac.init(signingKey); + byte[] rawHmac = mac.doFinal(data.getBytes()); + result = Base64.encode(rawHmac); + } catch (Exception e) { + throw new Error("Failed to generate HMAC : " + e.getMessage()); + } + return result; + } + /* + * 获取时间 + */ + public static String toGMTString(Date date) { + SimpleDateFormat df = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss z", Locale.UK); + df.setTimeZone(new java.util.SimpleTimeZone(0, "GMT")); + return df.format(date); + } + /* + * 发送POST请求 + */ + public static String sendPost(String url, String body, String ak_id, String ak_secret) { + PrintWriter out = null; + BufferedReader in = null; + String result = ""; + try { + URL realUrl = new URL(url); + /* + * http header 参数 + */ + String method = "POST"; + String accept = "application/json"; + String content_type = "application/json;chrset=utf-8"; + String path = realUrl.getFile(); + String date = toGMTString(new Date()); + String host = realUrl.getHost(); + // 1.对body做MD5+BASE64加密 + String bodyMd5 = MD5Base64(body); + String uuid = UUID.randomUUID().toString(); + String stringToSign = method + "\n" + accept + "\n" + bodyMd5 + "\n" + content_type + "\n" + date + "\n" + + "x-acs-signature-method:HMAC-SHA1\n" + + "x-acs-signature-nonce:" + uuid + "\n" + + "x-acs-version:2019-01-02\n" + + path; + // 2.计算 HMAC-SHA1 + String signature = HMACSha1(stringToSign, ak_secret); + // 3.得到 authorization header + String authHeader = "acs " + ak_id + ":" + signature; + // 打开和URL之间的连接 + URLConnection conn = realUrl.openConnection(); + // 设置通用的请求属性 + conn.setRequestProperty("Accept", accept); + conn.setRequestProperty("Content-Type", content_type); + conn.setRequestProperty("Content-MD5", bodyMd5); + conn.setRequestProperty("Date", date); + conn.setRequestProperty("Host", host); + conn.setRequestProperty("Authorization", authHeader); + conn.setRequestProperty("x-acs-signature-nonce", uuid); + conn.setRequestProperty("x-acs-signature-method", "HMAC-SHA1"); + conn.setRequestProperty("x-acs-version", "2019-01-02"); // 版本可选 + // 发送POST请求必须设置如下两行 + conn.setDoOutput(true); + conn.setDoInput(true); + // 获取URLConnection对象对应的输出流 + out = new PrintWriter(conn.getOutputStream()); + // 发送请求参数 + out.print(body); + // flush输出流的缓冲 + out.flush(); + // 定义BufferedReader输入流来读取URL的响应 + InputStream is; + HttpURLConnection httpconn = (HttpURLConnection) conn; + if (httpconn.getResponseCode() == 200) { + is = httpconn.getInputStream(); + } else { + is = httpconn.getErrorStream(); + } + in = new BufferedReader(new InputStreamReader(is)); + String line; + while ((line = in.readLine()) != null) { + result += line; + } + } catch (Exception e) { + System.out.println("发送 POST 请求出现异常!" + e); + e.printStackTrace(); + } + // 使用finally块来关闭输出流、输入流 + finally { + try { + if (out != null) { + out.close(); + } + if (in != null) { + in.close(); + } + } catch (IOException ex) { + ex.printStackTrace(); + } + } + return result; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/AlipayConfigUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/AlipayConfigUtil.java new file mode 100644 index 0000000..42975ef --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/AlipayConfigUtil.java @@ -0,0 +1,110 @@ +package com.gxwebsoft.common.core.utils; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.alipay.api.AlipayApiException; +import com.alipay.api.AlipayConstants; +import com.alipay.api.CertAlipayRequest; +import com.alipay.api.DefaultAlipayClient; +import com.gxwebsoft.common.core.config.ConfigProperties; +import com.gxwebsoft.common.core.exception.BusinessException; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * 支付宝工具类 + * @author leng + * + */ +@Component +public class AlipayConfigUtil { + private final StringRedisTemplate stringRedisTemplate; + public Integer tenantId; + public String gateway; + public JSONObject config; + public String appId; + public String privateKey; + public String appCertPublicKey; + public String alipayCertPublicKey; + public String alipayRootCert; + + @Resource + private ConfigProperties pathConfig; + + public AlipayConfigUtil(StringRedisTemplate stringRedisTemplate){ + this.stringRedisTemplate = stringRedisTemplate; + } + + // 实例化客户端 + public DefaultAlipayClient alipayClient(Integer tenantId) throws AlipayApiException { + this.gateway = "https://openapi.alipay.com/gateway.do"; + this.tenantId = tenantId; + this.payment(tenantId); + CertAlipayRequest certAlipayRequest = new CertAlipayRequest(); + certAlipayRequest.setServerUrl(this.gateway); + certAlipayRequest.setAppId(this.appId); + certAlipayRequest.setPrivateKey(this.privateKey); + certAlipayRequest.setFormat(AlipayConstants.FORMAT_JSON); + certAlipayRequest.setCharset(AlipayConstants.CHARSET_UTF8); + certAlipayRequest.setSignType(AlipayConstants.SIGN_TYPE_RSA2); + certAlipayRequest.setCertPath(this.appCertPublicKey); + certAlipayRequest.setAlipayPublicCertPath(this.alipayCertPublicKey); + certAlipayRequest.setRootCertPath(this.alipayRootCert); +// System.out.println("this.appId = " + this.appId); +// System.out.println("this.appId = " + this.gateway); +// System.out.println("this.appId = " + this.privateKey); +// System.out.println("this.appId = " + this.appCertPublicKey); +// System.out.println("this.appId = " + this.alipayCertPublicKey); +// System.out.println("this.appId = " + this.alipayRootCert); +// System.out.println("this.config = " + this.config); + return new DefaultAlipayClient(certAlipayRequest); + } + + /** + * 获取支付宝秘钥 + */ + public JSONObject payment(Integer tenantId) { + System.out.println("tenantId = " + tenantId); + String key = "cache".concat(tenantId.toString()).concat(":setting:payment"); + System.out.println("key = " + key); + String cache = stringRedisTemplate.opsForValue().get(key); + if (cache == null) { + throw new BusinessException("支付方式未配置"); + } + // 解析json数据 + JSONObject payment = JSON.parseObject(cache.getBytes()); + this.config = payment; + this.appId = payment.getString("alipayAppId"); + this.privateKey = payment.getString("privateKey"); + this.appCertPublicKey = pathConfig.getUploadPath() + "file" + payment.getString("appCertPublicKey"); + this.alipayCertPublicKey = pathConfig.getUploadPath() + "file" + payment.getString("alipayCertPublicKey"); + this.alipayRootCert = pathConfig.getUploadPath() + "file" + payment.getString("alipayRootCert"); + return payment; + } + + public String appId(){ + return this.appId; + } + + public String privateKey(){ + return this.privateKey; + } + + public String appCertPublicKey(){ + return this.appCertPublicKey; + } + + public String alipayCertPublicKey(){ + return this.alipayCertPublicKey; + } + + public String alipayRootCert(){ + return this.alipayRootCert; + } + + + + +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/AliyunTranslateUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/AliyunTranslateUtil.java new file mode 100644 index 0000000..8ba568f --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/AliyunTranslateUtil.java @@ -0,0 +1,72 @@ +package com.gxwebsoft.common.core.utils; + +import com.aliyun.alimt20181012.Client; +import com.aliyun.alimt20181012.models.TranslateGeneralRequest; +import com.aliyun.alimt20181012.models.TranslateGeneralResponse; +import com.aliyun.teaopenapi.models.Config; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * 阿里云机器翻译工具类 + */ +@Component +public class AliyunTranslateUtil { + + @Value("${aliyun.translate.access-key-id:}") + private String accessKeyId; + + @Value("${aliyun.translate.access-key-secret:}") + private String accessKeySecret; + + @Value("${aliyun.translate.endpoint:mt.cn-hangzhou.aliyuncs.com}") + private String endpoint; + + /** + * 创建客户端 + */ + private Client createClient() throws Exception { + Config config = new Config() + .setAccessKeyId(accessKeyId) + .setAccessKeySecret(accessKeySecret) + .setEndpoint(endpoint); + return new Client(config); + } + + /** + * 翻译文本 + * + * @param text 待翻译文本 + * @param targetLang 目标语言(如:en, zh, ja, ko等) + * @param sourceLang 源语言(如:zh, en, auto等,auto表示自动检测) + * @return 翻译后的文本 + */ + public String translate(String text, String targetLang, String sourceLang) { + try { + Client client = createClient(); + TranslateGeneralRequest request = new TranslateGeneralRequest() + .setFormatType("text") + .setSourceLanguage(sourceLang) + .setTargetLanguage(targetLang) + .setSourceText(text) + .setScene("general"); + + TranslateGeneralResponse response = client.translateGeneral(request); + return response.getBody().getData().getTranslated(); + } catch (Exception e) { + e.printStackTrace(); + return text; + } + } + + /** + * 翻译文本(自动检测源语言) + * + * @param text 待翻译文本 + * @param targetLang 目标语言 + * @return 翻译后的文本 + */ + public String translate(String text, String targetLang) { + return translate(text, targetLang, "auto"); + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/CacheClient.java b/src/main/java/com/gxwebsoft/common/core/utils/CacheClient.java new file mode 100644 index 0000000..62f063e --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/CacheClient.java @@ -0,0 +1,265 @@ +package com.gxwebsoft.common.core.utils; + +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.result.RedisResult; +import org.springframework.data.geo.Point; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Component; + + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.function.Function; + +import static com.gxwebsoft.common.core.constants.RedisConstants.CACHE_NULL_TTL; + +@Component +public class CacheClient { + private final StringRedisTemplate stringRedisTemplate; + public static Integer tenantId; + + public CacheClient(StringRedisTemplate stringRedisTemplate){ + this.stringRedisTemplate = stringRedisTemplate; + } + + /** + * 写入redis缓存 + * @param key [表名]:id + * @param entity 实体类对象 + * 示例 cacheClient.set("merchant:"+id,merchant) + */ + public void set(String key, T entity){ + stringRedisTemplate.opsForValue().set(prefix(key), JSONUtil.toJSONString(entity)); + } + + /** + * 写入redis缓存 + * @param key [表名]:id + * @param entity 实体类对象 + * 示例 cacheClient.set("merchant:"+id,merchant,1L,TimeUnit.DAYS) + */ + public void set(String key, T entity, Long time, TimeUnit unit){ + stringRedisTemplate.opsForValue().set(prefix(key), JSONUtil.toJSONString(entity),time,unit); + } + + /** + * 读取redis缓存 + * @param key [表名]:id + * 示例 cacheClient.get(key) + * @return merchant + */ + public String get(String key) { + return stringRedisTemplate.opsForValue().get(prefix(key)); + } + + /** + * 读取redis缓存 + * @param key [表名]:id + * @param clazz Merchant.class + * @param + * 示例 cacheClient.get("merchant:"+id,Merchant.class) + * @return merchant + */ + public T get(String key, Class clazz) { + String json = stringRedisTemplate.opsForValue().get(prefix(key)); + if(StrUtil.isNotBlank(json)){ + return JSONUtil.parseObject(json, clazz); + } + return null; + } + + /** + * 写redis缓存(哈希类型) + * @param key [表名]:id + * @param field 字段 + * 示例 cacheClient.get("merchant:"+id,Merchant.class) + */ + public void hPut(String key, String field, T entity) { + stringRedisTemplate.opsForHash().put(prefix(key),field,JSONUtil.toJSONString(entity)); + } + + /** + * 写redis缓存(哈希类型) + * @param key [表名]:id + * @param map 字段 + * 示例 cacheClient.get("merchant:"+id,Merchant.class) + */ + public void hPutAll(String key, Map map) { + stringRedisTemplate.opsForHash().putAll(prefix(key),map); + } + + /** + * 读取redis缓存(哈希类型) + * 示例 cacheClient.get("merchant:"+id,Merchant.class) + * @param key [表名]:id + * @param field 字段 + * @return merchant + */ + public T hGet(String key, String field, Class clazz) { + Object obj = stringRedisTemplate.opsForHash().get(prefix(key), field); + return JSONUtil.parseObject(JSONUtil.toJSONString(obj),clazz); + } + + public List hValues(String key){ + return stringRedisTemplate.opsForHash().values(prefix(key)); + } + + public Long hSize(String key){ + return stringRedisTemplate.opsForHash().size(prefix(key)); + } + + // 逻辑过期方式写入redis + public void setWithLogicalExpire(String key, T value, Long time, TimeUnit unit){ + // 设置逻辑过期时间 + final RedisResult redisResult = new RedisResult<>(); + redisResult.setData(value); + redisResult.setExpireTime(LocalDateTime.now().plusSeconds(unit.toSeconds(time))); + stringRedisTemplate.opsForValue().set(prefix(key),JSONUtil.toJSONString(redisResult)); + } + + // 读取redis + public R query(String keyPrefix, ID id, Class clazz, Function dbFallback, Long time, TimeUnit unit){ + String key = keyPrefix + id; + // 1.从redis查询缓存 + final String json = stringRedisTemplate.opsForValue().get(prefix(key)); + // 2.判断是否存在 + if (StrUtil.isNotBlank(json)) { + // 3.存在,直接返回 + return JSONUtil.parseObject(json,clazz); + } + // 判断命中的是否为空值 + if (json != null) { + return null; + } + // 4. 不存在,跟进ID查询数据库 + R r = dbFallback.apply(id); + // 5. 数据库不存在,返回错误 + if(r == null){ + // 空值写入数据库 + this.set(prefix(key),"",CACHE_NULL_TTL,TimeUnit.MINUTES); + return null; + } + // 写入redis + this.set(prefix(key),r,time,unit); + return r; + } + + /** + * 添加商户定位点 + * @param key geo + * @param id + * 示例 cacheClient.geoAdd("merchant-geo",merchant) + */ + public void geoAdd(String key, Double x, Double y, String id){ + stringRedisTemplate.opsForGeo().add(prefix(key),new Point(x,y),id); + } + + /** + * 删除定位 + * @param key geo + * @param id + * 示例 cacheClient.geoRemove("merchant-geo",id) + */ + public void geoRemove(String key, Integer id){ + stringRedisTemplate.opsForGeo().remove(prefix(key),id.toString()); + } + + + + public void sAdd(String key, T entity){ + stringRedisTemplate.opsForSet().add(prefix(key),JSONUtil.toJSONString(entity)); + } + + public Set sMembers(String key){ + return stringRedisTemplate.opsForSet().members(prefix(key)); + } + + // 更新排行榜 + public void zAdd(String key, Integer userId, Double value) { + stringRedisTemplate.opsForZSet().add(prefix(key),userId.toString(),value); + } + // 增加元素的score值,并返回增加后的值 + public Double zIncrementScore(String key,Integer userId, Double delta){ + return stringRedisTemplate.opsForZSet().incrementScore(key, userId.toString(), delta); + } + // 获取排名榜 + public Set range(String key, Integer start, Integer end) { + return stringRedisTemplate.opsForZSet().range(prefix(key), start, end); + } + // 获取排名榜 + public Set reverseRange(String key, Integer start, Integer end){ + return stringRedisTemplate.opsForZSet().reverseRange(prefix(key), start, end); + } + // 获取分数 + public Double score(String key, Object value){ + return stringRedisTemplate.opsForZSet().score(prefix(key), value); + } + + public void delete(String key){ + stringRedisTemplate.delete(prefix(key)); + } + + // 存储在list头部 + public void leftPush(String key, String keyword){ + stringRedisTemplate.opsForList().leftPush(prefix(key),keyword); + } + + // 获取列表指定范围内的元素 + public List listRange(String key,Long start, Long end){ + return stringRedisTemplate.opsForList().range(prefix(key), start, end); + } + + // 获取列表长度 + public Long listSize(String key){ + return stringRedisTemplate.opsForList().size(prefix(key)); + } + + // 裁剪list + public void listTrim(String key){ + stringRedisTemplate.opsForList().trim(prefix(key), 0L, 100L); + } + + /** + * 读取后台系统设置信息 + * @param keyName 键名wx-word + * @param tenantId 租户ID + * @return + * key示例 cache10048:setting:wx-work + */ + public JSONObject getSettingInfo(String keyName,Integer tenantId){ + String key = "cache" + tenantId + ":setting:" + keyName; + final String cache = stringRedisTemplate.opsForValue().get(key); + assert cache != null; + return JSON.parseObject(cache); + } + + /** + * KEY前缀 + * cache[tenantId]:[key+id] + */ + public static String prefix(String key){ + String prefix = "cache"; + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication != null) { + Object object = authentication.getPrincipal(); + if (object instanceof User) { + final Integer tenantId = ((User) object).getTenantId(); + prefix = prefix.concat(tenantId.toString()).concat(":"); + } + } + return prefix.concat(key); + } + + // 组装key + public String key(String name,Integer id){ + return name.concat(":").concat(id.toString()); + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/CertificateLoader.java b/src/main/java/com/gxwebsoft/common/core/utils/CertificateLoader.java new file mode 100644 index 0000000..a256e49 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/CertificateLoader.java @@ -0,0 +1,230 @@ +package com.gxwebsoft.common.core.utils; + +import com.gxwebsoft.common.core.config.CertificateProperties; +import com.gxwebsoft.common.core.config.CertificateProperties; +import lombok.extern.slf4j.Slf4j; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; + +import javax.annotation.PostConstruct; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +/** + * 证书加载工具类 + * 支持多种证书加载方式,适配Docker容器化部署 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +@Slf4j +@Component +public class CertificateLoader { + + private final CertificateProperties certConfig; + + public CertificateLoader(CertificateProperties certConfig) { + this.certConfig = certConfig; + } + + @PostConstruct + public void init() { + log.info("证书加载器初始化,加载模式:{}", certConfig.getLoadMode()); + if (certConfig.getLoadMode() == CertificateProperties.LoadMode.VOLUME) { + log.info("Docker挂载卷证书路径:{}", certConfig.getCertRootPath()); + validateCertDirectory(); + } + } + + /** + * 验证证书目录是否存在 + */ + private void validateCertDirectory() { + File certDir = new File(certConfig.getCertRootPath()); + if (!certDir.exists()) { + log.warn("证书目录不存在:{},将尝试创建", certConfig.getCertRootPath()); + if (!certDir.mkdirs()) { + log.error("无法创建证书目录:{}", certConfig.getCertRootPath()); + } + } else { + log.info("证书目录验证成功:{}", certConfig.getCertRootPath()); + } + } + + /** + * 加载证书文件路径 + * + * @param certPath 证书路径(可能是相对路径、绝对路径或classpath路径) + * @return 实际的证书文件路径 + */ + public String loadCertificatePath(String certPath) { + if (!StringUtils.hasText(certPath)) { + throw new IllegalArgumentException("证书路径不能为空"); + } + + try { + switch (certConfig.getLoadMode()) { + case CLASSPATH: + return loadFromClasspath(certPath); + case VOLUME: + return loadFromVolume(certPath); + case FILESYSTEM: + default: + return loadFromFileSystem(certPath); + } + } catch (Exception e) { + log.error("加载证书失败,路径:{}", certPath, e); + throw new RuntimeException("证书加载失败:" + certPath, e); + } + } + + /** + * 从classpath加载证书 + */ + private String loadFromClasspath(String certPath) throws IOException { + String resourcePath = certPath.startsWith("classpath:") ? + certPath.substring("classpath:".length()) : certPath; + + ClassPathResource resource = new ClassPathResource(resourcePath); + if (!resource.exists()) { + throw new IOException("Classpath中找不到证书文件:" + resourcePath); + } + + // 将classpath中的文件复制到临时目录 + Path tempFile = Files.createTempFile("cert_", ".pem"); + try (InputStream inputStream = resource.getInputStream()) { + Files.copy(inputStream, tempFile, java.nio.file.StandardCopyOption.REPLACE_EXISTING); + } + + String tempPath = tempFile.toAbsolutePath().toString(); + log.debug("从classpath加载证书:{} -> {}", resourcePath, tempPath); + return tempPath; + } + + /** + * 从Docker挂载卷加载证书 + */ + private String loadFromVolume(String certPath) { + log.debug("尝试从Docker挂载卷加载证书:{}", certPath); + + // 如果是完整路径,直接使用 + if (certPath.startsWith("/") || certPath.contains(":")) { + File file = new File(certPath); + log.debug("检查完整路径文件是否存在:{}", certPath); + if (file.exists()) { + log.debug("使用完整路径加载证书:{}", certPath); + return certPath; + } else { + log.error("完整路径文件不存在:{}", certPath); + } + } + + // 否则拼接挂载卷路径 + String fullPath = Paths.get(certConfig.getCertRootPath(), certPath).toString(); + File file = new File(fullPath); + if (!file.exists()) { + throw new RuntimeException("Docker挂载卷中找不到证书文件:" + fullPath); + } + + log.debug("从Docker挂载卷加载证书:{}", fullPath); + return fullPath; + } + + /** + * 从文件系统加载证书 + */ + private String loadFromFileSystem(String certPath) { + File file = new File(certPath); + if (!file.exists()) { + throw new RuntimeException("文件系统中找不到证书文件:" + certPath); + } + + log.debug("从文件系统加载证书:{}", certPath); + return certPath; + } + + /** + * 检查证书文件是否存在 + * + * @param certPath 证书路径 + * @return 是否存在 + */ + public boolean certificateExists(String certPath) { + try { + switch (certConfig.getLoadMode()) { + case CLASSPATH: + String resourcePath = certPath.startsWith("classpath:") ? + certPath.substring("classpath:".length()) : certPath; + ClassPathResource resource = new ClassPathResource(resourcePath); + return resource.exists(); + case VOLUME: + String fullPath = certPath.startsWith("/") ? certPath : + Paths.get(certConfig.getCertRootPath(), certPath).toString(); + return new File(fullPath).exists(); + case FILESYSTEM: + default: + return new File(certPath).exists(); + } + } catch (Exception e) { + log.warn("检查证书文件存在性时出错:{}", certPath, e); + return false; + } + } + + /** + * 获取证书文件的输入流 + * + * @param certPath 证书路径 + * @return 输入流 + */ + public InputStream getCertificateInputStream(String certPath) throws IOException { + switch (certConfig.getLoadMode()) { + case CLASSPATH: + String resourcePath = certPath.startsWith("classpath:") ? + certPath.substring("classpath:".length()) : certPath; + ClassPathResource resource = new ClassPathResource(resourcePath); + return resource.getInputStream(); + case VOLUME: + case FILESYSTEM: + default: + String actualPath = loadCertificatePath(certPath); + return Files.newInputStream(Paths.get(actualPath)); + } + } + + /** + * 列出证书目录中的所有文件 + * + * @return 证书文件列表 + */ + public String[] listCertificateFiles() { + try { + switch (certConfig.getLoadMode()) { + case VOLUME: + File certDir = new File(certConfig.getCertRootPath()); + if (certDir.exists() && certDir.isDirectory()) { + return certDir.list(); + } + break; + case CLASSPATH: + // classpath模式下不支持列出文件 + log.warn("Classpath模式下不支持列出证书文件"); + break; + case FILESYSTEM: + default: + // 文件系统模式下证书可能分散在不同目录,不支持统一列出 + log.warn("文件系统模式下不支持列出证书文件"); + break; + } + } catch (Exception e) { + log.error("列出证书文件时出错", e); + } + return new String[0]; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/CommonUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/CommonUtil.java new file mode 100644 index 0000000..6435db6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/CommonUtil.java @@ -0,0 +1,321 @@ +package com.gxwebsoft.common.core.utils; + +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.util.CharsetUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.crypto.SecureUtil; +import cn.hutool.crypto.symmetric.AES; +import cn.hutool.crypto.symmetric.SymmetricAlgorithm; +import com.gxwebsoft.common.core.Constants; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.system.entity.Role; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +/** + * 常用工具方法 + * + * @author WebSoft + * @since 2017-06-10 10:10:22 + */ +public class CommonUtil { + + // 生成uuid的字符 + private static final String[] chars = new String[]{ + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", + "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", + "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", + "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" + }; + + /** + * 生成8位uuid + * + * @return String + */ + public static String randomUUID8() { + StringBuilder sb = new StringBuilder(); + String uuid = UUID.randomUUID().toString().replace("-", ""); + for (int i = 0; i < 8; i++) { + String str = uuid.substring(i * 4, i * 4 + 4); + int x = Integer.parseInt(str, 16); + sb.append(chars[x % 0x3E]); + } + return sb.toString(); + } + + /** + * 生成16位uuid + * + * @return String + */ + public static String randomUUID16() { + StringBuilder sb = new StringBuilder(); + String uuid = UUID.randomUUID().toString().replace("-", ""); + for (int i = 0; i < 16; i++) { + String str = uuid.substring(i * 2, i * 2 + 2); + int x = Integer.parseInt(str, 16); + sb.append(chars[x % 0x3E]); + } + return sb.toString(); + } + + /** + * 获取当前时间 + * + * @return String + */ + public static String currentTime() { + Date date = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss"); + return sdf.format(date); + } + + /** + * 生成10位随机用户名 + * + * @return String + */ + public static String randomUsername(String prefix) { + Date date = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss"); + String currentTime = sdf.format(date); + return prefix + currentTime; + } + + /** + * 生成订单号 + * 20233191166110426 + * 20230419135802391412 + * @return + */ + public static String createOrderNo() { + String prefix = DateTime.now().toString(DatePattern.PURE_DATETIME_PATTERN); + return prefix + RandomUtil.randomNumbers(2); + } + + /** + * 生成订单号 + * @param tenantId + * 20233191166110426 + * 20230419135802391412 + * @return + */ + public static String createOrderNo(String tenantId) { + String prefix = DateTime.now().toString(DatePattern.PURE_DATETIME_PATTERN); + return prefix + tenantId + RandomUtil.randomNumbers(2); + } + + /** + * 生成订单水流号 + * @param tenantId + * @return + */ + public static String serialNo(int tenantId) { + String prefix = DateTime.now().toString(DatePattern.PURE_DATETIME_PATTERN); + return prefix + tenantId + RandomUtil.randomNumbers(2); + } + + /** + * 生成会员卡号 + * @return + */ + public static String createCardNo() { + String prefix = DateTime.now().toString(DatePattern.PURE_TIME_PATTERN); + return "00" + prefix + RandomUtil.randomNumbers(2); + } + + /** + * 检查List是否有重复元素 + * + * @param list List + * @param mapper 获取需要检查的字段的Function + * @param 数据的类型 + * @param 需要检查的字段的类型 + * @return boolean + */ + public static boolean checkRepeat(List list, Function mapper) { + for (int i = 0; i < list.size(); i++) { + for (int j = 0; j < list.size(); j++) { + if (i != j && mapper.apply(list.get(i)).equals(mapper.apply(list.get(j)))) { + return true; + } + } + } + return false; + } + + /** + * List转为树形结构 + * + * @param data List + * @param parentId 顶级的parentId + * @param parentIdMapper 获取parentId的Function + * @param idMapper 获取id的Function + * @param consumer 赋值children的Consumer + * @param 数据的类型 + * @param parentId的类型 + * @return List + */ + public static List toTreeData(List data, R parentId, + Function parentIdMapper, + Function idMapper, + BiConsumer> consumer) { + List result = new ArrayList<>(); + for (T d : data) { + R dParentId = parentIdMapper.apply(d); + if (ObjectUtil.equals(parentId, dParentId)) { + R dId = idMapper.apply(d); + List children = toTreeData(data, dId, parentIdMapper, idMapper, consumer); + consumer.accept(d, children); + result.add(d); + } + } + return result; + } + + /** + * 遍历树形结构数据 + * + * @param data List + * @param consumer 回调 + * @param mapper 获取children的Function + * @param 数据的类型 + */ + public static void eachTreeData(List data, Consumer consumer, Function> mapper) { + for (T d : data) { + consumer.accept(d); + List children = mapper.apply(d); + if (children != null && children.size() > 0) { + eachTreeData(children, consumer, mapper); + } + } + } + + /** + * 获取集合中的第一条数据 + * + * @param records 集合 + * @return 第一条数据 + */ + public static T listGetOne(List records) { + return records == null || records.size() == 0 ? null : records.get(0); + } + + /** + * 支持跨域 + * + * @param response HttpServletResponse + */ + public static void addCrossHeaders(HttpServletResponse response) { + response.setHeader("Access-Control-Max-Age", "3600"); + response.setHeader("Access-Control-Allow-Origin", "*"); + response.setHeader("Access-Control-Allow-Methods", "*"); + response.setHeader("Access-Control-Allow-Headers", "*"); + response.setHeader("Access-Control-Expose-Headers", Constants.TOKEN_HEADER_NAME); + } + + /** + * 输出错误信息 + * + * @param response HttpServletResponse + * @param code 错误码 + * @param message 提示信息 + * @param error 错误信息 + */ + public static void responseError(HttpServletResponse response, Integer code, String message, String error) { + response.setContentType("application/json;charset=UTF-8"); + try { + PrintWriter out = response.getWriter(); + out.write(JSONUtil.toJSONString(new ApiResult<>(code, message, null, error))); + out.flush(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static boolean hasRole(List array,String value){ + System.out.println("value = " + value); + if (value == null) { + return true; + } + if (array == null) { + return false; + } + if (!array.isEmpty()) { + final List collect = array.stream().map(Role::getRoleCode) + .collect(Collectors.toList()); + final boolean contains = collect.contains(value); + if (contains) { + return true; + } + } + return false; + } + + public static boolean hasRole(List array,List value){ + System.out.println("value = " + value); + if (value == null) { + return true; + } + if (array == null) { + return false; + } + if (!array.isEmpty()) { + final List collect = array.stream().map(Role::getRoleCode) + .collect(Collectors.toList()); + final boolean disjoint = Collections.disjoint(collect, value); + if (!disjoint) { + return true; + } + } + return false; + } + + public static AES aes(){ + // 随机生成密钥 + byte[] key = SecureUtil.generateKey(SymmetricAlgorithm.AES.getValue()).getEncoded(); + return SecureUtil.aes(key); + } + + // 机密文本 + public static String encrypt(String text){ + final AES aes = aes(); + return aes.encryptHex(text); + } + + // 解密 + public static String decrypt(String encrypt){ + final AES aes = aes(); + return aes.decryptStr(encrypt, CharsetUtil.CHARSET_UTF_8); + } + + /** + * 验证给定的字符串是否为有效的中国大陆手机号码。 + * + * @param phoneNumber 要验证的电话号码字符串 + * @return 如果字符串是有效的手机号码,则返回true;否则返回false + */ + public static boolean isValidPhoneNumber(String phoneNumber) { + // 定义手机号码的正则表达式 + String regex = "^1[3-9]\\d{9}$"; + + // 创建Pattern对象 + Pattern pattern = Pattern.compile(regex); + + // 使用matcher方法创建Matcher对象并进行匹配 + return pattern.matcher(phoneNumber).matches(); + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/DateTimeUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/DateTimeUtil.java new file mode 100644 index 0000000..bde0280 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/DateTimeUtil.java @@ -0,0 +1,93 @@ +package com.gxwebsoft.common.core.utils; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +/** + * 时间格式化工具类 + * 用于统一处理LocalDateTime的格式化 + * + * @author WebSoft + * @since 2025-08-23 + */ +public class DateTimeUtil { + + /** + * 默认的日期时间格式 + */ + public static final String DEFAULT_DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss"; + + /** + * 默认的日期格式 + */ + public static final String DEFAULT_DATE_PATTERN = "yyyy-MM-dd"; + + /** + * 默认的时间格式 + */ + public static final String DEFAULT_TIME_PATTERN = "HH:mm:ss"; + + /** + * 默认的日期时间格式化器 + */ + private static final DateTimeFormatter DEFAULT_DATETIME_FORMATTER = + DateTimeFormatter.ofPattern(DEFAULT_DATETIME_PATTERN); + + /** + * 格式化LocalDateTime为字符串 + * 使用默认格式:yyyy-MM-dd HH:mm:ss + * + * @param dateTime 要格式化的时间 + * @return 格式化后的字符串,如果输入为null则返回null + */ + public static String formatDateTime(LocalDateTime dateTime) { + if (dateTime == null) { + return null; + } + return dateTime.format(DEFAULT_DATETIME_FORMATTER); + } + + /** + * 格式化LocalDateTime为字符串 + * 使用指定格式 + * + * @param dateTime 要格式化的时间 + * @param pattern 格式模式 + * @return 格式化后的字符串,如果输入为null则返回null + */ + public static String formatDateTime(LocalDateTime dateTime, String pattern) { + if (dateTime == null) { + return null; + } + return dateTime.format(DateTimeFormatter.ofPattern(pattern)); + } + + /** + * 解析字符串为LocalDateTime + * 使用默认格式:yyyy-MM-dd HH:mm:ss + * + * @param dateTimeStr 时间字符串 + * @return LocalDateTime对象,如果输入为null或空字符串则返回null + */ + public static LocalDateTime parseDateTime(String dateTimeStr) { + if (dateTimeStr == null || dateTimeStr.trim().isEmpty()) { + return null; + } + return LocalDateTime.parse(dateTimeStr, DEFAULT_DATETIME_FORMATTER); + } + + /** + * 解析字符串为LocalDateTime + * 使用指定格式 + * + * @param dateTimeStr 时间字符串 + * @param pattern 格式模式 + * @return LocalDateTime对象,如果输入为null或空字符串则返回null + */ + public static LocalDateTime parseDateTime(String dateTimeStr, String pattern) { + if (dateTimeStr == null || dateTimeStr.trim().isEmpty()) { + return null; + } + return LocalDateTime.parse(dateTimeStr, DateTimeFormatter.ofPattern(pattern)); + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/DomainUtils.java b/src/main/java/com/gxwebsoft/common/core/utils/DomainUtils.java new file mode 100644 index 0000000..64f4ad2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/DomainUtils.java @@ -0,0 +1,34 @@ +package com.gxwebsoft.common.core.utils; + +import com.gxwebsoft.cms.entity.CmsDomain; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +public class DomainUtils { + public static boolean isDomainResolvable(String domain) { + try { + InetAddress.getByName(domain); + return true; + } catch (UnknownHostException e) { + return false; + } + } + + public static boolean DNSLookup(CmsDomain domain){ + try { + // 获取域名对应的InetAddress对象 + InetAddress inetAddress = InetAddress.getByName(domain.getDomain()); + final String hostAddress = inetAddress.getHostAddress(); + InetAddress inetAddress2 = InetAddress.getByName(domain.getHostValue()); + final String hostAddress2 = inetAddress2.getHostAddress(); + if(hostAddress.equals(hostAddress2)){ + return true; + } + return false; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/EncryptedQrCodeUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/EncryptedQrCodeUtil.java new file mode 100644 index 0000000..ff66ddc --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/EncryptedQrCodeUtil.java @@ -0,0 +1,433 @@ +package com.gxwebsoft.common.core.utils; + +import cn.hutool.core.util.CharsetUtil; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.SecureUtil; +import cn.hutool.crypto.symmetric.AES; +import cn.hutool.crypto.symmetric.SymmetricAlgorithm; +import cn.hutool.extra.qrcode.QrCodeUtil; +import cn.hutool.extra.qrcode.QrConfig; +import com.alibaba.fastjson.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.crypto.spec.SecretKeySpec; +import java.awt.*; +import java.io.ByteArrayOutputStream; +import java.util.Base64; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * 加密二维码工具类 + * 使用token作为密钥对二维码数据进行AES加密 + * + * @author WebSoft + * @since 2025-08-18 + */ +@Component +public class EncryptedQrCodeUtil { + + @Autowired + private RedisUtil redisUtil; + + private static final String QR_TOKEN_PREFIX = "qr_token:"; + private static final long DEFAULT_EXPIRE_MINUTES = 30; // 默认30分钟过期 + + /** + * 生成加密的二维码数据 + * + * @param originalData 原始数据 + * @param expireMinutes 过期时间(分钟) + * @return 包含token和加密数据的Map + */ + public Map generateEncryptedData(String originalData, Long expireMinutes) { + if (StrUtil.isBlank(originalData)) { + throw new IllegalArgumentException("原始数据不能为空"); + } + + if (expireMinutes == null || expireMinutes <= 0) { + expireMinutes = DEFAULT_EXPIRE_MINUTES; + } + + // 生成随机token作为密钥 + String token = RandomUtil.randomString(32); + + try { + // 使用token生成AES密钥 + AES aes = createAESFromToken(token); + + // 加密原始数据 + String encryptedData = aes.encryptHex(originalData); + + // 将token和原始数据存储到Redis中,设置过期时间 + String redisKey = QR_TOKEN_PREFIX + token; + redisUtil.set(redisKey, originalData, expireMinutes, TimeUnit.MINUTES); + + Map result = new HashMap<>(); + result.put("token", token); + result.put("encryptedData", encryptedData); + result.put("expireMinutes", expireMinutes.toString()); + + return result; + + } catch (Exception e) { + throw new RuntimeException("生成加密数据失败: " + e.getMessage(), e); + } + } + + /** + * 解密二维码数据 + * + * @param token 密钥token + * @param encryptedData 加密的数据 + * @return 解密后的原始数据 + */ + public String decryptData(String token, String encryptedData) { + if (StrUtil.isBlank(token) || StrUtil.isBlank(encryptedData)) { + throw new IllegalArgumentException("token和加密数据不能为空"); + } + + try { + // 从Redis验证token是否有效 + String redisKey = QR_TOKEN_PREFIX + token; + String originalData = redisUtil.get(redisKey); + + if (StrUtil.isBlank(originalData)) { + throw new RuntimeException("token已过期或无效"); + } + + // 使用token生成AES密钥 + AES aes = createAESFromToken(token); + + // 解密数据 + String decryptedData = aes.decryptStr(encryptedData, CharsetUtil.CHARSET_UTF_8); + + // 验证解密结果与Redis中存储的数据是否一致 + if (!originalData.equals(decryptedData)) { + throw new RuntimeException("数据验证失败"); + } + + return decryptedData; + + } catch (Exception e) { + throw new RuntimeException("解密数据失败: " + e.getMessage(), e); + } + } + + /** + * 生成加密的二维码图片(自包含模式) + * + * @param originalData 原始数据 + * @param width 二维码宽度 + * @param height 二维码高度 + * @param expireMinutes 过期时间(分钟) + * @param businessType 业务类型(可选,如:order、user、coupon等) + * @return 包含二维码图片Base64和token的Map + */ + public Map generateEncryptedQrCode(String originalData, int width, int height, Long expireMinutes, String businessType) { + try { + // 生成加密数据 + Map encryptedInfo = generateEncryptedData(originalData, expireMinutes); + + // 创建二维码内容(包含token、加密数据和业务类型) + Map qrContent = new HashMap<>(); + qrContent.put("token", encryptedInfo.get("token")); + qrContent.put("data", encryptedInfo.get("encryptedData")); + qrContent.put("type", "encrypted"); + + // 添加业务类型(如果提供) + if (StrUtil.isNotBlank(businessType)) { + qrContent.put("businessType", businessType); + } + + String qrDataJson = JSONObject.toJSONString(qrContent); + + // 配置二维码 + QrConfig config = new QrConfig(width, height); + config.setMargin(1); + config.setForeColor(Color.BLACK); + config.setBackColor(Color.WHITE); + + // 生成二维码图片 + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + QrCodeUtil.generate(qrDataJson, config, "png", outputStream); + + // 转换为Base64 + String base64Image = Base64.getEncoder().encodeToString(outputStream.toByteArray()); + + Map result = new HashMap<>(); + result.put("qrCodeBase64", base64Image); + result.put("token", encryptedInfo.get("token")); + result.put("originalData", originalData); + result.put("expireMinutes", encryptedInfo.get("expireMinutes")); + result.put("businessType", businessType); + + return result; + + } catch (Exception e) { + throw new RuntimeException("生成加密二维码失败: " + e.getMessage(), e); + } + } + + /** + * 生成加密的二维码图片(自包含模式,无业务类型) + * 向后兼容的重载方法 + * + * @param originalData 原始数据 + * @param width 二维码宽度 + * @param height 二维码高度 + * @param expireMinutes 过期时间(分钟) + * @return 包含二维码图片Base64和token的Map + */ + public Map generateEncryptedQrCode(String originalData, int width, int height, Long expireMinutes) { + return generateEncryptedQrCode(originalData, width, height, expireMinutes, null); + } + + /** + * 生成业务加密二维码(门店核销模式) + * 使用统一的业务密钥,门店可以直接解密 + * + * @param originalData 原始数据 + * @param width 二维码宽度 + * @param height 二维码高度 + * @param businessKey 业务密钥(如门店密钥) + * @param expireMinutes 过期时间(分钟) + * @param businessType 业务类型(如:order、coupon、ticket等) + * @return 包含二维码图片Base64的Map + */ + public Map generateBusinessEncryptedQrCode(String originalData, int width, int height, + String businessKey, Long expireMinutes, String businessType) { + try { + if (StrUtil.isBlank(businessKey)) { + throw new IllegalArgumentException("业务密钥不能为空"); + } + + if (expireMinutes == null || expireMinutes <= 0) { + expireMinutes = DEFAULT_EXPIRE_MINUTES; + } + + // 生成唯一的二维码ID + String qrId = RandomUtil.randomString(16); + + // 使用业务密钥加密数据 + AES aes = createAESFromToken(businessKey); + String encryptedData = aes.encryptHex(originalData); + + // 将二维码信息存储到Redis(用于验证和防重复使用) + String qrInfoKey = "qr_info:" + qrId; + Map qrInfo = new HashMap<>(); + qrInfo.put("originalData", originalData); + qrInfo.put("createTime", String.valueOf(System.currentTimeMillis())); + qrInfo.put("businessKey", businessKey); + redisUtil.set(qrInfoKey, JSONObject.toJSONString(qrInfo), expireMinutes, TimeUnit.MINUTES); + + // 创建二维码内容 + Map qrContent = new HashMap<>(); + qrContent.put("qrId", qrId); + qrContent.put("data", encryptedData); + qrContent.put("type", "business_encrypted"); + qrContent.put("expire", String.valueOf(System.currentTimeMillis() + expireMinutes * 60 * 1000)); + + // 添加业务类型(如果提供) + if (StrUtil.isNotBlank(businessType)) { + qrContent.put("businessType", businessType); + } + + String qrDataJson = JSONObject.toJSONString(qrContent); + + // 配置二维码 + QrConfig config = new QrConfig(width, height); + config.setMargin(1); + config.setForeColor(Color.BLACK); + config.setBackColor(Color.WHITE); + + // 生成二维码图片 + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + QrCodeUtil.generate(qrDataJson, config, "png", outputStream); + + // 转换为Base64 + String base64Image = Base64.getEncoder().encodeToString(outputStream.toByteArray()); + + Map result = new HashMap<>(); + result.put("qrCodeBase64", base64Image); + result.put("qrId", qrId); + result.put("originalData", originalData); + result.put("expireMinutes", expireMinutes.toString()); + result.put("businessType", businessType); + // 注意:出于安全考虑,不返回businessKey + + return result; + + } catch (Exception e) { + throw new RuntimeException("生成业务加密二维码失败: " + e.getMessage(), e); + } + } + + /** + * 生成业务加密二维码(门店核销模式,无业务类型) + * 向后兼容的重载方法 + * + * @param originalData 原始数据 + * @param width 二维码宽度 + * @param height 二维码高度 + * @param businessKey 业务密钥(如门店密钥) + * @param expireMinutes 过期时间(分钟) + * @return 包含二维码图片Base64的Map + */ + public Map generateBusinessEncryptedQrCode(String originalData, int width, int height, + String businessKey, Long expireMinutes) { + return generateBusinessEncryptedQrCode(originalData, width, height, businessKey, expireMinutes, null); + } + + /** + * 验证并解密二维码内容(自包含模式) + * 二维码包含token和加密数据,扫码方无需额外信息 + * + * @param qrContent 二维码扫描得到的内容 + * @return 解密后的原始数据 + */ + public String verifyAndDecryptQrCode(String qrContent) { + QrCodeDecryptResult result = verifyAndDecryptQrCodeWithResult(qrContent); + return result.getOriginalData(); + } + + /** + * 验证并解密二维码内容(自包含模式,返回完整结果) + * 包含业务类型等详细信息 + * + * @param qrContent 二维码扫描得到的内容 + * @return 包含解密数据和业务类型的完整结果 + */ + public QrCodeDecryptResult verifyAndDecryptQrCodeWithResult(String qrContent) { + try { + // 解析二维码内容 + @SuppressWarnings("unchecked") + Map contentMap = JSONObject.parseObject(qrContent, Map.class); + + String type = contentMap.get("type"); + + // 严格验证二维码类型,防止前端伪造 + if (!isValidQrCodeType(type, "encrypted")) { + throw new RuntimeException("无效的二维码类型或二维码已被篡改"); + } + + String token = contentMap.get("token"); + String encryptedData = contentMap.get("data"); + + // 验证必要字段 + if (StrUtil.isBlank(token) || StrUtil.isBlank(encryptedData)) { + throw new RuntimeException("二维码数据不完整"); + } + + String businessType = contentMap.get("businessType"); // 获取业务类型 + + // 解密数据(自包含模式:token就在二维码中) + String originalData = decryptData(token, encryptedData); + + // 返回包含业务类型的完整结果 + return QrCodeDecryptResult.createEncryptedResult(originalData, businessType); + + } catch (Exception e) { + throw new RuntimeException("验证和解密二维码失败: " + e.getMessage(), e); + } + } + + /** + * 验证并解密二维码内容(业务模式) + * 适用于门店核销场景:门店有统一的解密密钥 + * + * @param qrContent 二维码扫描得到的内容 + * @param businessKey 业务密钥(如门店密钥) + * @return 解密后的原始数据 + */ + public String verifyAndDecryptQrCodeWithBusinessKey(String qrContent, String businessKey) { + try { + // 解析二维码内容 + @SuppressWarnings("unchecked") + Map contentMap = JSONObject.parseObject(qrContent, Map.class); + + String type = contentMap.get("type"); + if (!"business_encrypted".equals(type)) { + throw new RuntimeException("不是业务加密类型的二维码"); + } + + String encryptedData = contentMap.get("data"); + String qrId = contentMap.get("qrId"); // 二维码唯一ID + + // 验证二维码是否已被使用(防止重复核销) + String usedKey = "qr_used:" + qrId; + if (StrUtil.isNotBlank(redisUtil.get(usedKey))) { + throw new RuntimeException("二维码已被使用"); + } + + // 使用业务密钥解密 + AES aes = createAESFromToken(businessKey); + String decryptedData = aes.decryptStr(encryptedData, CharsetUtil.CHARSET_UTF_8); + + // 标记二维码为已使用(24小时过期,防止重复使用) + redisUtil.set(usedKey, "used", 24L, TimeUnit.HOURS); + + return decryptedData; + + } catch (Exception e) { + throw new RuntimeException("业务验证和解密二维码失败: " + e.getMessage(), e); + } + } + + /** + * 删除token(使二维码失效) + * + * @param token 要删除的token + */ + public void invalidateToken(String token) { + if (StrUtil.isNotBlank(token)) { + String redisKey = QR_TOKEN_PREFIX + token; + redisUtil.delete(redisKey); + } + } + + /** + * 检查token是否有效 + * + * @param token 要检查的token + * @return true表示有效,false表示无效或过期 + */ + public boolean isTokenValid(String token) { + if (StrUtil.isBlank(token)) { + return false; + } + + String redisKey = QR_TOKEN_PREFIX + token; + String data = redisUtil.get(redisKey); + return StrUtil.isNotBlank(data); + } + + /** + * 验证二维码类型是否有效 + * + * @param actualType 实际的类型 + * @param expectedType 期望的类型 + * @return true表示有效,false表示无效 + */ + private boolean isValidQrCodeType(String actualType, String expectedType) { + return expectedType.equals(actualType); + } + + /** + * 根据token创建AES加密器 + * + * @param token 密钥token + * @return AES加密器 + */ + private AES createAESFromToken(String token) { + // 使用token生成固定长度的密钥 + String keyString = SecureUtil.md5(token); + // 取前16字节作为AES密钥 + byte[] keyBytes = keyString.substring(0, 16).getBytes(CharsetUtil.CHARSET_UTF_8); + SecretKeySpec secretKey = new SecretKeySpec(keyBytes, SymmetricAlgorithm.AES.getValue()); + return SecureUtil.aes(secretKey.getEncoded()); + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/FileServerUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/FileServerUtil.java new file mode 100644 index 0000000..45201d2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/FileServerUtil.java @@ -0,0 +1,401 @@ +package com.gxwebsoft.common.core.utils; + +import cn.hutool.core.img.ImgUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.io.IORuntimeException; +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.StrUtil; +import org.apache.tika.Tika; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.net.MalformedURLException; +import java.net.URLEncoder; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * 文件上传下载工具类 + * + * @author WebSoft + * @since 2018-12-14 08:38:53 + */ +public class FileServerUtil { + // 除 text/* 外也需要设置输出编码的 content-type + private final static List SET_CHARSET_CONTENT_TYPES = Arrays.asList( + "application/json", + "application/javascript" + ); + + /** + * 上传文件 + * + * @param file MultipartFile + * @param directory 文件保存的目录 + * @param uuidName 是否用uuid命名 + * @return File + */ + public static File upload(MultipartFile file, String directory, boolean uuidName) + throws IOException, IllegalStateException { + File outFile = getUploadFile(file.getOriginalFilename(), directory, uuidName); + if (!outFile.getParentFile().exists()) { + if (!outFile.getParentFile().mkdirs()) { + throw new RuntimeException("make directory fail"); + } + } + file.transferTo(outFile); + return outFile; + } + + /** + * 上传base64格式文件 + * + * @param base64 base64编码字符 + * @param fileName 文件名称, 为空使用uuid命名 + * @param directory 文件保存的目录 + * @return File + */ + public static File upload(String base64, String fileName, String directory) + throws FileNotFoundException, IORuntimeException { + if (StrUtil.isBlank(base64) || !base64.startsWith("data:image/") || !base64.contains(";base64,")) { + throw new RuntimeException("base64 data error"); + } + String suffix = "." + base64.substring(11, base64.indexOf(";")); // 获取文件后缀 + boolean uuidName = StrUtil.isBlank(fileName); + File outFile = getUploadFile(uuidName ? suffix : fileName, directory, uuidName); + byte[] bytes = Base64.getDecoder().decode(base64.substring(base64.indexOf(";") + 8).getBytes()); + IoUtil.write(new FileOutputStream(outFile), true, bytes); + return outFile; + } + + /** + * 获取上传文件位置 + * + * @param name 文件名称 + * @param directory 上传目录 + * @param uuidName 是否使用uuid命名 + * @return File + */ + public static File getUploadFile(String name, String directory, boolean uuidName) { + // 当前日期作为上传子目录 + String dir = new SimpleDateFormat("yyyyMMdd/").format(new Date()); + // 获取文件后缀 + String suffix = (name == null || !name.contains(".")) ? "" : name.substring(name.lastIndexOf(".")); + // 使用uuid命名 + if (uuidName || name == null) { + String uuid = UUID.randomUUID().toString().replaceAll("-", ""); + return new File(directory, dir + uuid + suffix); + } + // 使用原名称, 存在相同则加(1) + File file = new File(directory, dir + name); + String prefix = StrUtil.removeSuffix(name, suffix); + int sameSize = 2; + while (file.exists()) { + file = new File(directory, dir + prefix + "(" + sameSize + ")" + suffix); + sameSize++; + } + return file; + } + + /** + * 查看文件, 支持断点续传 + * + * @param file 文件 + * @param pdfDir office转pdf输出目录 + * @param officeHome openOffice安装目录 + * @param response HttpServletResponse + * @param request HttpServletRequest + */ + public static void preview(File file, String pdfDir, String officeHome, + HttpServletResponse response, HttpServletRequest request) { + preview(file, false, null, pdfDir, officeHome, response, request); + } + + /** + * 查看文件, 支持断点续传 + * + * @param file 文件 + * @param forceDownload 是否强制下载 + * @param fileName 强制下载的文件名称 + * @param pdfDir office转pdf输出目录 + * @param officeHome openOffice安装目录 + * @param response HttpServletResponse + * @param request HttpServletRequest + */ + public static void preview(File file, boolean forceDownload, String fileName, String pdfDir, String officeHome, + HttpServletResponse response, HttpServletRequest request) { + CommonUtil.addCrossHeaders(response); + if (file == null || !file.exists()) { + outNotFund(response); + return; + } + if (forceDownload) { + setDownloadHeader(response, StrUtil.isBlank(fileName) ? file.getName() : fileName); + } else { + // office转pdf预览 + if (OpenOfficeUtil.canConverter(file.getName())) { + File pdfFile = OpenOfficeUtil.converterToPDF(file.getAbsolutePath(), pdfDir, officeHome); + if (pdfFile != null) { + file = pdfFile; + } + } + // 获取文件类型 + String contentType = getContentType(file); + if (contentType != null) { + response.setContentType(contentType); + // 设置编码 + if (contentType.startsWith("text/") || SET_CHARSET_CONTENT_TYPES.contains(contentType)) { + try { + String charset = JChardetFacadeUtil.detectCodepage(file.toURI().toURL()); + if (charset != null) { + response.setCharacterEncoding(charset); + } + } catch (MalformedURLException e) { + e.printStackTrace(); + } + } + } else { + setDownloadHeader(response, file.getName()); + } + } + response.setHeader("Cache-Control", "public"); + output(file, response, request); + } + + /** + * 查看缩略图 + * + * @param file 原文件 + * @param thumbnail 缩略图文件 + * @param size 缩略图文件的最大值(kb) + * @param response HttpServletResponse + * @param request HttpServletRequest + */ + public static void previewThumbnail(File file, File thumbnail, Integer size, + HttpServletResponse response, HttpServletRequest request) { + // 如果是图片并且缩略图不存在则生成 + if (!thumbnail.exists() && isImage(file)) { + long fileSize = file.length(); + if ((fileSize / 1024) > size) { + try { + if (thumbnail.getParentFile().mkdirs()) { + System.out.println("生成缩略图1>>>>>>>>>>>>>>>> = " + thumbnail); + ImgUtil.scale(file, thumbnail, size / (fileSize / 1024f)); + if (thumbnail.exists() && thumbnail.length() > file.length()) { + FileUtil.copy(file, thumbnail, true); + } + }else{ + System.out.println("生成缩略图2>>>>>>>>>>>>>>>> = " + thumbnail); + ImgUtil.scale(file, thumbnail, size / (fileSize / 1024f)); + if (thumbnail.exists() && thumbnail.length() > file.length()) { + FileUtil.copy(file, thumbnail, true); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } else { + preview(file, null, null, response, request); + return; + } + } + preview(thumbnail.exists() ? thumbnail : file, null, null, response, request); + } + + /** + * 输出文件流, 支持断点续传 + * + * @param file 文件 + * @param response HttpServletResponse + * @param request HttpServletRequest + */ + public static void output(File file, HttpServletResponse response, HttpServletRequest request) { + long length = file.length(); // 文件总大小 + long start = 0, to = length - 1; // 开始读取位置, 结束读取位置 + long lastModified = file.lastModified(); // 文件修改时间 + response.setHeader("Accept-Ranges", "bytes"); + response.setHeader("ETag", "\"" + length + "-" + lastModified + "\""); + response.setHeader("Last-Modified", new Date(lastModified).toString()); + String range = request.getHeader("Range"); + if (range != null) { + response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT); + String[] ranges = range.replace("bytes=", "").split("-"); + start = Long.parseLong(ranges[0].trim()); + if (ranges.length > 1) { + to = Long.parseLong(ranges[1].trim()); + } + response.setHeader("Content-Range", "bytes " + start + "-" + to + "/" + length); + } + response.setHeader("Content-Length", String.valueOf(to - start + 1)); + try { + output(file, response.getOutputStream(), 2048, start, to); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 输出文件流 + * + * @param file 文件 + * @param os 输出流 + */ + public static void output(File file, OutputStream os) { + output(file, os, null); + } + + /** + * 输出文件流 + * + * @param file 文件 + * @param os 输出流 + * @param size 读取缓冲区大小 + */ + public static void output(File file, OutputStream os, Integer size) { + output(file, os, size, null, null); + } + + /** + * 输出文件流, 支持分片 + * + * @param file 文件 + * @param os 输出流 + * @param size 读取缓冲区大小 + * @param start 开始位置 + * @param to 结束位置 + */ + public static void output(File file, OutputStream os, Integer size, Long start, Long to) { + BufferedInputStream is = null; + try { + is = new BufferedInputStream(new FileInputStream(file)); + if (start != null) { + long skip = is.skip(start); + if (skip < start) { + System.out.println("ERROR: skip fail[ skipped=" + skip + ", start= " + start + " ]"); + } + to = to - start + 1; + } + byte[] bytes = new byte[size == null ? 2048 : size]; + int len; + if (to == null) { + while ((len = is.read(bytes)) != -1) { + os.write(bytes, 0, len); + } + } else { + while (to > 0 && (len = is.read(bytes)) != -1) { + os.write(bytes, 0, to < len ? (int) ((long) to) : len); + to -= len; + } + } + os.flush(); + } catch (IOException ignored) { + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (os != null) { + try { + os.close(); + } catch (IOException ignored) { + } + } + if (is != null) { + try { + is.close(); + } catch (IOException e) { + System.out.println(e.getMessage()); + } + } + } + } + + /** + * 获取文件类型 + * + * @param file 文件 + * @return String + */ + public static String getContentType(File file) { + String contentType = null; + if (file.exists()) { + try { + contentType = new Tika().detect(file); + } catch (IOException e) { + e.printStackTrace(); + } + } + return contentType; + } + + /** + * 判断文件是否是图片类型 + * + * @param file 文件 + * @return boolean + */ + public static boolean isImage(File file) { + return isImage(getContentType(file)); + } + + /** + * 判断文件是否是图片类型 + * + * @param contentType 文件类型 + * @return boolean + */ + public static boolean isImage(String contentType) { + return contentType != null && contentType.startsWith("image/"); + } + + /** + * 设置下载文件的header + * + * @param response HttpServletResponse + * @param fileName 文件名称 + */ + public static void setDownloadHeader(HttpServletResponse response, String fileName) { + response.setContentType("application/force-download"); + try { + fileName = URLEncoder.encode(fileName, "utf-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + response.setHeader("Content-Disposition", "attachment;fileName=" + fileName); + } + + /** + * 输出404错误页面 + * + * @param response HttpServletResponse + */ + public static void outNotFund(HttpServletResponse response) { + response.setStatus(HttpServletResponse.SC_NOT_FOUND); + outMessage("404 Not Found", null, response); + } + + /** + * 输出错误页面 + * + * @param title 标题 + * @param message 内容 + * @param response HttpServletResponse + */ + public static void outMessage(String title, String message, HttpServletResponse response) { + response.setContentType("text/html;charset=UTF-8"); + try { + PrintWriter writer = response.getWriter(); + writer.write(""); + writer.write("" + title + ""); + writer.write("

" + title + "

"); + if (message != null) { + writer.write(message); + } + writer.write("

WebSoft File Server

"); + writer.flush(); + } catch (IOException e) { + e.printStackTrace(); + } + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/HttpUtils.java b/src/main/java/com/gxwebsoft/common/core/utils/HttpUtils.java new file mode 100644 index 0000000..888acc2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/HttpUtils.java @@ -0,0 +1,311 @@ +package com.gxwebsoft.common.core.utils; + +import org.apache.commons.lang3.StringUtils; +import org.apache.http.HttpResponse; +import org.apache.http.NameValuePair; +import org.apache.http.client.HttpClient; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.conn.ClientConnectionManager; +import org.apache.http.conn.scheme.Scheme; +import org.apache.http.conn.scheme.SchemeRegistry; +import org.apache.http.conn.ssl.SSLSocketFactory; +import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.message.BasicNameValuePair; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class HttpUtils { + + /** + * get + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @return + * @throws Exception + */ + public static HttpResponse doGet(String host, String path, String method, + Map headers, + Map querys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpGet request = new HttpGet(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + return httpClient.execute(request); + } + + /** + * post form + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param bodys + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + Map bodys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (bodys != null) { + List nameValuePairList = new ArrayList(); + + for (String key : bodys.keySet()) { + nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key))); + } + UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8"); + formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8"); + request.setEntity(formEntity); + } + + return httpClient.execute(request); + } + + /** + * Post String + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + String body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (StringUtils.isNotBlank(body)) { + request.setEntity(new StringEntity(body, "utf-8")); + } + + return httpClient.execute(request); + } + + /** + * Post stream + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + byte[] body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (body != null) { + request.setEntity(new ByteArrayEntity(body)); + } + + return httpClient.execute(request); + } + + /** + * Put String + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPut(String host, String path, String method, + Map headers, + Map querys, + String body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPut request = new HttpPut(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (StringUtils.isNotBlank(body)) { + request.setEntity(new StringEntity(body, "utf-8")); + } + + return httpClient.execute(request); + } + + /** + * Put stream + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPut(String host, String path, String method, + Map headers, + Map querys, + byte[] body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPut request = new HttpPut(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (body != null) { + request.setEntity(new ByteArrayEntity(body)); + } + + return httpClient.execute(request); + } + + /** + * Delete + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @return + * @throws Exception + */ + public static HttpResponse doDelete(String host, String path, String method, + Map headers, + Map querys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpDelete request = new HttpDelete(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + return httpClient.execute(request); + } + + private static String buildUrl(String host, String path, Map querys) throws UnsupportedEncodingException { + StringBuilder sbUrl = new StringBuilder(); + sbUrl.append(host); + if (!StringUtils.isBlank(path)) { + sbUrl.append(path); + } + if (null != querys) { + StringBuilder sbQuery = new StringBuilder(); + for (Map.Entry query : querys.entrySet()) { + if (0 < sbQuery.length()) { + sbQuery.append("&"); + } + if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) { + sbQuery.append(query.getValue()); + } + if (!StringUtils.isBlank(query.getKey())) { + sbQuery.append(query.getKey()); + if (!StringUtils.isBlank(query.getValue())) { + sbQuery.append("="); + sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8")); + } + } + } + if (0 < sbQuery.length()) { + sbUrl.append("?").append(sbQuery); + } + } + + return sbUrl.toString(); + } + + private static HttpClient wrapClient(String host) { + HttpClient httpClient = new DefaultHttpClient(); + if (host.startsWith("https://")) { + sslClient(httpClient); + } + + return httpClient; + } + + private static void sslClient(HttpClient httpClient) { + try { + SSLContext ctx = SSLContext.getInstance("TLS"); + X509TrustManager tm = new X509TrustManager() { + public X509Certificate[] getAcceptedIssuers() { + return null; + } + public void checkClientTrusted(X509Certificate[] xcs, String str) { + + } + public void checkServerTrusted(X509Certificate[] xcs, String str) { + + } + }; + ctx.init(null, new TrustManager[] { tm }, null); + SSLSocketFactory ssf = new SSLSocketFactory(ctx); + ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); + ClientConnectionManager ccm = httpClient.getConnectionManager(); + SchemeRegistry registry = ccm.getSchemeRegistry(); + registry.register(new Scheme("https", 443, ssf)); + } catch (KeyManagementException ex) { + throw new RuntimeException(ex); + } catch (NoSuchAlgorithmException ex) { + throw new RuntimeException(ex); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/gxwebsoft/common/core/utils/ImageUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/ImageUtil.java new file mode 100644 index 0000000..b345923 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/ImageUtil.java @@ -0,0 +1,96 @@ +package com.gxwebsoft.common.core.utils; + +import cn.hutool.core.codec.Base64Encoder; + +import javax.imageio.IIOImage; +import javax.imageio.ImageIO; +import javax.imageio.ImageWriteParam; +import javax.imageio.ImageWriter; +import javax.imageio.stream.ImageOutputStream; +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.Iterator; +import java.io.File; + +public class ImageUtil { + public static String ImageBase64(String imgUrl) { + URL url = null; + InputStream is = null; + ByteArrayOutputStream outStream = null; + HttpURLConnection httpUrl = null; + try{ + url = new URL(imgUrl); + httpUrl = (HttpURLConnection) url.openConnection(); + httpUrl.connect(); + httpUrl.getInputStream(); + is = httpUrl.getInputStream(); + + outStream = new ByteArrayOutputStream(); + //创建一个Buffer字符串 + byte[] buffer = new byte[1024]; + //每次读取的字符串长度,如果为-1,代表全部读取完毕 + int len = 0; + //使用一个输入流从buffer里把数据读取出来 + while( (len=is.read(buffer)) != -1 ){ + //用输出流往buffer里写入数据,中间参数代表从哪个位置开始读,len代表读取的长度 + outStream.write(buffer, 0, len); + } + // 对字节数组Base64编码 + return new Base64Encoder().encode(outStream.toByteArray()); + }catch (Exception e) { + e.printStackTrace(); + } + finally{ + if(is != null) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if(outStream != null) { + try { + outStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if(httpUrl != null) { + httpUrl.disconnect(); + } + } + return null; + } + + + public static void adjustQuality(File inputFile, File outputFile, float quality) throws IOException { + // 读取图片文件 + BufferedImage image = ImageIO.read(inputFile); + + // 获取JPEG ImageWriters的迭代器 + Iterator iter = ImageIO.getImageWritersByFormatName("jpeg"); + ImageWriter writer = iter.next(); + + // 创建输出文件 + ImageOutputStream ios = ImageIO.createImageOutputStream(outputFile); + writer.setOutput(ios); + + // 创建ImageWriteParam并设置压缩质量 + ImageWriteParam iwp = writer.getDefaultWriteParam(); + if (iwp.canWriteCompressed()) { + iwp.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); + iwp.setCompressionQuality(quality); // 设置质量,1.0为最好,0.0最差 + } + + // 写入图片 + writer.write(null, new IIOImage(image, null, null), iwp); + writer.dispose(); + ios.close(); + } + +} + diff --git a/src/main/java/com/gxwebsoft/common/core/utils/JChardetFacadeUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/JChardetFacadeUtil.java new file mode 100644 index 0000000..1b49fb7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/JChardetFacadeUtil.java @@ -0,0 +1,2025 @@ +package com.gxwebsoft.common.core.utils; + +import java.io.*; +import java.net.URL; +import java.nio.charset.Charset; +import java.nio.charset.UnsupportedCharsetException; + +/** + * 文件编码检测工具, 核心代码来自 cpDetector 和 jChardet, 可以检测大多数文件的编码 + * + * @author WebSoft + * @since 2020-09-15 09:24:20 + */ +public class JChardetFacadeUtil { + + public static String detectCodepage(URL url) { + try { + Charset ret = JChardetFacade.getInstance().detectCodepage(url); + return ret == null ? null : ret.name(); + } catch (Exception ignored) { + } + return null; + } + + /** + * 下面代码来自: https://github.com/r91987/cpdetector + */ + public static class JChardetFacade extends AbstractCodepageDetector implements nsICharsetDetectionObserver { + private static JChardetFacade instance = null; + private static nsDetector det; + private byte[] buf = new byte[4096]; + private Charset codpage = null; + private boolean m_guessing = true; + private int amountOfVerifiers = 0; + + private JChardetFacade() { + det = new nsDetector(0); + det.Init(this); + this.amountOfVerifiers = det.getProbableCharsets().length; + } + + public static JChardetFacade getInstance() { + if (instance == null) { + instance = new JChardetFacade(); + } + + return instance; + } + + public synchronized Charset detectCodepage(InputStream in, int length) throws IOException { + this.Reset(); + int read = 0; + boolean done = false; + boolean isAscii = true; + Charset ret = null; + + int len; + do { + len = in.read(this.buf, 0, Math.min(this.buf.length, length - read)); + if (len > 0) { + read += len; + } + + if (!done) { + done = det.DoIt(this.buf, len, false); + } + } while (len > 0 && !done); + + det.DataEnd(); + if (this.codpage == null) { + if (this.m_guessing) { + ret = this.guess(); + } + } else { + ret = this.codpage; + } + return ret; + } + + private Charset guess() { + Charset ret = null; + String[] possibilities = det.getProbableCharsets(); + if (possibilities.length == this.amountOfVerifiers) { + ret = Charset.forName("US-ASCII"); + } else { + String check = possibilities[0]; + if (!check.equalsIgnoreCase("nomatch")) { + for (int i = 0; ret == null && i < possibilities.length; ++i) { + try { + ret = Charset.forName(possibilities[i]); + } catch (UnsupportedCharsetException ignored) { + } + } + } + } + return ret; + } + + public void Notify(String charset) { + this.codpage = Charset.forName(charset); + } + + public void Reset() { + det.Reset(); + this.codpage = null; + } + + public boolean isGuessing() { + return this.m_guessing; + } + + public synchronized void setGuessing(boolean guessing) { + this.m_guessing = guessing; + } + } + + /** + * + */ + public static abstract class AbstractCodepageDetector implements ICodepageDetector { + public AbstractCodepageDetector() { + } + + public Charset detectCodepage(URL url) throws IOException { + BufferedInputStream in = new BufferedInputStream(url.openStream()); + Charset result = this.detectCodepage(in, 2147483647); + in.close(); + return result; + } + + public final Reader open(URL url) throws IOException { + Reader ret = null; + Charset cs = this.detectCodepage(url); + if (cs != null) { + ret = new InputStreamReader(new BufferedInputStream(url.openStream()), cs); + } + + return ret; + } + + public int compareTo(Object o) { + String other = o.getClass().getName(); + String mine = this.getClass().getName(); + return mine.compareTo(other); + } + } + + /** + * + */ + interface ICodepageDetector extends Serializable, Comparable { + Reader open(URL var1) throws IOException; + + Charset detectCodepage(URL var1) throws IOException; + + Charset detectCodepage(InputStream var1, int var2) throws IOException; + } + + /** + * 以下代码开始是由Mozilla组织提供的JChardet, 它可以检测大多数文件的编码 + * http://jchardet.sourceforge.net/ + */ + public static class nsDetector extends nsPSMDetector implements nsICharsetDetector { + nsICharsetDetectionObserver mObserver = null; + + public nsDetector() { + } + + public nsDetector(int var1) { + super(var1); + } + + public void Init(nsICharsetDetectionObserver var1) { + this.mObserver = var1; + } + + public boolean DoIt(byte[] var1, int var2, boolean var3) { + if (var1 != null && !var3) { + this.HandleData(var1, var2); + return this.mDone; + } else { + return false; + } + } + + public void Done() { + this.DataEnd(); + } + + public void Report(String var1) { + if (this.mObserver != null) { + this.mObserver.Notify(var1); + } + + } + + public boolean isAscii(byte[] var1, int var2) { + for (int var3 = 0; var3 < var2; ++var3) { + if ((128 & var1[var3]) != 0) { + return false; + } + } + + return true; + } + } + + /** + * + */ + public static abstract class nsPSMDetector { + public static final int ALL = 0; + public static final int JAPANESE = 1; + public static final int CHINESE = 2; + public static final int SIMPLIFIED_CHINESE = 3; + public static final int TRADITIONAL_CHINESE = 4; + public static final int KOREAN = 5; + public static final int NO_OF_LANGUAGES = 6; + public static final int MAX_VERIFIERS = 16; + nsVerifier[] mVerifier; + nsEUCStatistics[] mStatisticsData; + nsEUCSampler mSampler = new nsEUCSampler(); + byte[] mState = new byte[16]; + int[] mItemIdx = new int[16]; + int mItems; + int mClassItems; + boolean mDone; + boolean mRunSampler; + boolean mClassRunSampler; + + public nsPSMDetector() { + this.initVerifiers(0); + this.Reset(); + } + + public nsPSMDetector(int var1) { + this.initVerifiers(var1); + this.Reset(); + } + + public nsPSMDetector(int var1, nsVerifier[] var2, nsEUCStatistics[] var3) { + this.mClassRunSampler = var3 != null; + this.mStatisticsData = var3; + this.mVerifier = var2; + this.mClassItems = var1; + this.Reset(); + } + + public void Reset() { + this.mRunSampler = this.mClassRunSampler; + this.mDone = false; + this.mItems = this.mClassItems; + + for (int var1 = 0; var1 < this.mItems; this.mItemIdx[var1] = var1++) { + this.mState[var1] = 0; + } + + this.mSampler.Reset(); + } + + protected void initVerifiers(int var1) { + boolean var2 = false; + int var3; + if (var1 >= 0 && var1 < 6) { + var3 = var1; + } else { + var3 = 0; + } + + this.mVerifier = null; + this.mStatisticsData = null; + if (var3 == 4) { + this.mVerifier = new nsVerifier[]{new nsUTF8Verifier(), new nsBIG5Verifier(), new nsISO2022CNVerifier(), new nsEUCTWVerifier(), new nsCP1252Verifier(), new nsUCS2BEVerifier(), new nsUCS2LEVerifier()}; + this.mStatisticsData = new nsEUCStatistics[]{null, new Big5Statistics(), null, new EUCTWStatistics(), null, null, null}; + } else if (var3 == 5) { + this.mVerifier = new nsVerifier[]{new nsUTF8Verifier(), new nsEUCKRVerifier(), new nsISO2022KRVerifier(), new nsCP1252Verifier(), new nsUCS2BEVerifier(), new nsUCS2LEVerifier()}; + } else if (var3 == 3) { + this.mVerifier = new nsVerifier[]{new nsUTF8Verifier(), new nsGB2312Verifier(), new nsGB18030Verifier(), new nsISO2022CNVerifier(), new nsHZVerifier(), new nsCP1252Verifier(), new nsUCS2BEVerifier(), new nsUCS2LEVerifier()}; + } else if (var3 == 1) { + this.mVerifier = new nsVerifier[]{new nsUTF8Verifier(), new nsSJISVerifier(), new nsEUCJPVerifier(), new nsISO2022JPVerifier(), new nsCP1252Verifier(), new nsUCS2BEVerifier(), new nsUCS2LEVerifier()}; + } else if (var3 == 2) { + this.mVerifier = new nsVerifier[]{new nsUTF8Verifier(), new nsGB2312Verifier(), new nsGB18030Verifier(), new nsBIG5Verifier(), new nsISO2022CNVerifier(), new nsHZVerifier(), new nsEUCTWVerifier(), new nsCP1252Verifier(), new nsUCS2BEVerifier(), new nsUCS2LEVerifier()}; + this.mStatisticsData = new nsEUCStatistics[]{null, new GB2312Statistics(), null, new Big5Statistics(), null, null, new EUCTWStatistics(), null, null, null}; + } else if (var3 == 0) { + this.mVerifier = new nsVerifier[]{new nsUTF8Verifier(), new nsSJISVerifier(), new nsEUCJPVerifier(), new nsISO2022JPVerifier(), new nsEUCKRVerifier(), new nsISO2022KRVerifier(), new nsBIG5Verifier(), new nsEUCTWVerifier(), new nsGB2312Verifier(), new nsGB18030Verifier(), new nsISO2022CNVerifier(), new nsHZVerifier(), new nsCP1252Verifier(), new nsUCS2BEVerifier(), new nsUCS2LEVerifier()}; + this.mStatisticsData = new nsEUCStatistics[]{null, null, new EUCJPStatistics(), null, new EUCKRStatistics(), null, new Big5Statistics(), new EUCTWStatistics(), new GB2312Statistics(), null, null, null, null, null, null}; + } + + this.mClassRunSampler = this.mStatisticsData != null; + this.mClassItems = this.mVerifier.length; + } + + public abstract void Report(String var1); + + public boolean HandleData(byte[] var1, int var2) { + for (int var3 = 0; var3 < var2; ++var3) { + byte var5 = var1[var3]; + int var4 = 0; + + while (var4 < this.mItems) { + byte var6 = nsVerifier.getNextState(this.mVerifier[this.mItemIdx[var4]], var5, this.mState[var4]); + if (var6 == 2) { + this.Report(this.mVerifier[this.mItemIdx[var4]].charset()); + this.mDone = true; + return this.mDone; + } + + if (var6 == 1) { + --this.mItems; + if (var4 < this.mItems) { + this.mItemIdx[var4] = this.mItemIdx[this.mItems]; + this.mState[var4] = this.mState[this.mItems]; + } + } else { + this.mState[var4++] = var6; + } + } + + if (this.mItems <= 1) { + if (1 == this.mItems) { + this.Report(this.mVerifier[this.mItemIdx[0]].charset()); + } + + this.mDone = true; + return this.mDone; + } + + int var7 = 0; + int var8 = 0; + + for (var4 = 0; var4 < this.mItems; ++var4) { + if (!this.mVerifier[this.mItemIdx[var4]].isUCS2() && !this.mVerifier[this.mItemIdx[var4]].isUCS2()) { + ++var7; + var8 = var4; + } + } + + if (1 == var7) { + this.Report(this.mVerifier[this.mItemIdx[var8]].charset()); + this.mDone = true; + return this.mDone; + } + } + + if (this.mRunSampler) { + this.Sample(var1, var2); + } + + return this.mDone; + } + + public void DataEnd() { + if (!this.mDone) { + if (this.mItems == 2) { + if (this.mVerifier[this.mItemIdx[0]].charset().equals("GB18030")) { + this.Report(this.mVerifier[this.mItemIdx[1]].charset()); + this.mDone = true; + } else if (this.mVerifier[this.mItemIdx[1]].charset().equals("GB18030")) { + this.Report(this.mVerifier[this.mItemIdx[0]].charset()); + this.mDone = true; + } + } + + if (this.mRunSampler) { + this.Sample((byte[]) null, 0, true); + } + + } + } + + public void Sample(byte[] var1, int var2) { + this.Sample(var1, var2, false); + } + + public void Sample(byte[] var1, int var2, boolean var3) { + int var4 = 0; + int var6 = 0; + + int var5; + for (var5 = 0; var5 < this.mItems; ++var5) { + if (null != this.mStatisticsData[this.mItemIdx[var5]]) { + ++var6; + } + + if (!this.mVerifier[this.mItemIdx[var5]].isUCS2() && !this.mVerifier[this.mItemIdx[var5]].charset().equals("GB18030")) { + ++var4; + } + } + + this.mRunSampler = var6 > 1; + if (this.mRunSampler) { + this.mRunSampler = this.mSampler.Sample(var1, var2); + if ((var3 && this.mSampler.GetSomeData() || this.mSampler.EnoughData()) && var6 == var4) { + this.mSampler.CalFreq(); + int var7 = -1; + int var8 = 0; + float var9 = 0.0F; + + for (var5 = 0; var5 < this.mItems; ++var5) { + if (null != this.mStatisticsData[this.mItemIdx[var5]] && !this.mVerifier[this.mItemIdx[var5]].charset().equals("Big5")) { + float var10 = this.mSampler.GetScore(this.mStatisticsData[this.mItemIdx[var5]].mFirstByteFreq(), this.mStatisticsData[this.mItemIdx[var5]].mFirstByteWeight(), this.mStatisticsData[this.mItemIdx[var5]].mSecondByteFreq(), this.mStatisticsData[this.mItemIdx[var5]].mSecondByteWeight()); + if (0 == var8++ || var9 > var10) { + var9 = var10; + var7 = var5; + } + } + } + + if (var7 >= 0) { + this.Report(this.mVerifier[this.mItemIdx[var7]].charset()); + this.mDone = true; + } + } + } + + } + + public String[] getProbableCharsets() { + String[] var1; + if (this.mItems <= 0) { + var1 = new String[]{"nomatch"}; + return var1; + } else { + var1 = new String[this.mItems]; + + for (int var2 = 0; var2 < this.mItems; ++var2) { + var1[var2] = this.mVerifier[this.mItemIdx[var2]].charset(); + } + + return var1; + } + } + } + + /** + * + */ + public static interface nsICharsetDetectionObserver { + void Notify(String var1); + } + + /** + * + */ + public static interface nsICharsetDetector { + void Init(nsICharsetDetectionObserver var1); + + boolean DoIt(byte[] var1, int var2, boolean var3); + + void Done(); + } + + /** + * + */ + public static abstract class nsVerifier { + static final byte eStart = 0; + static final byte eError = 1; + static final byte eItsMe = 2; + static final int eidxSft4bits = 3; + static final int eSftMsk4bits = 7; + static final int eBitSft4bits = 2; + static final int eUnitMsk4bits = 15; + + nsVerifier() { + } + + public abstract String charset(); + + public abstract int stFactor(); + + public abstract int[] cclass(); + + public abstract int[] states(); + + public abstract boolean isUCS2(); + + public static byte getNextState(nsVerifier var0, byte var1, byte var2) { + return (byte) (255 & var0.states()[(var2 * var0.stFactor() + (var0.cclass()[(var1 & 255) >> 3] >> ((var1 & 7) << 2) & 15) & 255) >> 3] >> ((var2 * var0.stFactor() + (var0.cclass()[(var1 & 255) >> 3] >> ((var1 & 7) << 2) & 15) & 255 & 7) << 2) & 15); + } + } + + /** + * + */ + public static class nsEUCSampler { + int mTotal = 0; + int mThreshold = 200; + int mState = 0; + public int[] mFirstByteCnt = new int[94]; + public int[] mSecondByteCnt = new int[94]; + public float[] mFirstByteFreq = new float[94]; + public float[] mSecondByteFreq = new float[94]; + + public nsEUCSampler() { + this.Reset(); + } + + public void Reset() { + this.mTotal = 0; + this.mState = 0; + + for (int var1 = 0; var1 < 94; ++var1) { + this.mFirstByteCnt[var1] = this.mSecondByteCnt[var1] = 0; + } + + } + + boolean EnoughData() { + return this.mTotal > this.mThreshold; + } + + boolean GetSomeData() { + return this.mTotal > 1; + } + + boolean Sample(byte[] var1, int var2) { + if (this.mState == 1) { + return false; + } else { + int var3 = 0; + + for (int var4 = 0; var4 < var2 && 1 != this.mState; ++var3) { + int var10002; + switch (this.mState) { + case 0: + if ((var1[var3] & 128) != 0) { + if (255 != (255 & var1[var3]) && 161 <= (255 & var1[var3])) { + ++this.mTotal; + var10002 = this.mFirstByteCnt[(255 & var1[var3]) - 161]++; + this.mState = 2; + } else { + this.mState = 1; + } + } + case 1: + break; + case 2: + if ((var1[var3] & 128) != 0) { + if (255 != (255 & var1[var3]) && 161 <= (255 & var1[var3])) { + ++this.mTotal; + var10002 = this.mSecondByteCnt[(255 & var1[var3]) - 161]++; + this.mState = 0; + } else { + this.mState = 1; + } + } else { + this.mState = 1; + } + break; + default: + this.mState = 1; + } + + ++var4; + } + + return 1 != this.mState; + } + } + + void CalFreq() { + for (int var1 = 0; var1 < 94; ++var1) { + this.mFirstByteFreq[var1] = (float) this.mFirstByteCnt[var1] / (float) this.mTotal; + this.mSecondByteFreq[var1] = (float) this.mSecondByteCnt[var1] / (float) this.mTotal; + } + + } + + float GetScore(float[] var1, float var2, float[] var3, float var4) { + return var2 * this.GetScore(var1, this.mFirstByteFreq) + var4 * this.GetScore(var3, this.mSecondByteFreq); + } + + float GetScore(float[] var1, float[] var2) { + float var4 = 0.0F; + + for (int var5 = 0; var5 < 94; ++var5) { + float var3 = var1[var5] - var2[var5]; + var4 += var3 * var3; + } + + return (float) Math.sqrt((double) var4) / 94.0F; + } + } + + /** + * + */ + public static abstract class nsEUCStatistics { + public abstract float[] mFirstByteFreq(); + + public abstract float mFirstByteStdDev(); + + public abstract float mFirstByteMean(); + + public abstract float mFirstByteWeight(); + + public abstract float[] mSecondByteFreq(); + + public abstract float mSecondByteStdDev(); + + public abstract float mSecondByteMean(); + + public abstract float mSecondByteWeight(); + + public nsEUCStatistics() { + } + } + + /** + * + */ + public static class EUCJPStatistics extends nsEUCStatistics { + static float[] mFirstByteFreq; + static float mFirstByteStdDev; + static float mFirstByteMean; + static float mFirstByteWeight; + static float[] mSecondByteFreq; + static float mSecondByteStdDev; + static float mSecondByteMean; + static float mSecondByteWeight; + + public float[] mFirstByteFreq() { + return mFirstByteFreq; + } + + public float mFirstByteStdDev() { + return mFirstByteStdDev; + } + + public float mFirstByteMean() { + return mFirstByteMean; + } + + public float mFirstByteWeight() { + return mFirstByteWeight; + } + + public float[] mSecondByteFreq() { + return mSecondByteFreq; + } + + public float mSecondByteStdDev() { + return mSecondByteStdDev; + } + + public float mSecondByteMean() { + return mSecondByteMean; + } + + public float mSecondByteWeight() { + return mSecondByteWeight; + } + + public EUCJPStatistics() { + mFirstByteFreq = new float[]{0.364808F, 0.0F, 0.0F, 0.145325F, 0.304891F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.001835F, 0.010771F, 0.006462F, 0.001157F, 0.002114F, 0.003231F, 0.001356F, 0.00742F, 0.004189F, 0.003231F, 0.003032F, 0.03319F, 0.006303F, 0.006064F, 0.009973F, 0.002354F, 0.00367F, 0.009135F, 0.001675F, 0.002792F, 0.002194F, 0.01472F, 0.011928F, 8.78E-4F, 0.013124F, 0.001077F, 0.009295F, 0.003471F, 0.002872F, 0.002433F, 9.57E-4F, 0.001636F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 8.0E-5F, 2.79E-4F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 8.0E-5F, 0.0F}; + mFirstByteStdDev = 0.050407F; + mFirstByteMean = 0.010638F; + mFirstByteWeight = 0.640871F; + mSecondByteFreq = new float[]{0.002473F, 0.039134F, 0.152745F, 0.009694F, 3.59E-4F, 0.02218F, 7.58E-4F, 0.004308F, 1.6E-4F, 0.002513F, 0.003072F, 0.001316F, 0.00383F, 0.001037F, 0.00359F, 9.57E-4F, 1.6E-4F, 2.39E-4F, 0.006462F, 0.001596F, 0.031554F, 0.001316F, 0.002194F, 0.016555F, 0.003271F, 6.78E-4F, 5.98E-4F, 0.206438F, 7.18E-4F, 0.001077F, 0.00371F, 0.001356F, 0.001356F, 4.39E-4F, 0.004388F, 0.005704F, 8.78E-4F, 0.010172F, 0.007061F, 0.01468F, 6.38E-4F, 0.02573F, 0.002792F, 7.18E-4F, 0.001795F, 0.091551F, 7.58E-4F, 0.003909F, 5.58E-4F, 0.031195F, 0.007061F, 0.001316F, 0.022579F, 0.006981F, 0.00726F, 0.001117F, 2.39E-4F, 0.012127F, 8.78E-4F, 0.00379F, 0.001077F, 7.58E-4F, 0.002114F, 0.002234F, 6.78E-4F, 0.002992F, 0.003311F, 0.023416F, 0.001237F, 0.002753F, 0.005146F, 0.002194F, 0.007021F, 0.008497F, 0.013763F, 0.011768F, 0.006303F, 0.001915F, 6.38E-4F, 0.008776F, 9.18E-4F, 0.003431F, 0.057603F, 4.39E-4F, 4.39E-4F, 7.58E-4F, 0.002872F, 0.001675F, 0.01105F, 0.0F, 2.79E-4F, 0.012127F, 7.18E-4F, 0.00738F}; + mSecondByteStdDev = 0.028247F; + mSecondByteMean = 0.010638F; + mSecondByteWeight = 0.359129F; + } + } + + /** + * + */ + public static class nsEUCJPVerifier extends nsVerifier { + static int[] cclass; + static int[] states; + static int stFactor; + static String charset; + + public int[] cclass() { + return cclass; + } + + public int[] states() { + return states; + } + + public int stFactor() { + return stFactor; + } + + public String charset() { + return charset; + } + + public nsEUCJPVerifier() { + cclass = new int[32]; + cclass[0] = 1145324612; + cclass[1] = 1430537284; + cclass[2] = 1145324612; + cclass[3] = 1145328708; + cclass[4] = 1145324612; + cclass[5] = 1145324612; + cclass[6] = 1145324612; + cclass[7] = 1145324612; + cclass[8] = 1145324612; + cclass[9] = 1145324612; + cclass[10] = 1145324612; + cclass[11] = 1145324612; + cclass[12] = 1145324612; + cclass[13] = 1145324612; + cclass[14] = 1145324612; + cclass[15] = 1145324612; + cclass[16] = 1431655765; + cclass[17] = 827675989; + cclass[18] = 1431655765; + cclass[19] = 1431655765; + cclass[20] = 572662309; + cclass[21] = 572662306; + cclass[22] = 572662306; + cclass[23] = 572662306; + cclass[24] = 572662306; + cclass[25] = 572662306; + cclass[26] = 572662306; + cclass[27] = 572662306; + cclass[28] = 0; + cclass[29] = 0; + cclass[30] = 0; + cclass[31] = 1342177280; + states = new int[5]; + states[0] = 286282563; + states[1] = 572657937; + states[2] = 286265378; + states[3] = 319885329; + states[4] = 4371; + charset = "EUC-JP"; + stFactor = 6; + } + + public boolean isUCS2() { + return false; + } + } + + /** + * + */ + public static class EUCKRStatistics extends nsEUCStatistics { + static float[] mFirstByteFreq; + static float mFirstByteStdDev; + static float mFirstByteMean; + static float mFirstByteWeight; + static float[] mSecondByteFreq; + static float mSecondByteStdDev; + static float mSecondByteMean; + static float mSecondByteWeight; + + public float[] mFirstByteFreq() { + return mFirstByteFreq; + } + + public float mFirstByteStdDev() { + return mFirstByteStdDev; + } + + public float mFirstByteMean() { + return mFirstByteMean; + } + + public float mFirstByteWeight() { + return mFirstByteWeight; + } + + public float[] mSecondByteFreq() { + return mSecondByteFreq; + } + + public float mSecondByteStdDev() { + return mSecondByteStdDev; + } + + public float mSecondByteMean() { + return mSecondByteMean; + } + + public float mSecondByteWeight() { + return mSecondByteWeight; + } + + public EUCKRStatistics() { + mFirstByteFreq = new float[]{0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 4.12E-4F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.057502F, 0.033182F, 0.002267F, 0.016076F, 0.014633F, 0.032976F, 0.004122F, 0.011336F, 0.058533F, 0.024526F, 0.025969F, 0.054411F, 0.01958F, 0.063273F, 0.113974F, 0.029885F, 0.150041F, 0.059151F, 0.002679F, 0.009893F, 0.014839F, 0.026381F, 0.015045F, 0.069456F, 0.08986F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F}; + mFirstByteStdDev = 0.025593F; + mFirstByteMean = 0.010638F; + mFirstByteWeight = 0.647437F; + mSecondByteFreq = new float[]{0.016694F, 0.0F, 0.012778F, 0.030091F, 0.002679F, 0.006595F, 0.001855F, 8.24E-4F, 0.005977F, 0.00474F, 0.003092F, 8.24E-4F, 0.01958F, 0.037304F, 0.008244F, 0.014633F, 0.001031F, 0.0F, 0.003298F, 0.002061F, 0.006183F, 0.005977F, 8.24E-4F, 0.021847F, 0.014839F, 0.052968F, 0.017312F, 0.007626F, 4.12E-4F, 8.24E-4F, 0.011129F, 0.0F, 4.12E-4F, 0.001649F, 0.005977F, 0.065746F, 0.020198F, 0.021434F, 0.014633F, 0.004122F, 0.001649F, 8.24E-4F, 8.24E-4F, 0.051937F, 0.01958F, 0.023289F, 0.026381F, 0.040396F, 0.009068F, 0.001443F, 0.00371F, 0.00742F, 0.001443F, 0.01319F, 0.002885F, 4.12E-4F, 0.003298F, 0.025969F, 4.12E-4F, 4.12E-4F, 0.006183F, 0.003298F, 0.066983F, 0.002679F, 0.002267F, 0.011129F, 4.12E-4F, 0.010099F, 0.015251F, 0.007626F, 0.043899F, 0.00371F, 0.002679F, 0.001443F, 0.010923F, 0.002885F, 0.009068F, 0.019992F, 4.12E-4F, 0.00845F, 0.005153F, 0.0F, 0.010099F, 0.0F, 0.001649F, 0.01216F, 0.011542F, 0.006595F, 0.001855F, 0.010923F, 4.12E-4F, 0.023702F, 0.00371F, 0.001855F}; + mSecondByteStdDev = 0.013937F; + mSecondByteMean = 0.010638F; + mSecondByteWeight = 0.352563F; + } + } + + /** + * + */ + public static class nsEUCKRVerifier extends nsVerifier { + static int[] cclass; + static int[] states; + static int stFactor; + static String charset; + + public int[] cclass() { + return cclass; + } + + public int[] states() { + return states; + } + + public int stFactor() { + return stFactor; + } + + public String charset() { + return charset; + } + + public nsEUCKRVerifier() { + cclass = new int[32]; + cclass[0] = 286331153; + cclass[1] = 1118481; + cclass[2] = 286331153; + cclass[3] = 286327057; + cclass[4] = 286331153; + cclass[5] = 286331153; + cclass[6] = 286331153; + cclass[7] = 286331153; + cclass[8] = 286331153; + cclass[9] = 286331153; + cclass[10] = 286331153; + cclass[11] = 286331153; + cclass[12] = 286331153; + cclass[13] = 286331153; + cclass[14] = 286331153; + cclass[15] = 286331153; + cclass[16] = 0; + cclass[17] = 0; + cclass[18] = 0; + cclass[19] = 0; + cclass[20] = 572662304; + cclass[21] = 858923554; + cclass[22] = 572662306; + cclass[23] = 572662306; + cclass[24] = 572662306; + cclass[25] = 572662322; + cclass[26] = 572662306; + cclass[27] = 572662306; + cclass[28] = 572662306; + cclass[29] = 572662306; + cclass[30] = 572662306; + cclass[31] = 35791394; + states = new int[2]; + states[0] = 286331649; + states[1] = 1122850; + charset = "EUC-KR"; + stFactor = 4; + } + + public boolean isUCS2() { + return false; + } + } + + /** + * + */ + public static class EUCTWStatistics extends nsEUCStatistics { + static float[] mFirstByteFreq; + static float mFirstByteStdDev; + static float mFirstByteMean; + static float mFirstByteWeight; + static float[] mSecondByteFreq; + static float mSecondByteStdDev; + static float mSecondByteMean; + static float mSecondByteWeight; + + public float[] mFirstByteFreq() { + return mFirstByteFreq; + } + + public float mFirstByteStdDev() { + return mFirstByteStdDev; + } + + public float mFirstByteMean() { + return mFirstByteMean; + } + + public float mFirstByteWeight() { + return mFirstByteWeight; + } + + public float[] mSecondByteFreq() { + return mSecondByteFreq; + } + + public float mSecondByteStdDev() { + return mSecondByteStdDev; + } + + public float mSecondByteMean() { + return mSecondByteMean; + } + + public float mSecondByteWeight() { + return mSecondByteWeight; + } + + public EUCTWStatistics() { + mFirstByteFreq = new float[]{0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.119286F, 0.052233F, 0.044126F, 0.052494F, 0.045906F, 0.019038F, 0.032465F, 0.026252F, 0.025502F, 0.015963F, 0.052493F, 0.019256F, 0.015137F, 0.031782F, 0.01737F, 0.018494F, 0.015575F, 0.016621F, 0.007444F, 0.011642F, 0.013916F, 0.019159F, 0.016445F, 0.007851F, 0.011079F, 0.022842F, 0.015513F, 0.010033F, 0.00995F, 0.010347F, 0.013103F, 0.015371F, 0.012502F, 0.007436F, 0.018253F, 0.014134F, 0.008907F, 0.005411F, 0.00957F, 0.013598F, 0.006092F, 0.007409F, 0.008432F, 0.005816F, 0.009349F, 0.005472F, 0.00717F, 0.00742F, 0.003681F, 0.007523F, 0.00461F, 0.006154F, 0.003348F, 0.005074F, 0.005922F, 0.005254F, 0.004682F, 0.002093F, 0.0F}; + mFirstByteStdDev = 0.016681F; + mFirstByteMean = 0.010638F; + mFirstByteWeight = 0.715599F; + mSecondByteFreq = new float[]{0.028933F, 0.011371F, 0.011053F, 0.007232F, 0.010192F, 0.004093F, 0.015043F, 0.011752F, 0.022387F, 0.00841F, 0.012448F, 0.007473F, 0.003594F, 0.007139F, 0.018912F, 0.006083F, 0.003302F, 0.010215F, 0.008791F, 0.024236F, 0.014107F, 0.014108F, 0.010303F, 0.009728F, 0.007877F, 0.009719F, 0.007952F, 0.021028F, 0.005764F, 0.009341F, 0.006591F, 0.012517F, 0.005921F, 0.008982F, 0.008771F, 0.012802F, 0.005926F, 0.008342F, 0.003086F, 0.006843F, 0.007576F, 0.004734F, 0.016404F, 0.008803F, 0.008071F, 0.005349F, 0.008566F, 0.01084F, 0.015401F, 0.031904F, 0.00867F, 0.011479F, 0.010936F, 0.007617F, 0.008995F, 0.008114F, 0.008658F, 0.005934F, 0.010452F, 0.009142F, 0.004519F, 0.008339F, 0.007476F, 0.007027F, 0.006025F, 0.021804F, 0.024248F, 0.015895F, 0.003768F, 0.010171F, 0.010007F, 0.010178F, 0.008316F, 0.006832F, 0.006364F, 0.009141F, 0.009148F, 0.012081F, 0.011914F, 0.004464F, 0.014257F, 0.006907F, 0.011292F, 0.018622F, 0.008149F, 0.004636F, 0.006612F, 0.013478F, 0.012614F, 0.005186F, 0.048285F, 0.006816F, 0.006743F, 0.008671F}; + mSecondByteStdDev = 0.00663F; + mSecondByteMean = 0.010638F; + mSecondByteWeight = 0.284401F; + } + } + + /** + * + */ + public static class nsEUCTWVerifier extends nsVerifier { + static int[] cclass; + static int[] states; + static int stFactor; + static String charset; + + public int[] cclass() { + return cclass; + } + + public int[] states() { + return states; + } + + public int stFactor() { + return stFactor; + } + + public String charset() { + return charset; + } + + public nsEUCTWVerifier() { + cclass = new int[32]; + cclass[0] = 572662306; + cclass[1] = 2236962; + cclass[2] = 572662306; + cclass[3] = 572654114; + cclass[4] = 572662306; + cclass[5] = 572662306; + cclass[6] = 572662306; + cclass[7] = 572662306; + cclass[8] = 572662306; + cclass[9] = 572662306; + cclass[10] = 572662306; + cclass[11] = 572662306; + cclass[12] = 572662306; + cclass[13] = 572662306; + cclass[14] = 572662306; + cclass[15] = 572662306; + cclass[16] = 0; + cclass[17] = 100663296; + cclass[18] = 0; + cclass[19] = 0; + cclass[20] = 1145324592; + cclass[21] = 286331221; + cclass[22] = 286331153; + cclass[23] = 286331153; + cclass[24] = 858985233; + cclass[25] = 858993459; + cclass[26] = 858993459; + cclass[27] = 858993459; + cclass[28] = 858993459; + cclass[29] = 858993459; + cclass[30] = 858993459; + cclass[31] = 53687091; + states = new int[6]; + states[0] = 338898961; + states[1] = 571543825; + states[2] = 269623842; + states[3] = 286330880; + states[4] = 1052949; + states[5] = 16; + charset = "x-euc-tw"; + stFactor = 7; + } + + public boolean isUCS2() { + return false; + } + } + + /** + * + */ + public static class Big5Statistics extends nsEUCStatistics { + static float[] mFirstByteFreq; + static float mFirstByteStdDev; + static float mFirstByteMean; + static float mFirstByteWeight; + static float[] mSecondByteFreq; + static float mSecondByteStdDev; + static float mSecondByteMean; + static float mSecondByteWeight; + + public float[] mFirstByteFreq() { + return mFirstByteFreq; + } + + public float mFirstByteStdDev() { + return mFirstByteStdDev; + } + + public float mFirstByteMean() { + return mFirstByteMean; + } + + public float mFirstByteWeight() { + return mFirstByteWeight; + } + + public float[] mSecondByteFreq() { + return mSecondByteFreq; + } + + public float mSecondByteStdDev() { + return mSecondByteStdDev; + } + + public float mSecondByteMean() { + return mSecondByteMean; + } + + public float mSecondByteWeight() { + return mSecondByteWeight; + } + + public Big5Statistics() { + mFirstByteFreq = new float[]{0.0F, 0.0F, 0.0F, 0.114427F, 0.061058F, 0.075598F, 0.048386F, 0.063966F, 0.027094F, 0.095787F, 0.029525F, 0.031331F, 0.036915F, 0.021805F, 0.019349F, 0.037496F, 0.018068F, 0.01276F, 0.030053F, 0.017339F, 0.016731F, 0.019501F, 0.01124F, 0.032973F, 0.016658F, 0.015872F, 0.021458F, 0.012378F, 0.017003F, 0.020802F, 0.012454F, 0.009239F, 0.012829F, 0.007922F, 0.010079F, 0.009815F, 0.010104F, 0.0F, 0.0F, 0.0F, 5.3E-5F, 3.5E-5F, 1.05E-4F, 3.1E-5F, 8.8E-5F, 2.7E-5F, 2.7E-5F, 2.6E-5F, 3.5E-5F, 2.4E-5F, 3.4E-5F, 3.75E-4F, 2.5E-5F, 2.8E-5F, 2.0E-5F, 2.4E-5F, 2.8E-5F, 3.1E-5F, 5.9E-5F, 4.0E-5F, 3.0E-5F, 7.9E-5F, 3.7E-5F, 4.0E-5F, 2.3E-5F, 3.0E-5F, 2.7E-5F, 6.4E-5F, 2.0E-5F, 2.7E-5F, 2.5E-5F, 7.4E-5F, 1.9E-5F, 2.3E-5F, 2.1E-5F, 1.8E-5F, 1.7E-5F, 3.5E-5F, 2.1E-5F, 1.9E-5F, 2.5E-5F, 1.7E-5F, 3.7E-5F, 1.8E-5F, 1.8E-5F, 1.9E-5F, 2.2E-5F, 3.3E-5F, 3.2E-5F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F}; + mFirstByteStdDev = 0.020606F; + mFirstByteMean = 0.010638F; + mFirstByteWeight = 0.675261F; + mSecondByteFreq = new float[]{0.020256F, 0.003293F, 0.045811F, 0.01665F, 0.007066F, 0.004146F, 0.009229F, 0.007333F, 0.003296F, 0.005239F, 0.008282F, 0.003791F, 0.006116F, 0.003536F, 0.004024F, 0.016654F, 0.009334F, 0.005429F, 0.033392F, 0.006121F, 0.008983F, 0.002801F, 0.004221F, 0.010357F, 0.014695F, 0.077937F, 0.006314F, 0.00402F, 0.007331F, 0.00715F, 0.005341F, 0.009195F, 0.00535F, 0.005698F, 0.004472F, 0.007242F, 0.004039F, 0.011154F, 0.016184F, 0.004741F, 0.012814F, 0.007679F, 0.008045F, 0.016631F, 0.009451F, 0.016487F, 0.007287F, 0.012688F, 0.017421F, 0.013205F, 0.03148F, 0.003404F, 0.009149F, 0.008921F, 0.007514F, 0.008683F, 0.008203F, 0.031403F, 0.011733F, 0.015617F, 0.015306F, 0.004004F, 0.010899F, 0.009961F, 0.008388F, 0.01092F, 0.003925F, 0.008585F, 0.009108F, 0.015546F, 0.004659F, 0.006934F, 0.007023F, 0.020252F, 0.005387F, 0.024704F, 0.006963F, 0.002625F, 0.009512F, 0.002971F, 0.008233F, 0.01F, 0.011973F, 0.010553F, 0.005945F, 0.006349F, 0.009401F, 0.008577F, 0.008186F, 0.008159F, 0.005033F, 0.008714F, 0.010614F, 0.006554F}; + mSecondByteStdDev = 0.009909F; + mSecondByteMean = 0.010638F; + mSecondByteWeight = 0.324739F; + } + } + + /** + * + */ + public static class nsBIG5Verifier extends nsVerifier { + static int[] cclass; + static int[] states; + static int stFactor; + static String charset; + + public int[] cclass() { + return cclass; + } + + public int[] states() { + return states; + } + + public int stFactor() { + return stFactor; + } + + public String charset() { + return charset; + } + + public nsBIG5Verifier() { + cclass = new int[32]; + cclass[0] = 286331153; + cclass[1] = 1118481; + cclass[2] = 286331153; + cclass[3] = 286327057; + cclass[4] = 286331153; + cclass[5] = 286331153; + cclass[6] = 286331153; + cclass[7] = 286331153; + cclass[8] = 572662306; + cclass[9] = 572662306; + cclass[10] = 572662306; + cclass[11] = 572662306; + cclass[12] = 572662306; + cclass[13] = 572662306; + cclass[14] = 572662306; + cclass[15] = 304226850; + cclass[16] = 1145324612; + cclass[17] = 1145324612; + cclass[18] = 1145324612; + cclass[19] = 1145324612; + cclass[20] = 858993460; + cclass[21] = 858993459; + cclass[22] = 858993459; + cclass[23] = 858993459; + cclass[24] = 858993459; + cclass[25] = 858993459; + cclass[26] = 858993459; + cclass[27] = 858993459; + cclass[28] = 858993459; + cclass[29] = 858993459; + cclass[30] = 858993459; + cclass[31] = 53687091; + states = new int[3]; + states[0] = 286339073; + states[1] = 304226833; + states[2] = 1; + charset = "Big5"; + stFactor = 5; + } + + public boolean isUCS2() { + return false; + } + } + + /** + * + */ + public static class GB2312Statistics extends nsEUCStatistics { + static float[] mFirstByteFreq; + static float mFirstByteStdDev; + static float mFirstByteMean; + static float mFirstByteWeight; + static float[] mSecondByteFreq; + static float mSecondByteStdDev; + static float mSecondByteMean; + static float mSecondByteWeight; + + public float[] mFirstByteFreq() { + return mFirstByteFreq; + } + + public float mFirstByteStdDev() { + return mFirstByteStdDev; + } + + public float mFirstByteMean() { + return mFirstByteMean; + } + + public float mFirstByteWeight() { + return mFirstByteWeight; + } + + public float[] mSecondByteFreq() { + return mSecondByteFreq; + } + + public float mSecondByteStdDev() { + return mSecondByteStdDev; + } + + public float mSecondByteMean() { + return mSecondByteMean; + } + + public float mSecondByteWeight() { + return mSecondByteWeight; + } + + public GB2312Statistics() { + mFirstByteFreq = new float[]{0.011628F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.011628F, 0.012403F, 0.009302F, 0.003876F, 0.017829F, 0.037209F, 0.008527F, 0.010078F, 0.01938F, 0.054264F, 0.010078F, 0.041085F, 0.02093F, 0.018605F, 0.010078F, 0.013178F, 0.016279F, 0.006202F, 0.009302F, 0.017054F, 0.011628F, 0.008527F, 0.004651F, 0.006202F, 0.017829F, 0.024806F, 0.020155F, 0.013953F, 0.032558F, 0.035659F, 0.068217F, 0.010853F, 0.036434F, 0.117054F, 0.027907F, 0.100775F, 0.010078F, 0.017829F, 0.062016F, 0.012403F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.00155F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F}; + mFirstByteStdDev = 0.020081F; + mFirstByteMean = 0.010638F; + mFirstByteWeight = 0.586533F; + mSecondByteFreq = new float[]{0.006202F, 0.031008F, 0.005426F, 0.003101F, 0.00155F, 0.003101F, 0.082171F, 0.014729F, 0.006977F, 0.00155F, 0.013953F, 0.0F, 0.013953F, 0.010078F, 0.008527F, 0.006977F, 0.004651F, 0.003101F, 0.003101F, 0.003101F, 0.008527F, 0.003101F, 0.005426F, 0.005426F, 0.005426F, 0.003101F, 0.00155F, 0.006202F, 0.014729F, 0.010853F, 0.0F, 0.011628F, 0.0F, 0.031783F, 0.013953F, 0.030233F, 0.039535F, 0.008527F, 0.015504F, 0.0F, 0.003101F, 0.008527F, 0.016279F, 0.005426F, 0.00155F, 0.013953F, 0.013953F, 0.044961F, 0.003101F, 0.004651F, 0.006977F, 0.00155F, 0.005426F, 0.012403F, 0.00155F, 0.015504F, 0.0F, 0.006202F, 0.00155F, 0.0F, 0.007752F, 0.006977F, 0.00155F, 0.009302F, 0.011628F, 0.004651F, 0.010853F, 0.012403F, 0.017829F, 0.005426F, 0.024806F, 0.0F, 0.006202F, 0.0F, 0.082171F, 0.015504F, 0.004651F, 0.0F, 0.006977F, 0.004651F, 0.0F, 0.008527F, 0.012403F, 0.004651F, 0.003876F, 0.003101F, 0.022481F, 0.024031F, 0.00155F, 0.047287F, 0.009302F, 0.00155F, 0.005426F, 0.017054F}; + mSecondByteStdDev = 0.014156F; + mSecondByteMean = 0.010638F; + mSecondByteWeight = 0.413467F; + } + } + + /** + * + */ + public static class nsGB2312Verifier extends nsVerifier { + static int[] cclass; + static int[] states; + static int stFactor; + static String charset; + + public int[] cclass() { + return cclass; + } + + public int[] states() { + return states; + } + + public int stFactor() { + return stFactor; + } + + public String charset() { + return charset; + } + + public nsGB2312Verifier() { + cclass = new int[32]; + cclass[0] = 286331153; + cclass[1] = 1118481; + cclass[2] = 286331153; + cclass[3] = 286327057; + cclass[4] = 286331153; + cclass[5] = 286331153; + cclass[6] = 286331153; + cclass[7] = 286331153; + cclass[8] = 286331153; + cclass[9] = 286331153; + cclass[10] = 286331153; + cclass[11] = 286331153; + cclass[12] = 286331153; + cclass[13] = 286331153; + cclass[14] = 286331153; + cclass[15] = 286331153; + cclass[16] = 0; + cclass[17] = 0; + cclass[18] = 0; + cclass[19] = 0; + cclass[20] = 572662304; + cclass[21] = 858993442; + cclass[22] = 572662306; + cclass[23] = 572662306; + cclass[24] = 572662306; + cclass[25] = 572662306; + cclass[26] = 572662306; + cclass[27] = 572662306; + cclass[28] = 572662306; + cclass[29] = 572662306; + cclass[30] = 572662306; + cclass[31] = 35791394; + states = new int[2]; + states[0] = 286331649; + states[1] = 1122850; + charset = "GB2312"; + stFactor = 4; + } + + public boolean isUCS2() { + return false; + } + } + + /** + * + */ + public static class nsGB18030Verifier extends nsVerifier { + static int[] cclass; + static int[] states; + static int stFactor; + static String charset; + + public int[] cclass() { + return cclass; + } + + public int[] states() { + return states; + } + + public int stFactor() { + return stFactor; + } + + public String charset() { + return charset; + } + + public nsGB18030Verifier() { + cclass = new int[32]; + cclass[0] = 286331153; + cclass[1] = 1118481; + cclass[2] = 286331153; + cclass[3] = 286327057; + cclass[4] = 286331153; + cclass[5] = 286331153; + cclass[6] = 858993459; + cclass[7] = 286331187; + cclass[8] = 572662306; + cclass[9] = 572662306; + cclass[10] = 572662306; + cclass[11] = 572662306; + cclass[12] = 572662306; + cclass[13] = 572662306; + cclass[14] = 572662306; + cclass[15] = 1109533218; + cclass[16] = 1717986917; + cclass[17] = 1717986918; + cclass[18] = 1717986918; + cclass[19] = 1717986918; + cclass[20] = 1717986918; + cclass[21] = 1717986918; + cclass[22] = 1717986918; + cclass[23] = 1717986918; + cclass[24] = 1717986918; + cclass[25] = 1717986918; + cclass[26] = 1717986918; + cclass[27] = 1717986918; + cclass[28] = 1717986918; + cclass[29] = 1717986918; + cclass[30] = 1717986918; + cclass[31] = 107374182; + states = new int[6]; + states[0] = 318767105; + states[1] = 571543825; + states[2] = 17965602; + states[3] = 286326804; + states[4] = 303109393; + states[5] = 17; + charset = "GB18030"; + stFactor = 7; + } + + public boolean isUCS2() { + return false; + } + } + + /** + * + */ + public static class nsISO2022CNVerifier extends nsVerifier { + static int[] cclass; + static int[] states; + static int stFactor; + static String charset; + + public int[] cclass() { + return cclass; + } + + public int[] states() { + return states; + } + + public int stFactor() { + return stFactor; + } + + public String charset() { + return charset; + } + + public nsISO2022CNVerifier() { + cclass = new int[32]; + cclass[0] = 2; + cclass[1] = 0; + cclass[2] = 0; + cclass[3] = 4096; + cclass[4] = 0; + cclass[5] = 48; + cclass[6] = 0; + cclass[7] = 0; + cclass[8] = 16384; + cclass[9] = 0; + cclass[10] = 0; + cclass[11] = 0; + cclass[12] = 0; + cclass[13] = 0; + cclass[14] = 0; + cclass[15] = 0; + cclass[16] = 572662306; + cclass[17] = 572662306; + cclass[18] = 572662306; + cclass[19] = 572662306; + cclass[20] = 572662306; + cclass[21] = 572662306; + cclass[22] = 572662306; + cclass[23] = 572662306; + cclass[24] = 572662306; + cclass[25] = 572662306; + cclass[26] = 572662306; + cclass[27] = 572662306; + cclass[28] = 572662306; + cclass[29] = 572662306; + cclass[30] = 572662306; + cclass[31] = 572662306; + states = new int[8]; + states[0] = 304; + states[1] = 286331152; + states[2] = 572662289; + states[3] = 336663074; + states[4] = 286335249; + states[5] = 286331237; + states[6] = 286335249; + states[7] = 18944273; + charset = "ISO-2022-CN"; + stFactor = 9; + } + + public boolean isUCS2() { + return false; + } + } + + /** + * + */ + public static class nsISO2022JPVerifier extends nsVerifier { + static int[] cclass; + static int[] states; + static int stFactor; + static String charset; + + public int[] cclass() { + return cclass; + } + + public int[] states() { + return states; + } + + public int stFactor() { + return stFactor; + } + + public String charset() { + return charset; + } + + public nsISO2022JPVerifier() { + cclass = new int[32]; + cclass[0] = 2; + cclass[1] = 570425344; + cclass[2] = 0; + cclass[3] = 4096; + cclass[4] = 458752; + cclass[5] = 3; + cclass[6] = 0; + cclass[7] = 0; + cclass[8] = 1030; + cclass[9] = 1280; + cclass[10] = 0; + cclass[11] = 0; + cclass[12] = 0; + cclass[13] = 0; + cclass[14] = 0; + cclass[15] = 0; + cclass[16] = 572662306; + cclass[17] = 572662306; + cclass[18] = 572662306; + cclass[19] = 572662306; + cclass[20] = 572662306; + cclass[21] = 572662306; + cclass[22] = 572662306; + cclass[23] = 572662306; + cclass[24] = 572662306; + cclass[25] = 572662306; + cclass[26] = 572662306; + cclass[27] = 572662306; + cclass[28] = 572662306; + cclass[29] = 572662306; + cclass[30] = 572662306; + cclass[31] = 572662306; + states = new int[6]; + states[0] = 304; + states[1] = 286331153; + states[2] = 572662306; + states[3] = 1091653905; + states[4] = 303173905; + states[5] = 287445265; + charset = "ISO-2022-JP"; + stFactor = 8; + } + + public boolean isUCS2() { + return false; + } + } + + /** + * + */ + public static class nsISO2022KRVerifier extends nsVerifier { + static int[] cclass; + static int[] states; + static int stFactor; + static String charset; + + public int[] cclass() { + return cclass; + } + + public int[] states() { + return states; + } + + public int stFactor() { + return stFactor; + } + + public String charset() { + return charset; + } + + public nsISO2022KRVerifier() { + cclass = new int[32]; + cclass[0] = 2; + cclass[1] = 0; + cclass[2] = 0; + cclass[3] = 4096; + cclass[4] = 196608; + cclass[5] = 64; + cclass[6] = 0; + cclass[7] = 0; + cclass[8] = 20480; + cclass[9] = 0; + cclass[10] = 0; + cclass[11] = 0; + cclass[12] = 0; + cclass[13] = 0; + cclass[14] = 0; + cclass[15] = 0; + cclass[16] = 572662306; + cclass[17] = 572662306; + cclass[18] = 572662306; + cclass[19] = 572662306; + cclass[20] = 572662306; + cclass[21] = 572662306; + cclass[22] = 572662306; + cclass[23] = 572662306; + cclass[24] = 572662306; + cclass[25] = 572662306; + cclass[26] = 572662306; + cclass[27] = 572662306; + cclass[28] = 572662306; + cclass[29] = 572662306; + cclass[30] = 572662306; + cclass[31] = 572662306; + states = new int[5]; + states[0] = 285212976; + states[1] = 572657937; + states[2] = 289476898; + states[3] = 286593297; + states[4] = 8465; + charset = "ISO-2022-KR"; + stFactor = 6; + } + + public boolean isUCS2() { + return false; + } + } + + /** + * + */ + public static class nsUCS2BEVerifier extends nsVerifier { + static int[] cclass; + static int[] states; + static int stFactor; + static String charset; + + public int[] cclass() { + return cclass; + } + + public int[] states() { + return states; + } + + public int stFactor() { + return stFactor; + } + + public String charset() { + return charset; + } + + public nsUCS2BEVerifier() { + cclass = new int[32]; + cclass[0] = 0; + cclass[1] = 2097408; + cclass[2] = 0; + cclass[3] = 12288; + cclass[4] = 0; + cclass[5] = 3355440; + cclass[6] = 0; + cclass[7] = 0; + cclass[8] = 0; + cclass[9] = 0; + cclass[10] = 0; + cclass[11] = 0; + cclass[12] = 0; + cclass[13] = 0; + cclass[14] = 0; + cclass[15] = 0; + cclass[16] = 0; + cclass[17] = 0; + cclass[18] = 0; + cclass[19] = 0; + cclass[20] = 0; + cclass[21] = 0; + cclass[22] = 0; + cclass[23] = 0; + cclass[24] = 0; + cclass[25] = 0; + cclass[26] = 0; + cclass[27] = 0; + cclass[28] = 0; + cclass[29] = 0; + cclass[30] = 0; + cclass[31] = 1409286144; + states = new int[7]; + states[0] = 288626549; + states[1] = 572657937; + states[2] = 291923490; + states[3] = 1713792614; + states[4] = 393569894; + states[5] = 1717659269; + states[6] = 1140326; + charset = "UTF-16BE"; + stFactor = 6; + } + + public boolean isUCS2() { + return true; + } + } + + /** + * + */ + public static class nsUCS2LEVerifier extends nsVerifier { + static int[] cclass; + static int[] states; + static int stFactor; + static String charset; + + public int[] cclass() { + return cclass; + } + + public int[] states() { + return states; + } + + public int stFactor() { + return stFactor; + } + + public String charset() { + return charset; + } + + public nsUCS2LEVerifier() { + cclass = new int[32]; + cclass[0] = 0; + cclass[1] = 2097408; + cclass[2] = 0; + cclass[3] = 12288; + cclass[4] = 0; + cclass[5] = 3355440; + cclass[6] = 0; + cclass[7] = 0; + cclass[8] = 0; + cclass[9] = 0; + cclass[10] = 0; + cclass[11] = 0; + cclass[12] = 0; + cclass[13] = 0; + cclass[14] = 0; + cclass[15] = 0; + cclass[16] = 0; + cclass[17] = 0; + cclass[18] = 0; + cclass[19] = 0; + cclass[20] = 0; + cclass[21] = 0; + cclass[22] = 0; + cclass[23] = 0; + cclass[24] = 0; + cclass[25] = 0; + cclass[26] = 0; + cclass[27] = 0; + cclass[28] = 0; + cclass[29] = 0; + cclass[30] = 0; + cclass[31] = 1409286144; + states = new int[7]; + states[0] = 288647014; + states[1] = 572657937; + states[2] = 303387938; + states[3] = 1712657749; + states[4] = 357927015; + states[5] = 1427182933; + states[6] = 1381717; + charset = "UTF-16LE"; + stFactor = 6; + } + + public boolean isUCS2() { + return true; + } + } + + /** + * + */ + public static class nsCP1252Verifier extends nsVerifier { + static int[] cclass; + static int[] states; + static int stFactor; + static String charset; + + public int[] cclass() { + return cclass; + } + + public int[] states() { + return states; + } + + public int stFactor() { + return stFactor; + } + + public String charset() { + return charset; + } + + public nsCP1252Verifier() { + cclass = new int[32]; + cclass[0] = 572662305; + cclass[1] = 2236962; + cclass[2] = 572662306; + cclass[3] = 572654114; + cclass[4] = 572662306; + cclass[5] = 572662306; + cclass[6] = 572662306; + cclass[7] = 572662306; + cclass[8] = 572662306; + cclass[9] = 572662306; + cclass[10] = 572662306; + cclass[11] = 572662306; + cclass[12] = 572662306; + cclass[13] = 572662306; + cclass[14] = 572662306; + cclass[15] = 572662306; + cclass[16] = 572662274; + cclass[17] = 16851234; + cclass[18] = 572662304; + cclass[19] = 285286690; + cclass[20] = 572662306; + cclass[21] = 572662306; + cclass[22] = 572662306; + cclass[23] = 572662306; + cclass[24] = 286331153; + cclass[25] = 286331153; + cclass[26] = 554766609; + cclass[27] = 286331153; + cclass[28] = 286331153; + cclass[29] = 286331153; + cclass[30] = 554766609; + cclass[31] = 286331153; + states = new int[3]; + states[0] = 571543601; + states[1] = 340853778; + states[2] = 65; + charset = "windows-1252"; + stFactor = 3; + } + + public boolean isUCS2() { + return false; + } + } + + /** + * + */ + public static class nsHZVerifier extends nsVerifier { + static int[] cclass; + static int[] states; + static int stFactor; + static String charset; + + public int[] cclass() { + return cclass; + } + + public int[] states() { + return states; + } + + public int stFactor() { + return stFactor; + } + + public String charset() { + return charset; + } + + public nsHZVerifier() { + cclass = new int[32]; + cclass[0] = 1; + cclass[1] = 0; + cclass[2] = 0; + cclass[3] = 4096; + cclass[4] = 0; + cclass[5] = 0; + cclass[6] = 0; + cclass[7] = 0; + cclass[8] = 0; + cclass[9] = 0; + cclass[10] = 0; + cclass[11] = 0; + cclass[12] = 0; + cclass[13] = 0; + cclass[14] = 0; + cclass[15] = 38813696; + cclass[16] = 286331153; + cclass[17] = 286331153; + cclass[18] = 286331153; + cclass[19] = 286331153; + cclass[20] = 286331153; + cclass[21] = 286331153; + cclass[22] = 286331153; + cclass[23] = 286331153; + cclass[24] = 286331153; + cclass[25] = 286331153; + cclass[26] = 286331153; + cclass[27] = 286331153; + cclass[28] = 286331153; + cclass[29] = 286331153; + cclass[30] = 286331153; + cclass[31] = 286331153; + states = new int[6]; + states[0] = 285213456; + states[1] = 572657937; + states[2] = 335548706; + states[3] = 341120533; + states[4] = 336872468; + states[5] = 36; + charset = "HZ-GB-2312"; + stFactor = 6; + } + + public boolean isUCS2() { + return false; + } + } + + /** + * + */ + public static class nsSJISVerifier extends nsVerifier { + static int[] cclass; + static int[] states; + static int stFactor; + static String charset; + + public int[] cclass() { + return cclass; + } + + public int[] states() { + return states; + } + + public int stFactor() { + return stFactor; + } + + public String charset() { + return charset; + } + + public nsSJISVerifier() { + cclass = new int[32]; + cclass[0] = 286331152; + cclass[1] = 1118481; + cclass[2] = 286331153; + cclass[3] = 286327057; + cclass[4] = 286331153; + cclass[5] = 286331153; + cclass[6] = 286331153; + cclass[7] = 286331153; + cclass[8] = 572662306; + cclass[9] = 572662306; + cclass[10] = 572662306; + cclass[11] = 572662306; + cclass[12] = 572662306; + cclass[13] = 572662306; + cclass[14] = 572662306; + cclass[15] = 304226850; + cclass[16] = 858993459; + cclass[17] = 858993459; + cclass[18] = 858993459; + cclass[19] = 858993459; + cclass[20] = 572662308; + cclass[21] = 572662306; + cclass[22] = 572662306; + cclass[23] = 572662306; + cclass[24] = 572662306; + cclass[25] = 572662306; + cclass[26] = 572662306; + cclass[27] = 572662306; + cclass[28] = 858993459; + cclass[29] = 1145393971; + cclass[30] = 1145324612; + cclass[31] = 279620; + states = new int[3]; + states[0] = 286339073; + states[1] = 572657937; + states[2] = 4386; + charset = "Shift_JIS"; + stFactor = 6; + } + + public boolean isUCS2() { + return false; + } + } + + /** + * + */ + public static class nsUTF8Verifier extends nsVerifier { + static int[] cclass; + static int[] states; + static int stFactor; + static String charset; + + public int[] cclass() { + return cclass; + } + + public int[] states() { + return states; + } + + public int stFactor() { + return stFactor; + } + + public String charset() { + return charset; + } + + public nsUTF8Verifier() { + cclass = new int[32]; + cclass[0] = 286331153; + cclass[1] = 1118481; + cclass[2] = 286331153; + cclass[3] = 286327057; + cclass[4] = 286331153; + cclass[5] = 286331153; + cclass[6] = 286331153; + cclass[7] = 286331153; + cclass[8] = 286331153; + cclass[9] = 286331153; + cclass[10] = 286331153; + cclass[11] = 286331153; + cclass[12] = 286331153; + cclass[13] = 286331153; + cclass[14] = 286331153; + cclass[15] = 286331153; + cclass[16] = 858989090; + cclass[17] = 1145324612; + cclass[18] = 1145324612; + cclass[19] = 1145324612; + cclass[20] = 1431655765; + cclass[21] = 1431655765; + cclass[22] = 1431655765; + cclass[23] = 1431655765; + cclass[24] = 1717986816; + cclass[25] = 1717986918; + cclass[26] = 1717986918; + cclass[27] = 1717986918; + cclass[28] = -2004318073; + cclass[29] = -2003269496; + cclass[30] = -1145324614; + cclass[31] = 16702940; + states = new int[26]; + states[0] = -1408167679; + states[1] = 878082233; + states[2] = 286331153; + states[3] = 286331153; + states[4] = 572662306; + states[5] = 572662306; + states[6] = 290805009; + states[7] = 286331153; + states[8] = 290803985; + states[9] = 286331153; + states[10] = 293041937; + states[11] = 286331153; + states[12] = 293015825; + states[13] = 286331153; + states[14] = 295278865; + states[15] = 286331153; + states[16] = 294719761; + states[17] = 286331153; + states[18] = 298634257; + states[19] = 286331153; + states[20] = 297865489; + states[21] = 286331153; + states[22] = 287099921; + states[23] = 286331153; + states[24] = 285212689; + states[25] = 286331153; + charset = "UTF-8"; + stFactor = 16; + } + + public boolean isUCS2() { + return false; + } + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/JSONUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/JSONUtil.java new file mode 100644 index 0000000..3c32d8e --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/JSONUtil.java @@ -0,0 +1,87 @@ +package com.gxwebsoft.common.core.utils; + +import cn.hutool.core.util.StrUtil; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; + +import java.util.TimeZone; + +/** + * JSON解析工具类 + * + * @author WebSoft + * @since 2017-06-10 10:10:39 + */ +public class JSONUtil { + /** + * 注意:不要直接 new ObjectMapper() 否则不支持 Java8 时间类型(LocalDateTime 等)。 + * 这里做最小可用配置,避免在 Redis/日志/签名等场景序列化失败。 + */ + private static final ObjectMapper objectMapper; + private static final ObjectWriter objectWriter; + + static { + objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); + objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + objectMapper.setTimeZone(TimeZone.getTimeZone("GMT+8")); + objectWriter = objectMapper.writerWithDefaultPrettyPrinter(); + } + + /** + * 对象转json字符串 + * + * @param value 对象 + * @return String + */ + public static String toJSONString(Object value) { + return toJSONString(value, false); + } + + /** + * 对象转json字符串 + * + * @param value 对象 + * @param pretty 是否格式化输出 + * @return String + */ + public static String toJSONString(Object value, boolean pretty) { + if (value != null) { + if (value instanceof String) { + return (String) value; + } + try { + if (pretty) { + return objectWriter.writeValueAsString(value); + } + return objectMapper.writeValueAsString(value); + } catch (Exception e) { + e.printStackTrace(); + } + } + return null; + } + + /** + * json字符串转对象 + * + * @param json String + * @param clazz Class + * @return T + */ + public static T parseObject(String json, Class clazz) { + if (StrUtil.isNotBlank(json) && clazz != null) { + try { + return objectMapper.readValue(json, clazz); + } catch (Exception e) { + e.printStackTrace(); + } + } + return null; + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/MyQrCodeUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/MyQrCodeUtil.java new file mode 100644 index 0000000..87d95b9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/MyQrCodeUtil.java @@ -0,0 +1,85 @@ +package com.gxwebsoft.common.core.utils; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.extra.qrcode.QrCodeUtil; +import cn.hutool.extra.qrcode.QrConfig; +import org.springframework.beans.factory.annotation.Value; + +import javax.annotation.Resource; +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.net.URL; +import java.util.HashMap; + +import static com.gxwebsoft.common.core.constants.QRCodeConstants.*; + +/** + * 常用工具方法 + * + * @author WebSoft + * @since 2017-06-10 10:10:22 + */ +public class MyQrCodeUtil { + + @Value("${config.upload-path}") + private static String uploadPath; + + private static final String logoUrl = "https://file.wsdns.cn/20230430/6fa31aca3b0d47af98a149cf2dd26a4f.jpeg"; + + /** + * 生成用户二维码 + */ + public static String getUserCode(Integer userId, String content) throws IOException { + return createQrCode(USER_QRCODE,userId,content); + } + + /** + * 生成工单二维码 + */ + public static String getTaskCode(Integer taskId, String content) throws IOException { + return createQrCode(TASK_QRCODE,taskId,content); + } + + /** + * 生成商品二维码 + */ + public static String getGoodsCode(Integer goodsId, String content) throws IOException { + return createQrCode(GOODS_QRCODE,goodsId,content); + } + + /** + * 生成自定义二维码 + */ + public static String getCodeMap(HashMap map) throws IOException { + return ""; + } + + /** + * 生成带水印的二维码 + * @param type 类型 + * @param id 实体ID + * @param content 二维码内容 + * @return 二维码图片地址 + */ + public static String createQrCode(String type,Integer id, String content) throws IOException { + String filePath = uploadPath + "/qrcode/".concat(type).concat("/"); + String qrcodeUrl = "https://file.websoft.top/qrcode/".concat(type).concat("/"); + // 将URL转为BufferedImage + BufferedImage bufferedImage = ImageIO.read(new URL(logoUrl)); + // 生成二维码 + QrConfig config = new QrConfig(300, 300); + // 设置边距,既二维码和背景之间的边距 + config.setMargin(1); + // 附带小logo + config.setImg(bufferedImage); + // 保存路径 + filePath = filePath.concat(id + ".jpg"); + qrcodeUrl = qrcodeUrl.concat(id + ".jpg") + "?v=" + DateUtil.current(); + + // 生成二维码 + QrCodeUtil.generate(content, config, FileUtil.file(filePath)); + return qrcodeUrl; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/OpenOfficeUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/OpenOfficeUtil.java new file mode 100644 index 0000000..cca3990 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/OpenOfficeUtil.java @@ -0,0 +1,124 @@ +package com.gxwebsoft.common.core.utils; + +import cn.hutool.core.util.StrUtil; +import org.artofsolving.jodconverter.OfficeDocumentConverter; +import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration; +import org.artofsolving.jodconverter.office.OfficeManager; + +import java.io.File; +import java.util.Arrays; +import java.util.Base64; + +/** + * OpenOfficeUtil + * + * @author WebSoft + * @since 2018-12-14 08:38:19 + */ +public class OpenOfficeUtil { + // 支持转换pdf的文件后缀列表 + private static final String[] CAN_CONVERTER_FILES = new String[]{ + "doc", "docx", "xls", "xlsx", "ppt", "pptx" + }; + + /** + * 文件转pdf + * + * @param filePath 源文件路径 + * @param outDir 输出目录 + * @param officeHome OpenOffice安装路径 + * @return File + */ + public static File converterToPDF(String filePath, String outDir, String officeHome) { + return converterToPDF(filePath, outDir, officeHome, true); + } + + /** + * 文件转pdf + * + * @param filePath 源文件路径 + * @param outDir 输出目录 + * @param officeHome OpenOffice安装路径 + * @param cache 是否使用上次转换过的文件 + * @return File + */ + public static File converterToPDF(String filePath, String outDir, String officeHome, boolean cache) { + if (StrUtil.isBlank(filePath)) { + return null; + } + File srcFile = new File(filePath); + if (!srcFile.exists()) { + return null; + } + // 是否转换过 + String outPath = Base64.getEncoder().encodeToString(filePath.getBytes()) + .replace("/", "-").replace("+", "-"); + File outFile = new File(outDir, outPath + ".pdf"); + if (cache && outFile.exists()) { + return outFile; + } + // 转换 + OfficeManager officeManager = null; + try { + officeManager = getOfficeManager(officeHome); + OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager); + return converterFile(srcFile, outFile, converter); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (officeManager != null) { + officeManager.stop(); + } + } + return null; + } + + /** + * 转换文件 + * + * @param inFile 源文件 + * @param outFile 输出文件 + * @param converter OfficeDocumentConverter + * @return File + */ + public static File converterFile(File inFile, File outFile, OfficeDocumentConverter converter) { + if (!outFile.getParentFile().exists()) { + if (!outFile.getParentFile().mkdirs()) { + return outFile; + } + } + converter.convert(inFile, outFile); + return outFile; + } + + /** + * 判断文件后缀是否可以转换pdf + * + * @param path 文件路径 + * @return boolean + */ + public static boolean canConverter(String path) { + try { + String suffix = path.substring(path.lastIndexOf(".") + 1); + return Arrays.asList(CAN_CONVERTER_FILES).contains(suffix); + } catch (Exception e) { + return false; + } + } + + /** + * 连接并启动OpenOffice + * + * @param officeHome OpenOffice安装路径 + * @return OfficeManager + */ + public static OfficeManager getOfficeManager(String officeHome) { + if (officeHome == null || officeHome.trim().isEmpty()) return null; + DefaultOfficeManagerConfiguration config = new DefaultOfficeManagerConfiguration(); + config.setOfficeHome(officeHome); // 设置OpenOffice安装目录 + OfficeManager officeManager = config.buildOfficeManager(); + officeManager.start(); // 启动OpenOffice服务 + return officeManager; + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/QrCodeDecryptResult.java b/src/main/java/com/gxwebsoft/common/core/utils/QrCodeDecryptResult.java new file mode 100644 index 0000000..bbfe3b6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/QrCodeDecryptResult.java @@ -0,0 +1,93 @@ +package com.gxwebsoft.common.core.utils; + +import lombok.Data; + +/** + * 二维码解密结果类 + * 包含解密后的数据和业务类型信息 + * + * @author WebSoft + * @since 2025-08-18 + */ +@Data +public class QrCodeDecryptResult { + + /** + * 解密后的原始数据 + */ + private String originalData; + + /** + * 业务类型(如:order、user、coupon、ticket等) + */ + private String businessType; + + /** + * 二维码类型(encrypted 或 business_encrypted) + */ + private String qrType; + + /** + * 二维码ID(仅业务模式有) + */ + private String qrId; + + /** + * 过期时间戳(仅业务模式有) + */ + private Long expireTime; + + /** + * 是否已过期 + */ + private Boolean expired; + + public QrCodeDecryptResult() {} + + public QrCodeDecryptResult(String originalData, String businessType, String qrType) { + this.originalData = originalData; + this.businessType = businessType; + this.qrType = qrType; + this.expired = false; + } + + /** + * 创建自包含模式的解密结果 + */ + public static QrCodeDecryptResult createEncryptedResult(String originalData, String businessType) { + return new QrCodeDecryptResult(originalData, businessType, "encrypted"); + } + + /** + * 创建业务模式的解密结果 + */ + public static QrCodeDecryptResult createBusinessResult(String originalData, String businessType, + String qrId, Long expireTime) { + QrCodeDecryptResult result = new QrCodeDecryptResult(originalData, businessType, "business_encrypted"); + result.setQrId(qrId); + result.setExpireTime(expireTime); + result.setExpired(expireTime != null && System.currentTimeMillis() > expireTime); + return result; + } + + /** + * 检查是否有业务类型 + */ + public boolean hasBusinessType() { + return businessType != null && !businessType.trim().isEmpty(); + } + + /** + * 检查是否为业务模式 + */ + public boolean isBusinessMode() { + return "business_encrypted".equals(qrType); + } + + /** + * 检查是否为自包含模式 + */ + public boolean isEncryptedMode() { + return "encrypted".equals(qrType); + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/RedisUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/RedisUtil.java new file mode 100644 index 0000000..f02ce42 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/RedisUtil.java @@ -0,0 +1,279 @@ +package com.gxwebsoft.common.core.utils; + +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.result.RedisResult; +import org.springframework.data.geo.Point; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Component; + +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.function.Function; + +import static com.gxwebsoft.common.core.constants.RedisConstants.CACHE_NULL_TTL; + +@Component +public class RedisUtil { + private final StringRedisTemplate stringRedisTemplate; + public static Integer tenantId; + + public RedisUtil(StringRedisTemplate stringRedisTemplate){ + this.stringRedisTemplate = stringRedisTemplate; + } + + /** + * 写入redis缓存 + * @param key [表名]:id + * @param entity 实体类对象 + * 示例 cacheClient.set("merchant:"+id,merchant) + */ + public void set(String key, T entity){ + stringRedisTemplate.opsForValue().set(key, JSONUtil.toJSONString(entity)); + } + + /** + * 写入redis缓存 + * @param key [表名]:id + * @param entity 实体类对象 + * 示例 cacheClient.set("merchant:"+id,merchant,1L,TimeUnit.DAYS) + */ + public void set(String key, T entity, Long time, TimeUnit unit){ + stringRedisTemplate.opsForValue().set(key, JSONUtil.toJSONString(entity),time,unit); + } + + /** + * 读取redis缓存 + * @param key [表名]:id + * 示例 cacheClient.get(key) + * @return merchant + */ + public String get(String key) { + return stringRedisTemplate.opsForValue().get(key); + } + + /** + * 读取redis缓存 + * @param key [表名]:id + * @param clazz Merchant.class + * @param + * 示例 cacheClient.get("merchant:"+id,Merchant.class) + * @return merchant + */ + public T get(String key, Class clazz) { + String json = stringRedisTemplate.opsForValue().get(key); + if(StrUtil.isNotBlank(json)){ + return JSONUtil.parseObject(json, clazz); + } + return null; + } + + /** + * 写redis缓存(哈希类型) + * @param key [表名]:id + * @param field 字段 + * 示例 cacheClient.get("merchant:"+id,Merchant.class) + */ + public void hPut(String key, String field, T entity) { + stringRedisTemplate.opsForHash().put(key,field,JSONUtil.toJSONString(entity)); + } + + /** + * 写redis缓存(哈希类型) + * @param key [表名]:id + * @param map 字段 + * 示例 cacheClient.get("merchant:"+id,Merchant.class) + */ + public void hPutAll(String key, Map map) { + stringRedisTemplate.opsForHash().putAll(key,map); + } + + /** + * 读取redis缓存(哈希类型) + * 示例 cacheClient.get("merchant:"+id,Merchant.class) + * @param key [表名]:id + * @param field 字段 + * @return merchant + */ + public T hGet(String key, String field, Class clazz) { + Object obj = stringRedisTemplate.opsForHash().get(key, field); + return JSONUtil.parseObject(JSONUtil.toJSONString(obj),clazz); + } + + public List hValues(String key){ + return stringRedisTemplate.opsForHash().values(key); + } + + public Long hSize(String key){ + return stringRedisTemplate.opsForHash().size(key); + } + + // 逻辑过期方式写入redis + public void setWithLogicalExpire(String key, T value, Long time, TimeUnit unit){ + // 设置逻辑过期时间 + final RedisResult redisResult = new RedisResult<>(); + redisResult.setData(value); + redisResult.setExpireTime(LocalDateTime.now().plusSeconds(unit.toSeconds(time))); + stringRedisTemplate.opsForValue().set(key,JSONUtil.toJSONString(redisResult)); + } + + // 读取redis + public R query(String keyPrefix, ID id, Class clazz, Function dbFallback, Long time, TimeUnit unit){ + String key = keyPrefix + id; + // 1.从redis查询缓存 + final String json = stringRedisTemplate.opsForValue().get(key); + // 2.判断是否存在 + if (StrUtil.isNotBlank(json)) { + // 3.存在,直接返回 + return JSONUtil.parseObject(json,clazz); + } + // 判断命中的是否为空值 + if (json != null) { + return null; + } + // 4. 不存在,跟进ID查询数据库 + R r = dbFallback.apply(id); + // 5. 数据库不存在,返回错误 + if(r == null){ + // 空值写入数据库 + this.set(key,"",CACHE_NULL_TTL,TimeUnit.MINUTES); + return null; + } + // 写入redis + this.set(key,r,time,unit); + return r; + } + + /** + * 添加商户定位点 + * @param key geo + * @param id + * 示例 cacheClient.geoAdd("merchant-geo",merchant) + */ + public void geoAdd(String key, Double x, Double y, String id){ + stringRedisTemplate.opsForGeo().add(key,new Point(x,y),id); + } + + /** + * 删除定位 + * @param key geo + * @param id + * 示例 cacheClient.geoRemove("merchant-geo",id) + */ + public void geoRemove(String key, Integer id){ + stringRedisTemplate.opsForGeo().remove(key,id.toString()); + } + + + + public void sAdd(String key, T entity){ + stringRedisTemplate.opsForSet().add(key,JSONUtil.toJSONString(entity)); + } + + public Set sMembers(String key){ + return stringRedisTemplate.opsForSet().members(key); + } + + // 更新排行榜 + public void zAdd(String key, Integer userId, Double value) { + stringRedisTemplate.opsForZSet().add(key,userId.toString(),value); + } + // 增加元素的score值,并返回增加后的值 + public Double zIncrementScore(String key,Integer userId, Double delta){ + return stringRedisTemplate.opsForZSet().incrementScore(key, userId.toString(), delta); + } + // 获取排名榜 + public Set range(String key, Integer start, Integer end) { + return stringRedisTemplate.opsForZSet().range(key, start, end); + } + // 获取排名榜 + public Set reverseRange(String key, Integer start, Integer end){ + return stringRedisTemplate.opsForZSet().reverseRange(key, start, end); + } + // 获取分数 + public Double score(String key, Object value){ + return stringRedisTemplate.opsForZSet().score(key, value); + } + + public void delete(String key){ + stringRedisTemplate.delete(key); + } + + // 存储在list头部 + public void leftPush(String key, String keyword){ + stringRedisTemplate.opsForList().leftPush(key,keyword); + } + + // 获取列表指定范围内的元素 + public List listRange(String key,Long start, Long end){ + return stringRedisTemplate.opsForList().range(key, start, end); + } + + // 获取列表长度 + public Long listSize(String key){ + return stringRedisTemplate.opsForList().size(key); + } + + // 裁剪list + public void listTrim(String key){ + stringRedisTemplate.opsForList().trim(key, 0L, 100L); + } + + /** + * 读取后台系统设置信息 + * @param keyName 键名wx-word + * @param tenantId 租户ID + * @return + * key示例 cache10048:setting:wx-work + */ + public JSONObject getSettingInfo(String keyName,Integer tenantId){ + String key = "cache" + tenantId + ":setting:" + keyName; + final String cache = stringRedisTemplate.opsForValue().get(key); + assert cache != null; + return JSON.parseObject(cache); + } + + /** + * KEY前缀 + * cache[tenantId]:[key+id] + */ + public static String prefix(String key){ + String prefix = "cache"; + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication != null) { + Object object = authentication.getPrincipal(); + if (object instanceof User) { + final Integer tenantId = ((User) object).getTenantId(); + prefix = prefix.concat(tenantId.toString()).concat(":"); + } + } + return prefix.concat(key); + } + + // 组装key + public String key(String name,Integer id){ + return name.concat(":").concat(id.toString()); + } + + // 获取上传配置 + public HashMap getUploadConfig(Integer tenantId){ + String key = "setting:upload:" + tenantId; + final String s = get(key); + final JSONObject jsonObject = JSONObject.parseObject(s); + final String uploadMethod = jsonObject.getString("uploadMethod"); + final String bucketDomain = jsonObject.getString("bucketDomain"); + + final HashMap map = new HashMap<>(); + map.put("uploadMethod",uploadMethod); + map.put("bucketDomain",bucketDomain); + return map; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/RequestUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/RequestUtil.java new file mode 100644 index 0000000..cdda4da --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/RequestUtil.java @@ -0,0 +1,343 @@ +package com.gxwebsoft.common.core.utils; + +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSONObject; +import com.gxwebsoft.common.core.config.ConfigProperties; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.system.entity.DictData; +import com.gxwebsoft.common.system.entity.Payment; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.entity.UserRole; +import com.gxwebsoft.shop.entity.ShopOrder; +import com.gxwebsoft.shop.entity.ShopMerchantAccount; +import com.wechat.pay.java.service.partnerpayments.jsapi.model.Transaction; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.HashMap; + +@Component +public class RequestUtil { + + @Autowired + private ConfigProperties configProperties; + + private static String ACCESS_TOKEN; + private static String TENANT_ID; + + public void setTenantId(String tenantId) { + TENANT_ID = tenantId; + } + + public void setAccessToken(String token) { + ACCESS_TOKEN = token; + } + + private String getServerUrl() { + return configProperties.getServerUrl(); + } + + // 预付请求付款(余额支付) + public Object balancePay(ShopOrder order) { + // 设置租户ID + setTenantId(order.getTenantId().toString()); + // 设置token + setAccessToken(order.getAddress()); + // 余额支付接口 + String path = "/system/payment/balancePay"; + try { + // 链式构建请求 + final String body = HttpRequest.post(getServerUrl().concat(path)) + .header("Tenantid", TENANT_ID) + .header("Authorization", ACCESS_TOKEN) + .body(JSONUtil.toJSONString(order))//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + return JSONUtil.parseObject(body, ApiResult.class).getData(); + + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + // 微信支付通知 + public String pushWxPayNotify(Transaction transaction, Payment payment) { + // 设置租户ID + setTenantId(payment.getTenantId().toString()); + // 推送支付通知地址 + String path = payment.getNotifyUrl(); + try { + // 链式构建请求 + return HttpRequest.post(path) + .header("Tenantid", TENANT_ID) + .body(JSONUtil.toJSONString(transaction))//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + + } catch (Exception e) { + e.printStackTrace(); + } + return "支付失败"; + } + + + public User getUserByPhone(String phone) { + String path = "/system/user/getByPhone/" + phone; + try { + // 链式构建请求 + String result = HttpRequest.get(getServerUrl().concat(path)) + .header("Authorization", ACCESS_TOKEN) + .header("Tenantid", TENANT_ID) + .timeout(20000)//超时,毫秒 + .execute().body(); + + JSONObject jsonObject = JSONObject.parseObject(result); + final String data = jsonObject.getString("data"); + return JSONObject.parseObject(data, User.class); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public User getByUserId(Integer userId) { + String path = "/system/user/" + userId; + try { + // 链式构建请求 + String result = HttpRequest.get(getServerUrl().concat(path)) + .header("Authorization", ACCESS_TOKEN) + .header("Tenantid", TENANT_ID) + .timeout(20000)//超时,毫秒 + .execute().body(); + + JSONObject jsonObject = JSONObject.parseObject(result); + System.out.println("jsonObject1111111111 = " + jsonObject); + final String data = jsonObject.getString("data"); + return JSONObject.parseObject(data, User.class); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public User getByUserIdWithoutLogin(Integer userId) { + String path = "/system/user/getByUserId/" + userId; + try { + // 链式构建请求 + String result = HttpRequest.get(getServerUrl().concat(path)) + .header("Tenantid", TENANT_ID) + .timeout(20000)//超时,毫秒 + .execute().body(); + JSONObject jsonObject = JSONObject.parseObject(result); + System.out.println("jsonObject1111 = " + jsonObject); + final String data = jsonObject.getString("data"); + return JSONObject.parseObject(data, User.class); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + // 新增用户 + public boolean saveUserByPhone(ShopMerchantAccount merchantAccount) { + String path = "/system/user/"; + try { + HashMap map = new HashMap<>(); + map.put("nickname", merchantAccount.getRealName()); + map.put("username", merchantAccount.getPhone()); + map.put("realName", merchantAccount.getRealName()); + map.put("phone", merchantAccount.getPhone()); + map.put("merchantId", merchantAccount.getMerchantId()); + final ArrayList roles = new ArrayList<>(); + final UserRole userRole = new UserRole(); + userRole.setUserId(merchantAccount.getUserId()); + userRole.setRoleId(merchantAccount.getRoleId()); + userRole.setTenantId(merchantAccount.getTenantId()); + roles.add(userRole); + map.put("roles", roles); + map.put("tenantId", TENANT_ID); + // 链式构建请求 + String result = HttpRequest.post(getServerUrl().concat(path)) + .header("Authorization", ACCESS_TOKEN) + .header("Tenantid", TENANT_ID) + .body(JSONUtil.toJSONString(map))//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + + } catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + public ApiResult updateUserBalance(String path, User user) { + try { + // 链式构建请求 + final String body = HttpRequest.put(getServerUrl().concat(path)) + .header("Authorization", ACCESS_TOKEN) + .header("Tenantid", TENANT_ID) + .body(JSONUtil.toJSONString(user)) + .timeout(20000) + .execute().body(); + return JSONUtil.parseObject(body, ApiResult.class); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public User getParent(Integer userId) { + try { + // 链式构建请求 + final String result = HttpRequest.get(getServerUrl().concat("/system/user-referee/getReferee/" + userId)) + .header("Tenantid", TENANT_ID) + .timeout(20000) + .execute().body(); + JSONObject jsonObject = JSONObject.parseObject(result); + final String data = jsonObject.getString("data"); + return JSONObject.parseObject(data, User.class); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + // 更新用户信息 + public void updateUser(User user) { + String path = "/system/user/"; + try { + // 链式构建请求 + final String body = HttpRequest.put(getServerUrl().concat(path)) + .header("Authorization", ACCESS_TOKEN) + .header("Tenantid", TENANT_ID) + .body(JSONUtil.toJSONString(user)) + .timeout(20000) + .execute().body(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + // 更新用户信息 + public void updateWithoutLogin(User user) { + String path = "/system/user/updateWithoutLogin"; + try { + // 链式构建请求 + final String body = HttpRequest.put(getServerUrl().concat(path)) + .header("Tenantid", TENANT_ID) + .body(JSONUtil.toJSONString(user)) + .timeout(20000) + .execute().body(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public String getMpOrderQrCode(String orderNo) { + String path = "/wx-login/getOrderQRCode/"; + try { + // 链式构建请求 + final String body = HttpRequest.get(getServerUrl().concat(path).concat(orderNo)) + .header("Authorization", ACCESS_TOKEN) + .header("tenantId", TENANT_ID) + .timeout(20000) + .execute().body(); + final JSONObject jsonObject = JSONObject.parseObject(body); + final String qrCode = jsonObject.getString("message"); + return qrCode; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public String getOrderQRCodeUnlimited(String orderNo) { + String path = "/wx-login/getOrderQRCodeUnlimited/"; + try { + // 链式构建请求 + final String body = HttpRequest.get(getServerUrl().concat(path).concat(orderNo)) + .header("Authorization", ACCESS_TOKEN) + .header("tenantId", TENANT_ID) + .timeout(20000) + .execute().body(); + System.out.println("body = " + body); + final JSONObject jsonObject = JSONObject.parseObject(body); + final String qrCode = jsonObject.getString("message"); + System.out.println("qrCode = " + qrCode); + return qrCode; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public void updateUserMerchantId(User user) { + String path = "/system/user/updateUserMerchantId"; + try { + // 链式构建请求 + final String body = HttpRequest.put(getServerUrl().concat(path)) + .header("Authorization", ACCESS_TOKEN) + .header("tenantId", TENANT_ID) + .body(JSONUtil.toJSONString(user)) + .timeout(20000) + .execute().body(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public ApiResult getWxConfig() { + String path = "/system/setting?settingKey=mp-weixin"; + try { + // 链式构建请求 + final String body = HttpRequest.get(getServerUrl().concat(path)) + .header("Authorization", ACCESS_TOKEN) + .header("tenantId", TENANT_ID) + .timeout(20000) + .execute().body(); + return JSONUtil.parseObject(body, ApiResult.class); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + public ApiResult pageDictData(Integer dictId) { + String path = "/system/dict-data/page"; + try { + // 链式构建请求 + final String body = HttpRequest.get(getServerUrl().concat(path).concat("?dictId=" + dictId)) + .header("tenantId", TENANT_ID) + .timeout(20000) + .execute().body(); + return JSONUtil.parseObject(body, ApiResult.class); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + // 余额支付通知 + public void pushBalancePayNotify(Transaction transaction, Payment payment) { + System.out.println("payment = " + payment); + System.out.println("transaction = " + transaction); + // 设置租户ID + setTenantId(payment.getTenantId().toString()); + // 推送支付通知地址 + String path = payment.getNotifyUrl(); + try { + // 链式构建请求 + HttpRequest.post(path) + .header("Tenantid", TENANT_ID) + .body(JSONUtil.toJSONString(transaction))//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/SignCheckUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/SignCheckUtil.java new file mode 100644 index 0000000..651e6ac --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/SignCheckUtil.java @@ -0,0 +1,197 @@ +package com.gxwebsoft.common.core.utils; + +import cn.hutool.crypto.SecureUtil; +import com.alibaba.fastjson.JSONObject; +import com.gxwebsoft.common.system.entity.KVEntity; +import org.apache.commons.lang3.StringUtils; + +import java.util.*; + +/** + * 签名检查和获取签名 + * https://blog.csdn.net/u011628753/article/details/110251445 + * @author leng + * + */ +public class SignCheckUtil { + // 签名字段 + public final static String SIGN = "sign"; + + /** + * 签名检查,签名参数中,sign是用于校验的加密值,其他参数按照字母顺序排序,加密,并将其内容链接起来 + * + * @param params + * @param key + * @return + */ + public static boolean signCheck(JSONObject params, String key) { + if (null != params) { + Map map = new HashMap<>(); + + params.forEach((k, v) -> { + map.put(k, v.toString()); + }); + return signCheck(map, key); + } + + return false; + } + + /** + * 签名检查,签名参数中,sign是用于校验的加密值,其他参数按照字母顺序排序,加密,并将其内容链接起来 + * + * @param params + * @param key + * 签名key不允许为空 + * @return + */ + public static boolean signCheck(Map params, String key) { + String sign = params.get(SIGN);// 签名 + if (null == sign) { + return false; + } + String signTemp = getSignString(params,key); + if (null == signTemp) { + return false; + } + return signTemp.equals(sign); + } + + /** + * 获取签名的字符串 + * + * @param params + * @param key + * @return + */ + public static String getSignString(JSONObject params, String key) { + if (null != params) { + Map map = new HashMap<>(); + + params.forEach((k, v) -> { + map.put(k, v.toString()); + }); + return getSignString(map, key); + } + + return null; + } + + /** + * 获取签名的字符串 + * + * @param params + * @param key + * @return + */ + public static String getSignString(Map params, String key) { + // 签名 + if (null == params || params.size() == 0) { + return null; + } + key = (null == key) ? "" : key; + List> list = new ArrayList<>(params.size() - 1); + + params.forEach((k, v) -> { + if (!SIGN.equals(k)) { + list.add(KVEntity.build(k, v)); + } + }); + + Collections.sort(list, (obj1, obj2) -> { + return obj1.getK().compareTo(obj2.getK()); + }); + + StringBuffer sb = new StringBuffer(); + for (KVEntity kv : list) { + String value = kv.getV(); + if (!StringUtils.isEmpty(value)) { + sb.append(kv.getV()).append("-"); + } + } + sb.append(key); + System.out.println("md5加密前的字符串 = " + sb + key); + String signTemp = SecureUtil.md5(sb.toString()).toLowerCase(); + return signTemp; + } + + /** + * 获取微信签名的字符串 + * + * 注意签名(sign)的生成方式,具体见官方文档(传参都要参与生成签名,且参数名按照字典序排序,最后接上APP_KEY,转化成大写) + * + * @param params + * @param key + * @return + */ + public static String getWXSignString(Map params, String key) { + // 签名 + if (null == params || params.size() == 0 || StringUtils.isEmpty(key)) { + return null; + } + + List> list = new ArrayList<>(params.size() - 1); + + params.forEach((k, v) -> { + if (!SIGN.equals(k)) { + list.add(KVEntity.build(k, v)); + } + }); + + Collections.sort(list, (obj1, obj2) -> { + return obj1.getK().compareTo(obj2.getK()); + }); + + StringBuffer sb = new StringBuffer(); + for (KVEntity kv : list) { + String value = kv.getV(); + if (!StringUtils.isEmpty(value)) { + sb.append(kv.getK() + "=" + value + "&"); + } + } + + sb.append("key=" + key); + String signTemp = SecureUtil.md5(sb.toString()).toLowerCase(); + return signTemp; + } + + /** + * 微信签名验证 + * @param params + * @param key + * @return + */ + public static boolean WXsignCheck(Map params, String key) { + String sign = params.get(SIGN); + if (StringUtils.isEmpty(sign)) { + return false; + } + return sign.equals(getWXSignString(params, key)); + } + + + /** + * 白名单校验 + * @param domainName abc.com + * @return true + */ + public boolean checkWhiteDomains(List whiteDomains, String domainName) { + if(whiteDomains == null){ + return true; + } + if (whiteDomains.isEmpty()) { + return true; + } + // 服务器域名白名单列表 + whiteDomains.add("glt-server.websoft.top"); + System.out.println("whiteDomains = " + whiteDomains); + System.out.println(">>> domainName = " + domainName); + for(String item: whiteDomains){ + if(Objects.equals(item, domainName)){ + return true; + } + } + return false; + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/SpmUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/SpmUtil.java new file mode 100644 index 0000000..091ef20 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/SpmUtil.java @@ -0,0 +1,23 @@ +package com.gxwebsoft.common.core.utils; + +import com.gxwebsoft.cms.entity.CmsNavigation; + +public class SpmUtil { + + // 生成spmUrl + public static String getSpmUrl(String path){ + return path.concat("?spm=c."); + } + + // 生成spmUrl + public static String getSpmUrl(String path, CmsNavigation navigation){ + return path.concat("?spm=c.".concat(navigation.getNavigationId().toString())); + } + + // 生成spmUrl +// public static String getSpmUrl(String path, T data){ +// System.out.println("json = " + data); +// return "?spm=".concat(path).concat(); +// } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/WechatCertAutoConfig.java b/src/main/java/com/gxwebsoft/common/core/utils/WechatCertAutoConfig.java new file mode 100644 index 0000000..75b0a22 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/WechatCertAutoConfig.java @@ -0,0 +1,171 @@ +package com.gxwebsoft.common.core.utils; + +import com.wechat.pay.java.core.Config; +import com.wechat.pay.java.core.RSAAutoCertificateConfig; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import com.gxwebsoft.common.core.config.ConfigProperties; + +import javax.annotation.Resource; + +/** + * 微信支付证书自动配置工具类 + * 使用RSAAutoCertificateConfig实现证书自动管理 + * + * @author 科技小王子 + * @since 2024-07-26 + */ +@Slf4j +@Component +public class WechatCertAutoConfig { + + @Value("${spring.profiles.active:prod}") + private String activeProfile; + + @Resource + private ConfigProperties configProperties; + + /** + * 创建微信支付自动证书配置 + * + * @param merchantId 商户号 + * @param privateKeyPath 私钥文件路径 + * @param merchantSerialNumber 商户证书序列号 + * @param apiV3Key APIv3密钥 + * @return 微信支付配置对象 + */ + public Config createAutoConfig(String merchantId, String privateKeyPath, + String merchantSerialNumber, String apiV3Key) { + try { + log.info("创建微信支付自动证书配置..."); + log.info("商户号: {}", merchantId); + log.info("私钥路径: {}", privateKeyPath); + log.info("证书序列号: {}", merchantSerialNumber); + + Config config = new RSAAutoCertificateConfig.Builder() + .merchantId(merchantId) + .privateKeyFromPath(privateKeyPath) + .merchantSerialNumber(merchantSerialNumber) + .apiV3Key(apiV3Key) + .build(); + + log.info("✅ 微信支付自动证书配置创建成功"); + log.info("🔄 系统将自动管理平台证书的下载和更新"); + + return config; + + } catch (Exception e) { + log.error("❌ 创建微信支付自动证书配置失败: {}", e.getMessage(), e); + + // 提供详细的错误诊断信息 + log.error("🔍 错误诊断:"); + log.error("1. 请检查商户平台是否已开启API安全功能"); + log.error("2. 请确认已申请使用微信支付公钥"); + log.error("3. 请验证APIv3密钥和证书序列号是否正确"); + log.error("4. 请检查网络连接是否正常"); + log.error("5. 请确认私钥文件路径是否正确: {}", privateKeyPath); + + throw new RuntimeException("微信支付自动证书配置失败: " + e.getMessage(), e); + } + } + + /** + * 使用默认开发环境配置创建自动证书配置 + * 根据当前环境自动选择证书路径 + * 开发环境拼接规则:配置文件upload-path + dev/wechat/ + 租户ID + * + * @return 微信支付配置对象 + */ + public Config createDefaultDevConfig() { + String merchantId = "1723321338"; + String privateKeyPath; + String merchantSerialNumber = "2B933F7C35014A1C363642623E4A62364B34C4EB"; + String apiV3Key = "0kF5OlPr482EZwtn9zGufUcqa7ovgxRL"; + + // 根据环境选择证书路径 + if ("dev".equals(activeProfile)) { + // 开发环境:使用配置文件upload-path拼接证书路径 + String uploadPath = configProperties.getUploadPath(); // 配置文件路径 + String tenantId = "10550"; // 租户ID + String certPath = uploadPath + "dev/wechat/" + tenantId + "/"; + privateKeyPath = certPath + "apiclient_key.pem"; + + log.info("开发环境:使用配置文件upload-path拼接证书路径"); + log.info("配置文件upload-path: {}", uploadPath); + log.info("证书基础路径: {}", certPath); + log.info("私钥文件路径: {}", privateKeyPath); + } else { + // 生产环境:使用相对路径,由系统动态解析 + privateKeyPath = "src/main/resources/certs/dev/wechat/apiclient_key.pem"; + log.info("生产环境:使用相对证书路径 - {}", privateKeyPath); + } + + return createAutoConfig(merchantId, privateKeyPath, merchantSerialNumber, apiV3Key); + } + + /** + * 测试证书配置是否正常 + * + * @param config 微信支付配置 + * @return 是否配置成功 + */ + public boolean testConfig(Config config) { + try { + // 这里可以添加一些基本的配置验证逻辑 + log.info("🧪 测试微信支付证书配置..."); + + if (config == null) { + log.error("配置对象为空"); + return false; + } + + log.info("✅ 证书配置测试通过"); + return true; + + } catch (Exception e) { + log.error("❌ 证书配置测试失败: {}", e.getMessage(), e); + return false; + } + } + + /** + * 获取配置使用说明 + * + * @return 使用说明 + */ + public String getUsageInstructions() { + return """ + 🚀 微信支付自动证书配置使用说明 + ================================ + + ✅ 优势: + 1. 自动下载微信支付平台证书 + 2. 证书过期时自动更新 + 3. 无需手动管理 wechatpay_cert.pem 文件 + 4. 符合微信支付官方最佳实践 + + 📝 使用方法: + + // 方法1: 使用默认开发环境配置 + Config config = wechatCertAutoConfig.createDefaultDevConfig(); + + // 方法2: 自定义配置 + Config config = wechatCertAutoConfig.createAutoConfig( + "商户号", + "私钥路径", + "证书序列号", + "APIv3密钥" + ); + + 🔧 前置条件: + 1. 微信商户平台已开启API安全功能 + 2. 已申请使用微信支付公钥 + 3. 私钥文件存在且路径正确 + 4. 网络连接正常 + + 📚 更多信息: + https://pay.weixin.qq.com/doc/v3/merchant/4012153196 + """; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/WechatPayCertificateDiagnostic.java b/src/main/java/com/gxwebsoft/common/core/utils/WechatPayCertificateDiagnostic.java new file mode 100644 index 0000000..ebe8189 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/WechatPayCertificateDiagnostic.java @@ -0,0 +1,314 @@ +package com.gxwebsoft.common.core.utils; + +import com.gxwebsoft.common.core.config.CertificateProperties; +import com.gxwebsoft.common.system.entity.Payment; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; + + +/** + * 微信支付证书诊断工具 + * 专门用于诊断和解决证书相关问题 + * + * @author 科技小王子 + * @since 2025-07-29 + */ +@Slf4j +@Component +public class WechatPayCertificateDiagnostic { + + private final CertificateProperties certConfig; + private final CertificateLoader certificateLoader; + + public WechatPayCertificateDiagnostic(CertificateProperties certConfig, CertificateLoader certificateLoader) { + this.certConfig = certConfig; + this.certificateLoader = certificateLoader; + } + + /** + * 全面诊断微信支付证书配置 + * + * @param payment 支付配置 + * @param tenantId 租户ID + * @param environment 环境(dev/prod) + * @return 诊断结果 + */ + public DiagnosticResult diagnoseCertificateConfig(Payment payment, Integer tenantId, String environment) { + DiagnosticResult result = new DiagnosticResult(); + + log.info("=== 开始微信支付证书诊断 ==="); + log.info("租户ID: {}, 环境: {}", tenantId, environment); + + try { + // 1. 检查基本配置 + checkBasicConfig(payment, result); + + // 2. 检查证书文件 + checkCertificateFiles(payment, tenantId, environment, result); + + // 3. 检查证书内容 + validateCertificateContent(payment, tenantId, environment, result); + + // 4. 生成建议 + generateRecommendations(result); + + } catch (Exception e) { + result.addError("诊断过程中发生异常: " + e.getMessage()); + log.error("证书诊断异常", e); + } + + log.info("=== 证书诊断完成 ==="); + return result; + } + + /** + * 检查基本配置 + */ + private void checkBasicConfig(Payment payment, DiagnosticResult result) { + if (payment == null) { + result.addError("支付配置为空"); + return; + } + + if (payment.getMchId() == null || payment.getMchId().trim().isEmpty()) { + result.addError("商户号未配置"); + } else { + result.addInfo("商户号: " + payment.getMchId()); + } + + if (payment.getAppId() == null || payment.getAppId().trim().isEmpty()) { + result.addError("应用ID未配置"); + } else { + result.addInfo("应用ID: " + payment.getAppId()); + } + + if (payment.getMerchantSerialNumber() == null || payment.getMerchantSerialNumber().trim().isEmpty()) { + result.addError("商户证书序列号未配置"); + } else { + result.addInfo("商户证书序列号: " + payment.getMerchantSerialNumber()); + } + + if (payment.getApiKey() == null || payment.getApiKey().trim().isEmpty()) { + result.addWarning("数据库中APIv3密钥未配置,将使用配置文件默认值"); + } else { + result.addInfo("APIv3密钥: 已配置(" + payment.getApiKey().length() + "位)"); + } + } + + /** + * 检查证书文件 + */ + private void checkCertificateFiles(Payment payment, Integer tenantId, String environment, DiagnosticResult result) { + if ("dev".equals(environment)) { + // 开发环境证书检查 + String tenantCertPath = "dev/wechat/" + tenantId; + String privateKeyPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getPrivateKeyFile(); + String apiclientCertPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getApiclientCertFile(); + + // 检查私钥文件 + if (certificateLoader.certificateExists(privateKeyPath)) { + result.addInfo("✅ 私钥文件存在: " + privateKeyPath); + try { + String privateKeyFile = certificateLoader.loadCertificatePath(privateKeyPath); + result.addInfo("私钥文件路径: " + privateKeyFile); + } catch (Exception e) { + result.addError("私钥文件加载失败: " + e.getMessage()); + } + } else { + result.addError("❌ 私钥文件不存在: " + privateKeyPath); + } + + // 检查商户证书文件 + if (certificateLoader.certificateExists(apiclientCertPath)) { + result.addInfo("✅ 商户证书文件存在: " + apiclientCertPath); + } else { + result.addWarning("⚠️ 商户证书文件不存在: " + apiclientCertPath + " (自动证书配置不需要此文件)"); + } + + } else { + // 生产环境证书检查 + if (payment.getApiclientKey() != null) { + result.addInfo("私钥文件配置: " + payment.getApiclientKey()); + } else { + result.addError("生产环境私钥文件路径未配置"); + } + + if (payment.getApiclientCert() != null) { + result.addInfo("商户证书文件配置: " + payment.getApiclientCert()); + } else { + result.addWarning("生产环境商户证书文件路径未配置 (自动证书配置不需要此文件)"); + } + } + } + + /** + * 验证证书内容 + */ + private void validateCertificateContent(Payment payment, Integer tenantId, String environment, DiagnosticResult result) { + try { + if ("dev".equals(environment)) { + String tenantCertPath = "dev/wechat/" + tenantId; + String apiclientCertPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getApiclientCertFile(); + + if (certificateLoader.certificateExists(apiclientCertPath)) { + validateX509Certificate(apiclientCertPath, payment.getMerchantSerialNumber(), result); + } + } + } catch (Exception e) { + result.addWarning("证书内容验证失败: " + e.getMessage()); + } + } + + /** + * 验证X509证书 + */ + private void validateX509Certificate(String certPath, String expectedSerialNumber, DiagnosticResult result) { + try { + String actualCertPath = certificateLoader.loadCertificatePath(certPath); + + try (InputStream inputStream = new FileInputStream(new File(actualCertPath))) { + CertificateFactory cf = CertificateFactory.getInstance("X.509"); + X509Certificate cert = (X509Certificate) cf.generateCertificate(inputStream); + + if (cert != null) { + String actualSerialNumber = cert.getSerialNumber().toString(16).toUpperCase(); + result.addInfo("证书序列号: " + actualSerialNumber); + result.addInfo("证书有效期: " + cert.getNotBefore() + " 至 " + cert.getNotAfter()); + result.addInfo("证书主体: " + cert.getSubjectX500Principal().toString()); + + // 检查序列号是否匹配 + if (expectedSerialNumber != null && !expectedSerialNumber.equalsIgnoreCase(actualSerialNumber)) { + result.addError("证书序列号不匹配! 配置: " + expectedSerialNumber + ", 实际: " + actualSerialNumber); + } else { + result.addInfo("✅ 证书序列号匹配"); + } + + // 检查证书是否过期 + long now = System.currentTimeMillis(); + if (now < cert.getNotBefore().getTime()) { + result.addError("证书尚未生效"); + } else if (now > cert.getNotAfter().getTime()) { + result.addError("证书已过期"); + } else { + result.addInfo("✅ 证书在有效期内"); + } + } else { + result.addError("无法解析证书文件"); + } + } + } catch (Exception e) { + result.addError("证书验证失败: " + e.getMessage()); + } + } + + /** + * 生成建议 + */ + private void generateRecommendations(DiagnosticResult result) { + if (result.hasErrors()) { + result.addRecommendation("🔧 修复建议:"); + + String errorText = result.getErrors(); + if (errorText.contains("商户号")) { + result.addRecommendation("1. 请在支付配置中设置正确的商户号"); + } + + if (errorText.contains("序列号")) { + result.addRecommendation("2. 请检查商户证书序列号是否正确,可在微信商户平台查看"); + } + + if (errorText.contains("证书文件")) { + result.addRecommendation("3. 请确保证书文件已正确放置在指定目录"); + } + + if (errorText.contains("过期")) { + result.addRecommendation("4. 请更新过期的证书文件"); + } + + result.addRecommendation("5. 建议使用RSAAutoCertificateConfig自动证书配置,可避免手动管理证书"); + result.addRecommendation("6. 确保在微信商户平台开启API安全功能并申请使用微信支付公钥"); + } else { + result.addRecommendation("✅ 证书配置正常,建议使用自动证书配置以获得最佳体验"); + } + } + + /** + * 诊断结果类 + */ + public static class DiagnosticResult { + private final StringBuilder errors = new StringBuilder(); + private final StringBuilder warnings = new StringBuilder(); + private final StringBuilder info = new StringBuilder(); + private final StringBuilder recommendations = new StringBuilder(); + + public void addError(String error) { + if (errors.length() > 0) errors.append("\n"); + errors.append(error); + } + + public void addWarning(String warning) { + if (warnings.length() > 0) warnings.append("\n"); + warnings.append(warning); + } + + public void addInfo(String information) { + if (info.length() > 0) info.append("\n"); + info.append(information); + } + + public void addRecommendation(String recommendation) { + if (recommendations.length() > 0) recommendations.append("\n"); + recommendations.append(recommendation); + } + + public boolean hasErrors() { + return errors.length() > 0; + } + + public String getErrors() { + return errors.toString(); + } + + public String getWarnings() { + return warnings.toString(); + } + + public String getInfo() { + return info.toString(); + } + + public String getRecommendations() { + return recommendations.toString(); + } + + public String getFullReport() { + StringBuilder report = new StringBuilder(); + report.append("=== 微信支付证书诊断报告 ===\n\n"); + + if (info.length() > 0) { + report.append("📋 基本信息:\n").append(info).append("\n\n"); + } + + if (warnings.length() > 0) { + report.append("⚠️ 警告:\n").append(warnings).append("\n\n"); + } + + if (errors.length() > 0) { + report.append("❌ 错误:\n").append(errors).append("\n\n"); + } + + if (recommendations.length() > 0) { + report.append("💡 建议:\n").append(recommendations).append("\n\n"); + } + + report.append("=== 诊断报告结束 ==="); + return report.toString(); + } + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/WechatPayCertificateFixer.java b/src/main/java/com/gxwebsoft/common/core/utils/WechatPayCertificateFixer.java new file mode 100644 index 0000000..af6e357 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/WechatPayCertificateFixer.java @@ -0,0 +1,312 @@ +package com.gxwebsoft.common.core.utils; + +import com.gxwebsoft.common.core.config.CertificateProperties; +import com.gxwebsoft.common.system.entity.Payment; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.List; + +/** + * 微信支付证书修复工具 + * 自动检测和修复常见的证书配置问题 + * + * @author 科技小王子 + * @since 2025-07-29 + */ +@Slf4j +@Component +public class WechatPayCertificateFixer { + + private final CertificateProperties certConfig; + private final CertificateLoader certificateLoader; + + public WechatPayCertificateFixer(CertificateProperties certConfig, CertificateLoader certificateLoader) { + this.certConfig = certConfig; + this.certificateLoader = certificateLoader; + } + + /** + * 自动修复证书配置问题 + * + * @param payment 支付配置 + * @param tenantId 租户ID + * @param environment 环境 + * @return 修复结果 + */ + public FixResult autoFixCertificateIssues(Payment payment, Integer tenantId, String environment) { + FixResult result = new FixResult(); + + log.info("开始自动修复租户 {} 的证书配置问题", tenantId); + + try { + // 1. 检查并修复基本配置 + fixBasicConfiguration(payment, result); + + // 2. 检查并修复证书文件问题 + fixCertificateFiles(payment, tenantId, environment, result); + + // 3. 检查并修复序列号问题 + fixSerialNumberIssues(payment, tenantId, environment, result); + + // 4. 生成修复建议 + generateFixRecommendations(result); + + } catch (Exception e) { + result.addError("修复过程中发生异常: " + e.getMessage()); + log.error("证书修复异常", e); + } + + log.info("证书配置修复完成,成功修复 {} 个问题", result.getFixedIssues().size()); + return result; + } + + /** + * 修复基本配置问题 + */ + private void fixBasicConfiguration(Payment payment, FixResult result) { + if (payment == null) { + result.addError("支付配置为空,无法修复"); + return; + } + + // 检查商户号 + if (payment.getMchId() == null || payment.getMchId().trim().isEmpty()) { + result.addError("商户号未配置,需要手动设置"); + } + + // 检查应用ID + if (payment.getAppId() == null || payment.getAppId().trim().isEmpty()) { + result.addError("应用ID未配置,需要手动设置"); + } + + // 检查APIv3密钥 + if (payment.getApiKey() == null || payment.getApiKey().trim().isEmpty()) { + result.addWarning("APIv3密钥未配置,将使用配置文件默认值"); + } else if (payment.getApiKey().length() != 32) { + result.addError("APIv3密钥长度错误,应为32位,实际为: " + payment.getApiKey().length()); + } + + // 检查商户证书序列号 + if (payment.getMerchantSerialNumber() == null || payment.getMerchantSerialNumber().trim().isEmpty()) { + result.addError("商户证书序列号未配置,需要手动设置"); + } + } + + /** + * 修复证书文件问题 + */ + private void fixCertificateFiles(Payment payment, Integer tenantId, String environment, FixResult result) { + if ("dev".equals(environment)) { + fixDevCertificateFiles(tenantId, result); + } else { + fixProdCertificateFiles(payment, result); + } + } + + /** + * 修复开发环境证书文件问题 + */ + private void fixDevCertificateFiles(Integer tenantId, FixResult result) { + String tenantCertPath = "dev/wechat/" + tenantId; + String privateKeyPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getPrivateKeyFile(); + String apiclientCertPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getApiclientCertFile(); + + // 检查私钥文件 + if (!certificateLoader.certificateExists(privateKeyPath)) { + result.addError("私钥文件不存在: " + privateKeyPath); + result.addRecommendation("请将 apiclient_key.pem 文件放置到 src/main/resources/" + privateKeyPath); + } else { + result.addFixed("私钥文件存在: " + privateKeyPath); + + // 尝试加载私钥文件 + try { + String privateKeyFile = certificateLoader.loadCertificatePath(privateKeyPath); + result.addFixed("私钥文件加载成功: " + privateKeyFile); + } catch (Exception e) { + result.addError("私钥文件加载失败: " + e.getMessage()); + } + } + + // 检查商户证书文件(可选) + if (!certificateLoader.certificateExists(apiclientCertPath)) { + result.addWarning("商户证书文件不存在: " + apiclientCertPath + " (自动证书配置不需要此文件)"); + } else { + result.addFixed("商户证书文件存在: " + apiclientCertPath); + } + } + + /** + * 修复生产环境证书文件问题 + */ + private void fixProdCertificateFiles(Payment payment, FixResult result) { + if (payment.getApiclientKey() == null || payment.getApiclientKey().trim().isEmpty()) { + result.addError("生产环境私钥文件路径未配置"); + } else { + result.addFixed("生产环境私钥文件路径已配置: " + payment.getApiclientKey()); + } + + if (payment.getApiclientCert() == null || payment.getApiclientCert().trim().isEmpty()) { + result.addWarning("生产环境商户证书文件路径未配置 (自动证书配置不需要此文件)"); + } else { + result.addFixed("生产环境商户证书文件路径已配置: " + payment.getApiclientCert()); + } + } + + /** + * 修复序列号问题 + */ + private void fixSerialNumberIssues(Payment payment, Integer tenantId, String environment, FixResult result) { + if (payment.getMerchantSerialNumber() == null || payment.getMerchantSerialNumber().trim().isEmpty()) { + result.addError("商户证书序列号未配置"); + return; + } + + // 在开发环境中,尝试从证书文件中提取序列号进行验证 + if ("dev".equals(environment)) { + try { + String tenantCertPath = "dev/wechat/" + tenantId; + String apiclientCertPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getApiclientCertFile(); + + if (certificateLoader.certificateExists(apiclientCertPath)) { + String actualCertPath = certificateLoader.loadCertificatePath(apiclientCertPath); + + try (InputStream inputStream = new FileInputStream(new File(actualCertPath))) { + CertificateFactory cf = CertificateFactory.getInstance("X.509"); + X509Certificate cert = (X509Certificate) cf.generateCertificate(inputStream); + + if (cert != null) { + String actualSerialNumber = cert.getSerialNumber().toString(16).toUpperCase(); + String configuredSerialNumber = payment.getMerchantSerialNumber(); + + if (!configuredSerialNumber.equalsIgnoreCase(actualSerialNumber)) { + result.addError("证书序列号不匹配! 配置: " + configuredSerialNumber + ", 实际: " + actualSerialNumber); + result.addRecommendation("建议将商户证书序列号更新为: " + actualSerialNumber); + } else { + result.addFixed("证书序列号匹配: " + actualSerialNumber); + } + } + } + } + } catch (Exception e) { + result.addWarning("无法验证证书序列号: " + e.getMessage()); + } + } + } + + /** + * 生成修复建议 + */ + private void generateFixRecommendations(FixResult result) { + if (result.hasErrors()) { + result.addRecommendation("=== 修复建议 ==="); + + if (result.getErrors().stream().anyMatch(e -> e.contains("商户号"))) { + result.addRecommendation("1. 请在微信商户平台获取商户号并在系统中配置"); + } + + if (result.getErrors().stream().anyMatch(e -> e.contains("应用ID"))) { + result.addRecommendation("2. 请在微信开放平台获取应用ID并在系统中配置"); + } + + if (result.getErrors().stream().anyMatch(e -> e.contains("APIv3密钥"))) { + result.addRecommendation("3. 请在微信商户平台设置32位APIv3密钥"); + } + + if (result.getErrors().stream().anyMatch(e -> e.contains("证书序列号"))) { + result.addRecommendation("4. 请在微信商户平台查看正确的商户证书序列号"); + } + + if (result.getErrors().stream().anyMatch(e -> e.contains("私钥文件"))) { + result.addRecommendation("5. 请从微信商户平台下载私钥文件并放置到正确位置"); + } + + result.addRecommendation("6. 建议使用RSAAutoCertificateConfig自动证书配置"); + result.addRecommendation("7. 确保在微信商户平台开启API安全功能"); + } + } + + /** + * 修复结果类 + */ + public static class FixResult { + private final List errors = new ArrayList<>(); + private final List warnings = new ArrayList<>(); + private final List fixedIssues = new ArrayList<>(); + private final List recommendations = new ArrayList<>(); + + public void addError(String error) { + errors.add(error); + } + + public void addWarning(String warning) { + warnings.add(warning); + } + + public void addFixed(String fixed) { + fixedIssues.add(fixed); + } + + public void addRecommendation(String recommendation) { + recommendations.add(recommendation); + } + + public boolean hasErrors() { + return !errors.isEmpty(); + } + + public List getErrors() { + return errors; + } + + public List getWarnings() { + return warnings; + } + + public List getFixedIssues() { + return fixedIssues; + } + + public List getRecommendations() { + return recommendations; + } + + public String getFullReport() { + StringBuilder report = new StringBuilder(); + report.append("=== 微信支付证书修复报告 ===\n\n"); + + if (!fixedIssues.isEmpty()) { + report.append("✅ 已修复的问题:\n"); + fixedIssues.forEach(issue -> report.append(" - ").append(issue).append("\n")); + report.append("\n"); + } + + if (!warnings.isEmpty()) { + report.append("⚠️ 警告:\n"); + warnings.forEach(warning -> report.append(" - ").append(warning).append("\n")); + report.append("\n"); + } + + if (!errors.isEmpty()) { + report.append("❌ 需要手动修复的问题:\n"); + errors.forEach(error -> report.append(" - ").append(error).append("\n")); + report.append("\n"); + } + + if (!recommendations.isEmpty()) { + report.append("💡 修复建议:\n"); + recommendations.forEach(rec -> report.append(" ").append(rec).append("\n")); + report.append("\n"); + } + + report.append("=== 修复报告结束 ==="); + return report.toString(); + } + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/WechatPayConfigChecker.java b/src/main/java/com/gxwebsoft/common/core/utils/WechatPayConfigChecker.java new file mode 100644 index 0000000..74a6fa4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/WechatPayConfigChecker.java @@ -0,0 +1,243 @@ +package com.gxwebsoft.common.core.utils; + +import com.gxwebsoft.common.core.config.CertificateProperties; +import com.gxwebsoft.common.core.service.PaymentCacheService; +import com.gxwebsoft.common.system.entity.Payment; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +/** + * 微信支付配置检查器 + * 用于快速检查和验证微信支付配置状态 + * + * @author 科技小王子 + * @since 2025-07-29 + */ +@Slf4j +@Component +public class WechatPayConfigChecker { + + @Autowired + private PaymentCacheService paymentCacheService; + + @Autowired + private CertificateLoader certificateLoader; + + @Autowired + private CertificateProperties certConfig; + + @Value("${spring.profiles.active:dev}") + private String activeProfile; + + /** + * 检查租户的微信支付配置状态 + * + * @param tenantId 租户ID + * @return 配置状态报告 + */ + public ConfigStatus checkTenantConfig(Integer tenantId) { + ConfigStatus status = new ConfigStatus(); + status.tenantId = tenantId; + status.environment = activeProfile; + + try { + // 获取支付配置 + Payment payment = paymentCacheService.getWechatPayConfig(tenantId); + if (payment == null) { + status.hasError = true; + status.errorMessage = "支付配置不存在"; + return status; + } + + status.merchantId = payment.getMchId(); + status.appId = payment.getAppId(); + status.serialNumber = payment.getMerchantSerialNumber(); + status.hasApiKey = payment.getApiKey() != null && !payment.getApiKey().isEmpty(); + status.apiKeyLength = payment.getApiKey() != null ? payment.getApiKey().length() : 0; + + // 检查公钥配置 + if (payment.getPubKey() != null && !payment.getPubKey().isEmpty() && + payment.getPubKeyId() != null && !payment.getPubKeyId().isEmpty()) { + + status.hasPublicKey = true; + status.publicKeyFile = payment.getPubKey(); + status.publicKeyId = payment.getPubKeyId(); + status.configMode = "公钥模式"; + + // 检查公钥文件是否存在 + String tenantCertPath = "dev/wechat/" + tenantId; + String pubKeyPath = tenantCertPath + "/" + payment.getPubKey(); + status.publicKeyExists = certificateLoader.certificateExists(pubKeyPath); + + } else { + status.hasPublicKey = false; + status.configMode = "自动证书模式"; + } + + // 检查私钥文件 + String tenantCertPath = "dev/wechat/" + tenantId; + String privateKeyPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getPrivateKeyFile(); + status.privateKeyExists = certificateLoader.certificateExists(privateKeyPath); + + // 检查商户证书文件 + String apiclientCertPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getApiclientCertFile(); + status.merchantCertExists = certificateLoader.certificateExists(apiclientCertPath); + + // 评估配置完整性 + evaluateConfigCompleteness(status); + + } catch (Exception e) { + status.hasError = true; + status.errorMessage = "检查配置时发生异常: " + e.getMessage(); + log.error("检查租户 {} 配置时发生异常", tenantId, e); + } + + return status; + } + + /** + * 评估配置完整性 + */ + private void evaluateConfigCompleteness(ConfigStatus status) { + if (status.hasError) { + return; + } + + // 基本配置检查 + if (status.merchantId == null || status.merchantId.isEmpty()) { + status.addIssue("商户号未配置"); + } + + if (status.appId == null || status.appId.isEmpty()) { + status.addIssue("应用ID未配置"); + } + + if (status.serialNumber == null || status.serialNumber.isEmpty()) { + status.addIssue("商户证书序列号未配置"); + } + + if (!status.hasApiKey) { + status.addIssue("APIv3密钥未配置"); + } else if (status.apiKeyLength != 32) { + status.addIssue("APIv3密钥长度错误,应为32位,实际为" + status.apiKeyLength + "位"); + } + + if (!status.privateKeyExists) { + status.addIssue("私钥文件不存在"); + } + + // 公钥模式特定检查 + if (status.hasPublicKey) { + if (!status.publicKeyExists) { + status.addIssue("公钥文件不存在"); + } + } + + // 设置配置状态 + if (status.issues.isEmpty()) { + status.configComplete = true; + status.recommendation = "✅ 配置完整,建议使用当前配置"; + } else { + status.configComplete = false; + if (status.hasPublicKey) { + status.recommendation = "⚠️ 公钥配置不完整,建议修复问题或回退到自动证书模式"; + } else { + status.recommendation = "⚠️ 自动证书配置不完整,建议配置公钥模式或修复当前问题"; + } + } + } + + /** + * 生成配置建议 + */ + public String generateConfigAdvice(Integer tenantId) { + ConfigStatus status = checkTenantConfig(tenantId); + + StringBuilder advice = new StringBuilder(); + advice.append("=== 租户 ").append(tenantId).append(" 微信支付配置建议 ===\n\n"); + + advice.append("当前配置模式: ").append(status.configMode).append("\n"); + advice.append("配置完整性: ").append(status.configComplete ? "完整" : "不完整").append("\n\n"); + + if (status.hasError) { + advice.append("❌ 错误: ").append(status.errorMessage).append("\n\n"); + return advice.toString(); + } + + // 基本信息 + advice.append("📋 基本信息:\n"); + advice.append(" 商户号: ").append(status.merchantId).append("\n"); + advice.append(" 应用ID: ").append(status.appId).append("\n"); + advice.append(" 序列号: ").append(status.serialNumber).append("\n"); + advice.append(" API密钥: ").append(status.hasApiKey ? "已配置(" + status.apiKeyLength + "位)" : "未配置").append("\n\n"); + + // 证书文件状态 + advice.append("📁 证书文件状态:\n"); + advice.append(" 私钥文件: ").append(status.privateKeyExists ? "✅ 存在" : "❌ 不存在").append("\n"); + advice.append(" 商户证书: ").append(status.merchantCertExists ? "✅ 存在" : "⚠️ 不存在").append("\n"); + + if (status.hasPublicKey) { + advice.append(" 公钥文件: ").append(status.publicKeyExists ? "✅ 存在" : "❌ 不存在").append("\n"); + advice.append(" 公钥ID: ").append(status.publicKeyId).append("\n"); + } + advice.append("\n"); + + // 问题列表 + if (!status.issues.isEmpty()) { + advice.append("⚠️ 发现的问题:\n"); + for (String issue : status.issues) { + advice.append(" - ").append(issue).append("\n"); + } + advice.append("\n"); + } + + // 建议 + advice.append("💡 建议:\n"); + advice.append(" ").append(status.recommendation).append("\n\n"); + + if (!status.hasPublicKey) { + advice.append("🔧 配置公钥模式的步骤:\n"); + advice.append(" 1. 获取微信支付平台公钥文件和公钥ID\n"); + advice.append(" 2. 将公钥文件放置到: src/main/resources/dev/wechat/").append(tenantId).append("/\n"); + advice.append(" 3. 执行SQL更新数据库配置:\n"); + advice.append(" UPDATE sys_payment SET \n"); + advice.append(" pub_key = 'wechatpay_public_key.pem',\n"); + advice.append(" pub_key_id = 'YOUR_PUBLIC_KEY_ID'\n"); + advice.append(" WHERE tenant_id = ").append(tenantId).append(" AND type = 0;\n\n"); + } + + advice.append("=== 配置建议结束 ==="); + return advice.toString(); + } + + /** + * 配置状态类 + */ + public static class ConfigStatus { + public Integer tenantId; + public String environment; + public String merchantId; + public String appId; + public String serialNumber; + public boolean hasApiKey; + public int apiKeyLength; + public boolean hasPublicKey; + public String publicKeyFile; + public String publicKeyId; + public boolean publicKeyExists; + public boolean privateKeyExists; + public boolean merchantCertExists; + public String configMode; + public boolean configComplete; + public boolean hasError; + public String errorMessage; + public String recommendation; + public java.util.List issues = new java.util.ArrayList<>(); + + public void addIssue(String issue) { + issues.add(issue); + } + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/WechatPayConfigValidator.java b/src/main/java/com/gxwebsoft/common/core/utils/WechatPayConfigValidator.java new file mode 100644 index 0000000..23326d2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/WechatPayConfigValidator.java @@ -0,0 +1,223 @@ +package com.gxwebsoft.common.core.utils; + +import com.gxwebsoft.common.core.config.CertificateProperties; +import com.gxwebsoft.common.system.entity.Payment; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; + +/** + * 微信支付配置验证工具 + * + * @author 科技小王子 + * @since 2025-07-27 + */ +@Slf4j +@Component +public class WechatPayConfigValidator { + + private final CertificateProperties certConfig; + private final CertificateLoader certificateLoader; + + @Value("${spring.profiles.active}") + private String activeProfile; + + public WechatPayConfigValidator(CertificateProperties certConfig, CertificateLoader certificateLoader) { + this.certConfig = certConfig; + this.certificateLoader = certificateLoader; + } + + /** + * 验证微信支付配置 + * + * @param payment 支付配置 + * @param tenantId 租户ID + * @return 验证结果 + */ + public ValidationResult validateWechatPayConfig(Payment payment, Integer tenantId) { + ValidationResult result = new ValidationResult(); + + log.info("开始验证微信支付配置 - 租户ID: {}", tenantId); + + // 1. 验证基本配置 + if (payment == null) { + result.addError("支付配置为空"); + return result; + } + + if (!StringUtils.hasText(payment.getMchId())) { + result.addError("商户号未配置"); + } + + if (!StringUtils.hasText(payment.getAppId())) { + result.addError("应用ID未配置"); + } + + if (!StringUtils.hasText(payment.getMerchantSerialNumber())) { + result.addError("商户证书序列号未配置"); + } + + // 2. 验证 APIv3 密钥 + String apiV3Key = getValidApiV3Key(payment); + if (!StringUtils.hasText(apiV3Key)) { + result.addError("APIv3密钥未配置"); + } else { + validateApiV3Key(apiV3Key, result); + } + + // 3. 验证证书文件 + validateCertificateFiles(tenantId, result); + + // 4. 记录验证结果 + if (result.isValid()) { + log.info("✅ 微信支付配置验证通过 - 租户ID: {}", tenantId); + } else { + log.error("❌ 微信支付配置验证失败 - 租户ID: {}, 错误: {}", tenantId, result.getErrors()); + } + + return result; + } + + /** + * 获取有效的 APIv3 密钥 + * 优先使用数据库配置,如果为空则使用配置文件默认值 + */ + public String getValidApiV3Key(Payment payment) { + String apiV3Key = payment.getApiKey(); + + if (!StringUtils.hasText(apiV3Key)) { + apiV3Key = certConfig.getWechatPay().getDev().getApiV3Key(); + log.warn("数据库中APIv3密钥为空,使用配置文件默认值"); + } + + return apiV3Key; + } + + /** + * 验证 APIv3 密钥格式 + */ + private void validateApiV3Key(String apiV3Key, ValidationResult result) { + if (apiV3Key.length() != 32) { + result.addError("APIv3密钥长度错误,应为32位,实际为: " + apiV3Key.length()); + } + + if (!apiV3Key.matches("^[a-zA-Z0-9]+$")) { + result.addError("APIv3密钥格式错误,应仅包含字母和数字"); + } + + log.info("APIv3密钥验证 - 长度: {}, 格式: {}", + apiV3Key.length(), + apiV3Key.matches("^[a-zA-Z0-9]+$") ? "正确" : "错误"); + } + + /** + * 验证证书文件 + */ + private void validateCertificateFiles(Integer tenantId, ValidationResult result) { + if ("dev".equals(activeProfile)) { + // 开发环境证书验证 + String tenantCertPath = "dev/wechat/" + tenantId; + String privateKeyPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getPrivateKeyFile(); + + if (!certificateLoader.certificateExists(privateKeyPath)) { + result.addError("证书文件不存在: " + privateKeyPath); + return; + } + + try { + certificateLoader.loadCertificatePath(privateKeyPath); + log.info("✅ 开发环境证书文件验证通过: {}", privateKeyPath); + } catch (Exception e) { + result.addError("证书文件加载失败: " + e.getMessage()); + } + } else { + // 生产环境证书验证 - 跳过文件存在性检查,因为证书路径来自数据库 + log.info("✅ 生产环境跳过证书文件存在性验证,使用数据库配置的证书路径"); + } + } + + /** + * 验证结果类 + */ + public static class ValidationResult { + private boolean valid = true; + private StringBuilder errors = new StringBuilder(); + + public void addError(String error) { + this.valid = false; + if (errors.length() > 0) { + errors.append("; "); + } + errors.append(error); + } + + public boolean isValid() { + return valid; + } + + public String getErrors() { + return errors.toString(); + } + + public void logErrors() { + if (!valid) { + log.error("配置验证失败: {}", errors.toString()); + } + } + } + + /** + * 生成配置诊断报告 + */ + public String generateDiagnosticReport(Payment payment, Integer tenantId) { + StringBuilder report = new StringBuilder(); + report.append("=== 微信支付配置诊断报告 ===\n"); + report.append("租户ID: ").append(tenantId).append("\n"); + + if (payment != null) { + report.append("商户号: ").append(payment.getMchId()).append("\n"); + report.append("应用ID: ").append(payment.getAppId()).append("\n"); + report.append("商户证书序列号: ").append(payment.getMerchantSerialNumber()).append("\n"); + + String dbApiKey = payment.getApiKey(); + String configApiKey = certConfig.getWechatPay().getDev().getApiV3Key(); + + report.append("数据库APIv3密钥: ").append(dbApiKey != null ? "已配置(" + dbApiKey.length() + "位)" : "未配置").append("\n"); + report.append("配置文件APIv3密钥: ").append(configApiKey != null ? "已配置(" + configApiKey.length() + "位)" : "未配置").append("\n"); + + String finalApiKey = getValidApiV3Key(payment); + report.append("最终使用APIv3密钥: ").append(finalApiKey != null ? "已配置(" + finalApiKey.length() + "位)" : "未配置").append("\n"); + + } else { + report.append("❌ 支付配置为空\n"); + } + + // 证书文件检查 + report.append("当前环境: ").append(activeProfile).append("\n"); + if ("dev".equals(activeProfile)) { + String tenantCertPath = "dev/wechat/" + tenantId; + String privateKeyPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getPrivateKeyFile(); + boolean certExists = certificateLoader.certificateExists(privateKeyPath); + + report.append("开发环境证书文件路径: ").append(privateKeyPath).append("\n"); + report.append("证书文件存在: ").append(certExists ? "是" : "否").append("\n"); + } else { + report.append("生产环境证书路径: 从数据库配置获取\n"); + if (payment != null) { + report.append("私钥文件: ").append(payment.getApiclientKey()).append("\n"); + report.append("证书文件: ").append(payment.getApiclientCert()).append("\n"); + } + } + + ValidationResult validation = validateWechatPayConfig(payment, tenantId); + report.append("配置验证结果: ").append(validation.isValid() ? "通过" : "失败").append("\n"); + if (!validation.isValid()) { + report.append("验证错误: ").append(validation.getErrors()).append("\n"); + } + + report.append("=== 诊断报告结束 ==="); + + return report.toString(); + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/WechatPayDiagnostic.java b/src/main/java/com/gxwebsoft/common/core/utils/WechatPayDiagnostic.java new file mode 100644 index 0000000..620d506 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/WechatPayDiagnostic.java @@ -0,0 +1,222 @@ +package com.gxwebsoft.common.core.utils; + +import com.gxwebsoft.common.system.entity.Payment; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Paths; + +/** + * 微信支付配置诊断工具 + * 用于排查微信支付签名验证失败等问题 + * + * @author 科技小王子 + * @since 2025-07-27 + */ +@Slf4j +@Component +public class WechatPayDiagnostic { + + /** + * 诊断微信支付配置 + * + * @param payment 支付配置 + * @param privateKeyPath 私钥路径 + * @param environment 环境标识 + */ + public void diagnosePaymentConfig(Payment payment, String privateKeyPath, String environment) { + log.info("=== 微信支付配置诊断开始 ==="); + log.info("环境: {}", environment); + + // 1. 检查支付配置基本信息 + checkBasicConfig(payment); + + // 2. 检查证书文件 + checkCertificateFiles(payment, privateKeyPath, environment); + + // 3. 检查配置完整性 + checkConfigCompleteness(payment); + + log.info("=== 微信支付配置诊断结束 ==="); + } + + /** + * 检查基本配置信息 + */ + private void checkBasicConfig(Payment payment) { + log.info("--- 基本配置检查 ---"); + + if (payment == null) { + log.error("❌ 支付配置为空"); + return; + } + + log.info("支付配置ID: {}", payment.getId()); + log.info("支付方式名称: {}", payment.getName()); + log.info("支付类型: {}", payment.getType()); + log.info("支付代码: {}", payment.getCode()); + log.info("状态: {}", payment.getStatus()); + + // 检查关键字段 + checkField("应用ID", payment.getAppId()); + checkField("商户号", payment.getMchId()); + checkField("商户证书序列号", payment.getMerchantSerialNumber()); + checkField("API密钥", payment.getApiKey(), true); + } + + /** + * 检查证书文件 + */ + private void checkCertificateFiles(Payment payment, String privateKeyPath, String environment) { + log.info("--- 证书文件检查 ---"); + + // 检查私钥文件 + if (privateKeyPath != null) { + checkFileExists("私钥文件", privateKeyPath); + } + + // 生产环境检查证书文件 + if (!"dev".equals(environment)) { + if (payment.getApiclientCert() != null) { + log.info("商户证书文件配置: {}", payment.getApiclientCert()); + } + + if (payment.getPubKey() != null) { + log.info("公钥文件配置: {}", payment.getPubKey()); + log.info("公钥ID: {}", payment.getPubKeyId()); + } + } + } + + /** + * 检查配置完整性 + */ + private void checkConfigCompleteness(Payment payment) { + log.info("--- 配置完整性检查 ---"); + + boolean isComplete = true; + + if (isEmpty(payment.getMchId())) { + log.error("❌ 商户号未配置"); + isComplete = false; + } + + if (isEmpty(payment.getMerchantSerialNumber())) { + log.error("❌ 商户证书序列号未配置"); + isComplete = false; + } + + if (isEmpty(payment.getApiKey())) { + log.error("❌ API密钥未配置"); + isComplete = false; + } + + if (isEmpty(payment.getAppId())) { + log.error("❌ 应用ID未配置"); + isComplete = false; + } + + if (isComplete) { + log.info("✅ 配置完整性检查通过"); + } else { + log.error("❌ 配置不完整,请补充缺失的配置项"); + } + } + + /** + * 检查字段是否为空 + */ + private void checkField(String fieldName, String value) { + checkField(fieldName, value, false); + } + + /** + * 检查字段是否为空 + */ + private void checkField(String fieldName, String value, boolean isSensitive) { + if (isEmpty(value)) { + log.warn("⚠️ {}: 未配置", fieldName); + } else { + if (isSensitive) { + log.info("✅ {}: 已配置(长度:{})", fieldName, value.length()); + } else { + log.info("✅ {}: {}", fieldName, value); + } + } + } + + /** + * 检查文件是否存在 + */ + private void checkFileExists(String fileName, String filePath) { + try { + File file = new File(filePath); + if (file.exists() && file.isFile()) { + log.info("✅ {}: 文件存在 - {}", fileName, filePath); + log.info(" 文件大小: {} bytes", file.length()); + + // 检查文件内容格式 + if (filePath.endsWith(".pem")) { + checkPemFileFormat(fileName, filePath); + } + } else { + log.error("❌ {}: 文件不存在 - {}", fileName, filePath); + } + } catch (Exception e) { + log.error("❌ {}: 检查文件时出错 - {} ({})", fileName, filePath, e.getMessage()); + } + } + + /** + * 检查PEM文件格式 + */ + private void checkPemFileFormat(String fileName, String filePath) { + try { + String content = Files.readString(Paths.get(filePath)); + if (content.contains("-----BEGIN") && content.contains("-----END")) { + log.info("✅ {}: PEM格式正确", fileName); + } else { + log.warn("⚠️ {}: PEM格式可能有问题", fileName); + } + } catch (Exception e) { + log.warn("⚠️ {}: 无法读取文件内容进行格式检查 ({})", fileName, e.getMessage()); + } + } + + /** + * 检查字符串是否为空 + */ + private boolean isEmpty(String str) { + return str == null || str.trim().isEmpty(); + } + + /** + * 生成诊断报告 + */ + public String generateDiagnosticReport(Payment payment, String environment) { + StringBuilder report = new StringBuilder(); + report.append("🔍 微信支付配置诊断报告\n"); + report.append("========================\n\n"); + + report.append("环境: ").append(environment).append("\n"); + report.append("租户ID: ").append(payment != null ? payment.getTenantId() : "未知").append("\n"); + report.append("商户号: ").append(payment != null ? payment.getMchId() : "未配置").append("\n"); + report.append("应用ID: ").append(payment != null ? payment.getAppId() : "未配置").append("\n\n"); + + report.append("🚨 常见问题排查:\n"); + report.append("1. 商户证书序列号是否正确\n"); + report.append("2. APIv3密钥是否正确\n"); + report.append("3. 私钥文件是否正确\n"); + report.append("4. 微信支付平台证书是否过期\n"); + report.append("5. 网络连接是否正常\n\n"); + + report.append("💡 建议解决方案:\n"); + report.append("1. 使用自动证书配置(RSAAutoCertificateConfig)\n"); + report.append("2. 在微信商户平台重新下载证书\n"); + report.append("3. 检查商户平台API安全设置\n"); + + return report.toString(); + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/WechatPayUtils.java b/src/main/java/com/gxwebsoft/common/core/utils/WechatPayUtils.java new file mode 100644 index 0000000..14a31e9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/WechatPayUtils.java @@ -0,0 +1,111 @@ +package com.gxwebsoft.common.core.utils; + +import java.nio.charset.StandardCharsets; + +/** + * 微信支付工具类 + * 处理微信支付API的字段限制和格式要求 + * + * @author 科技小王子 + * @since 2025-01-11 + */ +public class WechatPayUtils { + + /** + * 微信支付description字段的最大字节数限制 + */ + public static final int DESCRIPTION_MAX_BYTES = 127; + + /** + * 微信支付attach字段的最大字节数限制 + */ + public static final int ATTACH_MAX_BYTES = 127; + + /** + * 截断字符串以确保字节数不超过指定限制 + * 主要用于微信支付API的字段限制处理 + * + * @param text 原始文本 + * @param maxBytes 最大字节数 + * @return 截断后的文本,确保UTF-8字符完整性 + */ + public static String truncateToByteLimit(String text, int maxBytes) { + if (text == null || text.isEmpty()) { + return text; + } + + byte[] bytes = text.getBytes(StandardCharsets.UTF_8); + if (bytes.length <= maxBytes) { + return text; + } + + // 截断字节数组,但要确保不会截断UTF-8字符的中间 + int truncateLength = maxBytes; + while (truncateLength > 0) { + byte[] truncated = new byte[truncateLength]; + System.arraycopy(bytes, 0, truncated, 0, truncateLength); + + try { + String result = new String(truncated, StandardCharsets.UTF_8); + // 检查是否有无效字符(被截断的UTF-8字符) + if (!result.contains("\uFFFD")) { + return result; + } + } catch (Exception e) { + // 继续尝试更短的长度 + } + truncateLength--; + } + + return ""; // 如果无法安全截断,返回空字符串 + } + + /** + * 处理微信支付商品描述字段 + * 确保字节数不超过127字节 + * + * @param description 商品描述 + * @return 处理后的描述,符合微信支付要求 + */ + public static String processDescription(String description) { + return truncateToByteLimit(description, DESCRIPTION_MAX_BYTES); + } + + /** + * 处理微信支付附加数据字段 + * 确保字节数不超过127字节 + * + * @param attach 附加数据 + * @return 处理后的附加数据,符合微信支付要求 + */ + public static String processAttach(String attach) { + return truncateToByteLimit(attach, ATTACH_MAX_BYTES); + } + + /** + * 验证字符串是否符合微信支付字段的字节限制 + * + * @param text 待验证的文本 + * @param maxBytes 最大字节数限制 + * @return true如果符合限制,false如果超出限制 + */ + public static boolean isWithinByteLimit(String text, int maxBytes) { + if (text == null) { + return true; + } + return text.getBytes(StandardCharsets.UTF_8).length <= maxBytes; + } + + /** + * 获取字符串的UTF-8字节数 + * + * @param text 文本 + * @return 字节数 + */ + public static int getByteLength(String text) { + if (text == null) { + return 0; + } + return text.getBytes(StandardCharsets.UTF_8).length; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/WxNativeUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/WxNativeUtil.java new file mode 100644 index 0000000..52a8d2c --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/WxNativeUtil.java @@ -0,0 +1,20 @@ +package com.gxwebsoft.common.core.utils; + +import com.wechat.pay.java.core.Config; + +import java.util.HashMap; +import java.util.Map; + + +public class WxNativeUtil { + + private static final Map tenantConfigs = new HashMap<>(); + + public static void addConfig(Integer tenantId, Config config) { + tenantConfigs.put(tenantId, config); + } + + public static Config getConfig(Integer tenantId) { + return tenantConfigs.get(tenantId); + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/WxOfficialUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/WxOfficialUtil.java new file mode 100644 index 0000000..4f10747 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/WxOfficialUtil.java @@ -0,0 +1,106 @@ +package com.gxwebsoft.common.core.utils; + +import cn.hutool.core.util.CharsetUtil; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSONObject; +import com.gxwebsoft.common.core.config.ConfigProperties; +import com.gxwebsoft.common.core.exception.BusinessException; +import com.gxwebsoft.common.system.service.SettingService; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; + +/** + * 微信公众号工具类 + * @author 科技小王子 + * + */ +@Component +public class WxOfficialUtil { + private final StringRedisTemplate stringRedisTemplate; + private Integer tenantId; + public String appId; + public String appSecret; + public String openid; + public String unionid; + public String access_token; + public String expires_in; + public String nickname; + + + @Resource + private SettingService settingService; + @Resource + private ConfigProperties pathConfig; + @Resource + private CacheClient cacheClient; + + public WxOfficialUtil(StringRedisTemplate stringRedisTemplate){ + this.stringRedisTemplate = stringRedisTemplate; + } + + // 实例化客户端 + public WxOfficialUtil client(Integer tenantId) { + if(tenantId > 0){ + throw new BusinessException(tenantId + "123123"); + } + this.tenantId = tenantId; + this.config(); + System.out.println("this.tenantId = " + this.tenantId); + return this; + } + + // 开发者ID和秘钥 + private void config() { + String key = "cache"+ this.tenantId +":setting:wx-official"; + String wxOfficial = stringRedisTemplate.opsForValue().get(key); + JSONObject data = JSONObject.parseObject(wxOfficial); + if(data != null){ + this.appId = data.getString("appId"); + this.appSecret = data.getString("appSecret"); + } + System.out.println("this.appId = " + this.appId); + System.out.println("this.appSecret = " + this.appSecret); + } + + // 获取appId + public String getAppSecret(){ + return this.appSecret; + } + + public String getCodeUrl() throws UnsupportedEncodingException { + String encodedReturnUrl = URLEncoder.encode(pathConfig.getServerUrl() + "/open/wx-official/accessToken","UTF-8"); + return "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+ this.appId +"&redirect_uri=" + encodedReturnUrl + "&response_type=code&scope=snsapi_userinfo&state="+ this.tenantId +"#wechat_redirect"; + } + + // 获取access_token + public String getAccessToken(String code) { + String url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid="+ this.appId +"&secret="+ this.appSecret +"&code="+ code +"&grant_type=authorization_code"; + System.out.println("url = " + url); + String response = HttpUtil.get(url, CharsetUtil.CHARSET_UTF_8); + final JSONObject jsonObject = JSONObject.parseObject(response); + access_token = jsonObject.getString("access_token"); + if(access_token == null){ + throw new BusinessException("获取access_token失败"); + } + this.openid = jsonObject.getString("openid"); + this.unionid = jsonObject.getString("unionid"); + this.expires_in = jsonObject.getString("expires_in"); + return access_token; + } + + // 获取userinfo + public JSONObject getUserInfo(String access_token) { + String url = "https://api.weixin.qq.com/sns/userinfo?access_token="+ access_token +"&openid="+ this.openid +"&lang=zh_CN"; + System.out.println("url2 = " + url); + String response = HttpUtil.get(url, CharsetUtil.CHARSET_UTF_8); + System.out.println("response = " + response); + if(response == null){ + throw new BusinessException("获取userinfo失败"); + } + return JSONObject.parseObject(response); + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/WxUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/WxUtil.java new file mode 100644 index 0000000..ad45abe --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/WxUtil.java @@ -0,0 +1,152 @@ +package com.gxwebsoft.common.core.utils; + +import cn.hutool.core.util.CharsetUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSONObject; +import com.gxwebsoft.common.core.exception.BusinessException; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.concurrent.TimeUnit; + +/** + * 微信小程序工具类 + * @author 科技小王子 + * + */ +@Component +public class WxUtil { + private final StringRedisTemplate stringRedisTemplate; + private Integer tenantId; + public String appId; + public String appSecret; + public String access_token; + public String expires_in; + public String nickname; + public String userid; + public String user_ticket; + public String openid; + public String external_userid; + public String name; + public String position; + public String mobile; + public String gender; + public String email; + public String avatar; + public String thumb_avatar; + public String telephone; + public String address; + public String alias; + public String qr_code; + public String open_userid; + + @Resource + private CacheClient cacheClient; + + + public WxUtil(StringRedisTemplate stringRedisTemplate){ + this.stringRedisTemplate = stringRedisTemplate; + } + + + // 实例化客户端 + public WxUtil client(Integer tenantId) { + this.tenantId = tenantId; + this.config(); + return this; + } + + // 开发者ID和秘钥 + private void config() { + JSONObject settingInfo = cacheClient.getSettingInfo("wx-work", this.tenantId); + if(settingInfo == null){ + throw new BusinessException("微信小程序未配置"); + } + this.appId = settingInfo.getString("corpId"); + this.appSecret = settingInfo.getString("secret"); + System.out.println("this.appId = " + this.appId); + System.out.println("this.appSecret = " + this.appSecret); + } + + // 获取access_token + public void getAccessToken(String code) { + String key = "cache"+ this.tenantId +":ww:access_token"; + final String cachedValue = stringRedisTemplate.opsForValue().get(key); + + if(cachedValue != null){ + try { + // 尝试解析JSON格式的缓存 + JSONObject cachedJson = JSONObject.parseObject(cachedValue); + String accessToken = cachedJson.getString("access_token"); + if (accessToken != null) { + this.access_token = accessToken; + this.getUserInfo(code, accessToken); + return; + } + } catch (Exception e) { + // 如果解析失败,可能是旧格式的纯字符串token + System.out.println("企业微信缓存token格式异常,使用原值: " + e.getMessage()); + this.access_token = cachedValue; + this.getUserInfo(code, cachedValue); + return; + } + } + + // 缓存中没有,重新获取 + String url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=" +this.appId+ "&corpsecret="+ this.appSecret; + System.out.println("调用企业微信API获取token - URL: " + url); + String response = HttpUtil.get(url, CharsetUtil.CHARSET_UTF_8); + System.out.println("企业微信API响应: " + response); + final JSONObject jsonObject = JSONObject.parseObject(response); + + // 获取成功 + if(jsonObject.getString("access_token") != null){ + this.access_token = jsonObject.getString("access_token"); + this.expires_in = jsonObject.getString("expires_in"); + + // 缓存完整的JSON响应,与其他方法保持一致 + stringRedisTemplate.opsForValue().set(key, response, 7000, TimeUnit.SECONDS); + System.out.println("获取企业微信access_token成功 = " + this.access_token); + this.getUserInfo(code, this.access_token); + } + } + + // 获取userinfo + public void getUserInfo(String code, String access_token) { + String url = "https://qyapi.weixin.qq.com/cgi-bin/auth/getuserinfo?access_token=" +access_token+ "&code=" + code; + System.out.println("url2 = " + url); + String response = HttpUtil.get(url, CharsetUtil.CHARSET_UTF_8); + JSONObject jsonObject = JSONObject.parseObject(response); + final String errcode = jsonObject.getString("errcode"); + final String errmsg = jsonObject.getString("errmsg"); + if(!StrUtil.equals(errcode,"0")){ + throw new BusinessException(errmsg); + } + this.userid = jsonObject.getString("userid"); + this.user_ticket = jsonObject.getString("user_ticket"); + this.openid = jsonObject.getString("openid"); + this.external_userid = jsonObject.getString("external_userid"); + } + + public void getUserProfile(String userid, String access_token) { + String url = "https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token="+ access_token +"&userid=" + userid; + String response = HttpUtil.get(url, CharsetUtil.CHARSET_UTF_8); + JSONObject jsonObject = JSONObject.parseObject(response); + + this.name = jsonObject.getString("name"); + this.position = jsonObject.getString("position"); + this.gender = jsonObject.getString("gender"); + this.email = jsonObject.getString("email"); + this.avatar = jsonObject.getString("avatar"); + this.thumb_avatar = jsonObject.getString("thumb_avatar"); + this.telephone = jsonObject.getString("telephone"); + this.address = jsonObject.getString("address"); + this.alias = jsonObject.getString("alias"); + this.qr_code = jsonObject.getString("qr_code"); + this.open_userid = jsonObject.getString("open_userid"); + } + + +} diff --git a/src/main/java/com/gxwebsoft/common/core/utils/WxWorkUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/WxWorkUtil.java new file mode 100644 index 0000000..70635ed --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/utils/WxWorkUtil.java @@ -0,0 +1,154 @@ +package com.gxwebsoft.common.core.utils; + +import cn.hutool.core.util.CharsetUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSONObject; +import com.gxwebsoft.common.core.exception.BusinessException; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.concurrent.TimeUnit; + +/** + * 企业微信工具类 + * @author 科技小王子 + * + */ +@Component +public class WxWorkUtil { + private final StringRedisTemplate stringRedisTemplate; + private Integer tenantId; + public String appId; + public String appSecret; + public String access_token; + public String expires_in; + public String nickname; + public String userid; + public String user_ticket; + public String openid; + public String external_userid; + public String name; + public String position; + public String mobile; + public String gender; + public String email; + public String avatar; + public String thumb_avatar; + public String telephone; + public String address; + public String alias; + public String qr_code; + public String open_userid; + + @Resource + private CacheClient cacheClient; + + + public WxWorkUtil(StringRedisTemplate stringRedisTemplate){ + this.stringRedisTemplate = stringRedisTemplate; + } + + + // 实例化客户端 + public WxWorkUtil client(Integer tenantId) { + this.tenantId = tenantId; + this.config(); + return this; + } + + // 开发者ID和秘钥 + private void config() { + JSONObject settingInfo = cacheClient.getSettingInfo("wx-work", this.tenantId); + if(settingInfo == null){ + throw new BusinessException("企业微信未配置"); + } + this.appId = settingInfo.getString("corpId"); + this.appSecret = settingInfo.getString("secret"); + System.out.println("this.appId = " + this.appId); + System.out.println("this.appSecret = " + this.appSecret); + } + + // 获取access_token + public void getAccessToken(String code) { + String key = "cache"+ this.tenantId +":ww:access_token"; + final String cachedValue = stringRedisTemplate.opsForValue().get(key); + + if(cachedValue != null){ + try { + // 尝试解析JSON格式的缓存 + JSONObject cachedJson = JSONObject.parseObject(cachedValue); + String accessToken = cachedJson.getString("access_token"); + if (accessToken != null) { + this.access_token = accessToken; + this.getUserInfo(code, accessToken); + return; + } + } catch (Exception e) { + // 如果解析失败,可能是旧格式的纯字符串token + System.out.println("企业微信Work缓存token格式异常,使用原值: " + e.getMessage()); + this.access_token = cachedValue; + this.getUserInfo(code, cachedValue); + return; + } + } + + // 缓存中没有,重新获取 + String url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=" +this.appId+ "&corpsecret="+ this.appSecret; + System.out.println("调用企业微信Work API获取token - URL: " + url); + String response = HttpUtil.get(url, CharsetUtil.CHARSET_UTF_8); + System.out.println("企业微信Work API响应: " + response); + final JSONObject jsonObject = JSONObject.parseObject(response); + + // 获取成功 + if(jsonObject.getString("access_token") != null){ + this.access_token = jsonObject.getString("access_token"); + this.expires_in = jsonObject.getString("expires_in"); + + // 缓存完整的JSON响应,与其他方法保持一致 + stringRedisTemplate.opsForValue().set(key, response, 7000, TimeUnit.SECONDS); + System.out.println("获取企业微信Work access_token成功 = " + this.access_token); + this.getUserInfo(code, this.access_token); + } + } + + // 获取userinfo + public void getUserInfo(String code, String access_token) { + String url = "https://qyapi.weixin.qq.com/cgi-bin/auth/getuserinfo?access_token=" +access_token+ "&code=" + code; + System.out.println("url2 = " + url); + String response = HttpUtil.get(url, CharsetUtil.CHARSET_UTF_8); + System.out.println("response = " + response); + JSONObject jsonObject = JSONObject.parseObject(response); + final String errcode = jsonObject.getString("errcode"); + final String errmsg = jsonObject.getString("errmsg"); + if(!StrUtil.equals(errcode,"0")){ + throw new BusinessException(errmsg); + } + this.userid = jsonObject.getString("userid"); + this.user_ticket = jsonObject.getString("user_ticket"); + this.openid = jsonObject.getString("openid"); + this.external_userid = jsonObject.getString("external_userid"); + System.out.println("获取用户信息成功 = " + jsonObject); + } + + public void getUserProfile(String userid, String access_token) { + String url = "https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token="+ access_token +"&userid=" + userid; + String response = HttpUtil.get(url, CharsetUtil.CHARSET_UTF_8); + System.out.println("response3 = " + response); + JSONObject jsonObject = JSONObject.parseObject(response); + System.out.println("读取用户详细信息 = " + jsonObject); + + this.name = jsonObject.getString("name"); + this.position = jsonObject.getString("position"); + this.gender = jsonObject.getString("gender"); + this.email = jsonObject.getString("email"); + this.avatar = jsonObject.getString("avatar"); + this.thumb_avatar = jsonObject.getString("thumb_avatar"); + this.telephone = jsonObject.getString("telephone"); + this.address = jsonObject.getString("address"); + this.alias = jsonObject.getString("alias"); + this.qr_code = jsonObject.getString("qr_code"); + this.open_userid = jsonObject.getString("open_userid"); + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/web/ApiResult.java b/src/main/java/com/gxwebsoft/common/core/web/ApiResult.java new file mode 100644 index 0000000..0313839 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/web/ApiResult.java @@ -0,0 +1,87 @@ +package com.gxwebsoft.common.core.web; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; + +import java.io.Serializable; + +/** + * 返回结果 + * + * @author WebSoft + * @since 2017-06-10 10:10:50 + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class ApiResult implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "状态码") + private Integer code; + + @Schema(description = "状态信息") + private String message; + + @Schema(description = "返回数据") + private T data; + + @Schema(description = "错误信息") + private String error; + + public ApiResult() {} + + public ApiResult(Integer code) { + this(code, null); + } + + public ApiResult(Integer code, String message) { + this(code, message, null); + } + + public ApiResult(Integer code, String message, T data) { + this(code, message, data, null); + } + + public ApiResult(Integer code, String message, T data, String error) { + setCode(code); + setMessage(message); + setData(data); + setError(error); + } + + public Integer getCode() { + return this.code; + } + + public ApiResult setCode(Integer code) { + this.code = code; + return this; + } + + public String getMessage() { + return this.message; + } + + public ApiResult setMessage(String message) { + this.message = message; + return this; + } + + public T getData() { + return this.data; + } + + public ApiResult setData(T data) { + this.data = data; + return this; + } + + public String getError() { + return this.error; + } + + public ApiResult setError(String error) { + this.error = error; + return this; + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/web/BaseController.java b/src/main/java/com/gxwebsoft/common/core/web/BaseController.java new file mode 100644 index 0000000..46542ac --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/web/BaseController.java @@ -0,0 +1,333 @@ +package com.gxwebsoft.common.core.web; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.core.Constants; +import com.gxwebsoft.common.core.exception.BusinessException; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.utils.SignCheckUtil; +import com.gxwebsoft.common.system.entity.User; +import org.springframework.beans.propertyeditors.StringTrimmerEditor; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.InitBinder; +import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Controller基类 + * + * @author WebSoft + * @since 2017-06-10 10:10:19 + */ +public class BaseController { + @Resource + private HttpServletRequest request; + @Resource + private RedisUtil redisUtil; + + /** + * 获取当前登录的user + * + * @return User + */ + public User getLoginUser() { + try { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication != null) { + Object object = authentication.getPrincipal(); + if (object instanceof User) { + return (User) object; + } + } + } catch (Exception e) { + System.out.println(e.getMessage()); + } + return null; + } + + /** + * 获取当前登录的userId + * + * @return userId + */ + public Integer getLoginUserId() { + User loginUser = getLoginUser(); + return loginUser == null ? null : loginUser.getUserId(); + } + + /** + * 获取当前登录的tenantId + * + * @return tenantId + */ + public Integer getTenantId() { + String tenantId; + // 2 从请求头拿ID + tenantId = request.getHeader("tenantId"); + if(StrUtil.isNotBlank(tenantId)){ + return Integer.valueOf(tenantId); + } + // 3 从登录用户拿tenantId + User loginUser = getLoginUser(); + if (loginUser != null) { + return loginUser.getTenantId(); + } + // 1 从域名拿ID + String Domain = request.getHeader("Domain"); + if (StrUtil.isNotBlank(Domain)) { + String key = "Domain:" + Domain; + tenantId = redisUtil.get(key); + if(tenantId != null){ + System.out.println("从域名拿ID = " + tenantId); + return Integer.valueOf(tenantId); + } + } + return null; + } + + /** + * 返回成功 + * + * @return ApiResult + */ + public ApiResult success() { + return new ApiResult<>(Constants.RESULT_OK_CODE, Constants.RESULT_OK_MSG); + } + + /** + * 返回成功 + * + * @param message 状态信息 + * @return ApiResult + */ + public ApiResult success(String message) { + return success().setMessage(message); + } + + /** + * 返回成功 + * + * @param data 返回数据 + * @return ApiResult + */ + public ApiResult success(T data) { + return new ApiResult<>(Constants.RESULT_OK_CODE, Constants.RESULT_OK_MSG, data); + } + + /** + * 返回成功 + * + * @param message 状态信息 + * @return ApiResult + */ + public ApiResult success(String message, T data) { + return success(data).setMessage(message); + } + + /** + * 返回分页查询数据 + * + * @param list 当前页数据 + * @param count 总数量 + * @return ApiResult + */ + public ApiResult> success(List list, Long count) { + return success(new PageResult<>(list, count)); + } + + /** + * 返回分页查询数据 + * + * @param iPage IPage + * @return ApiResult + */ + public ApiResult> success(IPage iPage) { + return success(iPage.getRecords(), iPage.getTotal()); + } + + /** + * 返回失败 + * + * @return ApiResult + */ + public ApiResult fail() { + return new ApiResult<>(Constants.RESULT_ERROR_CODE, Constants.RESULT_ERROR_MSG); + } + + /** + * 返回失败 + * + * @param message 状态信息 + * @return ApiResult + */ + public ApiResult fail(String message) { + return fail().setMessage(message); + } + + /** + * 返回失败 + * + * @param data 返回数据 + * @return ApiResult + */ + public ApiResult fail(T data) { + return fail(Constants.RESULT_ERROR_MSG, data); + } + + /** + * 返回失败 + * + * @param message 状态信息 + * @param data 返回数据 + * @return ApiResult + */ + public ApiResult fail(String message, T data) { + return new ApiResult<>(Constants.RESULT_ERROR_CODE, message, data); + } + + /** + * 请求参数的空字符串转为null + */ + @InitBinder + public void initBinder(WebDataBinder binder) { + binder.registerCustomEditor(String.class, new StringTrimmerEditor(true)); + } + + // 自定义函数 + public String getAuthorization(){ + return request.getHeader("Authorization"); + } + + public String getAppId() { + // 兼容小写 + if(request.getHeader("appid") != null){ + return request.getHeader("appid"); + } + return request.getHeader("AppId"); + } + + public String getSign() { + return request.getParameter("sign"); + } + + /** + * 是否校验签名信息 + * 存在签名信息则需要验证 + */ + public void isCheckSign() { + if (StrUtil.isNotBlank(getSign())) { + if(getTenantId() == null){ + throw new BusinessException("签名失败:TenantId不能为空"); + } + + String timestamp1 = request.getParameter("timestamp"); + long timestamp2 = System.currentTimeMillis(); + long time = timestamp2 - Long.parseLong(timestamp1); + if(time > 600000L){ + throw new BusinessException("签名失败:请求超时"); + } + + Enumeration names = request.getParameterNames(); + //2.遍历正文名称的枚举获得请求参数 + Map params = new HashMap<>(); + while(names.hasMoreElements()){ + String name = names.nextElement(); + String value = request.getParameter(name); + params.put(name,value); + } + String signString = SignCheckUtil.getSignString(params, getAppSecret()); + System.out.println("请求的参数 = " + params); + System.out.println("正确的签名 = " + signString); + System.out.println("签名是否正确 = " + SignCheckUtil.signCheck(params, getAppSecret())); + + if (!SignCheckUtil.signCheck(params, getAppSecret())) { + throw new BusinessException("签名失败"); + } + } + + // 模拟提交参数 + // String key = "FRbMx1FkG4Qz6GZxY"; + // Map param0 = new HashMap<>(); + // param0.put("orderId", "D2018062976332656413"); + // param0.put("MainAccountID", "DC3NHPJ73S"); + // param0.put("MainAccountSN", "320"); + // param0.put("payStatus", "2"); + // param0.put("title","测试"); + // System.out.println("请求的参数 = " + param0); + // String signString0 = SignCheckUtil.getSignString(param0, key); + // System.out.println("signString0 = " + signString0); + + // return SignCheckUtil.signCheck(params, getAppSecret()); + } + + /** + * 获取当前请求租户的AppSecret + * + * @return AppSecret + */ + public String getAppSecret() { + String key = "cache5:AppSecret:" + Integer.valueOf(getAppId()); + return redisUtil.get(key); + } + + /** + * 根据账号|手机号码|邮箱查找用户ID + * @return userId + */ +// public Integer getUserIdByUsername(String username, Integer tenantId){ +// // 按账号搜素 +// User user = userService.getOne(new LambdaQueryWrapper().eq(User::getUsername, username).eq(User::getTenantId,tenantId)); +// if (user != null && user.getUserId() > 0) { +// return user.getUserId(); +// } +// // 按手机号码搜索 +// User userByPhone = userService.getOne(new LambdaQueryWrapper().eq(User::getPhone, username).eq(User::getTenantId, tenantId)); +// if (userByPhone != null && userByPhone.getUserId() > 0) { +// return userByPhone.getUserId(); +// } +// // 按邮箱搜索 +// User userByEmail = userService.getOne(new LambdaQueryWrapper().eq(User::getEmail, username).eq(User::getTenantId, tenantId)); +// if (userByEmail != null && userByEmail.getUserId() > 0) { +// return userByEmail.getUserId(); +// } +// throw new BusinessException("找不到该用户"); +// } + + /** + * 处理方法参数类型转换异常 + * 主要处理URL路径参数中传入"NaN"等无法转换为Integer的情况 + * + * @param ex 方法参数类型不匹配异常 + * @return ApiResult + */ + @ExceptionHandler(MethodArgumentTypeMismatchException.class) + public ApiResult handleMethodArgumentTypeMismatch(MethodArgumentTypeMismatchException ex) { + String parameterName = ex.getName(); + Object value = ex.getValue(); + Class requiredType = ex.getRequiredType(); + + // 记录错误日志 + System.err.println("参数类型转换异常: 参数名=" + parameterName + + ", 传入值=" + value + + ", 期望类型=" + (requiredType != null ? requiredType.getSimpleName() : "unknown")); + + // 如果是ID参数且传入的是"NaN",返回友好的错误信息 + if ("id".equals(parameterName) && "NaN".equals(String.valueOf(value))) { + return fail("无效的ID参数,请检查传入的ID值"); + } + + // 其他类型转换错误的通用处理 + return fail("参数格式错误: " + parameterName + " 的值 '" + value + "' 无法转换为 " + + (requiredType != null ? requiredType.getSimpleName() : "目标类型")); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/web/BaseParam.java b/src/main/java/com/gxwebsoft/common/core/web/BaseParam.java new file mode 100644 index 0000000..9661fd8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/web/BaseParam.java @@ -0,0 +1,98 @@ +package com.gxwebsoft.common.core.web; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.annotation.TableField; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.utils.CommonUtil; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 查询参数基本字段 + * + * @author WebSoft + * @since 2021-08-26 22:14:43 + */ +@Data +public class BaseParam implements Serializable { + private static final long serialVersionUID = 1L; + + @TableField(exist = false) + @Schema(description = "分页查询页码") + private Long page; + + @TableField(exist = false) + @Schema(description = "分页查询每页数量") + private Long limit; + + @TableField(exist = false) + @Schema(description = "国际化") + private String lang; + + @TableField(exist = false) + @Schema(description = "排序字段", example = "id asc, name desc") + private String sort; + + @TableField(exist = false) + @Schema(description = "排序方式", example = "asc或desc") + private String order; + + @QueryField(value = "create_time", type = QueryType.GE) + @TableField(exist = false) + @Schema(description = "创建时间起始值") + private String createTimeStart; + + @QueryField(value = "create_time", type = QueryType.LE) + @TableField(exist = false) + @Schema(description = "创建时间结束值") + private String createTimeEnd; + + @QueryField(value = "create_time", type = QueryType.GE) + @Schema(description = "搜索场景") + @TableField(exist = false) + private String sceneType; + + @Schema(description = "模糊搜素") + @TableField(exist = false) + private String keywords; + + @Schema(description = "token") + @TableField(exist = false) + private String token; + + @Schema(description = "租户ID") + @TableField(exist = false) + private Integer tenantId; + + @Schema(description = "商户ID") + @TableField(exist = false) + private Long merchantId; + + /** + * 获取集合中的第一条数据 + * + * @param records 集合 + * @return 第一条数据 + */ + public T getOne(List records) { + return CommonUtil.listGetOne(records); + } + + /** + * 国际化参数 + */ + public String getLang(){ + if(StrUtil.isBlank(this.lang)){ + return null; + } + if(this.lang.equals("zh")){ + return "zh_CN"; + } + return this.lang; + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/web/BatchParam.java b/src/main/java/com/gxwebsoft/common/core/web/BatchParam.java new file mode 100644 index 0000000..cc69572 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/web/BatchParam.java @@ -0,0 +1,57 @@ +package com.gxwebsoft.common.core.web; + +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.baomidou.mybatisplus.core.toolkit.support.SFunction; +import com.baomidou.mybatisplus.extension.service.IService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 批量修改通用参数 + * + * @author WebSoft + * @since 2020-03-13 00:11:06 + */ +@Data +public class BatchParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "需要修改的数据id集合") + private List ids; + + @Schema(description = "需要修改的字段和值") + private T data; + + /** + * 通用批量修改方法 + * + * @param service IService + * @param idField id字段名称 + * @return boolean + */ + public boolean update(IService service, String idField) { + if (this.data == null) { + return false; + } + return service.update(this.data, new UpdateWrapper().in(idField, this.ids)); + } + + /** + * 通用批量修改方法 + * + * @param service IService + * @param idField id字段名称 + * @return boolean + */ + public boolean update(IService service, SFunction idField) { + if (this.data == null) { + return false; + } + return service.update(this.data, new LambdaUpdateWrapper().in(idField, this.ids)); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/web/ExistenceParam.java b/src/main/java/com/gxwebsoft/common/core/web/ExistenceParam.java new file mode 100644 index 0000000..8c51268 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/web/ExistenceParam.java @@ -0,0 +1,96 @@ +package com.gxwebsoft.common.core.web; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.support.SFunction; +import com.baomidou.mybatisplus.extension.service.IService; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** + * 检查是否存在通用参数 + * + * @author WebSoft + * @since 2021-09-07 22:24:39 + */ +@Data +public class ExistenceParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "检查的字段") + private String field; + + @Schema(description = "字段的值") + private String value; + + @Schema(description = "修改时的主键") + private Integer id; + + /** + * 检查是否存在 + * + * @param service IService + * @param idField 修改时的主键字段 + * @return boolean + */ + public boolean isExistence(IService service, String idField) { + return isExistence(service, idField, true); + } + + /** + * 检查是否存在 + * + * @param service IService + * @param idField 修改时的主键字段 + * @param isToUnderlineCase 是否需要把field转为下划线格式 + * @return boolean + */ + public boolean isExistence(IService service, String idField, boolean isToUnderlineCase) { + if (StrUtil.hasBlank(this.field, this.value)) { + return false; + } + String fieldName = isToUnderlineCase ? StrUtil.toUnderlineCase(field) : field; + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(fieldName, value); + if (id != null) { + wrapper.ne(idField, id); + } + return service.count(wrapper) > 0; + } + + /** + * 检查是否存在 + * + * @param service IService + * @param idField 修改时的主键字段 + * @return boolean + */ + public boolean isExistence(IService service, SFunction idField) { + return isExistence(service, idField, true); + } + + /** + * 检查是否存在 + * + * @param service IService + * @param idField 修改时的主键字段 + * @param isToUnderlineCase 是否需要把field转为下划线格式 + * @return boolean + */ + public boolean isExistence(IService service, SFunction idField, boolean isToUnderlineCase) { + if (StrUtil.hasBlank(this.field, this.value)) { + return false; + } + String fieldName = isToUnderlineCase ? StrUtil.toUnderlineCase(field) : field; + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.apply(fieldName + " = {0}", value); + if (id != null) { + wrapper.ne(idField, id); + } + return service.count(wrapper) > 0; + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/web/PageParam.java b/src/main/java/com/gxwebsoft/common/core/web/PageParam.java new file mode 100644 index 0000000..596ea58 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/web/PageParam.java @@ -0,0 +1,343 @@ +package com.gxwebsoft.common.core.web; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.ReflectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.gxwebsoft.common.core.Constants; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.utils.CommonUtil; + +import java.lang.reflect.Field; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * 分页、排序、搜索参数封装 + * + * @author WebSoft + * @since 2019-04-26 10:34:35 + */ +public class PageParam extends Page { + private static final long serialVersionUID = 1L; + + /** + * 租户id字段名称 + */ + private static final String TENANT_ID_FIELD = "tenantId"; + + /** + * 查询条件 + */ + private final U where; + + /** + * 是否把字段名称驼峰转下划线 + */ + private final boolean isToUnderlineCase; + + public PageParam() { + this(null); + } + + public PageParam(U where) { + this(where, true); + } + + public PageParam(U where, boolean isToUnderlineCase) { + super(); + this.where = where; + this.isToUnderlineCase = isToUnderlineCase; + if (where != null) { + // 获取分页页码 + if (where.getPage() != null) { + setCurrent(where.getPage()); + } + // 获取分页每页数量 + if (where.getLimit() != null) { + setSize(where.getLimit()); + } + // 获取排序方式 + if (where.getSort() != null) { + if (sortIsSQL(where.getSort())) { + setOrders(parseOrderSQL(where.getSort())); + } else { + List orderItems = new ArrayList<>(); + String column = this.isToUnderlineCase ? StrUtil.toUnderlineCase(where.getSort()) : where.getSort(); + boolean asc = !Constants.ORDER_DESC_VALUE.equals(where.getOrder()); + orderItems.add(new OrderItem(column, asc)); + setOrders(orderItems); + } + } + } + } + + /** + * 排序字段是否是sql + */ + private boolean sortIsSQL(String sort) { + return sort != null && (sort.contains(",") || sort.trim().contains(" ")); + } + + /** + * 解析排序sql + */ + private List parseOrderSQL(String orderSQL) { + List orders = new ArrayList<>(); + if (StrUtil.isNotBlank(orderSQL)) { + for (String item : orderSQL.split(",")) { + String[] temp = item.trim().split(" "); + if (!temp[0].isEmpty()) { + String column = this.isToUnderlineCase ? StrUtil.toUnderlineCase(temp[0]) : temp[0]; + boolean asc = temp.length == 1 || !temp[temp.length - 1].equals(Constants.ORDER_DESC_VALUE); + orders.add(new OrderItem(column, asc)); + } + } + } + return orders; + } + + /** + * 设置默认排序方式 + * + * @param orderItems 排序方式 + * @return PageParam + */ + public PageParam setDefaultOrder(List orderItems) { + if (orders() == null || orders().size() == 0) { + setOrders(orderItems); + } + return this; + } + + /** + * 设置默认排序方式 + * + * @param orderSQL 排序方式 + * @return PageParam + */ + public PageParam setDefaultOrder(String orderSQL) { + setDefaultOrder(parseOrderSQL(orderSQL)); + return this; + } + + /** + * 获取查询条件 + * + * @param excludes 不包含的字段 + * @return QueryWrapper + */ + public QueryWrapper getWrapper(String... excludes) { + return buildWrapper(null, Arrays.asList(excludes)); + } + + /** + * 获取查询条件 + * + * @param columns 只包含的字段 + * @return QueryWrapper + */ + public QueryWrapper getWrapperWith(String... columns) { + return buildWrapper(Arrays.asList(columns), null); + } + + /** + * 构建QueryWrapper + * + * @param columns 包含的字段 + * @param excludes 排除的字段 + * @return QueryWrapper + */ + private QueryWrapper buildWrapper(List columns, List excludes) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + Map map = BeanUtil.beanToMap(where, false, true); + for (String fieldName : map.keySet()) { + Object fieldValue = map.get(fieldName); + Field field = ReflectUtil.getField(where.getClass(), fieldName); + + // 过滤不包含的字段 + if (columns != null && !columns.contains(fieldName)) { + continue; + } + + // 过滤排除的字段 + if (excludes != null && excludes.contains(fieldName)) { + continue; + } + + // 过滤逻辑删除字段 + if (field.getAnnotation(TableLogic.class) != null) { + continue; + } + + // 过滤租户id字段 + if (fieldName.equals(TENANT_ID_FIELD)) { + continue; + } + + // 获取注解指定的查询字段及查询方式 + QueryType queryType = QueryType.LIKE; + QueryField queryField = field.getAnnotation(QueryField.class); + if (queryField != null) { + if (StrUtil.isNotEmpty(queryField.value())) { + fieldName = queryField.value(); + } + if (queryField.type() != null) { + queryType = queryField.type(); + } + } else { + // 过滤非本表的字段 + TableField tableField = field.getAnnotation(TableField.class); + if (tableField != null && !tableField.exist()) { + continue; + } + } + + // 字段名驼峰转下划线 + if (this.isToUnderlineCase) { + fieldName = StrUtil.toUnderlineCase(fieldName); + } + + // + switch (queryType) { + case EQ: + queryWrapper.eq(fieldName, fieldValue); + break; + case NE: + queryWrapper.ne(fieldName, fieldValue); + break; + case GT: + queryWrapper.gt(fieldName, fieldValue); + break; + case GE: + queryWrapper.ge(fieldName, fieldValue); + break; + case LT: + queryWrapper.lt(fieldName, fieldValue); + break; + case LE: + queryWrapper.le(fieldName, fieldValue); + break; + case LIKE: + queryWrapper.like(fieldName, fieldValue); + break; + case NOT_LIKE: + queryWrapper.notLike(fieldName, fieldValue); + break; + case LIKE_LEFT: + queryWrapper.likeLeft(fieldName, fieldValue); + break; + case LIKE_RIGHT: + queryWrapper.likeRight(fieldName, fieldValue); + break; + case IS_NULL: + queryWrapper.isNull(fieldName); + break; + case IS_NOT_NULL: + queryWrapper.isNotNull(fieldName); + break; + case IN: + queryWrapper.in(fieldName, fieldValue); + break; + case NOT_IN: + queryWrapper.notIn(fieldName, fieldValue); + break; + case IN_STR: + if (fieldValue instanceof String) { + queryWrapper.in(fieldName, Arrays.asList(((String) fieldValue).split(","))); + } + break; + case NOT_IN_STR: + if (fieldValue instanceof String) { + queryWrapper.notIn(fieldName, Arrays.asList(((String) fieldValue).split(","))); + } + break; + } + } + return queryWrapper; + } + + /** + * 获取包含排序的查询条件 + * + * @return 包含排序的QueryWrapper + */ + public QueryWrapper getOrderWrapper() { + return getOrderWrapper(getWrapper()); + } + + /** + * 获取包含排序的查询条件 + * + * @param queryWrapper 不含排序的QueryWrapper + * @return 包含排序的QueryWrapper + */ + public QueryWrapper getOrderWrapper(QueryWrapper queryWrapper) { + if (queryWrapper == null) { + queryWrapper = new QueryWrapper<>(); + } + for (OrderItem orderItem : orders()) { + if (orderItem.isAsc()) { + queryWrapper.orderByAsc(orderItem.getColumn()); + } else { + queryWrapper.orderByDesc(orderItem.getColumn()); + } + } + return queryWrapper; + } + + /** + * 获取集合中的第一条数据 + * + * @param records 集合 + * @return 第一条数据 + */ + public T getOne(List records) { + return CommonUtil.listGetOne(records); + } + + /** + * 代码排序集合 + * + * @param records 集合 + * @return 排序后的集合 + */ + public List sortRecords(List records) { + List orderItems = orders(); + if (records == null || records.size() < 2 || orderItems == null || orderItems.size() == 0) { + return records; + } + Comparator comparator = null; + for (OrderItem item : orderItems) { + if (item.getColumn() == null) { + continue; + } + String field = this.isToUnderlineCase ? StrUtil.toCamelCase(item.getColumn()) : item.getColumn(); + Function keyExtractor = t -> ReflectUtil.getFieldValue(t, field); + if (comparator == null) { + if (item.isAsc()) { + comparator = Comparator.comparing(keyExtractor); + } else { + comparator = Comparator.comparing(keyExtractor, Comparator.reverseOrder()); + } + } else { + if (item.isAsc()) { + comparator.thenComparing(keyExtractor); + } else { + comparator.thenComparing(keyExtractor, Comparator.reverseOrder()); + } + } + } + if (comparator != null) { + return records.stream().sorted(comparator).collect(Collectors.toList()); + } + return records; + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/web/PageResult.java b/src/main/java/com/gxwebsoft/common/core/web/PageResult.java new file mode 100644 index 0000000..a9bc057 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/web/PageResult.java @@ -0,0 +1,51 @@ +package com.gxwebsoft.common.core.web; + +import io.swagger.v3.oas.annotations.media.Schema; + +import java.io.Serializable; +import java.util.List; + +/** + * 分页查询返回结果 + * + * @author WebSoft + * @since 2017-06-10 10:10:02 + */ +public class PageResult implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "当前页数据") + private List list; + + @Schema(description = "总数量") + private Long count; + + public PageResult() { + } + + public PageResult(List list) { + this(list, null); + } + + public PageResult(List list, Long count) { + setList(list); + setCount(count); + } + + public List getList() { + return this.list; + } + + public void setList(List list) { + this.list = list; + } + + public Long getCount() { + return this.count; + } + + public void setCount(Long count) { + this.count = count; + } + +} diff --git a/src/main/java/com/gxwebsoft/common/core/websocket/WebSocketConfig.java b/src/main/java/com/gxwebsoft/common/core/websocket/WebSocketConfig.java new file mode 100644 index 0000000..10c99f0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/websocket/WebSocketConfig.java @@ -0,0 +1,19 @@ +package com.gxwebsoft.common.core.websocket; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.socket.server.standard.ServerEndpointExporter; + + +@Configuration +public class WebSocketConfig { + @Bean + public ServerEndpointExporter serverEndpointExporter() { + ServerEndpointExporter exporter = new ServerEndpointExporter(); + + // 手动注册 WebSocket 端点 + exporter.setAnnotatedEndpointClasses(WebSocketServer.class); + + return exporter; + } +} diff --git a/src/main/java/com/gxwebsoft/common/core/websocket/WebSocketServer.java b/src/main/java/com/gxwebsoft/common/core/websocket/WebSocketServer.java new file mode 100644 index 0000000..c3b64fd --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/core/websocket/WebSocketServer.java @@ -0,0 +1,86 @@ +package com.gxwebsoft.common.core.websocket; + +import org.springframework.stereotype.Component; + +import javax.websocket.OnClose; +import javax.websocket.OnOpen; +import javax.websocket.Session; +import javax.websocket.server.PathParam; +import javax.websocket.server.ServerEndpoint; +import java.io.IOException; +import java.util.concurrent.ConcurrentHashMap; + + +@ServerEndpoint(value = "/api/chat/{userId}") +@Component +public class WebSocketServer { + + /** + * concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。 + */ + private static ConcurrentHashMap webSocketMap = new ConcurrentHashMap<>(); + /** + * 与某个客户端的连接会话,需要通过它来给客户端发送数据 + */ + private Session session; + /** + * 接收userId + */ + private String userId = ""; + + /** + * 连接建立成功调用的方法 + */ + @OnOpen + public void onOpen(Session session, @PathParam("userId") String userId) { + this.session = session; + this.userId = userId; + if (webSocketMap.containsKey(userId)) { + webSocketMap.remove(userId); + webSocketMap.put(userId, this); + //加入set中 + } else { + webSocketMap.put(userId, this); + } + + try { + sendMessage(userId, "连接成功"); + } catch (IOException e) { + + } + } + + /** + * 连接关闭调用的方法 + */ + @OnClose + public void onClose() { + if (webSocketMap.containsKey(userId)) { + webSocketMap.remove(userId); + } + } + + + /** + * 实现服务器主动推送 + */ + public void sendMessage(String userId, String message) throws IOException { + if (webSocketMap.containsKey(userId)) { + Session session1 = webSocketMap.get(userId).session; + if (session1 != null) session1.getBasicRemote().sendText(message); + } + } + + + /** + * 实现服务器主动推送 + */ + public void sendAllMessage(String message) throws IOException { + ConcurrentHashMap.KeySetView userIds = webSocketMap.keySet(); + for (String userId : userIds) { + WebSocketServer webSocketServer = webSocketMap.get(userId); + webSocketServer.session.getBasicRemote().sendText(message); + } + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/AiController.java b/src/main/java/com/gxwebsoft/common/system/controller/AiController.java new file mode 100644 index 0000000..8525a3b --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/AiController.java @@ -0,0 +1,139 @@ +package com.gxwebsoft.common.system.controller; + +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSONObject; +import com.gxwebsoft.common.core.utils.JSONUtil; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.websocket.WebSocketServer; +import com.gxwebsoft.common.system.entity.ChatMessage; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; + +@Tag(name = "AI") +@RestController +@RequestMapping("/api/chat") +public class AiController extends BaseController { + @Resource + private WebSocketServer webSocketServer; + + @PostMapping("/message") + public ApiResult message(@RequestBody ChatMessage message) throws IOException { + Map paramsJsonStr = new HashMap<>(); + paramsJsonStr.put("query", message.getQuery()); + paramsJsonStr.put("opsType", "0"); + + Map formData = new HashMap<>(); + formData.put("user", message.getUser()); + formData.put("responseMode", "streaming"); + formData.put("paramsJsonStr", JSONUtil.toJSONString(paramsJsonStr)); + formData.put("authCode", "a8cc4a0a-aea3-4ea5-811a-80316520a3d3"); + // 使用 Java 自带的 HttpURLConnection 发送流式请求 + try { + URL url = new URL("https://ai-console.gxshucheng.com/ai-console-api/run/v1"); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setRequestMethod("POST"); + connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary); + connection.setDoOutput(true); + connection.setConnectTimeout(600000); + connection.setReadTimeout(600000); + + // 写入请求体 + try (OutputStream os = connection.getOutputStream(); + PrintWriter writer = new PrintWriter(new OutputStreamWriter(os, StandardCharsets.UTF_8))) { + for (Map.Entry entry : formData.entrySet()) { + writeFormField(writer, entry.getKey(), entry.getValue()); + } + // 添加文件上传部分(可选) + // writeFilePart(writer, "file", "test.txt", "text/plain", "This is the file content."); + writer.append("--").append(boundary).append("--").append("\r\n"); + writer.flush(); + } + + StringBuilder responseStr = new StringBuilder(); + // 读取响应流 + try (BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) { + String line; + while ((line = br.readLine()) != null) { + System.out.println("Received chunk: " + line); // 打印接收到的每一部分数据 + // 这里可以对每一部分数据进行处理,例如解析或发送给前端 + if (!line.isEmpty()) { + String[] dataList = line.split("data: "); + if (dataList.length == 2) { +// System.out.println(dataList[1]); + Map data = JSONUtil.parseObject(dataList[1], Map.class); + if (data.get("event") != null && data.get("event").equals("message")) { + String answer = (String) data.get("answer"); + String task_id = (String) data.get("task_id"); + if (answer != null && !answer.isEmpty()) { + HashMap answerData = new HashMap<>(); + answerData.put("answer", answer); + answerData.put("taskId", task_id); + webSocketServer.sendMessage(message.getUser(), JSONUtil.toJSONString(answerData)); + } + System.out.println("answer: " + answer); + responseStr.append(answer); + }else if (data.get("event") != null && data.get("event").equals("message_end")) { + String task_id = (String) data.get("task_id"); + HashMap answerData = new HashMap<>(); + answerData.put("answer", "__END__"); + answerData.put("taskId", task_id); + + webSocketServer.sendMessage(message.getUser(), JSONUtil.toJSONString(answerData)); + } + } + } + } + } + } catch (Exception e) { + System.out.println(e.getMessage()); + for (StackTraceElement stackTraceElement : e.getStackTrace()) { + System.out.println(stackTraceElement); + } + webSocketServer.sendMessage(message.getUser(), "出错了,请晚点再来提问吧~"); + return fail("出错了,请晚点再来提问吧~"); + } + + // 返回成功响应 + return success("Stream processing completed"); + } + + private static final String boundary = "---" + System.currentTimeMillis() + "---"; + + private static void writeFormField(PrintWriter writer, String fieldName, String value) { + writer.append("--").append(boundary).append("\r\n"); + writer.append("Content-Disposition: form-data; name=\"").append(fieldName).append("\"\r\n"); + writer.append("\r\n"); + writer.append(value).append("\r\n"); + } + + @PostMapping("/messageStop") + public ApiResult stop(@RequestBody Map data) { + if (data.get("taskId") == null) return success(); + String taskId = data.get("taskId").toString(); + Map postData = new HashMap<>(); + postData.put("user", getLoginUserId()); + String token = "Bearer app-UxV82WXIRrScpf53exkJ7dIw"; + if (data.get("type") != null) { + token = "Bearer app-7AFseF5UTEJpZGkW93S0wybh"; + } + String res = HttpRequest.post("http://workflow.gxshucheng.com:8010/v1/chat-messages/" + taskId + "/stop") + .header("Authorization", token) + .header("Content-Type", "application/json") + .body(JSONObject.toJSONString(postData)) + .execute().body(); + System.out.println("stop res:" + res); + return success(); + } +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/CacheController.java b/src/main/java/com/gxwebsoft/common/system/controller/CacheController.java new file mode 100644 index 0000000..d95357d --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/CacheController.java @@ -0,0 +1,117 @@ +package com.gxwebsoft.common.system.controller; + +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; +import com.gxwebsoft.common.core.utils.CacheClient; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.Cache; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.service.SettingService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Set; +import java.util.concurrent.TimeUnit; + +/** + * 缓存控制器 + * + * @author WebSoft + * @since 2022-11-19 13:54:27 + */ +@Tag(name = "缓存管理") +@RestController +@RequestMapping("/api/system/cache") +public class CacheController extends BaseController { + @Resource + private SettingService settingService; + @Resource + private CacheClient cacheClient; + @Resource + private RedisUtil redisUtil; + @Resource + private StringRedisTemplate stringRedisTemplate; + + @PreAuthorize("hasAuthority('sys:cache:list')") + @Operation(summary = "查询全部缓存") + @GetMapping() + public ApiResult> list() { + String key = "cache".concat(getTenantId().toString()).concat("*"); + final Set keys = stringRedisTemplate.keys(key); + final HashMap map = new HashMap<>(); + final ArrayList list = new ArrayList<>(); + assert keys != null; + keys.forEach(d -> { + final Cache cache = new Cache(); + cache.setKey(d); + try { + final String content = stringRedisTemplate.opsForValue().get(d); + if(content != null){ + cache.setContent(stringRedisTemplate.opsForValue().get(d)); + } + } catch (Exception e) { + e.printStackTrace(); + } + list.add(cache); + }); + map.put("count",keys.size()); + map.put("list",list); + return success(map); + } + + @PreAuthorize("hasAuthority('sys:cache:list')") + @Operation(summary = "根据key查询缓存信息") + @GetMapping("/{key}") + public ApiResult get(@PathVariable("key") String key) { + final String s = redisUtil.get(key + getTenantId()); + if(StrUtil.isNotBlank(s)){ + return success("读取成功", JSONObject.parseObject(s)); + } + return fail("缓存不存在!"); + } + + @PreAuthorize("hasAuthority('sys:cache:save')") + @Operation(summary = "添加缓存") + @PostMapping() + public ApiResult add(@RequestBody Cache cache) { + if (cache.getExpireTime() != null) { + redisUtil.set(cache.getKey() + ":" + getTenantId(),cache.getContent(),cache.getExpireTime(), TimeUnit.MINUTES); + return success("缓存成功"); + } + redisUtil.set(cache.getKey() + ":" + getTenantId(),cache.getContent()); + return success("缓存成功"); + } + + @PreAuthorize("hasAuthority('sys:cache:save')") + @Operation(summary = "删除缓存") + @DeleteMapping("/{key}") + public ApiResult remove(@PathVariable("key") String key) { + if (Boolean.TRUE.equals(stringRedisTemplate.delete(key))) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:cache:save')") + @Operation(summary = "缓存皮肤") + @PostMapping("/theme") + public ApiResult saveTheme(@RequestBody Cache cache) { + final User loginUser = getLoginUser(); + final String username = loginUser.getUsername(); + if (username.equals("admin")) { + redisUtil.set(cache.getKey() + ":" + getTenantId(),cache.getContent()); + return success("缓存成功"); + } + return success("缓存失败"); + } + + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/CompanyCommentController.java b/src/main/java/com/gxwebsoft/common/system/controller/CompanyCommentController.java new file mode 100644 index 0000000..5f460b4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/CompanyCommentController.java @@ -0,0 +1,131 @@ +package com.gxwebsoft.common.system.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.CompanyComment; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.param.CompanyCommentParam; +import com.gxwebsoft.common.system.service.CompanyCommentService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 应用评论控制器 + * + * @author 科技小王子 + * @since 2024-10-17 15:30:24 + */ +@Tag(name = "应用评论管理") +@RestController +@RequestMapping("/api/system/company-comment") +public class CompanyCommentController extends BaseController { + @Resource + private CompanyCommentService companyCommentService; + + @PreAuthorize("hasAuthority('sys:company:list')") + @OperationLog + @Operation(summary = "分页查询应用评论") + @GetMapping("/page") + public ApiResult> page(CompanyCommentParam param) { + // 使用关联查询 + return success(companyCommentService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('sys:company:list')") + @OperationLog + @Operation(summary = "查询全部应用评论") + @GetMapping() + public ApiResult> list(CompanyCommentParam param) { + // 使用关联查询 + return success(companyCommentService.listRel(param)); + } + + @PreAuthorize("hasAuthority('sys:company:list')") + @OperationLog + @Operation(summary = "根据id查询应用评论") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(companyCommentService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('sys:company:save')") + @OperationLog + @Operation(summary = "添加应用评论") + @PostMapping() + public ApiResult save(@RequestBody CompanyComment companyComment) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + companyComment.setUserId(loginUser.getUserId()); + } + if (companyCommentService.save(companyComment)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:company:update')") + @OperationLog + @Operation(summary = "修改应用评论") + @PutMapping() + public ApiResult update(@RequestBody CompanyComment companyComment) { + if (companyCommentService.updateById(companyComment)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:company:remove')") + @OperationLog + @Operation(summary = "删除应用评论") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (companyCommentService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:company:save')") + @OperationLog + @Operation(summary = "批量添加应用评论") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (companyCommentService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:company:update')") + @OperationLog + @Operation(summary = "批量修改应用评论") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(companyCommentService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:company:remove')") + @OperationLog + @Operation(summary = "批量删除应用评论") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (companyCommentService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/CompanyContentController.java b/src/main/java/com/gxwebsoft/common/system/controller/CompanyContentController.java new file mode 100644 index 0000000..cc63569 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/CompanyContentController.java @@ -0,0 +1,125 @@ +package com.gxwebsoft.common.system.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.CompanyContent; +import com.gxwebsoft.common.system.param.CompanyContentParam; +import com.gxwebsoft.common.system.service.CompanyContentService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 应用详情控制器 + * + * @author 科技小王子 + * @since 2024-10-16 13:41:21 + */ +@Tag(name = "应用详情管理") +@RestController +@RequestMapping("/api/system/company-content") +public class CompanyContentController extends BaseController { + @Resource + private CompanyContentService companyContentService; + + @PreAuthorize("hasAuthority('sys:company:list')") + @OperationLog + @Operation(summary = "分页查询应用详情") + @GetMapping("/page") + public ApiResult> page(CompanyContentParam param) { + // 使用关联查询 + return success(companyContentService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('sys:company:list')") + @OperationLog + @Operation(summary = "查询全部应用详情") + @GetMapping() + public ApiResult> list(CompanyContentParam param) { + // 使用关联查询 + return success(companyContentService.listRel(param)); + } + + @PreAuthorize("hasAuthority('sys:company:list')") + @OperationLog + @Operation(summary = "根据id查询应用详情") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(companyContentService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('sys:company:save')") + @OperationLog + @Operation(summary = "添加应用详情") + @PostMapping() + public ApiResult save(@RequestBody CompanyContent companyContent) { + if (companyContentService.save(companyContent)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:company:update')") + @OperationLog + @Operation(summary = "修改应用详情") + @PutMapping() + public ApiResult update(@RequestBody CompanyContent companyContent) { + if (companyContentService.updateById(companyContent)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:company:remove')") + @OperationLog + @Operation(summary = "删除应用详情") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (companyContentService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:company:save')") + @OperationLog + @Operation(summary = "批量添加应用详情") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (companyContentService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:company:update')") + @OperationLog + @Operation(summary = "批量修改应用详情") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(companyContentService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:company:remove')") + @OperationLog + @Operation(summary = "批量删除应用详情") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (companyContentService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/CompanyController.java b/src/main/java/com/gxwebsoft/common/system/controller/CompanyController.java new file mode 100644 index 0000000..6a65b19 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/CompanyController.java @@ -0,0 +1,367 @@ +package com.gxwebsoft.common.system.controller; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.DesensitizedUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.exception.BusinessException; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.web.*; +import com.gxwebsoft.common.system.entity.*; +import com.gxwebsoft.common.system.mapper.CompanyMapper; +import com.gxwebsoft.common.system.mapper.TenantMapper; +import com.gxwebsoft.common.system.param.CompanyParam; +import com.gxwebsoft.common.system.service.*; +import com.gxwebsoft.shop.entity.ShopMerchantApply; +import com.gxwebsoft.shop.service.ShopMerchantApplyService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 企业信息控制器 + * + * @author 科技小王子 + * @since 2023-05-27 14:57:34 + */ +@Tag(name = "企业") +@RestController +@RequestMapping("/api/system/company") +public class CompanyController extends BaseController { + @Resource + private CompanyService companyService; + @Resource + private ShopMerchantApplyService shopMerchantApplyService; + @Resource + private CompanyContentService companyContentService; + @Resource + private CompanyUrlService companyUrlService; + @Resource + private CompanyParameterService companyParameterService; + @Resource + private TenantService tenantService; + @Resource + private CompanyMapper companyMapper; + @Resource + private TenantMapper tenantMapper; + @Resource + private DomainService domainService; + @Resource + private UserCollectionService userCollectionService; + @Resource + private RedisUtil redisUtil; + + + @Operation(summary = "分页查询企业信息不限租户") + @GetMapping("/pageAll") + public ApiResult> pageAll(CompanyParam param) { + final PageResult result = companyService.pageRelAll(param); + result.getList().forEach(d -> { + d.setPhone(DesensitizedUtil.mobilePhone(d.getPhone())); + d.setCompanyCode(DesensitizedUtil.idCardNum(d.getCompanyCode(),1,2)); + }); + final User loginUser = getLoginUser(); + if(loginUser != null){ + // 我的收藏 + final List myFocus = userCollectionService.list(new LambdaQueryWrapper().eq(UserCollection::getUserId, getLoginUserId())); + if (!CollectionUtils.isEmpty(myFocus)) { + final Set collect = myFocus.stream().map(UserCollection::getTid).collect(Collectors.toSet()); + if (param.getVersion() != null) { + // 我的收藏 + if (param.getVersion().equals(99)) { + param.setVersion(null); + param.setCompanyIds(collect); + } + } + result.getList().forEach(d -> { + d.setCollection(collect.contains(d.getCompanyId())); + }); + return success(result); + } + } + // 使用关联查询 + return success(result); + } + + @PreAuthorize("hasAuthority('sys:company:list')") + @Operation(summary = "分页查询企业信息") + @GetMapping("/page") + public ApiResult> page(CompanyParam param) { + // 使用关联查询 + return success(companyService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('sys:company:list')") + @OperationLog + @Operation(summary = "查询全部企业信息") + @GetMapping() + public ApiResult> list(CompanyParam param) { + // 使用关联查询 + return success(companyService.listRel(param)); + } + + @Operation(summary = "根据id查询企业信息") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + final Company company = companyService.getByIdRel(id); + if (ObjectUtil.isNotEmpty(company)) { + // 应用详情 + final CompanyContent content = companyContentService.getOne(new LambdaQueryWrapper().eq(CompanyContent::getCompanyId, company.getCompanyId()).last("limit 1")); + if (ObjectUtil.isNotEmpty(content)) { + company.setContent(content.getContent()); + } + // 应用链接 + company.setLinks(companyUrlService.list(new LambdaQueryWrapper().eq(CompanyUrl::getCompanyId, company.getCompanyId()))); + // 应用参数 + company.setParameters(companyParameterService.list(new LambdaQueryWrapper().eq(CompanyParameter::getCompanyId, company.getCompanyId()))); + + } + return success(company); + } + + @Transactional(rollbackFor = {Exception.class}, isolation = Isolation.SERIALIZABLE) + @PreAuthorize("hasAuthority('sys:company:save')") + @Operation(summary = "添加企业信息") + @PostMapping() + public ApiResult save(@RequestBody Company company) { + Tenant tenant = new Tenant(); + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + company.setUserId(loginUser.getUserId()); + tenant.setUserId(loginUser.getUserId()); + } + tenant.setTenantName(company.getShortName()); + tenant.setTenantCode(CommonUtil.randomUUID16()); + tenant.setComments(company.getComments()); + tenantService.save(tenant); + company.setTenantId(tenant.getTenantId()); + company.setTid(tenant.getTenantId()); + company.setAuthoritative(true); + // 添加租户并初始化 +// final Company result = tenantService.initialization(company); +// if (result != null) { +// return success("添加成功",result); +// } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:company:update')") + @OperationLog + @Operation(summary = "修改企业信息") + @PutMapping() + public ApiResult update(@RequestBody Company company) { + // 授权新的免费域名 + if (StrUtil.isNotBlank(company.getFreeDomain())) { + // 待授权的二级域名 + String domain = company.getFreeDomain().concat(".websoft.top"); + // 删除旧授权域名 + final Domain one = domainService.getOne(new LambdaQueryWrapper().eq(Domain::getType, 2).eq(Domain::getCompanyId, company.getCompanyId()).eq(Domain::getDeleted,0).last("limit 1")); + if(one != null){ + redisUtil.delete("Domain:".concat(one.getDomain())); + domainService.removeById(one); + } + // 保存记录 + final Domain sysDomain = new Domain(); + sysDomain.setDomain(domain); + sysDomain.setType(2); + sysDomain.setSortNumber(100); + sysDomain.setCompanyId(company.getCompanyId()); + sysDomain.setTenantId(company.getTenantId()); + domainService.save(sysDomain); + company.setDomain(domain); + // 写入缓存 + redisUtil.set("Domain:".concat(domain), company.getTenantId()); + } + // 同步更新租户表 + if(StrUtil.isNotBlank(company.getShortName())){ + final Tenant tenant = new Tenant(); + tenant.setTenantId(company.getTenantId()); + tenant.setTenantName(company.getShortName()); + tenantService.updateById(tenant); + } + if (companyService.updateById(company)) { + // 清除缓存 + redisUtil.delete("TenantInfo:".concat(company.getTenantId().toString())); + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:company:remove')") + @OperationLog + @Operation(summary = "删除企业信息") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + final Company company = companyService.getById(id); + tenantService.removeById(company.getTenantId()); + if (companyService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:company:save')") + @OperationLog + @Operation(summary = "批量添加企业信息") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (companyService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:company:update')") + @OperationLog + @Operation(summary = "批量修改企业信息") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(companyService, "company_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:company:remove')") + @OperationLog + @Operation(summary = "批量删除企业信息") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (companyService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "根据id查询企业信息") + @GetMapping("/profile") + public ApiResult profile() { + final User loginUser = getLoginUser(); + if(loginUser != null){ + final Company company = companyService.getOne(new LambdaQueryWrapper().eq(Company::getTenantId, loginUser.getTenantId()).eq(Company::getAuthoritative, true).last("limit 1")); + if (ObjectUtil.isNotEmpty(company)) { + final ShopMerchantApply apply = shopMerchantApplyService.getOne(new LambdaQueryWrapper().eq(ShopMerchantApply::getTenantId, loginUser.getTenantId()).last("limit 1")); + if (ObjectUtil.isNotEmpty(apply)) { + company.setCompanyName(apply.getMerchantName()); + company.setCompanyType(apply.getShopType()); + if (apply.getStatus().equals(1)) { + company.setAuthentication(1); + } + } + LocalDateTime now = LocalDateTime.now(); + // 即将过期(一周内过期的) + company.setSoon(company.getExpirationTime().minusDays(7).compareTo(now)); + // 是否过期 -1已过期 大于0 未过期 + company.setStatus(company.getExpirationTime().compareTo(now)); + return success(company); + } + } + return fail("企业不存在",null); + } + + @PreAuthorize("hasAuthority('sys:company:profile')") + @OperationLog + @Operation(summary = "根据id查询企业信息不限租户") + @GetMapping("/profileAll/{companyId}") + public ApiResult profileAll(@PathVariable("companyId") Integer companyId) { + return success(companyMapper.getCompanyAll(companyId)); + } + + @PreAuthorize("hasAuthority('sys:company:remove')") + @OperationLog + @Operation(summary = "销毁租户") + @DeleteMapping("/destruction/{id}") + public ApiResult destruction(@PathVariable("id") Integer id) { + final User loginUser = getLoginUser(); + if (!loginUser.getUsername().equals("admin")) { + throw new BusinessException("只有超级管理员才能操作"); + } + final Integer tenantId = getTenantId(); + if (tenantService.removeById(tenantId)) { + return success("删除成功",tenantId); + } + return fail("删除失败"); + } + @Operation(summary = "检查企业是否存在") + @GetMapping("/existence") + public ApiResult existence(ExistenceParam param) { + CompanyParam companyParam = new CompanyParam(); + if (param.getField().equals("shortName")) { + companyParam.setAppName(param.getValue()); + List count = companyMapper.getCount(companyParam); + if (!CollectionUtils.isEmpty(count)) { + return success(param.getValue() + "已存在"); + } + } + if (param.getField().equals("email")) { + companyParam.setEmail(param.getValue()); + List count = companyMapper.getCount(companyParam); + if (!CollectionUtils.isEmpty(count)) { + return success(param.getValue() + "已存在"); + } + } + if (param.getField().equals("phone")) { + companyParam.setPhone(param.getValue()); + List count = companyMapper.getCount(companyParam); + if (!CollectionUtils.isEmpty(count)) { + return success(param.getValue() + "已存在"); + } + } + return fail(param.getValue() + "不存在"); + } + + @Operation(summary = "根据id查询企业信息不限租户不带token") + @GetMapping("/companyInfoAll/{companyId}") + public ApiResult companyInfoAll(@PathVariable("companyId") Integer companyId) { + return success(companyMapper.getCompanyAll(companyId)); + } + + @PreAuthorize("hasAuthority('sys:company:updateAll')") + @OperationLog + @Operation(summary = "修改企业信息") + @PutMapping("/updateCompanyAll") + public ApiResult updateCompanyAll(@RequestBody Company company) { + if (companyMapper.updateByIdAll(company)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:company:removeAll')") + @OperationLog + @Operation(summary = "删除企业信息") + @DeleteMapping("/removeAll/{id}") + public ApiResult removeAll(@PathVariable("id") Integer id) { + if (companyMapper.removeCompanyAll(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:company:removeAll')") + @OperationLog + @Operation(summary = "恢复租户") + @DeleteMapping("/undeleteAll/{id}") + public ApiResult undeleteAll(@PathVariable("id") Integer id) { + if (companyMapper.undeleteAll(id)) { + return success("恢复成功"); + } + return fail("恢复失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/CompanyGitController.java b/src/main/java/com/gxwebsoft/common/system/controller/CompanyGitController.java new file mode 100644 index 0000000..451118c --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/CompanyGitController.java @@ -0,0 +1,122 @@ +package com.gxwebsoft.common.system.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.CompanyGit; +import com.gxwebsoft.common.system.param.CompanyGitParam; +import com.gxwebsoft.common.system.service.CompanyGitService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 代码仓库控制器 + * + * @author 科技小王子 + * @since 2024-10-19 18:08:51 + */ +@Tag(name = "代码仓库管理") +@RestController +@RequestMapping("/api/system/company-git") +public class CompanyGitController extends BaseController { + @Resource + private CompanyGitService companyGitService; + + @PreAuthorize("hasAuthority('sys:companyGit:list')") + @Operation(summary = "分页查询代码仓库") + @GetMapping("/page") + public ApiResult> page(CompanyGitParam param) { + // 使用关联查询 + return success(companyGitService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('sys:companyGit:list')") + @Operation(summary = "查询全部代码仓库") + @GetMapping() + public ApiResult> list(CompanyGitParam param) { + // 使用关联查询 + return success(companyGitService.listRel(param)); + } + + @PreAuthorize("hasAuthority('sys:companyGit:list')") + @Operation(summary = "根据id查询代码仓库") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(companyGitService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('sys:companyGit:save')") + @OperationLog + @Operation(summary = "添加代码仓库") + @PostMapping() + public ApiResult save(@RequestBody CompanyGit companyGit) { + if (companyGitService.save(companyGit)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:companyGit:update')") + @OperationLog + @Operation(summary = "修改代码仓库") + @PutMapping() + public ApiResult update(@RequestBody CompanyGit companyGit) { + if (companyGitService.updateById(companyGit)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:companyGit:remove')") + @OperationLog + @Operation(summary = "删除代码仓库") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (companyGitService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:companyGit:save')") + @OperationLog + @Operation(summary = "批量添加代码仓库") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (companyGitService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:companyGit:update')") + @OperationLog + @Operation(summary = "批量修改代码仓库") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(companyGitService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:companyGit:remove')") + @OperationLog + @Operation(summary = "批量删除代码仓库") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (companyGitService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/CompanyParameterController.java b/src/main/java/com/gxwebsoft/common/system/controller/CompanyParameterController.java new file mode 100644 index 0000000..086964f --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/CompanyParameterController.java @@ -0,0 +1,125 @@ +package com.gxwebsoft.common.system.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.CompanyParameter; +import com.gxwebsoft.common.system.param.CompanyParameterParam; +import com.gxwebsoft.common.system.service.CompanyParameterService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 应用参数控制器 + * + * @author 科技小王子 + * @since 2024-10-17 15:30:24 + */ +@Tag(name = "应用参数管理") +@RestController +@RequestMapping("/api/system/company-parameter") +public class CompanyParameterController extends BaseController { + @Resource + private CompanyParameterService companyParameterService; + + @PreAuthorize("hasAuthority('sys:company:list')") + @OperationLog + @Operation(summary = "分页查询应用参数") + @GetMapping("/page") + public ApiResult> page(CompanyParameterParam param) { + // 使用关联查询 + return success(companyParameterService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('sys:company:list')") + @OperationLog + @Operation(summary = "查询全部应用参数") + @GetMapping() + public ApiResult> list(CompanyParameterParam param) { + // 使用关联查询 + return success(companyParameterService.listRel(param)); + } + + @PreAuthorize("hasAuthority('sys:company:list')") + @OperationLog + @Operation(summary = "根据id查询应用参数") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(companyParameterService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('sys:company:save')") + @OperationLog + @Operation(summary = "添加应用参数") + @PostMapping() + public ApiResult save(@RequestBody CompanyParameter companyParameter) { + if (companyParameterService.save(companyParameter)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:company:update')") + @OperationLog + @Operation(summary = "修改应用参数") + @PutMapping() + public ApiResult update(@RequestBody CompanyParameter companyParameter) { + if (companyParameterService.updateById(companyParameter)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:company:remove')") + @OperationLog + @Operation(summary = "删除应用参数") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (companyParameterService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:company:save')") + @OperationLog + @Operation(summary = "批量添加应用参数") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (companyParameterService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:company:update')") + @OperationLog + @Operation(summary = "批量修改应用参数") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(companyParameterService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:company:remove')") + @OperationLog + @Operation(summary = "批量删除应用参数") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (companyParameterService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/CompanyUrlController.java b/src/main/java/com/gxwebsoft/common/system/controller/CompanyUrlController.java new file mode 100644 index 0000000..6de5078 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/CompanyUrlController.java @@ -0,0 +1,125 @@ +package com.gxwebsoft.common.system.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.CompanyUrl; +import com.gxwebsoft.common.system.param.CompanyUrlParam; +import com.gxwebsoft.common.system.service.CompanyUrlService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 应用域名控制器 + * + * @author 科技小王子 + * @since 2024-10-17 15:30:24 + */ +@Tag(name = "应用域名管理") +@RestController +@RequestMapping("/api/system/company-url") +public class CompanyUrlController extends BaseController { + @Resource + private CompanyUrlService companyUrlService; + + @PreAuthorize("hasAuthority('sys:company:list')") + @OperationLog + @Operation(summary = "分页查询应用域名") + @GetMapping("/page") + public ApiResult> page(CompanyUrlParam param) { + // 使用关联查询 + return success(companyUrlService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('sys:company:list')") + @OperationLog + @Operation(summary = "查询全部应用域名") + @GetMapping() + public ApiResult> list(CompanyUrlParam param) { + // 使用关联查询 + return success(companyUrlService.listRel(param)); + } + + @PreAuthorize("hasAuthority('sys:company:list')") + @OperationLog + @Operation(summary = "根据id查询应用域名") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(companyUrlService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('sys:company:save')") + @OperationLog + @Operation(summary = "添加应用域名") + @PostMapping() + public ApiResult save(@RequestBody CompanyUrl companyUrl) { + if (companyUrlService.save(companyUrl)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:company:update')") + @OperationLog + @Operation(summary = "修改应用域名") + @PutMapping() + public ApiResult update(@RequestBody CompanyUrl companyUrl) { + if (companyUrlService.updateById(companyUrl)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:company:remove')") + @OperationLog + @Operation(summary = "删除应用域名") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (companyUrlService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:company:save')") + @OperationLog + @Operation(summary = "批量添加应用域名") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (companyUrlService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:company:update')") + @OperationLog + @Operation(summary = "批量修改应用域名") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(companyUrlService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:company:remove')") + @OperationLog + @Operation(summary = "批量删除应用域名") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (companyUrlService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/DictController.java b/src/main/java/com/gxwebsoft/common/system/controller/DictController.java new file mode 100644 index 0000000..27fb3fe --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/DictController.java @@ -0,0 +1,177 @@ +package com.gxwebsoft.common.system.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Dict; +import com.gxwebsoft.common.system.entity.DictData; +import com.gxwebsoft.common.system.param.DictDataParam; +import com.gxwebsoft.common.system.param.DictParam; +import com.gxwebsoft.common.system.service.DictDataService; +import com.gxwebsoft.common.system.service.DictService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 字典控制器 + * + * @author WebSoft + * @since 2020-03-14 11:29:03 + */ +@Tag(name = "字典管理(业务类)") +@RestController +@RequestMapping("/api/system/dict") +public class DictController extends BaseController { + @Resource + private DictService dictService; + @Resource + private DictDataService dictDataService; + + @PreAuthorize("hasAuthority('sys:dict:list')") + @Operation(summary = "分页查询字典") + @GetMapping("/page") + public ApiResult> page(DictParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number"); + return success(dictService.page(page, page.getWrapper())); + } + + @PreAuthorize("hasAuthority('sys:dict:list')") + @Operation(summary = "查询全部字典") + @GetMapping() + public ApiResult> list(DictParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number"); + return success(dictService.list(page.getOrderWrapper())); + } + + @PreAuthorize("hasAuthority('sys:dict:list')") + @Operation(summary = "查询全部字典") + @GetMapping("/tree") + public ApiResult tree() { + final HashMap result = new HashMap<>(); + final List dictData = dictDataService.listRel(new DictDataParam()); + final Map> dataCollect = dictData.stream().collect(Collectors.groupingBy(DictData::getDictCode)); + for (String code : dataCollect.keySet()) { + Dict dict = new Dict(); + dict.setDictCode(code); + final Set> list = new LinkedHashSet<>(); + Set codes = new LinkedHashSet<>(); + for(DictData item : dictData){ + if (item.getDictCode().equals(code)) { + codes.add(item.getDictDataCode()); + } + } + list.add(codes); + dict.setItems(list); + result.put(code,dict.getItems()); + } + return success(result); + } + + @PreAuthorize("hasAuthority('sys:dict:list')") + @Operation(summary = "根据id查询字典") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(dictService.getById(id)); + } + + @PreAuthorize("hasAuthority('sys:dict:save')") + @Operation(summary = "添加字典") + @PostMapping() + public ApiResult add(@RequestBody Dict dict) { + if (dictService.count(new LambdaQueryWrapper() + .eq(Dict::getDictCode, dict.getDictCode())) > 0) { + return fail("字典标识已存在"); + } + if (dictService.count(new LambdaQueryWrapper() + .eq(Dict::getDictName, dict.getDictName())) > 0) { + return fail("字典名称已存在"); + } + if (dictService.save(dict)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:dict:update')") + @Operation(summary = "修改字典") + @PutMapping() + public ApiResult update(@RequestBody Dict dict) { + if (dictService.count(new LambdaQueryWrapper() + .eq(Dict::getDictCode, dict.getDictCode()) + .ne(Dict::getDictId, dict.getDictId())) > 0) { + return fail("字典标识已存在"); + } + if (dictService.count(new LambdaQueryWrapper() + .eq(Dict::getDictName, dict.getDictName()) + .ne(Dict::getDictId, dict.getDictId())) > 0) { + return fail("字典名称已存在"); + } + if (dictService.updateById(dict)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:dict:remove')") + @Operation(summary = "删除字典") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (dictService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:dict:save')") + @Operation(summary = "批量添加字典") + @PostMapping("/batch") + public ApiResult> saveBatch(@RequestBody List list) { + if (CommonUtil.checkRepeat(list, Dict::getDictCode)) { + return fail("字典标识不能重复", null); + } + if (CommonUtil.checkRepeat(list, Dict::getDictName)) { + return fail("字典名称不能重复", null); + } + List codeExists = dictService.list(new LambdaQueryWrapper() + .in(Dict::getDictCode, list.stream().map(Dict::getDictCode) + .collect(Collectors.toList()))); + if (codeExists.size() > 0) { + return fail("字典标识已存在", codeExists.stream().map(Dict::getDictCode) + .collect(Collectors.toList())).setCode(2); + } + List nameExists = dictService.list(new LambdaQueryWrapper() + .in(Dict::getDictName, list.stream().map(Dict::getDictCode) + .collect(Collectors.toList()))); + if (nameExists.size() > 0) { + return fail("字典名称已存在", nameExists.stream().map(Dict::getDictName) + .collect(Collectors.toList())).setCode(3); + } + if (dictService.saveBatch(list)) { + return success("添加成功", null); + } + return fail("添加失败", null); + } + + @PreAuthorize("hasAuthority('sys:dict:remove')") + @Operation(summary = "批量删除字典") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (dictService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/DictDataController.java b/src/main/java/com/gxwebsoft/common/system/controller/DictDataController.java new file mode 100644 index 0000000..1942f67 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/DictDataController.java @@ -0,0 +1,124 @@ +package com.gxwebsoft.common.system.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.DictData; +import com.gxwebsoft.common.system.param.DictDataParam; +import com.gxwebsoft.common.system.service.DictDataService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 字典数据控制器 + * + * @author WebSoft + * @since 2020-03-14 11:29:04 + */ +@Tag(name = "字典数据管理(业务类)") +@RestController +@RequestMapping("/api/system/dict-data") +public class DictDataController extends BaseController { + @Resource + private DictDataService dictDataService; + + @PreAuthorize("hasAuthority('sys:dict:list')") + @Operation(summary = "分页查询字典数据") + @GetMapping("/page") + public ApiResult> page(DictDataParam param) { + return success(dictDataService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('sys:dict:list')") + @Operation(summary = "查询全部字典数据") + @GetMapping() + public ApiResult> list(DictDataParam param) { + return success(dictDataService.listRel(param)); + } + + @PreAuthorize("hasAuthority('sys:dict:list')") + @Operation(summary = "根据id查询字典数据") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(dictDataService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('sys:dict:save')") + @Operation(summary = "添加字典数据") + @PostMapping() + public ApiResult add(@RequestBody DictData dictData) { + if (dictDataService.count(new LambdaQueryWrapper() + .eq(DictData::getDictId, dictData.getDictId()) + .eq(DictData::getDictDataName, dictData.getDictDataName())) > 0) { + return fail("字典数据名称已存在"); + } + if (dictDataService.count(new LambdaQueryWrapper() + .eq(DictData::getDictId, dictData.getDictId()) + .eq(DictData::getDictDataCode, dictData.getDictDataCode())) > 0) { + return fail("字典数据标识已存在"); + } + if (dictDataService.save(dictData)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:dict:update')") + @Operation(summary = "修改字典数据") + @PutMapping() + public ApiResult update(@RequestBody DictData dictData) { + if (dictDataService.count(new LambdaQueryWrapper() + .eq(DictData::getDictId, dictData.getDictId()) + .eq(DictData::getDictDataName, dictData.getDictDataName()) + .ne(DictData::getDictDataId, dictData.getDictDataId())) > 0) { + return fail("字典数据名称已存在"); + } + if (dictDataService.count(new LambdaQueryWrapper() + .eq(DictData::getDictId, dictData.getDictId()) + .eq(DictData::getDictDataCode, dictData.getDictDataCode()) + .ne(DictData::getDictDataId, dictData.getDictDataId())) > 0) { + return fail("字典数据标识已存在"); + } + if (dictDataService.updateById(dictData)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:dict:remove')") + @Operation(summary = "删除字典数据") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (dictDataService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:dict:save')") + @Operation(summary = "批量添加字典数据") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List dictDataList) { + if (dictDataService.saveBatch(dictDataList)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:dict:remove')") + @Operation(summary = "批量删除字典数据") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (dictDataService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/DictionaryController.java b/src/main/java/com/gxwebsoft/common/system/controller/DictionaryController.java new file mode 100644 index 0000000..ecbeb6d --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/DictionaryController.java @@ -0,0 +1,148 @@ +package com.gxwebsoft.common.system.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Dictionary; +import com.gxwebsoft.common.system.param.DictionaryParam; +import com.gxwebsoft.common.system.service.DictionaryService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 字典控制器 + * + * @author WebSoft + * @since 2020-03-14 11:29:03 + */ +@Tag(name = "字典管理(系统类)") +@RestController +@RequestMapping("/api/system/dictionary") +public class DictionaryController extends BaseController { + @Resource + private DictionaryService dictionaryService; + + @PreAuthorize("hasAuthority('sys:dictionary:list')") + @Operation(summary = "分页查询字典") + @GetMapping("/page") + public ApiResult> page(DictionaryParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number"); + return success(dictionaryService.page(page, page.getWrapper())); + } + + @PreAuthorize("hasAuthority('sys:dictionary:list')") + @Operation(summary = "查询全部字典") + @GetMapping() + public ApiResult> list(DictionaryParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number"); + return success(dictionaryService.list(page.getOrderWrapper())); + } + + @PreAuthorize("hasAuthority('sys:dictionary:list')") + @Operation(summary = "根据id查询字典") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(dictionaryService.getById(id)); + } + + @PreAuthorize("hasAuthority('sys:dictionary:save')") + @Operation(summary = "添加字典") + @PostMapping() + public ApiResult add(@RequestBody Dictionary dictionary) { + if (dictionaryService.count(new LambdaQueryWrapper() + .eq(Dictionary::getDictCode, dictionary.getDictCode())) > 0) { + return fail("字典标识已存在"); + } + if (dictionaryService.count(new LambdaQueryWrapper() + .eq(Dictionary::getDictName, dictionary.getDictName())) > 0) { + return fail("字典名称已存在"); + } + if (dictionaryService.save(dictionary)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:dictionary:update')") + @Operation(summary = "修改字典") + @PutMapping() + public ApiResult update(@RequestBody Dictionary dictionary) { + if (dictionaryService.count(new LambdaQueryWrapper() + .eq(Dictionary::getDictCode, dictionary.getDictCode()) + .ne(Dictionary::getDictId, dictionary.getDictId())) > 0) { + return fail("字典标识已存在"); + } + if (dictionaryService.count(new LambdaQueryWrapper() + .eq(Dictionary::getDictName, dictionary.getDictName()) + .ne(Dictionary::getDictId, dictionary.getDictId())) > 0) { + return fail("字典名称已存在"); + } + if (dictionaryService.updateById(dictionary)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:dictionary:remove')") + @Operation(summary = "删除字典") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (dictionaryService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:dictionary:save')") + @Operation(summary = "批量添加字典") + @PostMapping("/batch") + public ApiResult> saveBatch(@RequestBody List list) { + if (CommonUtil.checkRepeat(list, Dictionary::getDictCode)) { + return fail("字典标识不能重复", null); + } + if (CommonUtil.checkRepeat(list, Dictionary::getDictName)) { + return fail("字典名称不能重复", null); + } + List codeExists = dictionaryService.list(new LambdaQueryWrapper() + .in(Dictionary::getDictCode, list.stream().map(Dictionary::getDictCode) + .collect(Collectors.toList()))); + if (codeExists.size() > 0) { + return fail("字典标识已存在", codeExists.stream().map(Dictionary::getDictCode) + .collect(Collectors.toList())).setCode(2); + } + List nameExists = dictionaryService.list(new LambdaQueryWrapper() + .in(Dictionary::getDictName, list.stream().map(Dictionary::getDictCode) + .collect(Collectors.toList()))); + if (nameExists.size() > 0) { + return fail("字典名称已存在", nameExists.stream().map(Dictionary::getDictName) + .collect(Collectors.toList())).setCode(3); + } + if (dictionaryService.saveBatch(list)) { + return success("添加成功", null); + } + return fail("添加失败", null); + } + + @PreAuthorize("hasAuthority('sys:dictionary:remove')") + @Operation(summary = "批量删除字典") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (dictionaryService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/DictionaryDataController.java b/src/main/java/com/gxwebsoft/common/system/controller/DictionaryDataController.java new file mode 100644 index 0000000..df16554 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/DictionaryDataController.java @@ -0,0 +1,123 @@ +package com.gxwebsoft.common.system.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.*; +import com.gxwebsoft.common.system.entity.DictionaryData; +import com.gxwebsoft.common.system.param.DictionaryDataParam; +import com.gxwebsoft.common.system.service.DictionaryDataService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 字典数据控制器 + * + * @author WebSoft + * @since 2020-03-14 11:29:04 + */ +@Tag(name = "字典数据管理(系统类)") +@RestController +@RequestMapping("/api/system/dictionary-data") +public class DictionaryDataController extends BaseController { + @Resource + private DictionaryDataService dictionaryDataService; + + @PreAuthorize("hasAuthority('sys:dict:list')") + @Operation(summary = "分页查询字典数据") + @GetMapping("/page") + public ApiResult> page(DictionaryDataParam param) { + return success(dictionaryDataService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('sys:dict:list')") + @Operation(summary = "查询全部字典数据") + @GetMapping() + public ApiResult> list(DictionaryDataParam param) { + return success(dictionaryDataService.listRel(param)); + } + + @PreAuthorize("hasAuthority('sys:dict:list')") + @Operation(summary = "根据id查询字典数据") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(dictionaryDataService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('sys:dict:save')") + @Operation(summary = "添加字典数据") + @PostMapping() + public ApiResult add(@RequestBody DictionaryData dictionaryData) { + if (dictionaryDataService.count(new LambdaQueryWrapper() + .eq(DictionaryData::getDictId, dictionaryData.getDictId()) + .eq(DictionaryData::getDictDataName, dictionaryData.getDictDataName())) > 0) { + return fail("字典数据名称已存在"); + } + if (dictionaryDataService.count(new LambdaQueryWrapper() + .eq(DictionaryData::getDictId, dictionaryData.getDictId()) + .eq(DictionaryData::getDictDataCode, dictionaryData.getDictDataCode())) > 0) { + return fail("字典数据标识已存在"); + } + if (dictionaryDataService.save(dictionaryData)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:dict:update')") + @Operation(summary = "修改字典数据") + @PutMapping() + public ApiResult update(@RequestBody DictionaryData dictionaryData) { + if (dictionaryDataService.count(new LambdaQueryWrapper() + .eq(DictionaryData::getDictId, dictionaryData.getDictId()) + .eq(DictionaryData::getDictDataName, dictionaryData.getDictDataName()) + .ne(DictionaryData::getDictDataId, dictionaryData.getDictDataId())) > 0) { + return fail("字典数据名称已存在"); + } + if (dictionaryDataService.count(new LambdaQueryWrapper() + .eq(DictionaryData::getDictId, dictionaryData.getDictId()) + .eq(DictionaryData::getDictDataCode, dictionaryData.getDictDataCode()) + .ne(DictionaryData::getDictDataId, dictionaryData.getDictDataId())) > 0) { + return fail("字典数据标识已存在"); + } + if (dictionaryDataService.updateById(dictionaryData)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:dict:remove')") + @Operation(summary = "删除字典数据") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (dictionaryDataService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:dict:save')") + @Operation(summary = "批量添加字典数据") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List dictDataList) { + if (dictionaryDataService.saveBatch(dictDataList)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:dict:remove')") + @Operation(summary = "批量删除字典数据") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (dictionaryDataService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/DomainController.java b/src/main/java/com/gxwebsoft/common/system/controller/DomainController.java new file mode 100644 index 0000000..66b95cb --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/DomainController.java @@ -0,0 +1,127 @@ +package com.gxwebsoft.common.system.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Domain; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.param.DomainParam; +import com.gxwebsoft.common.system.service.DomainService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 授权域名控制器 + * + * @author 科技小王子 + * @since 2024-09-19 23:56:33 + */ +@Tag(name = "授权域名管理") +@RestController +@RequestMapping("/api/system/domain") +public class DomainController extends BaseController { + @Resource + private DomainService domainService; + + @Operation(summary = "分页查询授权域名") + @GetMapping("/page") + public ApiResult> page(DomainParam param) { + // 使用关联查询 + return success(domainService.pageRel(param)); + } + + @Operation(summary = "查询全部授权域名") + @GetMapping() + public ApiResult> list(DomainParam param) { + // 使用关联查询 + return success(domainService.listRel(param)); + } + + @PreAuthorize("hasAuthority('sys:domain:list')") + @OperationLog + @Operation(summary = "根据id查询授权域名") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(domainService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('sys:domain:save')") + @OperationLog + @Operation(summary = "添加授权域名") + @PostMapping() + public ApiResult save(@RequestBody Domain domain) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + domain.setUserId(loginUser.getUserId()); + } + if (domainService.save(domain)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:domain:update')") + @OperationLog + @Operation(summary = "修改授权域名") + @PutMapping() + public ApiResult update(@RequestBody Domain domain) { + if (domainService.updateById(domain)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:domain:remove')") + @OperationLog + @Operation(summary = "删除授权域名") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (domainService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:domain:save')") + @OperationLog + @Operation(summary = "批量添加授权域名") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (domainService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:domain:update')") + @OperationLog + @Operation(summary = "批量修改授权域名") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(domainService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:domain:remove')") + @OperationLog + @Operation(summary = "批量删除授权域名") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (domainService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/EmailController.java b/src/main/java/com/gxwebsoft/common/system/controller/EmailController.java new file mode 100644 index 0000000..cf1f9cc --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/EmailController.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.common.system.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.EmailRecord; +import com.gxwebsoft.common.system.service.EmailRecordService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.mail.MessagingException; + +/** + * 邮件功能控制器 + * + * @author WebSoft + * @since 2020-03-21 00:37:11 + */ +@Tag(name = "邮件功能") +@RestController +@RequestMapping("/api/system/email") +public class EmailController extends BaseController { + @Resource + private EmailRecordService emailRecordService; + + @PreAuthorize("hasAuthority('sys:email:send')") + @Operation(summary = "发送邮件") + @PostMapping() + public ApiResult send(@RequestBody EmailRecord emailRecord) { + try { + emailRecordService.sendFullTextEmail(emailRecord.getTitle(), emailRecord.getContent(), + emailRecord.getReceiver().split(",")); + emailRecord.setCreateUserId(getLoginUserId()); + emailRecordService.save(emailRecord); + return success("发送成功"); + } catch (MessagingException e) { + e.printStackTrace(); + } + return fail("发送失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/FileController.java b/src/main/java/com/gxwebsoft/common/system/controller/FileController.java new file mode 100644 index 0000000..e61068d --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/FileController.java @@ -0,0 +1,319 @@ +package com.gxwebsoft.common.system.controller; + +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.config.ConfigProperties; +import com.gxwebsoft.common.core.utils.FileServerUtil; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.FileRecord; +import com.gxwebsoft.common.system.param.FileRecordParam; +import com.gxwebsoft.common.system.service.FileRecordService; +import io.swagger.v3.oas.annotations.tags.Tag; + +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; + +/** + * 文件上传下载控制器 + * + * @author WebSoft + * @since 2018-12-24 16:10:24 + */ +@Tag(name = "文件上传下载") +@RestController +@RequestMapping("/api/file") +public class FileController extends BaseController { + @Resource + private ConfigProperties config; + @Resource + private RedisUtil redisUtil; + @Resource + private FileRecordService fileRecordService; + + @PreAuthorize("hasAuthority('sys:file:upload')") + @Operation(summary = "上传文件") + @PostMapping("/upload") + public ApiResult upload(@RequestParam MultipartFile file, HttpServletRequest request) { + FileRecord result = null; + try { + String dir = getUploadDir(); + File upload = FileServerUtil.upload(file, dir, config.getUploadUuidName()); + String path = upload.getAbsolutePath().replace("\\", "/").substring(dir.length() - 1); +// String requestURL = StrUtil.removeSuffix(request.getRequestURL(), "/upload"); + String requestURL = config.getFileServer() + "/api/file"; + String originalName = file.getOriginalFilename(); + result = new FileRecord(); + result.setCreateUserId(getLoginUserId()); + result.setName(StrUtil.isBlank(originalName) ? upload.getName() : originalName); + result.setLength(upload.length()); + result.setPath(path); + result.setUrl(requestURL + path); + String contentType = FileServerUtil.getContentType(upload); + result.setContentType(contentType); + if (FileServerUtil.isImage(contentType)) { + result.setThumbnail(requestURL + "/thumbnail" + path); + } + result.setDownloadUrl(config.getFileServer() + "/download" + path); + // 云存储配置 + final String s = redisUtil.get("setting:upload:" + getTenantId()); + final JSONObject jsonObject = JSONObject.parseObject(s); + final String uploadMethod = jsonObject.getString("uploadMethod"); + final String bucketDomain = jsonObject.getString("bucketDomain"); + if(!uploadMethod.equals("file")){ + path = bucketDomain + path; + } + result.setUrl(path); + fileRecordService.save(result); + return success(result); + } catch (Exception e) { + e.printStackTrace(); + return fail("上传失败", result).setError(e.toString()); + } + } + + @PreAuthorize("hasAuthority('sys:file:upload')") + @Operation(summary = "上传base64文件") + @PostMapping("/upload/base64") + public ApiResult uploadBase64(String base64, String fileName, HttpServletRequest request) { + FileRecord result = null; + try { + String dir = getUploadDir(); + File upload = FileServerUtil.upload(base64, fileName, getUploadDir()); + String path = upload.getAbsolutePath().substring(dir.length()).replace("\\", "/"); + String requestURL = StrUtil.removeSuffix(request.getRequestURL(), "/upload/base64"); + result = new FileRecord(); + result.setCreateUserId(getLoginUserId()); + result.setName(StrUtil.isBlank(fileName) ? upload.getName() : fileName); + result.setLength(upload.length()); + result.setPath(path); + result.setUrl(requestURL + path); + result.setThumbnail(FileServerUtil.isImage(upload) ? (requestURL + "/thumbnail" + path) : null); + fileRecordService.save(result); + return success(result); + } catch (Exception e) { + e.printStackTrace(); + return fail("上传失败", result).setError(e.toString()); + } + } + + @PreAuthorize("hasAuthority('sys:file:upload')") + @Operation(summary = "上传图片") + @PostMapping("/image") + public HashMap image(@RequestParam MultipartFile file, HttpServletRequest request) { + FileRecord result = null; + try { + String dir = getUploadDir(); + File upload = FileServerUtil.upload(file, dir, config.getUploadUuidName()); + String path = upload.getAbsolutePath().replace("\\", "/").substring(dir.length() - 1); +// System.out.println("request.getRequestURL() = " + request.getRequestURL()); +// String requestURL = StrUtil.removeSuffix(request.getRequestURL(), "/image"); + String requestURL = config.getFileServer() + "/api/file"; +// System.out.println("requestURL = " + requestURL); +// config.getServerUrl() + String originalName = file.getOriginalFilename(); + result = new FileRecord(); + result.setCreateUserId(getLoginUserId()); + result.setName(StrUtil.isBlank(originalName) ? upload.getName() : originalName); + result.setLength(upload.length()); + result.setPath(path); + result.setUrl(path); + String contentType = FileServerUtil.getContentType(upload); + result.setContentType(contentType); + if (FileServerUtil.isImage(contentType)) { + result.setThumbnail(requestURL + "/thumbnail" + path); + } + result.setDownloadUrl(requestURL + "/download" + path); + final HashMap map = new HashMap<>(); + map.put("name",result.getName()); + map.put("status","done"); + map.put("thumbUrl",result.getThumbnail()); + map.put("downloadUrl",result.getDownloadUrl()); + map.put("url",result.getUrl()); + fileRecordService.save(result); + return map; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + @PreAuthorize("hasAuthority('sys:file:list')") + @Operation(summary = "根据id查询文件") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(fileRecordService.getByIdRel(id)); + } + + @Operation(summary = "查看原文件") + @GetMapping("/{dir}/{name:.+}") + public void preview(@PathVariable("dir") String dir, @PathVariable("name") String name, + HttpServletResponse response, HttpServletRequest request) { + File file = new File(getUploadDir(), dir + "/" + name); + FileServerUtil.preview(file, getPdfOutDir(), config.getOpenOfficeHome(), response, request); + } + + @Operation(summary = "下载原文件") + @GetMapping("/download/{dir}/{name:.+}") + public void download(@PathVariable("dir") String dir, @PathVariable("name") String name, + HttpServletResponse response, HttpServletRequest request) { + String path = dir + "/" + name; + FileRecord record = fileRecordService.getByIdPath(path); + File file = new File(getUploadDir(), path); + String fileName = record == null ? file.getName() : record.getName(); + FileServerUtil.preview(file, true, fileName, null, null, response, request); + } + + @Operation(summary = "查看缩略图") + @GetMapping("/thumbnail/{dir}/{name:.+}") + public void thumbnail(@PathVariable("dir") String dir, @PathVariable("name") String name, + HttpServletResponse response, HttpServletRequest request) { + File file = new File(getUploadDir(), dir + "/" + name); + File thumbnail = new File(getUploadSmDir(), dir + "/" + name); + FileServerUtil.previewThumbnail(file, thumbnail, config.getThumbnailSize(), response, request); + } + + @PreAuthorize("hasAuthority('sys:file:remove')") + @Operation(summary = "删除文件") + @DeleteMapping("/remove/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + FileRecord record = fileRecordService.getById(id); + if (fileRecordService.removeById(id)) { + if (StrUtil.isNotBlank(record.getPath())) { + fileRecordService.deleteFileAsync(Arrays.asList( + new File(getUploadDir(), record.getPath()), + new File(getUploadSmDir(), record.getPath()) + )); + } + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:file:remove')") + @Operation(summary = "批量删除文件") + @DeleteMapping("/remove/batch") + public ApiResult deleteBatch(@RequestBody List ids) { + List fileRecords = fileRecordService.listByIds(ids); + if (fileRecordService.removeByIds(ids)) { + List files = new ArrayList<>(); + for (FileRecord record : fileRecords) { + if (StrUtil.isNotBlank(record.getPath())) { + files.add(new File(getUploadDir(), record.getPath())); + files.add(new File(getUploadSmDir(), record.getPath())); + } + } + fileRecordService.deleteFileAsync(files); + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:file:list')") + @Operation(summary = "分页查询文件") + @GetMapping("/page") + public ApiResult> page(FileRecordParam param, HttpServletRequest request) { + PageResult result = fileRecordService.pageRel(param); +// String requestURL = StrUtil.removeSuffix(request.getRequestURL(), "/page"); + String requestURL = config.getFileServer(); + for (FileRecord record : result.getList()) { + if (StrUtil.isNotBlank(record.getPath())) { + record.setUrl(requestURL + record.getPath()); + if (FileServerUtil.isImage(record.getContentType())) { + record.setThumbnail(requestURL + "/thumbnail" + record.getPath()); + } + record.setDownloadUrl(requestURL + "/download" + record.getPath()); + } + } + return success(result); + } + + @PreAuthorize("hasAuthority('sys:file:list')") + @Operation(summary = "查询全部文件") + @GetMapping("/list") + public ApiResult> list(FileRecordParam param, HttpServletRequest request) { + List records = fileRecordService.listRel(param); +// String requestURL = StrUtil.removeSuffix(request.getRequestURL(), "/list"); + String requestURL = config.getFileServer(); + for (FileRecord record : records) { + if (StrUtil.isNotBlank(record.getPath())) { + record.setUrl(requestURL + record.getPath()); + if (FileServerUtil.isImage(record.getContentType())) { + record.setThumbnail(requestURL + "/thumbnail" + record.getPath()); + } + record.setDownloadUrl(requestURL + "/download" + record.getPath()); + } + } + return success(records); + } + + /** + * 文件上传基目录 + */ + private String getUploadBaseDir() { + return config.getUploadPath(); + } + + /** + * 文件上传位置(服务器) + */ + private String getUploadDir() { + return config.getUploadPath(); + } + + /** + * 文件上传位置(本地) + */ +// private String getUploadDir() { +// return "/Users/gxwebsoft/Documents/uploads/"; +// } + + /** + * 缩略图生成位置 + */ + private String getUploadSmDir() { + return getUploadBaseDir() + "thumbnail/"; + } + + /** + * office转pdf输出位置 + */ + private String getPdfOutDir() { + return getUploadBaseDir() + "pdf/"; + } + + @PreAuthorize("hasAuthority('sys:file:upload')") + @Operation(summary = "添加文件") + @PostMapping() + public ApiResult save(@RequestBody FileRecord fileRecord) { + if (fileRecordService.save(fileRecord)) { + return success("上传成功"); + } + return fail("上传失败"); + } + + @PreAuthorize("hasAuthority('sys:file:update')") + @Operation(summary = "修改文件") + @PutMapping() + public ApiResult update(@RequestBody FileRecord fileRecord) { + if (fileRecordService.updateById(fileRecord)) { + return success("修改成功"); + } + return fail("修改失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/LoginRecordController.java b/src/main/java/com/gxwebsoft/common/system/controller/LoginRecordController.java new file mode 100644 index 0000000..91175ca --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/LoginRecordController.java @@ -0,0 +1,55 @@ +package com.gxwebsoft.common.system.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.LoginRecord; +import com.gxwebsoft.common.system.param.LoginRecordParam; +import com.gxwebsoft.common.system.service.LoginRecordService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 登录日志控制器 + * + * @author WebSoft + * @since 2018-12-24 16:10:31 + */ +@Tag(name = "登录日志") +@RestController +@RequestMapping("/api/system/login-record") +public class LoginRecordController extends BaseController { + @Resource + private LoginRecordService loginRecordService; + + @PreAuthorize("hasAuthority('sys:login-record:list')") + @Operation(summary = "分页查询登录日志") + @GetMapping("/page") + public ApiResult> page(LoginRecordParam param) { + return success(loginRecordService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('sys:login-record:list')") + @Operation(summary = "查询全部登录日志") + @GetMapping() + public ApiResult> list(LoginRecordParam param) { + return success(loginRecordService.listRel(param)); + } + + @PreAuthorize("hasAuthority('sys:login-record:list')") + @Operation(summary = "根据id查询登录日志") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(loginRecordService.getByIdRel(id)); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/MainController.java b/src/main/java/com/gxwebsoft/common/system/controller/MainController.java new file mode 100644 index 0000000..07ab5b3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/MainController.java @@ -0,0 +1,314 @@ +package com.gxwebsoft.common.system.controller; + +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; +import com.aliyuncs.CommonRequest; +import com.aliyuncs.CommonResponse; +import com.aliyuncs.DefaultAcsClient; +import com.aliyuncs.IAcsClient; +import com.aliyuncs.exceptions.ClientException; +import com.aliyuncs.exceptions.ServerException; +import com.aliyuncs.http.MethodType; +import com.aliyuncs.profile.DefaultProfile; +import com.google.gson.Gson; +import com.gxwebsoft.common.core.config.ConfigProperties; +import com.gxwebsoft.common.core.security.JwtSubject; +import com.gxwebsoft.common.core.security.JwtUtil; +import com.gxwebsoft.common.core.utils.CacheClient; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.ExistenceParam; +import com.gxwebsoft.common.system.entity.LoginRecord; +import com.gxwebsoft.common.system.entity.Menu; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.param.LoginParam; +import com.gxwebsoft.common.system.param.SmsCaptchaParam; +import com.gxwebsoft.common.system.param.UpdatePasswordParam; +import com.gxwebsoft.common.system.result.CaptchaResult; +import com.gxwebsoft.common.system.result.LoginResult; +import com.gxwebsoft.common.system.service.*; +import com.wf.captcha.SpecCaptcha; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.HashMap; +import java.util.List; +import java.util.Random; +import java.util.concurrent.TimeUnit; + +/** + * 登录认证控制器 + * + * @author WebSoft + * @since 2018-12-24 16:10:11 + */ +@Tag(name = "登录认证") +@RestController +@RequestMapping("/api") +public class MainController extends BaseController { + @Resource + private ConfigProperties configProperties; + @Resource + private UserService userService; + @Resource + private RoleMenuService roleMenuService; + @Resource + private LoginRecordService loginRecordService; + @Resource + private CacheClient cacheClient; + @Resource + private RedisUtil redisUtil; + + @Operation(summary = "检查用户是否存在") + @GetMapping("/existence") + public ApiResult existence(ExistenceParam param) { + if (param.isExistence(userService, User::getUserId)) { + return success("已存在", param.getValue()); + } + return fail("不存在"); + } + + @Operation(summary = "获取登录用户信息") + @GetMapping("/auth/user") + public ApiResult userInfo() { + final Integer loginUserId = getLoginUserId(); + if(loginUserId != null){ + return success(userService.getByIdRel(getLoginUserId())); + } + return fail("loginUserId不存在",null); + } + + @Operation(summary = "获取登录用户菜单") + @GetMapping("/auth/menu") + public ApiResult> userMenu() { + List menus = roleMenuService.listMenuByUserId(getLoginUserId(), Menu.TYPE_MENU); + return success(CommonUtil.toTreeData(menus, 0, Menu::getParentId, Menu::getMenuId, Menu::setChildren)); + } + + @PreAuthorize("hasAuthority('sys:auth:user')") + @Operation(summary = "修改个人信息") + @PutMapping("/auth/user") + public ApiResult updateInfo(@RequestBody User user) { + user.setUserId(getLoginUserId()); + // 不能修改的字段 + user.setUsername(null); + user.setPassword(null); + user.setEmailVerified(null); + user.setOrganizationId(null); + user.setStatus(null); + if (userService.updateById(user)) { + return success(userService.getByIdRel(user.getUserId())); + } + return fail("保存失败", null); + } + + @PreAuthorize("hasAuthority('sys:auth:password')") + @Operation(summary = "修改自己密码") + @PutMapping("/auth/password") + public ApiResult updatePassword(@RequestBody UpdatePasswordParam param) { + if (StrUtil.hasBlank(param.getOldPassword(), param.getPassword())) { + return fail("参数不能为空"); + } + Integer userId = getLoginUserId(); + if (userId == null) { + return fail("未登录"); + } + if (!userService.comparePassword(userService.getById(userId).getPassword(), param.getOldPassword())) { + return fail("原密码输入不正确"); + } + User user = new User(); + user.setUserId(userId); + user.setPassword(userService.encodePassword(param.getPassword())); + if (userService.updateById(user)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "图形验证码") + @GetMapping("/captcha") + public ApiResult captcha() { + SpecCaptcha specCaptcha = new SpecCaptcha(130, 48, 5); + return success(new CaptchaResult(specCaptcha.toBase64(), specCaptcha.text().toLowerCase())); + } + + @Operation(summary = "企业微信登录链接") + @GetMapping("/wxWorkQrConnect") + public ApiResult wxWorkQrConnect() throws UnsupportedEncodingException { + final JSONObject settingInfo = cacheClient.getSettingInfo("wx-work", 10048); + final String corpId = settingInfo.getString("corpId"); + String encodedReturnUrl = URLEncoder.encode("https://oa.gxwebsoft.com/api/open/wx-work/login","UTF-8"); + String url = "https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect?appid=" +corpId+ "&redirect_uri=" +encodedReturnUrl+ "&state=ww_login@gxwebsoft&usertype=admin"; + return success("获取成功",url); + } + + @Operation(summary = "短信验证码") + @PostMapping("/sendSmsCaptcha") + public ApiResult sendSmsCaptcha(@RequestBody SmsCaptchaParam param) { + // 读取短信配置信息 + String string = redisUtil.get("setting:sms:" + getTenantId()); + JSONObject jsonObject = JSONObject.parseObject(string); + String accessKeyId = jsonObject.getString("accessKeyId"); + String accessKeySecret = jsonObject.getString("accessKeySecret"); + String userTemplateId = jsonObject.getString("userTemplateId"); + String sign = jsonObject.getString("sign"); + if(accessKeyId != null){ + DefaultProfile profile = DefaultProfile.getProfile("regionld", accessKeyId, accessKeySecret); + IAcsClient client = new DefaultAcsClient(profile); + CommonRequest request = new CommonRequest(); + request.setSysMethod(MethodType.POST); + request.setSysDomain("dysmsapi.aliyuncs.com"); + request.setSysVersion("2017-05-25"); + request.setSysAction("SendSms"); + request.putQueryParameter("RegionId", "cn-hangzhou"); + request.putQueryParameter("PhoneNumbers", param.getPhone()); + request.putQueryParameter("SignName", sign); + request.putQueryParameter("TemplateCode", userTemplateId); + // 生成短信验证码 + Random randObj = new Random(); + String code = Integer.toString(100000 + randObj.nextInt(900000)); + request.putQueryParameter("TemplateParam", "{\"code\":" + code + "}"); + try { + CommonResponse response = client.getCommonResponse(request); + System.out.println("response = " + response); + String json = response.getData(); + System.out.println("json = " + json); + Gson g = new Gson(); + HashMap result = g.fromJson(json, HashMap.class); + System.out.println("result = " + result); + if("OK".equals(result.get("Message"))) { + System.out.println("======================== = " + result); + cacheClient.set(param.getPhone(),code,5L,TimeUnit.MINUTES); + String key = "code:" + param.getPhone(); + redisUtil.set(key,code,5L,TimeUnit.MINUTES); + return success("发送成功",result.get("Message")); + }else{ + return fail("发送失败"); + } + } catch (ServerException e) { + e.printStackTrace(); + } catch (ClientException e) { + e.printStackTrace(); + } + } + return fail("发送失败"); + } + + @Operation(summary = "重置密码") + @PutMapping("/password") + public ApiResult resetPassword(@RequestBody User user) { + if (user.getPassword() == null) { + return fail("参数不正确"); + } + if (user.getCode() == null) { + return fail("验证码不能为空"); + } + // 短信验证码校验 + String code = cacheClient.get(user.getPhone(), String.class); + if (!StrUtil.equals(code,user.getCode())) { + return fail("验证码不正确"); + } + + user.setUserId(getLoginUserId()); + user.setPassword(userService.encodePassword(user.getPassword())); + if (userService.updateById(user)) { + return success("密码修改成功"); + } else { + return fail("密码修改失败"); + } + } + + @Operation(summary = "短信验证码登录") + @PostMapping("/loginBySms") + public ApiResult loginBySms(@RequestBody LoginParam param, HttpServletRequest request) { + final String phone = param.getPhone(); + final Integer tenantId = param.getTenantId(); + final String code = param.getCode(); + + User user = userService.getByUsername(phone, tenantId); + // 验证码校验 + String key = "code:" + param.getPhone(); + if(!code.equals(redisUtil.get(key))){ + String message = "验证码不正确"; + loginRecordService.saveAsync(phone, LoginRecord.TYPE_ERROR, message, tenantId,request); + return fail(message, null); + } + if (user == null) { + String message = "账号不存在"; + loginRecordService.saveAsync(phone, LoginRecord.TYPE_ERROR, message, tenantId,request); + return fail(message, null); + } + if (!user.getStatus().equals(0)) { + String message = "账号被冻结"; + loginRecordService.saveAsync(phone, LoginRecord.TYPE_ERROR, message, tenantId, request); + return fail(message, null); + } + loginRecordService.saveAsync(phone, LoginRecord.TYPE_LOGIN, null, tenantId, request); + + // 设置过期时间 + Long tokenExpireTime = configProperties.getTokenExpireTime(); + final JSONObject register = cacheClient.getSettingInfo("register", tenantId); + if(register != null){ + final String ExpireTime = register.getString("tokenExpireTime"); + if (ExpireTime != null) { + tokenExpireTime = Long.valueOf(ExpireTime); + } + } + + // 签发token + String access_token = JwtUtil.buildToken(new JwtSubject(phone, tenantId), + tokenExpireTime, configProperties.getTokenKey()); + return success("登录成功", new LoginResult(access_token, user)); + } + + @Operation(summary = "会员注册") + @PostMapping("/register") + public ApiResult register(@RequestBody LoginParam param, HttpServletRequest request) { + final String phone = param.getPhone(); + final Integer tenantId = param.getTenantId(); + final String code = param.getCode(); + + User user = userService.getByUsername(phone, tenantId); + // 验证码校验 + String key = "code:" + param.getPhone(); + if(!code.equals(redisUtil.get(key))){ + String message = "验证码不正确"; + loginRecordService.saveAsync(phone, LoginRecord.TYPE_ERROR, message, tenantId,request); + return fail(message, null); + } + if (user == null) { + String message = "账号不存在"; + loginRecordService.saveAsync(phone, LoginRecord.TYPE_ERROR, message, tenantId,request); + return fail(message, null); + } + if (!user.getStatus().equals(0)) { + String message = "账号被冻结"; + loginRecordService.saveAsync(phone, LoginRecord.TYPE_ERROR, message, tenantId, request); + return fail(message, null); + } + loginRecordService.saveAsync(phone, LoginRecord.TYPE_LOGIN, null, tenantId, request); + + // 设置过期时间 + Long tokenExpireTime = configProperties.getTokenExpireTime(); + final JSONObject register = cacheClient.getSettingInfo("register", tenantId); + if(register != null){ + final String ExpireTime = register.getString("tokenExpireTime"); + if (ExpireTime != null) { + tokenExpireTime = Long.valueOf(ExpireTime); + } + } + + // 签发token + String access_token = JwtUtil.buildToken(new JwtSubject(phone, tenantId), + tokenExpireTime, configProperties.getTokenKey()); + return success("登录成功", new LoginResult(access_token, user)); + } +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/MenuController.java b/src/main/java/com/gxwebsoft/common/system/controller/MenuController.java new file mode 100644 index 0000000..58d2ec9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/MenuController.java @@ -0,0 +1,457 @@ +package com.gxwebsoft.common.system.controller; + +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.*; +import com.gxwebsoft.common.system.entity.*; +import com.gxwebsoft.common.system.param.MenuImportParam; +import com.gxwebsoft.common.system.param.MenuParam; +import com.gxwebsoft.common.system.param.VersionParam; +import com.gxwebsoft.common.system.service.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 菜单控制器 + * + * @author WebSoft + * @since 2018-12-24 16:10:23 + */ +@Tag(name = "菜单") +@RestController +@RequestMapping("/api/system/menu") +public class MenuController extends BaseController { + @Resource + private MenuService menuService; + @Resource + private CompanyService companyService; + @Resource + private UserService userService; + @Resource + private RoleService roleService; + @Resource + private RoleMenuService roleMenuService; + + @PreAuthorize("hasAuthority('sys:menu:list')") + @Operation(summary = "分页查询菜单") + @GetMapping("/page") + public ApiResult> page(MenuParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + return success(menuService.page(page, page.getWrapper())); + } + + @PreAuthorize("hasAuthority('sys:menu:list')") + @Operation(summary = "查询全部菜单") + @GetMapping() + public ApiResult> list(MenuParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + return success(menuService.list(page.getOrderWrapper())); + } + + @PreAuthorize("hasAuthority('sys:menu:list')") + @Operation(summary = "根据id查询菜单") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(menuService.getById(id)); + } + + @PreAuthorize("hasAuthority('sys:menu:save')") + @OperationLog + @Operation(summary = "添加菜单") + @PostMapping() + public ApiResult add(@RequestBody Menu menu) { + if (menu.getParentId() == null) { + menu.setParentId(0); + } + // 去除字符串前面的空格 + menu.setTitle(StrUtil.trimStart(menu.getTitle())); + menu.setPath(StrUtil.trimStart(menu.getPath())); + menu.setComponent(StrUtil.trimStart(menu.getComponent())); + menu.setAuthority(StrUtil.trimStart(menu.getAuthority())); + if (menuService.save(menu)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:menu:update')") + @OperationLog + @Operation(summary = "修改菜单") + @PutMapping() + public ApiResult update(@RequestBody Menu menu) { + // 去除字符串前面的空格 + menu.setTitle(StrUtil.trimStart(menu.getTitle())); + menu.setPath(StrUtil.trimStart(menu.getPath())); + menu.setComponent(StrUtil.trimStart(menu.getComponent())); + menu.setAuthority(StrUtil.trimStart(menu.getAuthority())); + if (menuService.updateById(menu)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:menu:remove')") + @OperationLog + @Operation(summary = "删除菜单") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (menuService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:menu:save')") + @OperationLog + @Operation(summary = "批量添加菜单") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List menus) { + if (menuService.saveBatch(menus)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:menu:update')") + @OperationLog + @Operation(summary = "批量修改菜单") + @PutMapping("/batch") + public ApiResult updateBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(menuService, "menu_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:menu:remove')") + @OperationLog + @Operation(summary = "批量删除菜单") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (menuService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:menu:remove')") + @Operation(summary = "删除父级以下菜单") + @DeleteMapping("/deleteParentMenu/{id}") + public ApiResult deleteParentMenu(@PathVariable("id") Integer id) { + final List list = menuService.list(new LambdaQueryWrapper().eq(Menu::getParentId, id)); + if (CollectionUtils.isEmpty(list)) { + menuService.removeById(id); + return success("删除成功"); + } + final Set ids = list.stream().map(Menu::getMenuId).collect(Collectors.toSet()); + final List list2 = menuService.list(new LambdaUpdateWrapper().in(Menu::getParentId, ids)); + final Set collect = list2.stream().map(Menu::getMenuId).collect(Collectors.toSet()); + if (!CollectionUtils.isEmpty(list2)) { + ids.addAll(collect); + final List list3 = menuService.list(new LambdaUpdateWrapper().in(Menu::getParentId, ids)); + final Set collect1 = list3.stream().map(Menu::getMenuId).collect(Collectors.toSet()); + if (!CollectionUtils.isEmpty(collect1)) { + ids.addAll(collect1); + } + ids.add(id); + if (menuService.removeByIds(ids)) { + return success("删除成功"); + } + } + ids.add(id); + if (menuService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:menu:update')") + @Operation(summary = "安装插件") + @GetMapping("/install/{id}") + public ApiResult install(@PathVariable("id") Integer id){ + if(menuService.install(id)){ + // 更新安装次数 +// final Plug plug = plugService.getOne(new LambdaQueryWrapper().eq(Plug::getMenuId, id)); +// plug.setInstalls(plug.getInstalls() + 1); +// plugService.updateById(plug); + return success("安装成功"); + } + return fail("安装失败",id); + } + + /** + * excel批量导入菜单 + */ + @PreAuthorize("hasAuthority('sys:menu:save')") + @Operation(summary = "批量导入菜单") + @Transactional(rollbackFor = {Exception.class}) + @PostMapping("/import") + public ApiResult importBatch(MultipartFile file) { + ImportParams importParams = new ImportParams(); + try { + System.out.println("=== 开始菜单导入流程 ==="); + + // 检查导入前的菜单数据 + long beforeCount = menuService.count(); + System.out.println("导入前菜单总数: " + beforeCount); + + // 检查当前未删除的菜单 + List undeletedMenus = menuService.list(new LambdaQueryWrapper().eq(Menu::getDeleted, 0)); + System.out.println("当前未删除的菜单数: " + undeletedMenus.size()); + if (!undeletedMenus.isEmpty()) { + System.out.println("未删除菜单列表:"); + for (Menu menu : undeletedMenus) { + System.out.println(" ID: " + menu.getMenuId() + ", 名称: " + menu.getTitle() + + ", 父级ID: " + menu.getParentId() + ", deleted: " + menu.getDeleted()); + } + } + + // 第一步:永久删除已标记为 deleted=1 的记录 + boolean deleteResult = menuService.remove(new LambdaQueryWrapper().eq(Menu::getDeleted, 1)); + System.out.println("已永久删除标记为deleted=1的菜单记录,结果: " + deleteResult); + + // 第二步:将现有未删除的记录(deleted=0)标记为 deleted=1 + if (!undeletedMenus.isEmpty()) { + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(Menu::getDeleted, 0); + updateWrapper.set(Menu::getDeleted, 1); + boolean updateResult = menuService.update(updateWrapper); + System.out.println("更新未删除菜单记录的结果: " + updateResult); + } + + // 检查更新后的菜单数据 + long afterCleanupCount = menuService.count(new LambdaQueryWrapper().eq(Menu::getDeleted, 0)); + System.out.println("清理后未标记删除的菜单数: " + afterCleanupCount); + + // 第三步:导入XLS文件的内容 + List list = ExcelImportUtil.importExcel(file.getInputStream(), MenuImportParam.class, importParams); + System.out.println("从Excel文件中读取到" + list.size() + "条菜单记录"); + + // 存储原始parentId到菜单列表的映射关系 + Map> menuGroups = new HashMap<>(); + // 存储原始ID到新菜单对象的映射关系(用于后续设置正确的parentId) + Map tempIdMapping = new HashMap<>(); + + // 按parentId分组(处理null值) + for (MenuImportParam param : list) { + Integer parentId = param.getParentId() != null ? param.getParentId() : 0; + menuGroups.computeIfAbsent(parentId, k -> new ArrayList<>()).add(param); + } + + System.out.println("菜单分组情况:"); + for (Map.Entry> entry : menuGroups.entrySet()) { + System.out.println(" parentId=" + entry.getKey() + " 的菜单数: " + entry.getValue().size()); + } + + // 先创建所有父级菜单(parentId为0的菜单) + List rootMenus = menuGroups.getOrDefault(0, new ArrayList<>()); + List createdRootMenus = new ArrayList<>(); + + System.out.println("开始创建" + rootMenus.size() + "个根菜单"); + for (MenuImportParam param : rootMenus) { + Menu menu = convertToMenu(param); + menu.setParentId(0); // 根菜单的parentId为0 + menuService.save(menu); + createdRootMenus.add(menu); + System.out.println("创建根菜单: " + menu.getTitle() + ", ID: " + menu.getMenuId() + ", 原始ID: " + param.getMenuId()); + + // 记录原始ID到新菜单的映射关系 + if (param.getMenuId() != null) { + tempIdMapping.put(param.getMenuId(), menu); + } + } + + // 递归创建子级菜单(注意:这里不再处理parentId=0的菜单,因为已经在上面处理过了) + System.out.println("开始创建子级菜单(跳过根菜单)"); + // 只处理非根菜单的子级菜单 + for (Map.Entry> entry : menuGroups.entrySet()) { + Integer parentId = entry.getKey(); + if (parentId != 0) { // 跳过根菜单(parentId=0) + System.out.println("处理parentId=" + parentId + "的子菜单"); + createChildMenus(menuGroups, tempIdMapping, parentId); + } + } + + // 获取所有导入的菜单ID + List allImportedMenuIds = new ArrayList<>(); + for (Menu menu : tempIdMapping.values()) { + allImportedMenuIds.add(menu.getMenuId()); + } + + System.out.println("总共导入了" + allImportedMenuIds.size() + "个菜单"); + + // 显示导入的菜单详情 + if (!allImportedMenuIds.isEmpty()) { + List allImportedMenus = menuService.list(new LambdaQueryWrapper() + .in(Menu::getMenuId, allImportedMenuIds) + .orderByAsc(Menu::getParentId, Menu::getSortNumber)); + System.out.println("导入的菜单详情:"); + for (Menu menu : allImportedMenus) { + System.out.println(" ID: " + menu.getMenuId() + ", 名称: " + menu.getTitle() + + ", 父级ID: " + menu.getParentId() + ", 类型: " + menu.getMenuType()); + } + } + + // 为超级管理员配置菜单权限 + if (!allImportedMenuIds.isEmpty()) { + List allImportedMenus = menuService.list(new LambdaQueryWrapper() + .in(Menu::getMenuId, allImportedMenuIds)); + System.out.println("为" + allImportedMenus.size() + "个菜单配置超级管理员权限"); + configureSuperAdminPermissionsForImportedMenus(allImportedMenus); + } + + // 最终检查 + long finalCount = menuService.count(); + System.out.println("导入后菜单总数: " + finalCount); + System.out.println("=== 菜单导入流程结束 ==="); + + return success("成功导入" + list.size() + "条"); + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败: " + e.getMessage()); + } + } + + /** + * 递归创建子级菜单 + * @param menuGroups 菜单分组 + * @param tempIdMapping 临时ID映射关系 + * @param originalParentId 原始父级ID + */ + private void createChildMenus(Map> menuGroups, + Map tempIdMapping, + Integer originalParentId) { + System.out.println(">>> 进入createChildMenus方法,处理originalParentId=" + originalParentId); + + // 特殊处理:originalParentId=0的情况已经在主方法中处理过了,这里不应该再处理 + if (originalParentId == 0) { + System.out.println(" 跳过originalParentId=0的处理(已在主方法中处理)"); + System.out.println("<<< 退出createChildMenus方法,处理originalParentId=" + originalParentId); + return; + } + + List childMenus = menuGroups.get(originalParentId); + if (childMenus == null || childMenus.isEmpty()) { + System.out.println(" 没有找到originalParentId=" + originalParentId + "的子菜单"); + System.out.println("<<< 退出createChildMenus方法,处理originalParentId=" + originalParentId); + return; + } + + // 获取新的父级菜单对象 + Menu parentMenu = tempIdMapping.get(originalParentId); + if (parentMenu == null) { + System.out.println(" 未找到原始ID为" + originalParentId + "的父级菜单,跳过处理"); + System.out.println("<<< 退出createChildMenus方法,处理originalParentId=" + originalParentId); + return; + } + + Integer newParentId = parentMenu.getMenuId(); + + System.out.println(" 创建父级ID为" + originalParentId + "(新ID:" + newParentId + ")的子菜单,共" + childMenus.size() + "个"); + + // 创建所有子菜单 + for (int i = 0; i < childMenus.size(); i++) { + MenuImportParam param = childMenus.get(i); + System.out.println(" 处理第" + (i+1) + "个子菜单,原始ID: " + param.getMenuId() + ", 原始ParentId: " + param.getParentId()); + + Menu menu = convertToMenu(param); + menu.setParentId(newParentId); + menuService.save(menu); + + System.out.println(" 创建子菜单: " + menu.getTitle() + ", ID: " + menu.getMenuId() + + ", 父级ID: " + menu.getParentId() + ", 原始ID: " + param.getMenuId()); + + // 记录原始ID到新菜单的映射关系 + if (param.getMenuId() != null) { + tempIdMapping.put(param.getMenuId(), menu); + } + + // 递归创建当前菜单的子级菜单(使用原始ID作为下一个递归的父级ID) + System.out.println(" 递归调用createChildMenus,处理原始ID=" + param.getMenuId() + "的子菜单"); + createChildMenus(menuGroups, tempIdMapping, param.getMenuId()); + } + + System.out.println("<<< 退出createChildMenus方法,处理originalParentId=" + originalParentId); + } + + /** + * 将MenuImportParam转换为Menu实体 + * @param param MenuImportParam对象 + * @return Menu实体 + */ + private Menu convertToMenu(MenuImportParam param) { + Menu menu = new Menu(); + menu.setParentId(param.getParentId()); + menu.setTitle(param.getTitle()); + menu.setPath(param.getPath()); + menu.setComponent(param.getComponent()); + menu.setModules(param.getModules()); + menu.setModulesUrl(param.getModulesUrl()); + menu.setMenuType(param.getMenuType()); + menu.setSortNumber(param.getSortNumber() != null ? param.getSortNumber() : 0); + menu.setAuthority(param.getAuthority()); + menu.setIcon(param.getIcon()); + menu.setHide(param.getHide()); + menu.setAppId(param.getAppId()); + menu.setTenantId(param.getTenantId()); + menu.setDeleted(0); // 新导入的数据deleted设为0 + return menu; + } + + /** + * 为超级管理员配置导入菜单的权限 + * @param importedMenus 导入的菜单列表 + */ + private void configureSuperAdminPermissionsForImportedMenus(List importedMenus) { + try { + // 1.查找当前租户的超管权限的roleId + final Role superAdmin = roleService.getOne(new LambdaQueryWrapper().eq(Role::getRoleCode, "superAdmin")); + if (superAdmin == null) { + System.out.println("未找到superAdmin角色"); + return; + } + + final Integer roleId = superAdmin.getRoleId(); + final Integer tenantId = superAdmin.getTenantId(); + + // 为所有导入的菜单配置权限 + for (Menu menu : importedMenus) { + RoleMenu roleMenu = new RoleMenu(); + roleMenu.setRoleId(roleId); + roleMenu.setMenuId(menu.getMenuId()); + roleMenu.setTenantId(tenantId); + roleMenuService.save(roleMenu); + } + + // 调整根菜单的排序(如果有根菜单的话) + for (Menu menu : importedMenus) { + if (menu.getParentId() == 0) { + menu.setSortNumber(0); + menuService.updateById(menu); + break; + } + } + + System.out.println("为超级管理员配置菜单权限成功,共配置了" + importedMenus.size() + "个菜单"); + } catch (Exception e) { + System.err.println("为超级管理员配置菜单权限失败: " + e.getMessage()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/OperationRecordController.java b/src/main/java/com/gxwebsoft/common/system/controller/OperationRecordController.java new file mode 100644 index 0000000..ec54bc4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/OperationRecordController.java @@ -0,0 +1,61 @@ +package com.gxwebsoft.common.system.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.OperationRecord; +import com.gxwebsoft.common.system.param.OperationRecordParam; +import com.gxwebsoft.common.system.service.OperationRecordService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 操作日志控制器 + * + * @author WebSoft + * @since 2018-12-24 16:10:12 + */ +@Tag(name = "操作日志") +@RestController +@RequestMapping("/api/system/operation-record") +public class OperationRecordController extends BaseController { + @Resource + private OperationRecordService operationRecordService; + + /** + * 分页查询操作日志 + */ + @PreAuthorize("hasAuthority('sys:operation-record:list')") + @Operation(summary = "分页查询操作日志") + @GetMapping("/page") + public ApiResult> page(OperationRecordParam param) { + return success(operationRecordService.pageRel(param)); + } + + /** + * 查询全部操作日志 + */ + @PreAuthorize("hasAuthority('sys:operation-record:list')") + @Operation(summary = "查询全部操作日志") + @GetMapping() + public ApiResult> list(OperationRecordParam param) { + return success(operationRecordService.listRel(param)); + } + + /** + * 根据id查询操作日志 + */ + @PreAuthorize("hasAuthority('sys:operation-record:list')") + @Operation(summary = "根据id查询操作日志") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(operationRecordService.getByIdRel(id)); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/OrganizationController.java b/src/main/java/com/gxwebsoft/common/system/controller/OrganizationController.java new file mode 100644 index 0000000..4174b04 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/OrganizationController.java @@ -0,0 +1,130 @@ +package com.gxwebsoft.common.system.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.*; +import com.gxwebsoft.common.system.entity.Organization; +import com.gxwebsoft.common.system.param.OrganizationParam; +import com.gxwebsoft.common.system.service.OrganizationService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 组织机构控制器 + * + * @author WebSoft + * @since 2020-03-14 11:29:04 + */ +@Tag(name = "组织机构管理") +@RestController +@RequestMapping("/api/system/organization") +public class OrganizationController extends BaseController { + @Resource + private OrganizationService organizationService; + + @PreAuthorize("hasAuthority('sys:org:list')") + @Operation(summary = "分页查询组织机构") + @GetMapping("/page") + public ApiResult> page(OrganizationParam param) { + return success(organizationService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('sys:org:list')") + @Operation(summary = "查询全部组织机构") + @GetMapping() + public ApiResult> list(OrganizationParam param) { + return success(organizationService.listRel(param)); + } + + @PreAuthorize("hasAuthority('sys:org:list')") + @Operation(summary = "根据id查询组织机构") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(organizationService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('sys:org:save')") + @Operation(summary = "添加组织机构") + @PostMapping() + public ApiResult add(@RequestBody Organization organization) { + if (organization.getParentId() == null) { + organization.setParentId(0); + } + if (organizationService.count(new LambdaQueryWrapper() + .eq(Organization::getOrganizationName, organization.getOrganizationName()) + .eq(Organization::getParentId, organization.getParentId())) > 0) { + return fail("机构名称已存在"); + } + if (organizationService.save(organization)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:org:update')") + @Operation(summary = "修改组织机构") + @PutMapping() + public ApiResult update(@RequestBody Organization organization) { + if (organization.getOrganizationName() != null) { + if (organization.getParentId() == null) { + organization.setParentId(0); + } + if (organizationService.count(new LambdaQueryWrapper() + .eq(Organization::getOrganizationName, organization.getOrganizationName()) + .eq(Organization::getParentId, organization.getParentId()) + .ne(Organization::getOrganizationId, organization.getOrganizationId())) > 0) { + return fail("机构名称已存在"); + } + } + if (organizationService.updateById(organization)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:org:remove')") + @Operation(summary = "删除组织机构") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (organizationService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:org:save')") + @Operation(summary = "批量添加组织机构") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List organizationList) { + if (organizationService.saveBatch(organizationList)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:org:update')") + @Operation(summary = "批量修改组织机构") + @PutMapping("/batch") + public ApiResult updateBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(organizationService, Organization::getOrganizationId)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:org:remove')") + @Operation(summary = "批量删除组织机构") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (organizationService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/PaymentController.java b/src/main/java/com/gxwebsoft/common/system/controller/PaymentController.java new file mode 100644 index 0000000..f68c414 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/PaymentController.java @@ -0,0 +1,235 @@ +package com.gxwebsoft.common.system.controller; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.utils.RequestUtil; +import com.gxwebsoft.common.core.web.*; +import com.gxwebsoft.common.core.service.PaymentCacheService; +import com.gxwebsoft.common.system.entity.Payment; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.entity.UserBalanceLog; +import com.gxwebsoft.common.system.param.PaymentParam; +import com.gxwebsoft.common.system.service.PaymentService; +import com.gxwebsoft.common.system.service.UserBalanceLogService; +import com.gxwebsoft.common.system.service.UserService; +import com.gxwebsoft.shop.entity.ShopOrder; +import com.wechat.pay.java.service.partnerpayments.jsapi.model.Transaction; +import com.wechat.pay.java.service.partnerpayments.model.TransactionAmount; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +import static com.gxwebsoft.common.core.constants.BalanceConstants.BALANCE_USE; + +/** + * 支付方式控制器 + * + * @author 科技小王子 + * @since 2024-05-11 12:39:11 + */ +@Tag(name = "支付") +@RestController +@RequestMapping("/api/system/payment") +public class PaymentController extends BaseController { + @Resource + private PaymentService paymentService; + @Resource + private UserService userService; + @Resource + private UserBalanceLogService userBalanceLogService; + @Resource + private RedisUtil redisUtil; + @Resource + private RequestUtil requestUtil; + @Resource + private PaymentCacheService paymentCacheService; + + @Operation(summary = "余额支付接口") + @PostMapping("/balancePay") + public ApiResult balancePay(@RequestBody ShopOrder order) { + System.out.println("使用余额支付 >>> 订单信息 " + order); + + // 查询购买者信息 + final User buyer = userService.getById(order.getUserId()); + + if (buyer.getBalance().compareTo(order.getPayPrice()) < 0) { + return fail("余额不足"); + } + + // 扣除余额 + final BigDecimal subtract = buyer.getBalance().subtract(order.getTotalPrice()); +// final BigDecimal multiply = subtract.multiply(new BigDecimal(100)); + buyer.setBalance(subtract); + final boolean updateUser = userService.updateUser(buyer); + + // 记录余额明细 + UserBalanceLog userBalanceLog = new UserBalanceLog(); + userBalanceLog.setUserId(buyer.getUserId()); + userBalanceLog.setScene(BALANCE_USE); + userBalanceLog.setMoney(order.getPayPrice()); + BigDecimal balance = buyer.getBalance().add(order.getPayPrice()); + userBalanceLog.setBalance(balance); + userBalanceLog.setComments(order.getMerchantName()); + userBalanceLog.setTransactionId(UUID.randomUUID().toString()); + userBalanceLog.setOrderNo(order.getOrderNo()); + final boolean save = userBalanceLogService.save(userBalanceLog); + System.out.println("save = " + save); + + // 推送微信官方支付结果(携带租户ID的POST请求) + final Transaction transaction = new Transaction(); + transaction.setOutTradeNo(order.getOrderNo()); + transaction.setTransactionId(order.getOrderNo()); + final TransactionAmount amount = new TransactionAmount(); + // 计算金额 + BigDecimal decimal = order.getTotalPrice(); + final BigDecimal multiply = decimal.multiply(new BigDecimal(100)); + // 将 BigDecimal 转换为 Integer + Integer money = multiply.intValue(); + amount.setTotal(money); + amount.setCurrency("CNY"); + transaction.setAmount(amount); + // 获取支付配置信息用于解密 - 使用缓存服务 + Payment payment = paymentCacheService.getWechatPayConfig(order.getTenantId()); + System.out.println("获取到支付配置: " + payment.getMchId()); + requestUtil.pushBalancePayNotify(transaction, payment); + + return success("支付成功",order.getOrderNo()); + } + + @Operation(summary = "选择支付方式") + @GetMapping("/select") + public ApiResult select(PaymentParam param) { + String key = "SelectPayment:".concat(getTenantId().toString()); + final String string = redisUtil.get(key); + final List paymentList = JSONObject.parseArray(string, Payment.class); + if (!CollectionUtils.isEmpty(paymentList)) { + return success(paymentList); + } + // 使用关联查询 + final List list = paymentService.list(new LambdaUpdateWrapper().eq(Payment::getStatus, true)); + if (!CollectionUtils.isEmpty(list)) { + list.forEach(d -> { + d.setApiKey(null); + d.setApiclientCert(null); + d.setApiclientKey(null); + d.setMerchantSerialNumber(null); + }); + } + redisUtil.set(key,list,1L, TimeUnit.DAYS); + return success(list); + } + + @PreAuthorize("hasAuthority('sys:payment:list')") + @Operation(summary = "分页查询支付方式") + @GetMapping("/page") + public ApiResult> page(PaymentParam param) { + // 使用关联查询 + return success(paymentService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('sys:payment:list')") + @Operation(summary = "查询全部支付方式") + @GetMapping() + public ApiResult> list(PaymentParam param) { + // 使用关联查询 + return success(paymentService.listRel(param)); + } + + @PreAuthorize("hasAuthority('sys:payment:list')") + @Operation(summary = "根据id查询支付方式") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(paymentService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('sys:payment:save')") + @OperationLog + @Operation(summary = "添加支付方式") + @PostMapping() + public ApiResult save(@RequestBody Payment payment) { + if (paymentService.count(new LambdaQueryWrapper().eq(Payment::getCode,payment.getCode())) > 0) { + return fail(payment.getName() + "已存在"); + } + if (paymentService.save(payment)) { + // 使用缓存服务统一管理缓存 + paymentCacheService.cachePaymentConfig(payment, getTenantId()); + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:payment:update')") + @OperationLog + @Operation(summary = "修改支付方式") + @PutMapping() + public ApiResult update(@RequestBody Payment payment) { + if (paymentService.updateById(payment)) { + // 使用缓存服务统一管理缓存 + paymentCacheService.cachePaymentConfig(payment, getTenantId()); + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:payment:remove')") + @OperationLog + @Operation(summary = "删除支付方式") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + final Payment payment = paymentService.getById(id); + System.out.println("payment = " + payment); + + // 使用缓存服务统一管理缓存删除 + paymentCacheService.removePaymentConfig(payment.getCode(), getTenantId()); + if (paymentService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:payment:save')") + @OperationLog + @Operation(summary = "批量添加支付方式") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (paymentService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:payment:update')") + @OperationLog + @Operation(summary = "批量修改支付方式") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(paymentService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:payment:remove')") + @OperationLog + @Operation(summary = "批量删除支付方式") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (paymentService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/PlugController.java b/src/main/java/com/gxwebsoft/common/system/controller/PlugController.java new file mode 100644 index 0000000..2429e99 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/PlugController.java @@ -0,0 +1,161 @@ +package com.gxwebsoft.common.system.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Menu; +import com.gxwebsoft.common.system.entity.Plug; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.param.PlugParam; +import com.gxwebsoft.common.system.service.MenuService; +import com.gxwebsoft.common.system.service.PlugService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 插件扩展控制器 + * + * @author 科技小王子 + * @since 2023-05-18 11:57:37 + */ +@Tag(name = "插件扩展管理") +@RestController +@RequestMapping("/api/system/plug") +public class PlugController extends BaseController { + @Resource + private PlugService plugService; + @Resource + private MenuService menuService; + + @PreAuthorize("hasAuthority('sys:plug:list')") + @Operation(summary = "分页查询插件扩展") + @GetMapping("/page") + public ApiResult> page(PlugParam param) { + // 如果不传userId,只显示审核通过的插件 + if (param.getUserId() == null) { + param.setStatus(20); + } + // 使用关联查询 + return success(plugService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('sys:plug:list')") + @Operation(summary = "查询全部插件扩展") + @GetMapping() + public ApiResult> list(PlugParam param) { + // 使用关联查询 + return success(plugService.listRel(param)); + } + + @PreAuthorize("hasAuthority('sys:plug:list')") + @Operation(summary = "根据id查询插件扩展") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(plugService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('sys:plug:save')") + @Operation(summary = "添加插件扩展") + @PostMapping() + public ApiResult save(@RequestBody Plug plug) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + plug.setUserId(loginUser.getUserId()); + } + if (plugService.save(plug)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:plug:update')") + @Operation(summary = "修改插件扩展") + @PutMapping() + public ApiResult update(@RequestBody Plug plug) { + if (plugService.updateById(plug)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:plug:remove')") + @Operation(summary = "删除插件扩展") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (plugService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:plug:save')") + @Operation(summary = "批量添加插件扩展") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (plugService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:plug:update')") + @Operation(summary = "批量修改插件扩展") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(plugService, "menu_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:plug:remove')") + @Operation(summary = "批量删除插件扩展") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (plugService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:plug:save')") + @Operation(summary = "发布插件") + @PostMapping("/plug") + public ApiResult plug(@RequestBody Plug plug){ + final Integer menuId = plug.getParentId(); + // 查重 + final long count = plugService.count(new LambdaQueryWrapper().eq(Plug::getMenuId, menuId)); + if(count > 0){ + return fail("请勿重复发布"); + } + // 准备数据 + final Menu menu = menuService.getById(menuId); + plug.setUserId(getLoginUserId()); + plug.setMenuId(menuId); + plug.setTenantId(getTenantId()); + plug.setIcon(menu.getIcon()); + plug.setPath(menu.getPath()); + plug.setComponent(menu.getComponent()); + plug.setAuthority(menu.getAuthority()); + plug.setTitle(menu.getTitle()); + plug.setMenuType(menu.getMenuType()); + plug.setMeta(menu.getMeta()); + plug.setParentId(menu.getParentId()); + plug.setHide(menu.getHide()); + plug.setSortNumber(menu.getSortNumber()); + if(plugService.save(plug)){ + return success("发布成功"); + } + return fail("发布失败"); + } +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/RedisUtilController.java b/src/main/java/com/gxwebsoft/common/system/controller/RedisUtilController.java new file mode 100644 index 0000000..3e1cac5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/RedisUtilController.java @@ -0,0 +1,77 @@ +package com.gxwebsoft.common.system.controller; + +import com.gxwebsoft.common.core.utils.CacheClient; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("/api/redis-util") +@Tag(name = "Redis缓存工具接口") +public class RedisUtilController extends BaseController { + private CacheClient cacheClient; + private final StringRedisTemplate redisTemplate; + private static final String SPLIT = ":"; + private static final String PREFIX_ENTITY_LIKE = "focus:user"; + private static final String PREFIX_USER_LIKE = "like:user"; + private static final String PREFIX_FOLLOWEE = "followee"; + private static final String PREFIX_FOLLOWER = "follower"; + + + public RedisUtilController(StringRedisTemplate redisTemplate) { + this.redisTemplate = redisTemplate; + } + + @Operation(summary = "添加关注") + @PostMapping("/addFocus") + public ApiResult addFocus(@RequestBody User user) { + final Integer userId = user.getUserId(); + redisTemplate.opsForZSet().incrementScore(getFocusKey(userId), userId.toString(), 1); + return success("关注成功"); + } + + /** + * 某个用户的关注数 + * @return like:entity:[entityId] ->set(userId) + */ + public static String getFocusKey(Integer userId) { + return PREFIX_ENTITY_LIKE + SPLIT + userId; + } + + /** + * 某个用户的赞 + * @return like:entity:[entityId] ->set(userId) + */ + public static String getEntityLikeKey(int entityType, int entityId) { + return PREFIX_ENTITY_LIKE + SPLIT + entityType + SPLIT + entityId; + } + + /** + * 某个用户的赞 + * @return like:user:[userId] ->int + */ + public static String getUserLikeKey(int userId) { + return PREFIX_USER_LIKE + SPLIT + userId; + } + + /** + * 某个用户关注的实体(键:用户Id,值:实体Id) + * @return followee:[userId:entityType] ->zSet(entityId,now) + */ + public static String getFolloweeKey(int userId, int entityType) { + return PREFIX_FOLLOWEE + SPLIT + userId + SPLIT + entityType; + } + + /** + * 某个实体拥有的粉丝(键:实体Id,值:用户Id) + * @return follower:[entityType:entityId] ->zSet(entityId,now) + */ + public static String getFollowerKey(int entityType, int entityId) { + return PREFIX_FOLLOWER + SPLIT + entityType + SPLIT + entityId; + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/RoleController.java b/src/main/java/com/gxwebsoft/common/system/controller/RoleController.java new file mode 100644 index 0000000..eece032 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/RoleController.java @@ -0,0 +1,144 @@ +package com.gxwebsoft.common.system.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Role; +import com.gxwebsoft.common.system.param.RoleParam; +import com.gxwebsoft.common.system.service.RoleService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 角色控制器 + * + * @author WebSoft + * @since 2018-12-24 16:10:02 + */ +@Tag(name = "角色管理") +@RestController +@RequestMapping("/api/system/role") +public class RoleController extends BaseController { + @Resource + private RoleService roleService; + + @PreAuthorize("hasAuthority('sys:role:list')") + @Operation(summary = "分页查询角色") + @GetMapping("/page") + public ApiResult> page(RoleParam param) { + PageParam page = new PageParam<>(param); + return success(roleService.page(page, page.getWrapper())); + } + + @PreAuthorize("hasAuthority('sys:role:list')") + @Operation(summary = "查询全部角色") + @GetMapping() + public ApiResult> list(RoleParam param) { + PageParam page = new PageParam<>(param); + return success(roleService.list(page.getOrderWrapper())); + } + + @PreAuthorize("hasAuthority('sys:role:list')") + @Operation(summary = "根据id查询角色") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(roleService.getById(id)); + } + + @PreAuthorize("hasAuthority('sys:role:save')") + @Operation(summary = "添加角色") + @PostMapping() + public ApiResult save(@RequestBody Role role) { + if (roleService.count(new LambdaQueryWrapper().eq(Role::getRoleCode, role.getRoleCode())) > 0) { + return fail("角色标识已存在"); + } + if (roleService.count(new LambdaQueryWrapper().eq(Role::getRoleName, role.getRoleName())) > 0) { + return fail("角色名称已存在"); + } + if (roleService.save(role)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:role:update')") + @Operation(summary = "修改角色") + @PutMapping() + public ApiResult update(@RequestBody Role role) { + if (role.getRoleCode() != null && roleService.count(new LambdaQueryWrapper() + .eq(Role::getRoleCode, role.getRoleCode()) + .ne(Role::getRoleId, role.getRoleId())) > 0) { + return fail("角色标识已存在"); + } + if (role.getRoleName() != null && roleService.count(new LambdaQueryWrapper() + .eq(Role::getRoleName, role.getRoleName()) + .ne(Role::getRoleId, role.getRoleId())) > 0) { + return fail("角色名称已存在"); + } + if (roleService.updateById(role)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:role:remove')") + @Operation(summary = "删除角色") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (roleService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:role:save')") + @Operation(summary = "批量添加角色") + @PostMapping("/batch") + public ApiResult> saveBatch(@RequestBody List list) { + // 校验是否重复 + if (CommonUtil.checkRepeat(list, Role::getRoleName)) { + return fail("角色名称存在重复", null); + } + if (CommonUtil.checkRepeat(list, Role::getRoleCode)) { + return fail("角色标识存在重复", null); + } + // 校验是否存在 + List codeExists = roleService.list(new LambdaQueryWrapper().in(Role::getRoleCode, + list.stream().map(Role::getRoleCode).collect(Collectors.toList()))); + if (codeExists.size() > 0) { + return fail("角色标识已存在", codeExists.stream().map(Role::getRoleCode) + .collect(Collectors.toList())).setCode(2); + } + List nameExists = roleService.list(new LambdaQueryWrapper().in(Role::getRoleName, + list.stream().map(Role::getRoleCode).collect(Collectors.toList()))); + if (nameExists.size() > 0) { + return fail("角色标识已存在", nameExists.stream().map(Role::getRoleCode) + .collect(Collectors.toList())).setCode(3); + } + if (roleService.saveBatch(list)) { + return success("添加成功", null); + } + return fail("添加失败", null); + } + + @PreAuthorize("hasAuthority('sys:role:remove')") + @Operation(summary = "批量删除角色") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (roleService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/RoleMenuController.java b/src/main/java/com/gxwebsoft/common/system/controller/RoleMenuController.java new file mode 100644 index 0000000..fdc186a --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/RoleMenuController.java @@ -0,0 +1,96 @@ +package com.gxwebsoft.common.system.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.exception.BusinessException; +import com.gxwebsoft.common.system.entity.Menu; +import com.gxwebsoft.common.system.entity.RoleMenu; +import com.gxwebsoft.common.system.service.MenuService; +import com.gxwebsoft.common.system.service.RoleMenuService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +/** + * 角色菜单控制器 + * + * @author WebSoft + * @since 2018-12-24 16:10:01 + */ +@Tag(name = "角色菜单管理") +@RestController +@RequestMapping("/api/system/role-menu") +public class RoleMenuController extends BaseController { + @Resource + private RoleMenuService roleMenuService; + @Resource + private MenuService menuService; + + @PreAuthorize("hasAuthority('sys:role:list')") + @Operation(summary = "查询角色菜单") + @GetMapping("/{id}") + public ApiResult> list(@PathVariable("id") Integer roleId) { + List menus = menuService.list(new LambdaQueryWrapper().orderByAsc(Menu::getSortNumber)); + List roleMenus = roleMenuService.list(new LambdaQueryWrapper() + .eq(RoleMenu::getRoleId, roleId)); + for (Menu menu : menus) { + menu.setChecked(roleMenus.stream().anyMatch((d) -> d.getMenuId().equals(menu.getMenuId()))); + } + return success(menus); + } + + @Transactional(rollbackFor = {Exception.class}) + @PreAuthorize("hasAuthority('sys:role:update')") + @Operation(summary = "修改角色菜单") + @PutMapping("/{id}") + public ApiResult update(@PathVariable("id") Integer roleId, @RequestBody List menuIds) { + roleMenuService.remove(new LambdaUpdateWrapper().eq(RoleMenu::getRoleId, roleId)); + if (menuIds != null && menuIds.size() > 0) { + List roleMenuList = new ArrayList<>(); + for (Integer menuId : menuIds) { + RoleMenu roleMenu = new RoleMenu(); + roleMenu.setRoleId(roleId); + roleMenu.setMenuId(menuId); + roleMenuList.add(roleMenu); + } + if (!roleMenuService.saveBatch(roleMenuList)) { + throw new BusinessException("保存失败"); + } + } + return success("保存成功"); + } + + @PreAuthorize("hasAuthority('sys:role:update')") + @Operation(summary = "添加角色菜单") + @PostMapping("/{id}") + public ApiResult addRoleAuth(@PathVariable("id") Integer roleId, @RequestBody Integer menuId) { + RoleMenu roleMenu = new RoleMenu(); + roleMenu.setRoleId(roleId); + roleMenu.setMenuId(menuId); + if (roleMenuService.save(roleMenu)) { + return success(); + } + return fail(); + } + + @PreAuthorize("hasAuthority('sys:role:update')") + @Operation(summary = "移除角色菜单") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer roleId, @RequestBody Integer menuId) { + if (roleMenuService.remove(new LambdaUpdateWrapper() + .eq(RoleMenu::getRoleId, roleId).eq(RoleMenu::getMenuId, menuId))) { + return success(); + } + return fail(); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/SettingController.java b/src/main/java/com/gxwebsoft/common/system/controller/SettingController.java new file mode 100644 index 0000000..51e670d --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/SettingController.java @@ -0,0 +1,178 @@ +package com.gxwebsoft.common.system.controller; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.web.*; +import com.gxwebsoft.common.system.entity.Setting; +import com.gxwebsoft.common.system.entity.Tenant; +import com.gxwebsoft.common.system.param.SettingParam; +import com.gxwebsoft.common.system.service.SettingService; +import com.gxwebsoft.common.system.service.TenantService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 系统设置控制器 + * + * @author WebSoft + * @since 2022-11-19 13:54:27 + */ +@Tag(name = "系统设置管理") +@RestController +@RequestMapping("/api/system/setting") +public class SettingController extends BaseController { + @Resource + private SettingService settingService; + @Resource + private TenantService tenantService; + @Resource + private RedisUtil redisUtil; + + @PreAuthorize("hasAuthority('sys:setting:save')") + @Operation(summary = "分页查询系统设置") + @GetMapping("/page") + public ApiResult> page(SettingParam param) { + // 使用关联查询 + return success(settingService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('sys:setting:save')") + @Operation(summary = "查询全部系统设置") + @GetMapping() + public ApiResult> list(SettingParam param) { + // 使用关联查询 + return success(settingService.listRel(param)); + } + + @PreAuthorize("hasAuthority('sys:setting:save')") + @Operation(summary = "根据id查询系统设置") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(settingService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('sys:setting:save')") + @Operation(summary = "添加系统设置") + @PostMapping() + public ApiResult save(@RequestBody Setting setting) { + if (settingService.save(setting)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:setting:save')") + @Operation(summary = "修改系统设置") + @PutMapping() + public ApiResult update(@RequestBody Setting setting) { + if (settingService.updateById(setting)) { + // 更新系统设置信息到缓存 + String key = "setting:" + setting.getSettingKey() + ":" + getTenantId(); + System.out.println("key = " + key); + redisUtil.set(key, JSON.parseObject(setting.getContent())); + // 创建微信支付Bean +// settingService.initConfig(setting); + // 更新租户信息 + if (setting.getSettingKey().equals("setting")) { + System.out.println("修改系统设置 = " + setting.getContent()); + final String content = setting.getContent(); + final JSONObject jsonObject = JSONObject.parseObject(content); + final String siteName = jsonObject.getString("siteName"); + final String logo = jsonObject.getString("logo"); + System.out.println("siteName = " + siteName); + final Tenant tenant = new Tenant(); + tenant.setTenantName(siteName); + tenant.setTenantId(getTenantId()); + tenant.setLogo(logo); + tenantService.updateById(tenant); + } + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:setting:remove')") + @Operation(summary = "删除系统设置") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (settingService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:setting:save')") + @Operation(summary = "批量添加系统设置") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (settingService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:setting:update')") + @Operation(summary = "批量修改系统设置") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(settingService, "setting_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:setting:remove')") + @Operation(summary = "批量删除系统设置") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (settingService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:setting:data')") + @Operation(summary = "查询租户设置信息") + @GetMapping("/data") + public ApiResult data() { + return success(settingService.getData("setting")); + } + + @PreAuthorize("hasAuthority('sys:setting:save')") + @Operation(summary = "更新主题皮肤") + @PutMapping("/theme") + public ApiResult theme(@RequestBody Setting setting) { + String key = "theme:".concat(getTenantId().toString()); + // 新增 + final Setting one = settingService.getOne(new LambdaQueryWrapper().eq(Setting::getSettingKey, setting.getSettingKey())); + if(one == null){ + settingService.save(setting); + redisUtil.set(key,setting.getContent()); + return success("保存成功"); + } + // 更新 + final Setting update = settingService.getOne(new LambdaQueryWrapper().eq(Setting::getSettingKey, setting.getSettingKey())); + update.setContent(setting.getContent()); + if (settingService.updateById(update)) { + redisUtil.set(key,setting.getContent()); + return success("更新成功"); + } + return fail("更新失败"); + } + + @Operation(summary = "更新主题皮肤") + @GetMapping("/getTheme") + public ApiResult getTheme() { + String key = "theme:".concat(getTenantId().toString()); + return success("获取成功",redisUtil.get(key)); + } +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/TenantController.java b/src/main/java/com/gxwebsoft/common/system/controller/TenantController.java new file mode 100644 index 0000000..4114e04 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/TenantController.java @@ -0,0 +1,158 @@ +package com.gxwebsoft.common.system.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.gxwebsoft.common.core.exception.BusinessException; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.Menu; +import com.gxwebsoft.common.system.entity.RoleMenu; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.service.MenuService; +import com.gxwebsoft.common.system.service.RoleMenuService; +import com.gxwebsoft.common.system.service.TenantService; +import com.gxwebsoft.common.system.entity.Tenant; +import com.gxwebsoft.common.system.param.TenantParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 租户控制器 + * + * @author 科技小王子 + * @since 2023-07-17 17:49:53 + */ +@Tag(name = "租户管理") +@RestController +@RequestMapping("/api/system/tenant") +public class TenantController extends BaseController { + @Resource + private TenantService tenantService; + @Resource + private MenuService menuService; + @Resource + private RoleMenuService roleMenuService; + + @PreAuthorize("hasAuthority('sys:tenant:list')") + @Operation(summary = "分页查询租户") + @GetMapping("/page") + public ApiResult> page(TenantParam param) { + // 使用关联查询 + return success(tenantService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('sys:tenant:list')") + @Operation(summary = "查询全部租户") + @GetMapping() + public ApiResult> list(TenantParam param) { + // 使用关联查询 + return success(tenantService.listRel(param)); + } + + @PreAuthorize("hasAuthority('sys:tenant:list')") + @Operation(summary = "根据id查询租户") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(tenantService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('sys:tenant:save')") + @Operation(summary = "添加租户") + @PostMapping() + public ApiResult save(@RequestBody Tenant tenant) { + System.out.println("tenant = " + tenant); + if (tenantService.save(tenant)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:tenant:update')") + @Operation(summary = "修改租户") + @PutMapping() + public ApiResult update(@RequestBody Tenant tenant) { + if (tenantService.updateById(tenant)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:tenant:remove')") + @Operation(summary = "删除租户") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (tenantService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:tenant:save')") + @Operation(summary = "批量添加租户") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (tenantService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:tenant:update')") + @Operation(summary = "批量修改租户") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(tenantService, "tenant_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:tenant:remove')") + @Operation(summary = "批量删除租户") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (tenantService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "租户角色权限初始化") + @GetMapping("/role-menu/{id}") + public ApiResult> initialization(@PathVariable("id") Integer roleId) { + List menus = menuService.list(new LambdaQueryWrapper().orderByAsc(Menu::getSortNumber)); + List roleMenus = roleMenuService.list(new LambdaQueryWrapper() + .eq(RoleMenu::getRoleId, roleId)); + for (Menu menu : menus) { + menu.setChecked(roleMenus.stream().anyMatch((d) -> d.getMenuId().equals(menu.getMenuId()))); + } + List menuIds = menus.stream().map(Menu::getMenuId).collect(Collectors.toList()); + roleMenuService.remove(new LambdaUpdateWrapper().eq(RoleMenu::getRoleId, roleId)); + if (menuIds.size() > 0) { + List roleMenuList = new ArrayList<>(); + for (Integer menuId : menuIds) { + RoleMenu roleMenu = new RoleMenu(); + roleMenu.setRoleId(roleId); + roleMenu.setMenuId(menuId); + roleMenuList.add(roleMenu); + } + if (!roleMenuService.saveBatch(roleMenuList)) { + throw new BusinessException("保存失败"); + } + } + return success(menus); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/UserCollectionController.java b/src/main/java/com/gxwebsoft/common/system/controller/UserCollectionController.java new file mode 100644 index 0000000..0585272 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/UserCollectionController.java @@ -0,0 +1,135 @@ +package com.gxwebsoft.common.system.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.entity.UserCollection; +import com.gxwebsoft.common.system.param.UserCollectionParam; +import com.gxwebsoft.common.system.service.UserCollectionService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 我的收藏控制器 + * + * @author 科技小王子 + * @since 2024-04-28 18:08:32 + */ +@Tag(name = "用户收藏") +@RestController +@RequestMapping("/api/system/user-collection") +public class UserCollectionController extends BaseController { + @Resource + private UserCollectionService userCollectionService; + + @PreAuthorize("hasAuthority('sys:userCollection:list')") + @Operation(summary = "分页查询我的收藏") + @GetMapping("/page") + public ApiResult> page(UserCollectionParam param) { + // 使用关联查询 + return success(userCollectionService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('sys:userCollection:list')") + @Operation(summary = "查询全部我的收藏") + @GetMapping() + public ApiResult> list(UserCollectionParam param) { + // 使用关联查询 + return success(userCollectionService.listRel(param)); + } + + @PreAuthorize("hasAuthority('sys:userCollection:list')") + @Operation(summary = "根据id查询我的收藏") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(userCollectionService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('sys:userCollection:save')") + @OperationLog + @Operation(summary = "添加和取消收藏") + @PostMapping() + public ApiResult save(@RequestBody UserCollection userCollection) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + userCollection.setUserId(loginUser.getUserId()); + userCollection.setTid(userCollection.getTid()); + final UserCollection one = userCollectionService.getOne(new LambdaQueryWrapper().eq(UserCollection::getUserId, loginUser.getUserId()).eq(UserCollection::getTid, userCollection.getTid()).last("limit 1")); + if (one != null) { + userCollectionService.removeById(one.getId()); + return success("已取消收藏"); + } + if (userCollectionService.save(userCollection)) { + return success("已添加收藏"); + } + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:userCollection:update')") + @OperationLog + @Operation(summary = "修改我的收藏") + @PutMapping() + public ApiResult update(@RequestBody UserCollection userCollection) { + if (userCollectionService.updateById(userCollection)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:userCollection:remove')") + @OperationLog + @Operation(summary = "删除我的收藏") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (userCollectionService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:userCollection:save')") + @OperationLog + @Operation(summary = "批量添加我的收藏") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (userCollectionService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:userCollection:update')") + @OperationLog + @Operation(summary = "批量修改我的收藏") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(userCollectionService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:userCollection:remove')") + @OperationLog + @Operation(summary = "批量删除我的收藏") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (userCollectionService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/UserController.java b/src/main/java/com/gxwebsoft/common/system/controller/UserController.java new file mode 100644 index 0000000..19b99bc --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/UserController.java @@ -0,0 +1,401 @@ +package com.gxwebsoft.common.system.controller; + +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.web.*; +import com.gxwebsoft.common.system.entity.*; +import com.gxwebsoft.common.system.param.UserImportParam; +import com.gxwebsoft.common.system.param.UserParam; +import com.gxwebsoft.common.system.service.DictionaryDataService; +import com.gxwebsoft.common.system.service.OrganizationService; +import com.gxwebsoft.common.system.service.RoleService; +import com.gxwebsoft.common.system.service.UserService; +import io.swagger.v3.oas.annotations.tags.Tag; + +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 用户控制器 + * + * @author WebSoft + * @since 2018-12-24 16:10:41 + */ +@Tag(name = "用户管理") +@RestController +@RequestMapping("/api/system/user") +public class UserController extends BaseController { + @Resource + private UserService userService; + @Resource + private RoleService roleService; + @Resource + private OrganizationService organizationService; + @Resource + private DictionaryDataService dictionaryDataService; + + @PreAuthorize("hasAuthority('sys:auth:user')") + @Operation(summary = "分页查询用户") + @GetMapping("/page") + public ApiResult> page(UserParam param) { + return success(userService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('sys:auth:user')") + @Operation(summary = "分页查询用户") + @GetMapping("/pageAdminByPhone") + public ApiResult> pageAdminByPhone(UserParam param) { + return success(userService.pageAdminByPhone(param)); + } + + @PreAuthorize("hasAuthority('sys:auth:user')") + @Operation(summary = "查询全部用户") + @GetMapping() + public ApiResult> list(UserParam param) { + return success(userService.listRel(param)); + } + + @PreAuthorize("hasAuthority('sys:auth:user')") + @Operation(summary = "根据id查询用户") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(userService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('sys:auth:user')") + @Operation(summary = "根据手机号码查询用户") + @GetMapping("/getByPhone/{phone}") + public ApiResult getByPhone(@PathVariable("phone") String phone) { + return success(userService.getByPhone(phone)); + } + + @PreAuthorize("hasAuthority('sys:user:save')") + @Operation(summary = "添加用户") + @PostMapping() + public ApiResult add(@RequestBody User user) { + user.setStatus(0); + user.setPassword(userService.encodePassword(user.getPassword())); + if (userService.saveUser(user)) { + return success("添加成功",user.getUserId()); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:user:save')") + @Operation(summary = "批量添加用户") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List userList) { + userList.forEach(d -> { + d.setStatus(0); + if (d.getPassword() != null) { + d.setPassword(userService.encodePassword(d.getPassword())); + } + }); + if (userService.saveBatch(userList)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:user:save')") + @Operation(summary = "批量添加用户并返回userId") + @PostMapping("/batchBackUserId") + public ApiResult saveBatchBackUserId(@RequestBody List userList) { + userList.forEach(d -> { + d.setStatus(0); + d.setPassword(userService.encodePassword(d.getPassword())); + }); + final Set phones = userList.stream().map(User::getPhone).collect(Collectors.toSet()); + if (userService.saveBatch(userList)) { + final UserParam userParam = new UserParam(); + userParam.setPhones(phones); + userParam.setLimit(500L); + final PageResult result = userService.pageRel(userParam); + final Set collect = result.getList().stream().map(User::getUserId).collect(Collectors.toSet()); + return success("添加成功",collect); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:user:update')") + @OperationLog + @Operation(summary = "修改用户") + @PutMapping() + public ApiResult update(@RequestBody User user) { + user.setStatus(null); + user.setUsername(null); + user.setPassword(null); + if (userService.updateUser(user)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:user:remove')") + @OperationLog + @Operation(summary = "删除用户") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (userService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:user:update')") + @OperationLog + @Operation(summary = "批量修改用户") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(userService, User::getUserId)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:user:remove')") + @OperationLog + @Operation(summary = "批量删除用户") + @Transactional(rollbackFor = {Exception.class}) + @DeleteMapping("/batch") + public ApiResult deleteBatch(@RequestBody List ids) { + if (userService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:user:update')") + @OperationLog + @Operation(summary = "修改用户状态") + @PutMapping("/status") + public ApiResult updateStatus(@RequestBody User user) { + if (user.getUserId() == null || user.getStatus() == null || !Arrays.asList(0, 1).contains(user.getStatus())) { + return fail("参数不正确"); + } + User u = new User(); + u.setUserId(user.getUserId()); + u.setStatus(user.getStatus()); + if (userService.updateById(u)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:user:update')") + @OperationLog + @Operation(summary = "修改推荐状态") + @PutMapping("/recommend") + public ApiResult updateRecommend(@RequestBody User user) { + if (user.getUserId() == null || user.getRecommend() == null || !Arrays.asList(0, 1).contains(user.getRecommend())) { + return fail("参数不正确"); + } + User u = new User(); + u.setUserId(user.getUserId()); + u.setRecommend(user.getRecommend()); + if (userService.updateById(u)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:user:update')") + @OperationLog + @Operation(summary = "批量修改用户状态") + @PutMapping("/status/batch") + public ApiResult updateStatusBatch(@RequestBody BatchParam batchParam) { + if (!Arrays.asList(0, 1).contains(batchParam.getData())) { + return fail("状态值不正确"); + } + if (userService.update(new LambdaUpdateWrapper() + .in(User::getUserId, batchParam.getIds()) + .set(User::getStatus, batchParam.getData()))) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:user:update')") + @OperationLog + @Operation(summary = "重置密码") + @PutMapping("/password") + public ApiResult resetPassword(@RequestBody User user) { + if (user.getUserId() == null || StrUtil.isBlank(user.getPassword())) { + return fail("参数不正确"); + } + User u = new User(); + u.setUserId(user.getUserId()); + u.setPassword(userService.encodePassword(user.getPassword())); + if (userService.updateById(u)) { + return success("重置成功"); + } else { + return fail("重置失败"); + } + } + + @PreAuthorize("hasAuthority('sys:user:update')") + @OperationLog + @Operation(summary = "批量重置密码") + @PutMapping("/password/batch") + public ApiResult resetPasswordBatch(@RequestBody BatchParam batchParam) { + if (batchParam.getIds() == null || batchParam.getIds().size() == 0) { + return fail("请选择用户"); + } + if (batchParam.getData() == null) { + return fail("请输入密码"); + } + if (userService.update(new LambdaUpdateWrapper() + .in(User::getUserId, batchParam.getIds()) + .set(User::getPassword, userService.encodePassword(batchParam.getData())))) { + return success("重置成功"); + } else { + return fail("重置失败"); + } + } + + @Operation(summary = "检查用户是否存在") + @GetMapping("/existence") + public ApiResult existence(ExistenceParam param) { + if (param.isExistence(userService, User::getUserId)) { + return success(param.getValue() + "已存在"); + } + return fail(param.getValue() + "不存在"); + } + + /** + * excel导入用户 + */ + @PreAuthorize("hasAuthority('sys:user:save')") + @Operation(summary = "导入用户") + @Transactional(rollbackFor = {Exception.class}) + @PostMapping("/import") + public ApiResult> importBatch(MultipartFile file) { + ImportParams importParams = new ImportParams(); + try { + List list = ExcelImportUtil.importExcel(file.getInputStream(), + UserImportParam.class, importParams); + // 校验是否重复 + if (CommonUtil.checkRepeat(list, UserImportParam::getUsername)) { + return fail("账号存在重复", null); + } + if (CommonUtil.checkRepeat(list, UserImportParam::getPhone)) { + return fail("手机号存在重复", null); + } + // 校验是否存在 + List usernameExists = userService.list(new LambdaQueryWrapper().in(User::getUsername, + list.stream().map(UserImportParam::getUsername).collect(Collectors.toList()))); + if (usernameExists.size() > 0) { + return fail("账号已经存在", + usernameExists.stream().map(User::getUsername).collect(Collectors.toList())); + } + List phoneExists = userService.list(new LambdaQueryWrapper().in(User::getPhone, + list.stream().map(UserImportParam::getPhone).collect(Collectors.toList()))); + if (phoneExists.size() > 0) { + return fail("手机号已经存在", + phoneExists.stream().map(User::getPhone).collect(Collectors.toList())); + } + // 添加 + List users = new ArrayList<>(); + for (UserImportParam one : list) { + User u = new User(); + u.setStatus(0); + u.setUsername(one.getUsername()); + u.setPassword(userService.encodePassword(one.getPassword())); + u.setNickname(one.getNickname()); + u.setPhone(one.getPhone()); + Role role = roleService.getOne(new QueryWrapper() + .eq("role_name", one.getRoleName()), false); + if (role == null) { + return fail("角色不存在", Collections.singletonList(one.getRoleName())); + } else { + u.setRoles(Collections.singletonList(role)); + } + Organization organization = organizationService.getOne(new QueryWrapper() + .eq("organization_full_name", one.getOrganizationName()), false); + if (organization == null) { + return fail("机构不存在", Collections.singletonList(one.getOrganizationName())); + } else { + u.setOrganizationId(organization.getOrganizationId()); + } + DictionaryData sex = dictionaryDataService.getByDictCodeAndName("sex", one.getSexName()); + if (sex == null) { + return fail("性别不存在", Collections.singletonList(one.getSexName())); + } else { + u.setSex(sex.getDictDataCode()); + } + } + if (userService.saveBatch(users)) { + return success("导入成功", null); + } + } catch (Exception e) { + e.printStackTrace(); + } + return fail("导入失败", null); + } + + @PreAuthorize("hasAuthority('sys:auth:user')") + @PostMapping("/getAvatarByMpWx") + @Operation(summary = "更新微信头像") + public ApiResult getAvatarByMpWx(@RequestBody User user){ + user.setAvatar("https://oa.gxwebsoft.com/assets/logo.7ccfefb9.svg"); + if (userService.updateUser(user)) { + return success("更新成功"); + } + return fail("更新失败"); + } + + @PostMapping("/updatePointsBySign") + @Operation(summary = "签到成功累加积分") + public ApiResult updatePointsBySign(){ + final User loginUser = getLoginUser(); + loginUser.setPoints(loginUser.getPoints() + 1); + if (userService.updateUser(loginUser)) { + return success("签到成功"); + } + return fail("签到失败"); + } + + @PreAuthorize("hasAuthority('sys:auth:user')") + @PutMapping("/updateUserBalance") + @Operation(summary = "更新用户余额") + public ApiResult updateUserBalance(@RequestBody User user){ + if (getLoginUser() == null) { + return fail("请先登录"); + } + if (userService.updateUser(user)) { + return success("操作成功"); + } + return fail("操作失败"); + } + + @PreAuthorize("hasAuthority('sys:user:list')") + @OperationLog + @Operation(summary = "统计用户余额") + @GetMapping("/countUserBalance") + public ApiResult countUserBalance(User param) { + final LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.gt(User::getBalance, 0); + if (!param.getOrganizationId().equals(0)) { + wrapper.eq(User::getOrganizationId,param.getOrganizationId()); + } + final List list = userService.list(wrapper); + final BigDecimal totalBalance = list.stream().map(User::getBalance).reduce(BigDecimal.ZERO, BigDecimal::add); + // System.out.println("统计用户余额 = " + totalBalance); + return success("统计成功",totalBalance); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/UserFileController.java b/src/main/java/com/gxwebsoft/common/system/controller/UserFileController.java new file mode 100644 index 0000000..b56214d --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/UserFileController.java @@ -0,0 +1,158 @@ +package com.gxwebsoft.common.system.controller; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.gxwebsoft.common.core.utils.FileServerUtil; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.service.UserFileService; +import com.gxwebsoft.common.system.entity.UserFile; +import com.gxwebsoft.common.system.param.UserFileParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 用户文件控制器 + * + * @author WebSoft + * @since 2022-07-21 14:34:40 + */ +@Tag(name = "用户文件管理") +@RestController +@RequestMapping("/api/system/user-file") +public class UserFileController extends BaseController { + @Resource + private UserFileService userFileService; + + @Operation(summary = "分页查询用户文件") + @GetMapping("/page") + public ApiResult> page(UserFileParam param, HttpServletRequest request) { + param.setUserId(getLoginUserId()); + PageParam page = new PageParam<>(param); + page.setDefaultOrder("is_directory desc"); + PageParam result = userFileService.page(page, page.getWrapper()); + List records = result.getRecords(); + String requestURL = StrUtil.removeSuffix(request.getRequestURL(), "/system/user-file") + "/file"; + for (UserFile record : records) { + if (StrUtil.isNotBlank(record.getPath())) { + record.setUrl(requestURL + "/" + record.getPath()); + if (FileServerUtil.isImage(record.getContentType())) { + record.setThumbnail(requestURL + "/thumbnail/" + record.getPath()); + } + record.setDownloadUrl(requestURL + "/download/" + record.getPath()); + } + } + return success(records, result.getTotal()); + } + + @Operation(summary = "查询全部用户文件") + @GetMapping() + public ApiResult> list(UserFileParam param, HttpServletRequest request) { + param.setUserId(getLoginUserId()); + PageParam page = new PageParam<>(param); + page.setDefaultOrder("is_directory desc"); + List records = userFileService.list(page.getOrderWrapper()); + String requestURL = StrUtil.removeSuffix(request.getRequestURL(), "/system/user-file") + "/file"; + for (UserFile record : records) { + if (StrUtil.isNotBlank(record.getPath())) { + record.setUrl(requestURL + "/" + record.getPath()); + if (FileServerUtil.isImage(record.getContentType())) { + record.setThumbnail(requestURL + "/thumbnail/" + record.getPath()); + } + record.setDownloadUrl(requestURL + "/download/" + record.getPath()); + } + } + return success(records); + } + + @PreAuthorize("hasAuthority('sys:auth:user')") + @Operation(summary = "添加用户文件") + @PostMapping() + public ApiResult save(@RequestBody UserFile userFile) { + userFile.setUserId(getLoginUserId()); + if (userFile.getParentId() == null) { + userFile.setParentId(0); + } + if (userFile.getIsDirectory() != null && userFile.getIsDirectory().equals(1)) { + if (userFileService.count(new LambdaQueryWrapper() + .eq(UserFile::getName, userFile.getName()) + .eq(UserFile::getParentId, userFile.getParentId()) + .eq(UserFile::getUserId, userFile.getUserId())) > 0) { + return fail("文件夹名称已存在"); + } + } + if (userFileService.save(userFile)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:auth:user')") + @Operation(summary = "修改用户文件") + @PutMapping() + public ApiResult update(@RequestBody UserFile userFile) { + Integer loginUserId = getLoginUserId(); + UserFile old = userFileService.getById(userFile.getId()); + UserFile entity = new UserFile(); + if (StrUtil.isNotBlank(userFile.getName())) { + entity.setName(userFile.getName()); + } + if (userFile.getParentId() != null) { + entity.setParentId(userFile.getParentId()); + } + if (!old.getUserId().equals(loginUserId) || + (entity.getName() == null && entity.getParentId() == null)) { + return fail("修改失败"); + } + if (old.getIsDirectory() != null && old.getIsDirectory().equals(1)) { + if (userFileService.count(new LambdaQueryWrapper() + .eq(UserFile::getName, entity.getName() == null ? old.getName() : entity.getName()) + .eq(UserFile::getParentId, entity.getParentId() == null ? old.getParentId() : entity.getParentId()) + .eq(UserFile::getUserId, loginUserId) + .ne(UserFile::getId, old.getId())) > 0) { + return fail("文件夹名称已存在"); + } + } + if (userFileService.update(entity, new LambdaUpdateWrapper() + .eq(UserFile::getId, userFile.getId()) + .eq(UserFile::getUserId, loginUserId))) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:auth:user')") + @Operation(summary = "删除用户文件") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (userFileService.remove(new LambdaUpdateWrapper() + .eq(UserFile::getId, id) + .eq(UserFile::getUserId, getLoginUserId()))) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:auth:user')") + @Operation(summary = "批量删除用户文件") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (userFileService.remove(new LambdaUpdateWrapper() + .in(UserFile::getId, ids) + .eq(UserFile::getUserId, getLoginUserId()))) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/UserRefereeController.java b/src/main/java/com/gxwebsoft/common/system/controller/UserRefereeController.java new file mode 100644 index 0000000..6cd1463 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/UserRefereeController.java @@ -0,0 +1,183 @@ +package com.gxwebsoft.common.system.controller; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.entity.UserReferee; +import com.gxwebsoft.common.system.param.UserRefereeParam; +import com.gxwebsoft.common.system.service.UserRefereeService; +import com.gxwebsoft.common.system.service.UserService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 用户推荐关系表控制器 + * + * @author 科技小王子 + * @since 2023-10-07 22:56:36 + */ +@Tag(name = "用户") +@RestController +@RequestMapping("/api/system/user-referee") +public class UserRefereeController extends BaseController { + @Resource + private UserRefereeService userRefereeService; + @Resource + private UserService userService; + + @PreAuthorize("hasAuthority('sys:userReferee:list')") + @OperationLog + @Operation(summary = "分页查询用户推荐关系表") + @GetMapping("/page") + public ApiResult> page(UserRefereeParam param) { + // 使用关联查询 + return success(userRefereeService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('sys:userReferee:list')") + @OperationLog + @Operation(summary = "查询全部用户推荐关系表") + @GetMapping() + public ApiResult> list(UserRefereeParam param) { + // 使用关联查询 + return success(userRefereeService.listRel(param)); + } + + @PreAuthorize("hasAuthority('sys:userReferee:list')") + @OperationLog + @Operation(summary = "根据id查询用户推荐关系表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(userRefereeService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('sys:userReferee:save')") + @OperationLog + @Operation(summary = "添加用户推荐关系表") + @PostMapping() + public ApiResult save(@RequestBody UserReferee userReferee) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + userReferee.setUserId(loginUser.getUserId()); + } + if (userRefereeService.save(userReferee)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:userReferee:update')") + @OperationLog + @Operation(summary = "修改用户推荐关系表") + @PutMapping() + public ApiResult update(@RequestBody UserReferee userReferee) { + if (userRefereeService.updateById(userReferee)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:userReferee:remove')") + @OperationLog + @Operation(summary = "删除用户推荐关系表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (userRefereeService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('sys:userReferee:save')") + @OperationLog + @Operation(summary = "批量添加用户推荐关系表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (userRefereeService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('sys:userReferee:update')") + @OperationLog + @Operation(summary = "批量修改用户推荐关系表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(userRefereeService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:userReferee:remove')") + @OperationLog + @Operation(summary = "批量删除用户推荐关系表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (userRefereeService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "查询推荐人信息") + @GetMapping("/getReferee/{id}") + public ApiResult getReferee(@PathVariable("id") Integer id) { + if (id == null) { + return fail("参数错误", null); + } + + final UserReferee referee = userRefereeService.getOne(new LambdaQueryWrapper() + .eq(UserReferee::getUserId, id) + .eq(UserReferee::getDeleted, 0)); + + if (ObjectUtil.isEmpty(referee)) { + return fail("查询失败", null); + } + + final User user = userService.getByIdRel(referee.getDealerId()); + if (ObjectUtil.isNotEmpty(user)) { + return success(user); + } + return fail("查询失败", null); + } + + @Operation(summary = "查询推荐人列表") + @GetMapping("/getRefereeList/{id}") + public ApiResult> getRefereeList(@PathVariable("id") Integer id) { + if (id == null) { + return fail("参数错误", null); + } + + final List refereeList = userRefereeService.list(new LambdaQueryWrapper() + .eq(UserReferee::getDealerId, id) + .eq(UserReferee::getDeleted, 0)); + + if (ObjectUtil.isEmpty(refereeList)) { + return fail("查询失败", null); + } + + final List users = userService.list( + new LambdaQueryWrapper() + .in(User::getUserId, refereeList.stream().map(UserReferee::getUserId).toList()) + ); + if (ObjectUtil.isNotEmpty(users)) { + return success(users); + } + return fail("查询失败", null); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/controller/WxLoginController.java b/src/main/java/com/gxwebsoft/common/system/controller/WxLoginController.java new file mode 100644 index 0000000..9ed476a --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/controller/WxLoginController.java @@ -0,0 +1,833 @@ +package com.gxwebsoft.common.system.controller; + +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.gxwebsoft.cms.entity.CmsWebsite; +import com.gxwebsoft.cms.service.CmsWebsiteService; +import com.gxwebsoft.common.core.config.ConfigProperties; +import com.gxwebsoft.common.core.exception.BusinessException; +import com.gxwebsoft.common.core.security.JwtSubject; +import com.gxwebsoft.common.core.security.JwtUtil; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.utils.RequestUtil; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.*; +import com.gxwebsoft.common.system.param.UserParam; +import com.gxwebsoft.common.system.result.LoginResult; +import com.gxwebsoft.common.system.service.*; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import okhttp3.*; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.RequestBody; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.time.Instant; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeUnit; + +import static com.gxwebsoft.common.core.constants.PlatformConstants.MP_WEIXIN; +import static com.gxwebsoft.common.core.constants.RedisConstants.ACCESS_TOKEN_KEY; +import static com.gxwebsoft.common.core.constants.RedisConstants.MP_WX_KEY; + +@RestController +@RequestMapping("/api/wx-login") +@Tag(name = "微信小程序登录API") +public class WxLoginController extends BaseController { + private final StringRedisTemplate redisTemplate; + private final OkHttpClient http = new OkHttpClient(); + private final ObjectMapper om; + private volatile long tokenExpireEpoch = 0L; // 过期的 epoch 秒 + @Resource + private SettingService settingService; + @Resource + private UserService userService; + @Resource + private ConfigProperties configProperties; + @Resource + private UserRoleService userRoleService; + @Resource + private LoginRecordService loginRecordService; + @Resource + private RoleService roleService; + @Resource + private RedisUtil redisUtil; + @Resource + private RequestUtil requestUtil; + @Resource + private ConfigProperties config; + @Resource + private UserRefereeService userRefereeService; + @Resource + private CmsWebsiteService cmsWebsiteService; + + + public WxLoginController(StringRedisTemplate redisTemplate, ObjectMapper objectMapper) { + this.redisTemplate = redisTemplate; + this.om = objectMapper; + } + + @Operation(summary = "获取微信AccessToken") + @Transactional(rollbackFor = {Exception.class}) + @PostMapping("/getAccessToken") + public ApiResult getMpAccessToken() { + return success("操作成功", getAccessToken()); + } + + @Operation(summary = "获取微信openId") + @Transactional(rollbackFor = {Exception.class}) + @PostMapping("/getOpenId") + public ApiResult getOpenId(@RequestBody UserParam userParam, HttpServletRequest request) { + // 1.获取openid + JSONObject result = getOpenIdByCode(userParam); + String openid = result.getString("openid"); + String unionid = result.getString("unionid"); + if (openid == null) { + return fail("获取openid失败", null); + } + // 2.通过openid查询用户是否已存在 + User user = userService.getByOauthId(userParam); + // 3.存在则签发token并返回登录成功,不存在则注册新用户 + if (user == null) { + user = addUser(userParam); + } + // 4.签发token + loginRecordService.saveAsync(user.getUsername(), LoginRecord.TYPE_LOGIN, null, user.getTenantId(), request); + String access_token = JwtUtil.buildToken(new JwtSubject(user.getUsername(), user.getTenantId()), + configProperties.getTokenExpireTime(), configProperties.getTokenKey()); + return success("登录成功", new LoginResult(access_token, user)); + } + + @Operation(summary = "微信授权手机号码并登录") + @Transactional(rollbackFor = {Exception.class}) + @PostMapping("/loginByMpWxPhone") + public ApiResult loginByMpWxPhone(@RequestBody UserParam userParam, HttpServletRequest request) { + // 获取手机号码 + String phone = getPhoneByCode(userParam); + if (phone == null) { + String key = ACCESS_TOKEN_KEY.concat(":").concat(getTenantId().toString()); + redisTemplate.delete(key); + throw new BusinessException("授权失败,请重试"); + } + // 查询是否存在 + User user = userService.getByPhone(phone); + // 不存在则注册 + if (user == null) { + if ((userParam.getOpenid() == null || userParam.getOpenid().isEmpty()) && userParam.getAuthCode() != null) { + UserParam userParam2 = new UserParam(); + userParam2.setCode(userParam.getAuthCode()); + JSONObject result = getOpenIdByCode(userParam2); + String openid = result.getString("openid"); +// String unionid = result.getString("unionid"); + userParam.setOpenid(openid); + } + userParam.setPhone(phone); + user = addUser(userParam); + user.setRecommend(1); + } else { + // 存在则检查绑定上级 + if (userParam.getSceneType() != null && userParam.getSceneType().equals("save_referee") && userParam.getRefereeId() != null && userParam.getRefereeId() != 0) { + UserReferee check = userRefereeService.check(user.getUserId(), userParam.getRefereeId()); + if (check == null) { + UserReferee userReferee = new UserReferee(); + userReferee.setDealerId(userParam.getRefereeId()); + userReferee.setUserId(user.getUserId()); + userRefereeService.save(userReferee); + } + } + } + // 签发token + String access_token = JwtUtil.buildToken(new JwtSubject(user.getUsername(), user.getTenantId()), + configProperties.getTokenExpireTime(), configProperties.getTokenKey()); + loginRecordService.saveAsync(user.getUsername(), LoginRecord.TYPE_REGISTER, null, user.getTenantId(), request); + // 附加体育中心项目用户信息 +// user.setBookingUser(); + return success("登录成功", new LoginResult(access_token, user)); + } + + @Operation(summary = "微信授权手机号码并更新") + @Transactional(rollbackFor = {Exception.class}) + @PostMapping("/updatePhoneByMpWx") + public ApiResult updatePhoneByMpWx(@RequestBody UserParam userParam) { + // 获取微信授权手机号 + String phone = getPhoneByCode(userParam); + // 查询当前用户 + User user = userService.getById(userParam.getUserId()); + if (user != null && phone != null) { + user.setPhone(phone); + userService.updateUser(user); + return success("更新成功", phone); + } + return fail("更新失败"); + } + + /** + * 新用户注册 + */ + private User addUser(UserParam userParam) { + User addUser = new User(); + // 注册用户 + addUser.setStatus(0); + addUser.setUsername(createUsername("wx_")); + addUser.setNickname("微信用户"); + addUser.setPlatform(MP_WEIXIN); + addUser.setGradeId(2); + if (userParam.getGradeId() != null) { + addUser.setGradeId(userParam.getGradeId()); + } + if (userParam.getPhone() != null) { + addUser.setPhone(userParam.getPhone()); + } + if (StrUtil.isNotBlank(userParam.getOpenid())) { + addUser.setOpenid(userParam.getOpenid()); + } + if (StrUtil.isNotBlank(userParam.getUnionid())) { + addUser.setUnionid(userParam.getUnionid()); + } + addUser.setPassword(userService.encodePassword(CommonUtil.randomUUID16())); + addUser.setTenantId(getTenantId()); + addUser.setRecommend(1); + Role role = roleService.getOne(new QueryWrapper().eq("role_code", "user"), false); + addUser.setRoleId(role.getRoleId()); + if (userService.saveUser(addUser)) { + // 添加用户角色 + final UserRole userRole = new UserRole(); + userRole.setUserId(addUser.getUserId()); + userRole.setTenantId(addUser.getTenantId()); + userRole.setRoleId(addUser.getRoleId()); + userRoleService.save(userRole); + } + // 绑定关系 + if (userParam.getSceneType() != null && userParam.getSceneType().equals("save_referee") && userParam.getRefereeId() != null && userParam.getRefereeId() != 0) { + UserReferee check = userRefereeService.check(addUser.getUserId(), userParam.getRefereeId()); + if (check == null) { + UserReferee userReferee = new UserReferee(); + userReferee.setDealerId(userParam.getRefereeId()); + userReferee.setUserId(addUser.getUserId()); + userRefereeService.save(userReferee); + } + } + return addUser; + } + + // 获取openid + private JSONObject getOpenIdByCode(UserParam userParam) { + // 从缓存获取微信小程序配置信息 + JSONObject setting = getWxConfigFromCache(getTenantId()); + // 获取openId + String apiUrl = "https://api.weixin.qq.com/sns/jscode2session?appid=" + setting.getString("appId") + "&secret=" + setting.getString("appSecret") + "&js_code=" + userParam.getCode() + "&grant_type=authorization_code"; + // 执行get请求 + String result = HttpUtil.get(apiUrl); + // 解析access_token + return JSON.parseObject(result); + } + + /** + * 获取微信手机号码 + * + * @param userParam 需要传微信凭证code + */ + private String getPhoneByCode(UserParam userParam) { + // 获取手机号码 + String apiUrl = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=" + getAccessToken(); + HashMap paramMap = new HashMap<>(); + if (StrUtil.isBlank(userParam.getCode())) { + throw new BusinessException("code不能为空"); + } + paramMap.put("code", userParam.getCode()); + // 执行post请求 + String post = HttpUtil.post(apiUrl, JSON.toJSONString(paramMap)); + JSONObject json = JSON.parseObject(post); + if (json.get("errcode").equals(0)) { + JSONObject phoneInfo = JSON.parseObject(json.getString("phone_info")); + // 微信用户的手机号码 + final String phoneNumber = phoneInfo.getString("phoneNumber"); + // 验证手机号码 +// if (userParam.getNotVerifyPhone() == null && !Validator.isMobile(phoneNumber)) { +// String key = ACCESS_TOKEN_KEY.concat(":").concat(getTenantId().toString()); +// redisTemplate.delete(key); +// throw new BusinessException("手机号码格式不正确"); +// } + return phoneNumber; + } + return null; + } + + /** + * 生成随机账号 + * + * @return username + */ + private String createUsername(String type) { + return type.concat(RandomUtil.randomString(12)); + } + + /** + * 获取接口调用凭据AccessToken + * ... + */ + public String getAccessToken() { + Integer tenantId = getTenantId(); + String key = ACCESS_TOKEN_KEY.concat(":").concat(tenantId.toString()); + + // 从缓存获取微信小程序配置信息 + JSONObject setting = getWxConfigFromCache(tenantId); + if (setting == null) { + throw new BusinessException("请先配置小程序"); + } + + // 从缓存获取access_token + String value = redisTemplate.opsForValue().get(key); + if (value != null) { + // 解析access_token + JSONObject response = JSON.parseObject(value); + String accessToken = response.getString("access_token"); + if (accessToken != null) { + return accessToken; + } + } + + // 微信获取凭证接口 + String apiUrl = "https://api.weixin.qq.com/cgi-bin/token"; + // 组装url参数 + String url = apiUrl.concat("?grant_type=client_credential") + .concat("&appid=").concat(setting.getString("appId")) + .concat("&secret=").concat(setting.getString("appSecret")); + + // 执行get请求 + String result = HttpUtil.get(url); + // 解析access_token + JSONObject response = JSON.parseObject(result); + if (response.getString("access_token") != null) { + // 存入缓存 + redisTemplate.opsForValue().set(key, result, 7000L, TimeUnit.SECONDS); + return response.getString("access_token"); + } + throw new BusinessException("小程序配置不正确"); + } + + @Operation(summary = "获取微信openId并更新") + @PostMapping("/getWxOpenId") + public ApiResult getWxOpenId(@RequestBody UserParam userParam) { + final User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("请先登录"); + } + // 已存在直接返回 + if (StrUtil.isNotBlank(loginUser.getOpenid())) { + return success(loginUser); + } + // 请求微信接口获取openid + String apiUrl = "https://api.weixin.qq.com/sns/jscode2session"; + final HashMap map = new HashMap<>(); + final JSONObject setting = getWxConfigFromCache(getTenantId()); + final String appId = setting.getString("appId"); + final String appSecret = setting.getString("appSecret"); + map.put("appid", appId); + map.put("secret", appSecret); + map.put("js_code", userParam.getCode()); + map.put("grant_type", "authorization_code"); + final String response = HttpUtil.get(apiUrl, map); + final JSONObject jsonObject = JSONObject.parseObject(response); + String openid = jsonObject.getString("openid"); + String sessionKey = jsonObject.getString("session_key"); + String unionid = jsonObject.getString("unionid"); + // 保存openID + if (loginUser.getOpenid() == null || StrUtil.isBlank(loginUser.getOpenid())) { + loginUser.setOpenid(openid); + loginUser.setUnionid(unionid); + requestUtil.updateUser(loginUser); +// userService.updateById(loginUser); + } + return success("获取成功", jsonObject); + } + + @Operation(summary = "仅获取微信openId") + @PostMapping("/getWxOpenIdOnly") + public ApiResult getWxOpenIdOnly(@RequestBody UserParam userParam) { + + String apiUrl = "https://api.weixin.qq.com/sns/jscode2session"; + final HashMap map = new HashMap<>(); + final JSONObject setting = getWxConfigFromCache(getTenantId()); + final String appId = setting.getString("appId"); + final String appSecret = setting.getString("appSecret"); + map.put("appid", appId); + map.put("secret", appSecret); + map.put("js_code", userParam.getCode()); + map.put("grant_type", "authorization_code"); + final String response = HttpUtil.get(apiUrl, map); + final JSONObject jsonObject = JSONObject.parseObject(response); + return success("获取成功", jsonObject); + } + + @Operation(summary = "获取微信小程序码-用户ID") + @GetMapping("/getUserQRCode") + public ApiResult getQRCode() { + String apiUrl = "https://api.weixin.qq.com/wxa/getwxacode?access_token=" + getAccessToken(); + final HashMap map = new HashMap<>(); + map.put("path", "/package/user/qrcode?user_id=" + getLoginUserId()); +// map.put("env_version","trial"); + // 获取图片 Buffer + byte[] qrCode = HttpRequest.post(apiUrl) + .body(JSON.toJSONString(map)) + .execute().bodyBytes(); + + // 保存的文件名称 + final String fileName = CommonUtil.randomUUID8().concat(".png"); + // 保存路径 + String filePath = getUploadDir().concat("qrcode/") + fileName; + File file = FileUtil.writeBytes(qrCode, filePath); + if (file != null) { + return success(config.getFileServer().concat("/qrcode/").concat(fileName)); + } + return fail("获取失败", null); + } + + @Operation(summary = "获取微信小程序码-订单核销码") + @GetMapping("/getOrderQRCode/{orderNo}") + public ApiResult getOrderQRCode(@PathVariable("orderNo") String orderNo) { + String apiUrl = "https://api.weixin.qq.com/wxa/getwxacode?access_token=" + getAccessToken(); + final HashMap map = new HashMap<>(); + map.put("path", "/package/admin/order-scan?orderNo=".concat(orderNo)); + map.put("env_version", "release"); + // 获取图片 Buffer + byte[] qrCode = HttpRequest.post(apiUrl) + .body(JSON.toJSONString(map)) + .execute().bodyBytes(); + + // 保存的文件名称 + final String fileName = CommonUtil.randomUUID8().concat(".png"); + // 保存路径 + String filePath = getUploadDir().concat("qrcode/") + fileName; + File file = FileUtil.writeBytes(qrCode, filePath); + if (file != null) { + return success(config.getFileServer().concat("/qrcode/").concat(fileName)); + } + return fail("获取失败", null); + } + + @Operation(summary = "获取微信小程序码-订单核销码-数量极多的业务场景") + @GetMapping("/getOrderQRCodeUnlimited/{scene}") + public void getOrderQRCodeUnlimited(@PathVariable("scene") String scene, HttpServletResponse response) throws IOException { + try { + // 从scene参数中解析租户ID + System.out.println("scene = " + scene); + Integer tenantId = extractTenantIdFromScene(scene); + System.out.println("从scene参数中解析租户ID = " + tenantId); + if (tenantId == null) { + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + response.getWriter().write("{\"error\":\"无法从scene参数中获取租户信息\"}"); + return; + } + + // 使用指定租户ID获取 access_token + String accessToken = getAccessTokenForTenant(tenantId); + String apiUrl = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken; + + final HashMap map = new HashMap<>(); + map.put("scene", scene); + map.put("page", "pages/index/index"); + map.put("env_version", "release"); + + // 判断应用运行状态 + final CmsWebsite website = cmsWebsiteService.getByTenantId(tenantId); + if(website.getRunning().equals(2)){ + map.put("check_path",false); + map.put("env_version","trial"); + } + + String jsonBody = JSON.toJSONString(map); + System.out.println("请求的 JSON body = " + jsonBody); + + // 获取微信 API 响应 + cn.hutool.http.HttpResponse httpResponse = HttpRequest.post(apiUrl) + .body(jsonBody) + .execute(); + + byte[] responseBytes = httpResponse.bodyBytes(); + String contentType = httpResponse.header("Content-Type"); + + // 检查响应内容类型,判断是否为错误响应 + if (contentType != null && contentType.contains("application/json")) { + // 微信返回了错误信息(JSON格式) + String errorResponse = new String(responseBytes, "UTF-8"); + System.err.println("微信 API 错误响应: " + errorResponse); + + // 返回错误信息给前端 + response.setContentType("application/json;charset=UTF-8"); + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + response.getWriter().write(errorResponse); + return; + } + + // 成功获取二维码图片 + response.setContentType("image/png"); + response.setHeader("Cache-Control", "no-cache"); + response.setHeader("Content-Disposition", "inline; filename=qrcode.png"); + + // 输出图片 + response.getOutputStream().write(responseBytes); + System.out.println("二维码生成成功,大小: " + responseBytes.length + " bytes"); + + } catch (Exception e) { + System.err.println("生成二维码失败: " + e.getMessage()); + e.printStackTrace(); + + // 返回错误信息 + response.setContentType("application/json;charset=UTF-8"); + response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + response.getWriter().write("{\"error\":\"生成二维码失败: " + e.getMessage() + "\"}"); + } + } + + @Operation(summary = "获取微信小程序码-用户ID") + @GetMapping("/getQRCodeText") + public byte[] getQRCodeText(String scene, String page, Integer width, + Boolean isHyaline, String envVersion) throws IOException { + HttpUrl url = HttpUrl.parse("https://api.weixin.qq.com/wxa/getwxacodeunlimit") + .newBuilder() + .addQueryParameter("access_token", getLocalAccessToken()) + .build(); + + System.out.println("page = " + page); + // 构造请求 JSON + // 注意:scene 仅支持可见字符,长度上限 32,尽量 URL-safe(字母数字下划线等) + // page 必须是已发布小程序内的路径(不带开头斜杠也可) + var root = om.createObjectNode(); + root.put("scene", scene); + if (page != null) root.put("page", page); + if (width != null) root.put("width", width); // 默认 430,建议 280~1280 + if (isHyaline != null) root.put("is_hyaline", isHyaline); + if (envVersion != null) root.put("env_version", envVersion); // release/trial/develop + + okhttp3.RequestBody reqBody = okhttp3.RequestBody.create( + root.toString(), MediaType.parse("application/json; charset=utf-8")); + Request req = new Request.Builder().url(url).post(reqBody).build(); + + try (Response resp = http.newCall(req).execute()) { + if (!resp.isSuccessful()) { + throw new IOException("HTTP " + resp.code() + " calling getwxacodeunlimit"); + } + MediaType ct = resp.body().contentType(); + byte[] bytes = resp.body().bytes(); + // 微信出错时返回 JSON,需要识别一下 + if (ct != null && ct.subtype() != null && ct.subtype().contains("json")) { + String err = new String(bytes); + throw new IOException("WeChat error: " + err); + } + return bytes; // 成功就是图片二进制(PNG) + } + } + + /** + * 获取/刷新 access_token + */ + public String getLocalAccessToken() throws IOException { + long now = Instant.now().getEpochSecond(); + String key = "AccessToken:Local:" + getTenantId(); + + // 从缓存获取access_token,使用JSON格式 + String value = redisUtil.get(key); + if (value != null && now < tokenExpireEpoch - 60) { + try { + // 尝试解析为JSON格式 + JSONObject response = JSON.parseObject(value); + String accessToken = response.getString("access_token"); + if (accessToken != null) { + System.out.println("从缓存获取到access_token(Local): " + accessToken.substring(0, Math.min(10, accessToken.length())) + "..."); + return accessToken; + } + } catch (Exception e) { + // 如果解析失败,可能是旧格式的纯字符串token + System.out.println("本地缓存token格式异常,使用原值: " + e.getMessage()); + return value; + } + } + + // 从缓存获取微信小程序配置信息 + Integer tenantId = getTenantId(); + JSONObject setting = getWxConfigFromCache(tenantId); + if (setting == null) { + throw new IOException("请先配置小程序"); + } + + String appId = setting.getString("appId"); + String appSecret = setting.getString("appSecret"); + + if (appId == null || appSecret == null) { + throw new IOException("小程序配置不完整,缺少 appId 或 appSecret"); + } + + HttpUrl url = HttpUrl.parse("https://api.weixin.qq.com/cgi-bin/token") + .newBuilder() + .addQueryParameter("grant_type", "client_credential") + .addQueryParameter("appid", appId) + .addQueryParameter("secret", appSecret) + .build(); + + Request req = new Request.Builder().url(url).get().build(); + try (Response resp = http.newCall(req).execute()) { + String body = resp.body().string(); + JsonNode json = om.readTree(body); + if (json.has("access_token")) { + String token = json.get("access_token").asText(); + long expiresIn = json.get("expires_in").asInt(7200); + + // 缓存完整的JSON响应,与其他方法保持一致 + redisUtil.set(key, body, expiresIn, TimeUnit.SECONDS); + tokenExpireEpoch = now + expiresIn; + System.out.println("获取新的access_token成功(Local),租户ID: " + tenantId); + return token; + } else { + throw new IOException("Get access_token failed: " + body); + } + } + } + + /** + * 文件上传位置(服务器) + */ + private String getUploadDir() { + return config.getUploadPath(); + } + + @Operation(summary = "调试:检查微信小程序配置") + @GetMapping("/debug/checkWxConfig") + public ApiResult debugCheckWxConfig() { + Integer tenantId = getTenantId(); + Map result = new HashMap<>(); + result.put("tenantId", tenantId); + + try { + // 尝试从缓存获取配置 + JSONObject setting = getWxConfigFromCache(tenantId); + result.put("hasConfig", true); + result.put("config", setting); + result.put("cacheKey", MP_WX_KEY + tenantId); + } catch (Exception e) { + result.put("hasConfig", false); + result.put("error", e.getMessage()); + result.put("cacheKey", MP_WX_KEY + tenantId); + + // 提供创建配置的建议 + Map suggestion = new HashMap<>(); + suggestion.put("message", "请在Redis中创建微信小程序配置"); + suggestion.put("cacheKey", MP_WX_KEY + tenantId); + suggestion.put("tenantId", tenantId); + suggestion.put("sampleConfig", createSampleWxConfig()); + result.put("suggestion", suggestion); + } + + return success("配置检查完成", result); + } + + @Operation(summary = "调试:创建示例微信小程序配置") + @PostMapping("/debug/createSampleWxConfig") + public ApiResult debugCreateSampleWxConfig(@RequestBody Map params) { + Integer tenantId = getTenantId(); + + String appId = params.get("appId"); + String appSecret = params.get("appSecret"); + + if (appId == null || appSecret == null) { + return fail("请提供 appId 和 appSecret", null); + } + + try { + // 直接在Redis中创建配置 + String key = MP_WX_KEY + tenantId; + + // 创建配置内容 + Map config = new HashMap<>(); + config.put("appId", appId); + config.put("appSecret", appSecret); + config.put("tenantId", tenantId.toString()); + config.put("settingKey", "mp-weixin"); + config.put("settingId", "301"); + + // 保存到Redis缓存 + redisUtil.set(key, JSON.toJSONString(config)); + + return success("微信小程序配置创建成功", config); + } catch (Exception e) { + return fail("创建配置失败: " + e.getMessage(), null); + } + } + + private Map createSampleWxConfig() { + Map sample = new HashMap<>(); + sample.put("appId", "wx_your_app_id_here"); + sample.put("appSecret", "your_app_secret_here"); + return sample; + } + + @Operation(summary = "调试:获取AccessToken") + @GetMapping("/debug/getAccessToken") + public ApiResult debugGetAccessToken() { + try { + // 获取当前线程的租户ID + Integer tenantId = getTenantId(); + if (tenantId == null) { + tenantId = 10550; // 默认租户 + } + + System.out.println("=== 开始调试获取AccessToken,租户ID: " + tenantId + " ==="); + + // 手动调用获取AccessToken + String accessToken = getAccessTokenForTenant(tenantId); + + String result = "获取AccessToken成功: " + (accessToken != null ? accessToken.substring(0, Math.min(10, accessToken.length())) + "..." : "null"); + System.out.println("调试结果: " + result); + + return success(result); + } catch (Exception e) { + System.err.println("调试获取AccessToken异常: " + e.getMessage()); + e.printStackTrace(); + return fail("获取AccessToken失败: " + e.getMessage()); + } + } + + /** + * 从Redis缓存中获取微信小程序配置 + * @param tenantId 租户ID + * @return 微信配置信息 + */ + private JSONObject getWxConfigFromCache(Integer tenantId) { + String key = MP_WX_KEY + tenantId; + String cacheValue = redisUtil.get(key); + if (StrUtil.isBlank(cacheValue)) { + throw new BusinessException("未找到微信小程序配置,请检查缓存key: " + key); + } + try { + return JSON.parseObject(cacheValue); + } catch (Exception e) { + throw new BusinessException("微信小程序配置格式错误: " + e.getMessage()); + } + } + + /** + * 从scene参数中提取租户ID + * scene格式可能是: uid_33103 或其他包含用户ID的格式 + */ + private Integer extractTenantIdFromScene(String scene) { + try { + System.out.println("解析scene参数: " + scene); + + // 如果scene包含uid_前缀,提取用户ID + if (scene != null && scene.startsWith("uid_")) { + String userIdStr = scene.substring(4); // 去掉"uid_"前缀 + Integer userId = Integer.parseInt(userIdStr); + System.out.println("userId = " + userId); + + // 根据用户ID查询用户信息,获取租户ID + User user = userService.getByIdIgnoreTenant(userId); + System.out.println("user = " + user); + if (user != null) { + System.out.println("从用户ID " + userId + " 获取到租户ID: " + user.getTenantId()); + return user.getTenantId(); + } else { + System.err.println("未找到用户ID: " + userId); + } + } + + // 如果无法解析,默认使用租户10550 + System.out.println("无法解析scene参数,使用默认租户ID: 10550"); + return 10550; + + } catch (Exception e) { + System.err.println("解析scene参数异常: " + e.getMessage()); + // 出现异常时,默认使用租户10550 + return 10550; + } + } + + /** + * 为指定租户获取AccessToken + */ + private String getAccessTokenForTenant(Integer tenantId) { + try { + String key = ACCESS_TOKEN_KEY.concat(":").concat(tenantId.toString()); + + // 从缓存获取access_token + String value = redisUtil.get(key); + if (value != null) { + try { + // 尝试解析为JSON格式(与getAccessToken方法保持一致) + JSONObject response = JSON.parseObject(value); + String accessToken = response.getString("access_token"); + if (accessToken != null) { + System.out.println("从缓存获取到access_token: " + accessToken.substring(0, Math.min(10, accessToken.length())) + "..."); + return accessToken; + } + } catch (Exception e) { + // 如果解析失败,可能是旧格式的纯字符串token,直接返回 + System.out.println("缓存token格式异常,使用原值: " + e.getMessage()); + return value; + } + } + + // 缓存中没有,重新获取 + JSONObject wxConfig = getWxConfigFromCache(tenantId); + String appId = wxConfig.getString("appId"); + String appSecret = wxConfig.getString("appSecret"); + + String apiUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appId + "&secret=" + appSecret; + System.out.println("调用微信API获取token - 租户ID: " + tenantId + ", AppID: " + (appId != null ? appId.substring(0, Math.min(8, appId.length())) + "..." : "null")); + System.out.println("微信API请求URL: " + apiUrl.replaceAll("secret=[^&]*", "secret=***")); + String result = HttpUtil.get(apiUrl); + System.out.println("微信API响应: " + result); + JSONObject json = JSON.parseObject(result); + + // 检查是否有错误 + if (json.containsKey("errcode")) { + Integer errcode = json.getInteger("errcode"); + String errmsg = json.getString("errmsg"); + System.err.println("微信API错误 - errcode: " + errcode + ", errmsg: " + errmsg); + + if (errcode == 40125) { + throw new RuntimeException("微信AppSecret配置错误,请检查并更新正确的AppSecret"); + } else if (errcode == 40013) { + throw new RuntimeException("微信AppID配置错误,请检查并更新正确的AppID"); + } else { + throw new RuntimeException("微信API调用失败: " + errmsg + " (errcode: " + errcode + ")"); + } + } + + if (json.containsKey("access_token")) { + String accessToken = json.getString("access_token"); + Integer expiresIn = json.getInteger("expires_in"); + + // 缓存access_token,存储完整JSON响应(与getAccessToken方法保持一致) + redisUtil.set(key, result, (long) (expiresIn - 300), TimeUnit.SECONDS); + + System.out.println("获取新的access_token成功,租户ID: " + tenantId); + return accessToken; + } else { + throw new RuntimeException("获取access_token失败: " + result); + } + + } catch (Exception e) { + System.err.println("获取access_token异常,租户ID: " + tenantId + ", 错误: " + e.getMessage()); + throw new RuntimeException("获取access_token失败: " + e.getMessage()); + } + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/dto/PaymentCacheDTO.java b/src/main/java/com/gxwebsoft/common/system/dto/PaymentCacheDTO.java new file mode 100644 index 0000000..8a0cab9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/dto/PaymentCacheDTO.java @@ -0,0 +1,39 @@ +package com.gxwebsoft.common.system.dto; + +import lombok.Data; +import java.io.Serializable; + +/** + * 支付配置缓存DTO + * 专门用于Redis缓存,不包含时间字段,避免序列化问题 + * + * @author 科技小王子 + * @since 2025-01-13 + */ +@Data +public class PaymentCacheDTO implements Serializable { + private static final long serialVersionUID = 1L; + + private Integer id; + private String name; + private Integer type; + private String code; + private String image; + private Integer wechatType; + private String appId; + private String mchId; + private String apiKey; + private String apiclientCert; + private String apiclientKey; + private String pubKey; + private String pubKeyId; + private String merchantSerialNumber; + private String notifyUrl; + private String comments; + private Integer sortNumber; + private Boolean status; + private Integer deleted; + private Integer tenantId; + + // 不包含 createTime 和 updateTime 字段,避免序列化问题 +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/Cache.java b/src/main/java/com/gxwebsoft/common/system/entity/Cache.java new file mode 100644 index 0000000..232c183 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/Cache.java @@ -0,0 +1,34 @@ +package com.gxwebsoft.common.system.entity; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * 缓存管理 + * + * @author WebSoft + * @since 2022-11-19 13:54:27 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "Setting对象", description = "缓存管理") +public class Cache implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "key") + private String key; + + @Schema(description = "设置内容(json格式)") + private String content; + + @Schema(description = "过期时间(秒)") + private Long expireTime; + + @Schema(description = "租户id") + private Integer tenantId; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/ChatMessage.java b/src/main/java/com/gxwebsoft/common/system/entity/ChatMessage.java new file mode 100644 index 0000000..2102b4d --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/ChatMessage.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.Map; + +/** + * 机构 + * + * @author LX + * @since 2025-04-14 00:35:34 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "LawOrg对象", description = "机构") +@TableName("law_org") +public class ChatMessage implements Serializable { + private static final long serialVersionUID = 1L; + + @TableField(exist = false) + private String query; + + @TableField(exist = false) + private String inputs; + + @TableField(exist = false) + private String responseMode; + + @TableField(exist = false) + private String user; + + @TableField(exist = false) + private String conversationId; + + @TableField(exist = false) + private String type; + + @TableField(exist = false) + private Integer requestType; + + @TableField(exist = false) + private Map files; +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/Company.java b/src/main/java/com/gxwebsoft/common/system/entity/Company.java new file mode 100644 index 0000000..9e37455 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/Company.java @@ -0,0 +1,337 @@ +package com.gxwebsoft.common.system.entity; + +import cn.hutool.core.util.DesensitizedUtil; +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.List; + +/** + * 企业信息 + * + * @author 科技小王子 + * @since 2023-05-27 14:57:34 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "Company对象", description = "企业信息") +@TableName("sys_company") +public class Company implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "企业id") + @TableId(value = "company_id", type = IdType.AUTO) + private Integer companyId; + + @Schema(description = "应用类型") + private Integer type; + + @Schema(description = "企业简称") + private String shortName; + + @Schema(description = "企业全称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "企业标识") + private String companyCode; + + @Schema(description = "企业类型") + private String companyType; + + @Schema(description = "是否官方") + private Boolean official; + + @Schema(description = "企业类型 多选") + private String companyTypeMultiple; + + @Schema(description = "应用标识") + private String companyLogo; + + @Schema(description = "封面图") + private String image; + + @Schema(description = "应用详情") + @TableField(exist = false) + private String content; + + @Schema(description = "栏目分类") + private Integer categoryId; + + @Schema(description = "栏目名称") + @TableField(exist = false) + private String categoryName; + + @Schema(description = "应用截图") + private String files; + + @Schema(description = "顶级域名") + private String domain; + + @Schema(description = "免费域名") + private String freeDomain; + + @Schema(description = "销售价格") + private BigDecimal price; + + @Schema(description = "计费方式") + private Integer chargingMethod; + + @Schema(description = "联系电话") + private String phone; + + @Schema(description = "公司座机") + private String tel; + + @Schema(description = "电子邮箱") + private String email; + + @Schema(description = "企业法人") + private String businessEntity; + + @Schema(description = "发票抬头") + @TableField("Invoice_header") + private String invoiceHeader; + + @Schema(description = "服务开始时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime startTime; + + @Schema(description = "服务到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime expirationTime; + + @Schema(description = "即将过期") + private Integer soon; + + @Schema(description = "应用版本 10体验版 20授权版 30旗舰版") + private Integer version; + + @Schema(description = "版本名称") + private String versionName; + + @Schema(description = "版本号") + private String versionCode; + + @Schema(description = "评分") + private BigDecimal rate; + + @Schema(description = "企业成员(当前)") + private Integer users; + + @Schema(description = "成员数量(上限)") + private Integer members; + + @Schema(description = "浏览数量") + private Long clicks; + + @Schema(description = "点赞数量") + private Long likes; + + @Schema(description = "购买数量") + private Long buys; + + @Schema(description = "存储空间") + private Long storage; + + @Schema(description = "存储空间(上限)") + private Long storageMax; + + @Schema(description = "行业类型(父级)") + private String industryParent; + + @Schema(description = "行业类型(子级)") + private String industryChild; + + @Schema(description = "部门数量") + private Integer departments; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否实名认证") + private Integer authentication; + + @Schema(description = "主控端节点") + private String serverUrl; + + @Schema(description = "模块节点") + private String modulesUrl; + + @Schema(description = "重定向节点") + private String redirectUrl; + + @Schema(description = "request合法域名") + private String requestUrl; + + @Schema(description = "socket合法域名") + private String socketUrl; + + @Schema(description = "总后台管理入口") + private String adminUrl; + + @Schema(description = "商户端管理入口") + private String merchantUrl; + + @Schema(description = "默认网站URL") + private String websiteUrl; + + @Schema(description = "微信小程序二维码") + private String mpWeixinCode; + + @Schema(description = "支付宝小程序二维码") + private String mpAlipayCode; + + @Schema(description = "H5端应用二维码") + private String h5Code; + + @Schema(description = "安卓APP二维码") + private String androidUrl; + + @Schema(description = "苹果APP二维码") + private String iosUrl; + + @Schema(description = "应用类型") + private String appType; + + @Schema(description = "状态") + private Integer status; + + @Schema(description = "排序") + private Integer sortNumber; + + @Schema(description = "插件ID(菜单根节点)") + private Integer menuId; + + @Schema(description = "当前使用的租户模板") + private Integer planId; + + @Schema(description = "是否开启网站") + private Boolean websiteStatus; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "是否含税") + private Boolean isTax; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "是否默认企业主体") + private Boolean authoritative; + + @Schema(description = "是否推荐") + private Boolean recommend; + + @Schema(description = "商户ID") + private Long merchantId; + + @Schema(description = "租户ID") + private Integer tid; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "租户名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "租户编号") + @TableField(exist = false) + private String tenantCode; + + @Schema(description = "昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "配置信息") + @TableField(exist = false) + private Object config; + + @Schema(description = "是否已收藏") + @TableField(exist = false) + private Boolean collection; + + @Schema(description = "新注册的密码") + @TableField(exist = false) + private String password; + + @Schema(description = "手机号(脱敏)") + @TableField(exist = false) + private String mobile; + + @Schema(description = "是否已购买") + @TableField(exist = false) + private Boolean isBuy; + + @Schema(description = "用户是否已安装了该插件") + @TableField(exist = false) + private Boolean installed; + + @Schema(description = "产品参数") + @TableField(exist = false) + private List parameters; + + @Schema(description = "产品按钮及链接") + @TableField(exist = false) + private List links; + + @Schema(description = "购买数量") + @TableField(exist = false) + private Integer num; + + @Schema(description = "角色列表") + @TableField(exist = false) + private List roles; + + @Schema(description = "权限列表") + @TableField(exist = false) + private List authorities; + + @Schema(description = "记录克隆的模板ID") + @TableField(exist = false) + private Integer templateId; + + public String getMobile() { + return DesensitizedUtil.mobilePhone(this.phone); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/CompanyComment.java b/src/main/java/com/gxwebsoft/common/system/entity/CompanyComment.java new file mode 100644 index 0000000..5ad0b6b --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/CompanyComment.java @@ -0,0 +1,61 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 应用评论 + * + * @author 科技小王子 + * @since 2024-10-17 15:30:24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CompanyComment对象", description = "应用评论") +@TableName("sys_company_comment") +public class CompanyComment implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "父级ID") + private Integer parentId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "评分") + private BigDecimal rate; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "评论内容") + private String comments; + + @Schema(description = "状态") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/CompanyContent.java b/src/main/java/com/gxwebsoft/common/system/entity/CompanyContent.java new file mode 100644 index 0000000..1230838 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/CompanyContent.java @@ -0,0 +1,44 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 应用详情 + * + * @author 科技小王子 + * @since 2024-10-16 13:41:21 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CompanyContent对象", description = "应用详情") +@TableName("sys_company_content") +public class CompanyContent implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "详细内容") + private String content; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/CompanyGit.java b/src/main/java/com/gxwebsoft/common/system/entity/CompanyGit.java new file mode 100644 index 0000000..b8d482b --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/CompanyGit.java @@ -0,0 +1,142 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 代码仓库 + * + * @author 科技小王子 + * @since 2024-10-19 18:08:51 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CompanyGit对象", description = "代码仓库") +@TableName("sys_company_git") +public class CompanyGit implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "仓库名称") + private String title; + + @Schema(description = "厂商") + private String brand; + + @Schema(description = "图标") + private String icon; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "仓库地址") + private String domain; + + @Schema(description = "账号") + private String account; + + @Schema(description = "密码") + private String password; + + @Schema(description = "仓库描述") + private String comments; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1待确认") + private Integer status; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "租户id") + private Integer tenantId; + + /** + * 用户余额变动明细表 + * + * @author 科技小王子 + * @since 2023-04-21 15:59:09 + */ + @Data + @EqualsAndHashCode(callSuper = false) + @Schema(name = "UserBalanceLog对象", description = "用户余额变动明细表") + @TableName("sys_user_balance_log") + public static class UserBalanceLog implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "log_id", type = IdType.AUTO) + private Integer logId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "余额变动场景(10用户充值 20用户消费 30管理员操作 40订单退款)") + private Integer scene; + + @Schema(description = "变动金额") + private BigDecimal money; + + @Schema(description = "变动后余额") + private BigDecimal balance; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "支付流水号") + private String transactionId; + + @Schema(description = "管理员备注") + private String remark; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "商户编码") + private String merchantCode; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "用户头像") + @TableField(exist = false) + private String avatar; + + } +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/CompanyParameter.java b/src/main/java/com/gxwebsoft/common/system/entity/CompanyParameter.java new file mode 100644 index 0000000..e2c0718 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/CompanyParameter.java @@ -0,0 +1,57 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 应用参数 + * + * @author 科技小王子 + * @since 2024-10-17 15:30:24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CompanyParameter对象", description = "应用参数") +@TableName("sys_company_parameter") +public class CompanyParameter implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "参数名称") + private String name; + + @Schema(description = "参数内容") + private String value; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1待确认") + private Integer status; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "租户id") + private Integer tenantId; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/CompanyUrl.java b/src/main/java/com/gxwebsoft/common/system/entity/CompanyUrl.java new file mode 100644 index 0000000..1bee66a --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/CompanyUrl.java @@ -0,0 +1,66 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 应用域名 + * + * @author 科技小王子 + * @since 2024-10-17 15:30:24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CompanyUrl对象", description = "应用域名") +@TableName("sys_company_url") +public class CompanyUrl implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "域名类型") + private String type; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "域名") + private String domain; + + @Schema(description = "账号") + private String account; + + @Schema(description = "密码") + private String password; + + @Schema(description = "二维码") + private String qrcode; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1待确认") + private Integer status; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "租户id") + private Integer tenantId; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/Dict.java b/src/main/java/com/gxwebsoft/common/system/entity/Dict.java new file mode 100644 index 0000000..35f9c61 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/Dict.java @@ -0,0 +1,60 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Set; + +/** + * 字典 + * + * @author WebSoft + * @since 2020-03-14 11:29:03 + */ +@Data +@Schema(description = "字典(业务类)") +@TableName("sys_dict") +public class Dict implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "字典id") + @TableId(type = IdType.AUTO) + private Integer dictId; + + @Schema(description = "字典标识") + private String dictCode; + + @Schema(description = "字典名称") + private String dictName; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "字典项列表") + @TableField(exist = false) + private Set> items; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/DictData.java b/src/main/java/com/gxwebsoft/common/system/entity/DictData.java new file mode 100644 index 0000000..e9bf6e9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/DictData.java @@ -0,0 +1,66 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 字典数据 + * + * @author WebSoft + * @since 2020-03-14 11:29:04 + */ +@Data +@Schema(description = "字典数据(业务类)") +@TableName("sys_dict_data") +public class DictData implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "字典数据id") + @TableId(type = IdType.AUTO) + private Integer dictDataId; + + @Schema(description = "字典id") + private Integer dictId; + + @Schema(description = "字典数据标识") + private String dictDataCode; + + @Schema(description = "字典数据名称") + private String dictDataName; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "字典代码") + @TableField(exist = false) + private String dictCode; + + @Schema(description = "字典名称") + @TableField(exist = false) + private String dictName; + + @Schema(description = "租户id") + private Integer tenantId; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/Dictionary.java b/src/main/java/com/gxwebsoft/common/system/entity/Dictionary.java new file mode 100644 index 0000000..b184758 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/Dictionary.java @@ -0,0 +1,59 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; + +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * 字典 + * + * @author WebSoft + * @since 2020-03-14 11:29:03 + */ +@Data +@Schema(description = "字典(系统类)") +@TableName("sys_dictionary") +public class Dictionary implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "字典id") + @TableId(type = IdType.AUTO) + private Integer dictId; + + @Schema(description = "字典标识") + private String dictCode; + + @Schema(description = "字典名称") + private String dictName; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "租户id") + private Integer tenantId; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/DictionaryData.java b/src/main/java/com/gxwebsoft/common/system/entity/DictionaryData.java new file mode 100644 index 0000000..9f9ed86 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/DictionaryData.java @@ -0,0 +1,67 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * 字典数据 + * + * @author WebSoft + * @since 2020-03-14 11:29:04 + */ +@Data +@Schema(description = "字典数据(系统类)") +@TableName("sys_dictionary_data") +public class DictionaryData implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "字典数据id") + @TableId(type = IdType.AUTO) + private Integer dictDataId; + + @Schema(description = "字典id") + private Integer dictId; + + @Schema(description = "字典数据标识") + private String dictDataCode; + + @Schema(description = "字典数据名称") + private String dictDataName; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "字典代码") + @TableField(exist = false) + private String dictCode; + + @Schema(description = "字典名称") + @TableField(exist = false) + private String dictName; + + @Schema(description = "租户id") + private Integer tenantId; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/Domain.java b/src/main/java/com/gxwebsoft/common/system/entity/Domain.java new file mode 100644 index 0000000..c9fc263 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/Domain.java @@ -0,0 +1,75 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 授权域名 + * + * @author 科技小王子 + * @since 2024-09-19 23:56:33 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "Domain对象", description = "授权域名") +@TableName("sys_domain") +public class Domain implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "域名") + private String domain; + + @Schema(description = "主机记录") + private String hostName; + + @Schema(description = "记录值") + private String hostValue; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "类型 0常规 1后台 2商家端") + private Integer type; + + @Schema(description = "状态") + private Integer status; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/EmailRecord.java b/src/main/java/com/gxwebsoft/common/system/entity/EmailRecord.java new file mode 100644 index 0000000..1831835 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/EmailRecord.java @@ -0,0 +1,59 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 邮件发送记录 + * + * @author WebSoft + * @since 2021-08-29 12:36:35 + */ +@Data +@Schema(description = "邮件发送记录") +@TableName("sys_email_record") +public class EmailRecord implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键id") + @TableId(type = IdType.AUTO) + private Integer id; + + @Schema(description = "邮件标题") + private String title; + + @Schema(description = "邮件内容") + private String content; + + @Schema(description = "收件邮箱") + private String receiver; + + @Schema(description = "发件邮箱") + private String sender; + + @Schema(description = "创建人") + private Integer createUserId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/FileRecord.java b/src/main/java/com/gxwebsoft/common/system/entity/FileRecord.java new file mode 100644 index 0000000..f846af5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/FileRecord.java @@ -0,0 +1,94 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 文件上传记录 + * + * @author WebSoft + * @since 2021-08-29 12:36:32 + */ +@Data +@Schema(description = "文件上传记录") +@TableName("sys_file_record") +public class FileRecord implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键id") + @TableId(type = IdType.AUTO) + private Integer id; + + @Schema(description = "分组ID") + private String groupId; + + @Schema(description = "文件名称") + private String name; + + @Schema(description = "文件存储路径") + private String path; + + @Schema(description = "文件大小") + private Long length; + + @Schema(description = "文件类型") + private String contentType; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "创建人") + private Integer createUserId; + + @Schema(description = "AppId") + private Integer appId; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "商户编号") + private String merchantCode; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "文件访问地址") + @TableField(exist = false) + private String url; + + @Schema(description = "文件缩略图访问地址") + @TableField(exist = false) + private String thumbnail; + + @Schema(description = "文件下载地址") + @TableField(exist = false) + private String downloadUrl; + + @Schema(description = "创建人账号") + @TableField(exist = false) + private String createUsername; + + @Schema(description = "创建人名称") + @TableField(exist = false) + private String createNickname; + + @Schema(description = "用户头像") + @TableField(exist = false) + private String avatar; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/KVEntity.java b/src/main/java/com/gxwebsoft/common/system/entity/KVEntity.java new file mode 100644 index 0000000..c1fa9ab --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/KVEntity.java @@ -0,0 +1,56 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 租户 + * + * @author WebSoft + * @since 2021-08-28 11:31:06 + */ +@Data +@Schema(description = "实体") +public class KVEntity implements Serializable { + private static final long serialVersionUID = 1L; + protected K k; + protected V v; + public KVEntity() { + super(); + } + + public KVEntity(K k, V v) { + super(); + this.k = k; + this.v = v; + } + + public static KVEntity build(K k, V v) { + return new KVEntity<>(k, v); + } + + public K getK() { + return k; + } + + public void setK(K k) { + this.k = k; + } + + public V getV() { + return v; + } + + public void setV(V v) { + this.v = v; + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/LoginRecord.java b/src/main/java/com/gxwebsoft/common/system/entity/LoginRecord.java new file mode 100644 index 0000000..b516166 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/LoginRecord.java @@ -0,0 +1,76 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 登录日志 + * + * @author WebSoft + * @since 2018-12-24 16:10:41 + */ +@Data +@Schema(description = "登录日志") +@TableName("sys_login_record") +public class LoginRecord implements Serializable { + private static final long serialVersionUID = 1L; + public static final int TYPE_LOGIN = 0; // 登录成功 + public static final int TYPE_ERROR = 1; // 登录失败 + public static final int TYPE_LOGOUT = 2; // 退出登录 + public static final int TYPE_REFRESH = 3; // 续签token + public static final int TYPE_REGISTER = 4; // 注册成功 + + @Schema(description = "主键id") + @TableId(type = IdType.AUTO) + private Integer id; + + @Schema(description = "用户账号") + private String username; + + @Schema(description = "操作系统") + private String os; + + @Schema(description = "设备名称") + private String device; + + @Schema(description = "浏览器类型") + private String browser; + + @Schema(description = "ip地址") + private String ip; + + @Schema(description = "操作类型, 0登录成功, 1登录失败, 2退出登录, 3续签token") + private Integer loginType; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "操作时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "用户id") + @TableField(exist = false) + private Integer userId; + + @Schema(description = "用户昵称") + @TableField(exist = false) + private String nickname; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/Menu.java b/src/main/java/com/gxwebsoft/common/system/entity/Menu.java new file mode 100644 index 0000000..7e1e4b0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/Menu.java @@ -0,0 +1,95 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.security.core.GrantedAuthority; + +import java.util.Date; +import java.util.List; + +/** + * 菜单 + * + * @author WebSoft + * @since 2018-12-24 16:10:17 + */ +@Data +@Schema(description = "菜单") +@TableName("sys_menu") +@JsonIgnoreProperties(ignoreUnknown = true) +public class Menu implements GrantedAuthority { + private static final long serialVersionUID = 1L; + public static final int TYPE_MENU = 0; // 菜单类型 + public static final int TYPE_BTN = 1; // 按钮类型 + + @Schema(description = "菜单id") + @TableId(type = IdType.AUTO) + private Integer menuId; + + @Schema(description = "上级id, 0是顶级") + private Integer parentId; + + @Schema(description = "菜单名称") + private String title; + + @Schema(description = "菜单路由地址") + private String path; + + @Schema(description = "菜单组件地址") + private String component; + + @Schema(description = "模块ID") + private String modules; + + @Schema(description = "模块API") + private String modulesUrl; + + @Schema(description = "菜单类型, 0菜单, 1按钮") + private Integer menuType; + + @Schema(description = "打开方式, 0当前页, 1新窗口") + @TableField(exist = false) + private Integer openType; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "权限标识") + private String authority; + + @Schema(description = "菜单图标") + private String icon; + + @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示左侧菜单)") + private Integer hide; + + @Schema(description = "路由元信息") + private String meta; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "关联应用") + private Integer appId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "修改时间") + private Date updateTime; + + @Schema(description = "子菜单") + @TableField(exist = false) + private List children; + + @Schema(description = "角色权限树选中状态") + @TableField(exist = false) + private Boolean checked; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/OperationRecord.java b/src/main/java/com/gxwebsoft/common/system/entity/OperationRecord.java new file mode 100644 index 0000000..8ffb3bf --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/OperationRecord.java @@ -0,0 +1,98 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 操作日志 + * + * @author WebSoft + * @since 2018-12-24 16:10:33 + */ +@Data +@Schema(description = "操作日志") +@TableName("sys_operation_record") +public class OperationRecord implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键id") + @TableId(type = IdType.AUTO) + private Integer id; + + @Schema(description = "用户id") + private Integer userId; + + @Schema(description = "操作模块") + private String module; + + @Schema(description = "操作功能") + private String description; + + @Schema(description = "请求地址") + private String url; + + @Schema(description = "请求方式") + private String requestMethod; + + @Schema(description = "调用方法") + private String method; + + @Schema(description = "请求参数") + private String params; + + @Schema(description = "返回结果") + private String result; + + @Schema(description = "异常信息") + private String error; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "消耗时间, 单位毫秒") + private Long spendTime; + + @Schema(description = "操作系统") + private String os; + + @Schema(description = "设备名称") + private String device; + + @Schema(description = "浏览器类型") + private String browser; + + @Schema(description = "ip地址") + private String ip; + + @Schema(description = "状态, 0成功, 1异常") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "操作时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "用户昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "用户账号") + @TableField(exist = false) + private String username; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/Organization.java b/src/main/java/com/gxwebsoft/common/system/entity/Organization.java new file mode 100644 index 0000000..215a64c --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/Organization.java @@ -0,0 +1,92 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * 组织机构 + * + * @author WebSoft + * @since 2020-03-14 11:29:04 + */ +@Data +@Schema(description = "组织机构") +@TableName("sys_organization") +public class Organization implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "机构id") + @TableId(type = IdType.AUTO) + private Integer organizationId; + + @Schema(description = "上级id, 0是顶级") + private Integer parentId; + + @Schema(description = "机构名称") + private String organizationName; + + @Schema(description = "机构全称") + private String organizationFullName; + + @Schema(description = "机构代码") + private String organizationCode; + + @Schema(description = "机构类型, 字典标识") + private String organizationType; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "邮政编码") + private String zipCode; + + @Schema(description = "负责人id") + private Integer leaderId; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "机构类型名称") + @TableField(exist = false) + private String organizationTypeName; + + @Schema(description = "负责人姓名") + @TableField(exist = false) + private String leaderNickname; + + @Schema(description = "负责人账号") + @TableField(exist = false) + private String leaderUsername; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/Payment.java b/src/main/java/com/gxwebsoft/common/system/entity/Payment.java new file mode 100644 index 0000000..819ff36 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/Payment.java @@ -0,0 +1,100 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * 支付方式 + * + * @author 科技小王子 + * @since 2024-05-11 12:39:11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "Payment对象", description = "支付方式") +@TableName("sys_payment") +public class Payment implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "支付方式") + private String name; + + @Schema(description = "类型") + private Integer type; + + @Schema(description = "标识") + private String code; + + @Schema(description = "支付图标") + private String image; + + @Schema(description = "微信商户号类型 1普通商户2子商户") + private Integer wechatType; + + @Schema(description = "应用ID") + private String appId; + + @Schema(description = "商户号") + private String mchId; + + @Schema(description = "设置APIv3密钥") + private String apiKey; + + @Schema(description = "证书文件 (CERT)") + private String apiclientCert; + + @Schema(description = "证书文件 (KEY)") + private String apiclientKey; + + @Schema(description = "公钥文件 (KEY)") + private String pubKey; + + @Schema(description = "公钥ID") + private String pubKeyId; + + @Schema(description = "商户证书序列号") + private String merchantSerialNumber; + + @Schema(description = "支付结果通知") + private String notifyUrl; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "文章排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0未启用, 1启用") + private Boolean status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonIgnore // 缓存时忽略此字段 + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonIgnore // 缓存时忽略此字段 + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/Plug.java b/src/main/java/com/gxwebsoft/common/system/entity/Plug.java new file mode 100644 index 0000000..b8ef784 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/Plug.java @@ -0,0 +1,144 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.List; + +/** + * 插件扩展 + * + * @author 科技小王子 + * @since 2023-05-18 11:57:37 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "Plug对象", description = "插件扩展") +@TableName("sys_plug") +public class Plug implements Serializable { + private static final long serialVersionUID = 1L; + public static final int TYPE_MENU = 0; // 菜单类型 + public static final int TYPE_BTN = 1; // 按钮类型 + + @Schema(description = "插件id") + @TableId(value = "plug_id", type = IdType.AUTO) + private Integer plugId; + + @Schema(description = "菜单ID") + private Integer menuId; + + @Schema(description = "上级id, 0是顶级") + private Integer parentId; + + @Schema(description = "菜单名称") + private String title; + + @Schema(description = "菜单路由地址") + private String path; + + @Schema(description = "菜单组件地址, 目录可为空") + private String component; + + @Schema(description = "类型, 0菜单, 1按钮") + private Integer menuType; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "权限标识") + private String authority; + + @Schema(description = "打开位置") + private String target; + + @Schema(description = "菜单图标") + private String icon; + + @Schema(description = "图标颜色") + private String color; + + @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") + private Integer hide; + + @Schema(description = "菜单侧栏选中的path") + private String active; + + @Schema(description = "其它路由元信息") + private String meta; + + @Schema(description = "插件描述") + private String comments; + + @Schema(description = "插件详情") + private String content; + + @Schema(description = "评分") + private BigDecimal score; + + @Schema(description = "插件价格") + private BigDecimal price; + + @Schema(description = "浏览次数") + private Integer clicks; + + @Schema(description = "安装次数") + private Integer installs; + + @Schema(description = "关联应用ID") + private Integer appId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "状态") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "商户编码") + private String merchantCode; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "子菜单") + @TableField(exist = false) + private List children; + + @Schema(description = "角色权限树选中状态") + @TableField(exist = false) + private Boolean checked; + + @Schema(description = "租户名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "企业简称") + @TableField(exist = false) + private String shortName; + + @Schema(description = "企业域名") + @TableField(exist = false) + private String domain; +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/Role.java b/src/main/java/com/gxwebsoft/common/system/entity/Role.java new file mode 100644 index 0000000..2859ce9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/Role.java @@ -0,0 +1,56 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 角色 + * + * @author WebSoft + * @since 2018-12-24 16:10:01 + */ +@Data +@Schema(description = "角色") +@TableName("sys_role") +public class Role implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "角色id") + @TableId(type = IdType.AUTO) + private Integer roleId; + + @Schema(description = "角色标识") + private String roleCode; + + @Schema(description = "角色名称") + private String roleName; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(hidden = true) + @TableField(exist = false) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/RoleMenu.java b/src/main/java/com/gxwebsoft/common/system/entity/RoleMenu.java new file mode 100644 index 0000000..14781c7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/RoleMenu.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 角色菜单 + * + * @author WebSoft + * @since 2018-12-24 16:10:54 + */ +@Data +@Schema(description = "角色权限") +@TableName("sys_role_menu") +public class RoleMenu implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键id") + @TableId(type = IdType.AUTO) + private Integer id; + + @Schema(description = "角色id") + private Integer roleId; + + @Schema(description = "菜单id") + private Integer menuId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/Setting.java b/src/main/java/com/gxwebsoft/common/system/entity/Setting.java new file mode 100644 index 0000000..336bc2e --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/Setting.java @@ -0,0 +1,61 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 系统设置 + * + * @author WebSoft + * @since 2022-11-19 13:54:27 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "Setting对象", description = "系统设置") +@TableName("sys_setting") +public class Setting implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "id") + @TableId(value = "setting_id", type = IdType.AUTO) + private Integer settingId; + + @Schema(description = "设置项标示") + private String settingKey; + + @Schema(description = "设置内容(json格式)") + private String content; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "修改租户名称") + @TableField(exist = false) + private String tenantName; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/Tenant.java b/src/main/java/com/gxwebsoft/common/system/entity/Tenant.java new file mode 100644 index 0000000..fc5f804 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/Tenant.java @@ -0,0 +1,78 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.List; + +/** + * 租户 + * + * @author 科技小王子 + * @since 2023-07-17 17:49:53 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "Tenant对象", description = "租户") +@TableName("sys_tenant") +public class Tenant implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "租户id") + @TableId(value = "tenant_id", type = IdType.AUTO) + private Integer tenantId; + + @Schema(description = "租户名称") + private String tenantName; + + @Schema(description = "租户编号") + private String tenantCode; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态") + private Integer status; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "logo") + @TableField(exist = false) + private String logo; + + @Schema(description = "游客") + @TableField(exist = false) + private String username; + + @Schema(description = "游客身份") + @TableField(exist = false) + private String token; + + @Schema(description = "当前登录用户") + @TableField(exist = false) + private User loginUser; + + @Schema(description = "菜单信息") + @TableField(exist = false) + private List menu; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/User.java b/src/main/java/com/gxwebsoft/common/system/entity/User.java new file mode 100644 index 0000000..ca83722 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/User.java @@ -0,0 +1,317 @@ +package com.gxwebsoft.common.system.entity; + +import cn.hutool.core.util.DesensitizedUtil; +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.gxwebsoft.cms.entity.CmsWebsite; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.security.core.userdetails.UserDetails; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + * 用户 + * + * @author WebSoft + * @since 2018-12-24 16:10:13 + */ +@Data +@Schema(description = "用户") +@TableName("sys_user") +public class User implements UserDetails { + private static final long serialVersionUID = 1L; + + @Schema(description = "用户id") + @TableId(type = IdType.AUTO) + private Integer userId; + + @Schema(description = "用户类型, 0普通用户") + private Integer type; + + @Schema(description = "用户编码") + private String userCode; + + @Schema(description = "账号") + private String username; + + @Schema(description = "密码") + private String password; + + @Schema(description = "昵称") + private String nickname; + + @Schema(description = "头像") + private String avatar; + + @Schema(description = "头像") + private String bgImage; + + @Schema(description = "性别, 字典标识") + private String sex; + + @Schema(description = "手机号") + private String phone; + + @Schema(description = "邮箱") + private String email; + + @Schema(description = "支付密码") + private String payPassword; + + @Schema(description = "职务") + private String position; + + @Schema(description = "邮箱是否验证, 0否, 1是") + private Integer emailVerified; + + @Schema(description = "别名") + private String alias; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "身份证号(脱敏)") + private String idCard; + + @Schema(description = "身份证号") + @TableField(exist = false) + private String idCardNo; + + @Schema(description = "出生日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime birthday; + + @Schema(description = "年龄") + private Integer age; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "用户可用余额") + private BigDecimal balance; + + @Schema(description = "用户可用积分") + private Integer points; + + @Schema(description = "用户总支付的金额") + private String payMoney; + + @Schema(description = "实际消费的金额(不含退款)") + private BigDecimal expendMoney; + + @Schema(description = "会员等级ID") + private Integer gradeId; + + @Schema(description = "个人简介") + private String introduction; + + @Schema(description = "机构ID") + private Integer organizationId; + + @Schema(description = "会员分组ID") + private Integer groupId; + + @Schema(description = "会员分组") + @TableField(exist = false) + private String groupName; + + @Schema(description = "客户ID") + @TableField(exist = false) + private Integer customerId; + + @Schema(description = "企业ID") + @TableField(exist = false) + private Integer companyId; + + @Schema(description = "模板ID") + @TableField(exist = false) + private Integer templateId; + + @Schema(description = "注册来源客户端") + private String platform; + + @Schema(description = "是否下线会员") + private Integer offline; + + @Schema(description = "关注数") + private Integer followers; + + @Schema(description = "粉丝数") + private Integer fans; + + @Schema(description = "获赞数") + private Integer likes; + + @Schema(description = "客户端ID") + private String clientId; + + @Schema(description = "可管理的商户") + private String merchants; + + @Schema(description = "商户ID") + private Long merchantId; + + @Schema(description = "商户名称") + private String merchantName; + + @Schema(description = "是否管理员") + private Boolean isAdmin; + + @Schema(description = "评论数") + private Integer commentNumbers; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "租户名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "最后结算时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime settlementTime; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "公司名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否已实名认证") + private Integer certification; + + @Schema(description = "机构名称") + @TableField(exist = false) + private String organizationName; + + @Schema(description = "性别名称") + @TableField(exist = false) + private String sexName; + + @Schema(description = "会员等级") + @TableField(exist = false) + private String gradeName; + + @Schema(description = "默认注册的角色ID") + @TableField(exist = false) + private Integer roleId; + + @Schema(description = "角色列表") + @TableField(exist = false) + private List roles; + + @Schema(description = "权限列表") + @TableField(exist = false) + private List authorities; + + @Schema(description = "微信凭证") + @TableField(exist = false) + private String code; + + @Schema(description = "推荐人ID") + @TableField(exist = false) + private Integer dealerId; + + @Schema(description = "微信openid") + private String openid; + + @Schema(description = "公众号openid") + private String officeOpenid; + + @Schema(description = "微信unionid") + private String unionid; + + @Schema(description = "关联用户ID") + @TableField(exist = false) + private Integer sysUserId; + + @Schema(description = "ico文件") + @TableField(exist = false) + private String logo; + + @Schema(description = "创建的应用数量") + @TableField(exist = false) + private Double apps; + + @Schema(description = "租户设置信息") + @TableField(exist = false) + private String setting; + + @Schema(description = "手机号(脱敏)") + @TableField(exist = false) + private String mobile; + + @Schema(description = "网站信息") + @TableField(exist = false) + private CmsWebsite website; + + @Override + public boolean isAccountNonExpired() { + return true; + } + + @Override + public boolean isAccountNonLocked() { + return this.status != null && this.status == 0; + } + + @Override + public boolean isCredentialsNonExpired() { + return true; + } + + @Override + public boolean isEnabled() { + return true; + } + + public String getMobile(){ + return DesensitizedUtil.mobilePhone(this.phone); + } + + public String getIdCardNo(){ + return DesensitizedUtil.idCardNum(this.idCard,4,4); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/UserBalanceLog.java b/src/main/java/com/gxwebsoft/common/system/entity/UserBalanceLog.java new file mode 100644 index 0000000..bd62f51 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/UserBalanceLog.java @@ -0,0 +1,87 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 用户余额变动明细表 + * + * @author 科技小王子 + * @since 2023-04-21 15:59:09 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "UserBalanceLog对象", description = "用户余额变动明细表") +@TableName("sys_user_balance_log") +public class UserBalanceLog implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "log_id", type = IdType.AUTO) + private Integer logId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "余额变动场景(10用户充值 20用户消费 30管理员操作 40订单退款)") + private Integer scene; + + @Schema(description = "变动金额") + private BigDecimal money; + + @Schema(description = "变动后余额") + private BigDecimal balance; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "支付流水号") + private String transactionId; + + @Schema(description = "管理员备注") + private String remark; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "商户编码") + private String merchantCode; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "用户头像") + @TableField(exist = false) + private String avatar; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/UserCollection.java b/src/main/java/com/gxwebsoft/common/system/entity/UserCollection.java new file mode 100644 index 0000000..89133e9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/UserCollection.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 我的收藏 + * + * @author 科技小王子 + * @since 2024-04-28 18:08:32 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "UserCollection对象", description = "我的收藏") +@TableName("sys_user_collection") +public class UserCollection implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "租户ID") + private Integer tid; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/UserFile.java b/src/main/java/com/gxwebsoft/common/system/entity/UserFile.java new file mode 100644 index 0000000..f99ec96 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/UserFile.java @@ -0,0 +1,79 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.*; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户文件 + * + * @author WebSoft + * @since 2022-07-21 14:34:40 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "UserFile对象", description = "用户文件") +@TableName("sys_user_file") +public class UserFile implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "用户id") + private Integer userId; + + @Schema(description = "文件名称") + private String name; + + @Schema(description = "是否是文件夹, 0否, 1是") + private Integer isDirectory; + + @Schema(description = "上级id") + private Integer parentId; + + @Schema(description = "文件路径") + private String path; + + @Schema(description = "文件大小") + private Integer length; + + @Schema(description = "文件类型") + private String contentType; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "文件访问地址") + @TableField(exist = false) + private String url; + + @Schema(description = "文件缩略图访问地址") + @TableField(exist = false) + private String thumbnail; + + @Schema(description = "文件下载地址") + @TableField(exist = false) + private String downloadUrl; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/UserInfo.java b/src/main/java/com/gxwebsoft/common/system/entity/UserInfo.java new file mode 100644 index 0000000..ecf46eb --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/UserInfo.java @@ -0,0 +1,260 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + * 用户 + * + * @author WebSoft + * @since 2018-12-24 16:10:13 + */ +@Data +@Schema(description = "用户") +@TableName("sys_user") +public class UserInfo { + private static final long serialVersionUID = 1L; + + @Schema(description = "用户id") + @TableId(type = IdType.AUTO) + private Integer userId; + + @Schema(description = "用户类型, 0普通用户 6开发者 10企业用户") + private Integer type; + + @Schema(description = "用户编码") + private String userCode; + + @Schema(description = "账号") + private String username; + + @Schema(description = "密码") + private String password; + + @Schema(description = "昵称") + private String nickname; + + @Schema(description = "头像") + private String avatar; + + @Schema(description = "头像") + private String bgImage; + + @Schema(description = "性别, 字典标识") + private String sex; + + @Schema(description = "手机号") + private String phone; + + @Schema(description = "邮箱") + private String email; + + @Schema(description = "职务") + private String position; + + @Schema(description = "邮箱是否验证, 0否, 1是") + private Integer emailVerified; + + @Schema(description = "别名") + private String alias; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "身份证号") + private String idCard; + + @Schema(description = "出生日期") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime birthday; + + @Schema(description = "年龄") + private Integer age; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "用户可用余额") + private BigDecimal balance; + + @Schema(description = "用户可用积分") + private Integer points; + + @Schema(description = "用户总支付的金额") + private String payMoney; + + @Schema(description = "实际消费的金额(不含退款)") + private String expendMoney; + + @Schema(description = "会员等级ID") + private Integer gradeId; + + @Schema(description = "个人简介") + private String introduction; + + @Schema(description = "机构ID") + private Integer organizationId; + + @Schema(description = "客户ID") + private Integer customerId; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "注册来源客户端") + private String platform; + + @Schema(description = "兴趣爱好") + private String interest; + + @Schema(description = "身高") + private String height; + + @Schema(description = "体重") + private String weight; + + @Schema(description = "学历") + private String education; + + @Schema(description = "月薪") + private String monthlyPay; + + @Schema(description = "是否下线会员") + private Integer offline; + + @Schema(description = "关注数") + private Integer followers; + + @Schema(description = "粉丝数") + private Integer fans; + + @Schema(description = "获赞数") + private Integer likes; + + @Schema(description = "评论数") + private Integer commentNumbers; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "租户名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "最后结算时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime settlementTime; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "公司名称") + private String companyName; + + @Schema(description = "是否已实名认证") + private Integer certification; + + @Schema(description = "机构名称") + @TableField(exist = false) + private String organizationName; + + @Schema(description = "性别名称") + @TableField(exist = false) + private String sexName; + + @Schema(description = "会员等级") + @TableField(exist = false) + private String gradeName; + + @Schema(description = "默认注册的角色ID") + @TableField(exist = false) + private Integer roleId; + + @Schema(description = "角色列表") + @TableField(exist = false) + private List roles; + + @Schema(description = "权限列表") + @TableField(exist = false) + private List authorities; + + @Schema(description = "微信凭证") + @TableField(exist = false) + private String code; + + @Schema(description = "推荐人ID") + @TableField(exist = false) + private Integer dealerId; + + @Schema(description = "微信openid") + @TableField(exist = false) + private String openid; + + @Schema(description = "微信unionid") + @TableField(exist = false) + private String unionid; + + @Schema(description = "所属商户名称") + @TableField(exist = false) + private String merchantName; + + @Schema(description = "ico文件") + @TableField(exist = false) + private String logo; + + @Schema(description = "创建的应用数量") + @TableField(exist = false) + private Double apps; + + @Schema(description = "租户设置信息") + @TableField(exist = false) + private String setting; + + @Schema(description = "手机号(脱敏)") + @TableField(exist = false) + private String mobile; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/UserReferee.java b/src/main/java/com/gxwebsoft/common/system/entity/UserReferee.java new file mode 100644 index 0000000..b836af8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/UserReferee.java @@ -0,0 +1,59 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 用户推荐关系表 + * + * @author 科技小王子 + * @since 2023-10-07 22:56:36 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "UserReferee对象", description = "用户推荐关系表") +@TableName("sys_user_referee") +public class UserReferee implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "推荐人ID") + private Integer dealerId; + + @Schema(description = "用户id(被推荐人)") + private Integer userId; + + @Schema(description = "推荐关系层级(1,2,3)") + private Integer level; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @TableField(exist = false) + private User user; +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/UserRole.java b/src/main/java/com/gxwebsoft/common/system/entity/UserRole.java new file mode 100644 index 0000000..9308dd9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/UserRole.java @@ -0,0 +1,52 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 用户角色 + * + * @author WebSoft + * @since 2018-12-24 16:10:23 + */ +@Data +@Schema(description = "用户角色") +@TableName("sys_user_role") +public class UserRole implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键id") + @TableId(type = IdType.AUTO) + private Integer id; + + @Schema(description = "用户id") + private Integer userId; + + @Schema(description = "角色id") + private Integer roleId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "角色名称") + @TableField(exist = false) + private String roleName; + + @Schema(description = "租户ID") + private Integer tenantId; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/entity/UserVerify.java b/src/main/java/com/gxwebsoft/common/system/entity/UserVerify.java new file mode 100644 index 0000000..0f74385 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/entity/UserVerify.java @@ -0,0 +1,110 @@ +package com.gxwebsoft.common.system.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDate; +import java.util.Date; + +/** + * 实名认证 + * + * @author 科技小王子 + * @since 2025-05-29 23:01:04 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "UserVerify对象", description = "实名认证") +@TableName("sys_user_verify") +public class UserVerify implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "认证类型, 0个人 1企业") + private Integer type; + + @Schema(description = "主体名称") + private String name; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "证件号码") + private String idCard; + + @Schema(description = "出生日期") + private LocalDate birthday; + + @Schema(description = "正面") + private String sfz1; + + @Schema(description = "反面") + private String sfz2; + + @Schema(description = "营业执照号码") + private String zzCode; + + @Schema(description = "营业执照照片") + private String zzImg; + + @Schema(description = "其他证件") + private String files; + + @Schema(description = "审核人") + private Integer adminId; + + @Schema(description = "机构ID") + private Integer organizationId; + + @Schema(description = "机构ID") + @TableField(exist = false) + private String organizationName; + + @Schema(description = "用户角色ID") + private Integer userRoleId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0待审核, 1已通过审核,2已驳回") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + @Schema(description = "手机号码") + @TableField(exist = false) + private String phone; + + @Schema(description = "状态名称") + @TableField(exist = false) + private String statusText; + + public String getStatusText() { + String[] statusArray = {"待审核", "已审核通过", "已驳回"}; + return statusArray[this.status]; + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/CompanyCommentMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/CompanyCommentMapper.java new file mode 100644 index 0000000..d80c603 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/CompanyCommentMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.CompanyComment; +import com.gxwebsoft.common.system.param.CompanyCommentParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 应用评论Mapper + * + * @author 科技小王子 + * @since 2024-10-17 15:30:24 + */ +public interface CompanyCommentMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CompanyCommentParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CompanyCommentParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/CompanyContentMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/CompanyContentMapper.java new file mode 100644 index 0000000..3a75de9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/CompanyContentMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.CompanyContent; +import com.gxwebsoft.common.system.param.CompanyContentParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 应用详情Mapper + * + * @author 科技小王子 + * @since 2024-10-16 13:41:21 + */ +public interface CompanyContentMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CompanyContentParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CompanyContentParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/CompanyGitMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/CompanyGitMapper.java new file mode 100644 index 0000000..345650f --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/CompanyGitMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.CompanyGit; +import com.gxwebsoft.common.system.param.CompanyGitParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 代码仓库Mapper + * + * @author 科技小王子 + * @since 2024-10-19 18:08:51 + */ +public interface CompanyGitMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CompanyGitParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CompanyGitParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/CompanyMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/CompanyMapper.java new file mode 100644 index 0000000..28b534f --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/CompanyMapper.java @@ -0,0 +1,62 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.system.entity.Company; +import com.gxwebsoft.common.system.param.CompanyParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 企业信息Mapper + * + * @author 科技小王子 + * @since 2023-05-27 14:57:34 + */ +public interface CompanyMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CompanyParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CompanyParam param); + + @InterceptorIgnore(tenantLine = "true") + List getCount(@Param("param") CompanyParam param); + + @InterceptorIgnore(tenantLine = "true") + List selectPageRelAll(PageParam page, CompanyParam param); + + @InterceptorIgnore(tenantLine = "true") + Company getCompanyAll(@Param("companyId") Integer companyId); + + @InterceptorIgnore(tenantLine = "true") + void updateByCompanyId(@Param("param") Company company); + + @InterceptorIgnore(tenantLine = "true") + boolean removeCompanyAll(Integer id); + + @InterceptorIgnore(tenantLine = "true") + boolean undeleteAll(Integer id); + + @InterceptorIgnore(tenantLine = "true") + boolean updateByIdAll(Company company); + + @InterceptorIgnore(tenantLine = "true") + Company getByTenantId(Integer tenantId); +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/CompanyParameterMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/CompanyParameterMapper.java new file mode 100644 index 0000000..c55b5f0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/CompanyParameterMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.CompanyParameter; +import com.gxwebsoft.common.system.param.CompanyParameterParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 应用参数Mapper + * + * @author 科技小王子 + * @since 2024-10-17 15:30:24 + */ +public interface CompanyParameterMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CompanyParameterParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CompanyParameterParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/CompanyUrlMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/CompanyUrlMapper.java new file mode 100644 index 0000000..117ed2b --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/CompanyUrlMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.CompanyUrl; +import com.gxwebsoft.common.system.param.CompanyUrlParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 应用域名Mapper + * + * @author 科技小王子 + * @since 2024-10-17 15:30:24 + */ +public interface CompanyUrlMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CompanyUrlParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CompanyUrlParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/DictDataMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/DictDataMapper.java new file mode 100644 index 0000000..f36039f --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/DictDataMapper.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.DictData; +import com.gxwebsoft.common.system.param.DictDataParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 字典数据Mapper + * + * @author WebSoft + * @since 2020-03-14 11:29:04 + */ +public interface DictDataMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") DictDataParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") DictDataParam param); + + /** + * 根据dictCode和dictDataName查询 + * + * @param dictCode 字典标识 + * @param dictDataName 字典项名称 + * @return List + */ + List getByDictCodeAndName(@Param("dictCode") String dictCode, + @Param("dictDataName") String dictDataName); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/DictMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/DictMapper.java new file mode 100644 index 0000000..ce19779 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/DictMapper.java @@ -0,0 +1,14 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gxwebsoft.common.system.entity.Dict; + +/** + * 字典Mapper + * + * @author WebSoft + * @since 2020-03-14 11:29:03 + */ +public interface DictMapper extends BaseMapper { + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/DictionaryDataMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/DictionaryDataMapper.java new file mode 100644 index 0000000..519c2ba --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/DictionaryDataMapper.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.DictionaryData; +import com.gxwebsoft.common.system.param.DictionaryDataParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 字典数据Mapper + * + * @author WebSoft + * @since 2020-03-14 11:29:04 + */ +public interface DictionaryDataMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") DictionaryDataParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") DictionaryDataParam param); + + /** + * 根据dictCode和dictDataName查询 + * + * @param dictCode 字典标识 + * @param dictDataName 字典项名称 + * @return List + */ + List getByDictCodeAndName(@Param("dictCode") String dictCode, + @Param("dictDataName") String dictDataName); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/DictionaryMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/DictionaryMapper.java new file mode 100644 index 0000000..7c2cbac --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/DictionaryMapper.java @@ -0,0 +1,14 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gxwebsoft.common.system.entity.Dictionary; + +/** + * 字典Mapper + * + * @author WebSoft + * @since 2020-03-14 11:29:03 + */ +public interface DictionaryMapper extends BaseMapper { + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/DomainMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/DomainMapper.java new file mode 100644 index 0000000..2853001 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/DomainMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.Domain; +import com.gxwebsoft.common.system.param.DomainParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 授权域名Mapper + * + * @author 科技小王子 + * @since 2024-09-19 23:56:33 + */ +public interface DomainMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") DomainParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") DomainParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/EmailRecordMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/EmailRecordMapper.java new file mode 100644 index 0000000..02611c9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/EmailRecordMapper.java @@ -0,0 +1,14 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gxwebsoft.common.system.entity.EmailRecord; + +/** + * 邮件记录Mapper + * + * @author WebSoft + * @since 2020-03-14 11:29:04 + */ +public interface EmailRecordMapper extends BaseMapper { + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/FileRecordMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/FileRecordMapper.java new file mode 100644 index 0000000..fe9f0b8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/FileRecordMapper.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.FileRecord; +import com.gxwebsoft.common.system.param.FileRecordParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 文件上传记录Mapper + * + * @author WebSoft + * @since 2021-08-30 11:18:04 + */ +public interface FileRecordMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") FileRecordParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") FileRecordParam param); + + /** + * 根据path查询 + * + * @param path 文件路径 + * @return FileRecord + */ + @InterceptorIgnore(tenantLine = "true") + List getByIdPath(@Param("path") String path); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/LoginRecordMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/LoginRecordMapper.java new file mode 100644 index 0000000..4409fdd --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/LoginRecordMapper.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.LoginRecord; +import com.gxwebsoft.common.system.param.LoginRecordParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 登录日志Mapper + * + * @author WebSoft + * @since 2018-12-24 16:10:11 + */ +public interface LoginRecordMapper extends BaseMapper { + + /** + * 添加, 排除租户拦截 + * + * @param entity LoginRecord + * @return int + */ + @Override + @InterceptorIgnore(tenantLine = "true") + int insert(LoginRecord entity); + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") LoginRecordParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") LoginRecordParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/MenuMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/MenuMapper.java new file mode 100644 index 0000000..938ef17 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/MenuMapper.java @@ -0,0 +1,22 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gxwebsoft.common.system.entity.Menu; +import com.gxwebsoft.common.system.param.MenuParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 菜单Mapper + * + * @author WebSoft + * @since 2018-12-24 16:10:32 + */ +public interface MenuMapper extends BaseMapper { + @InterceptorIgnore(tenantLine = "true") + List getMenuByClone(@Param("param") MenuParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/OperationRecordMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/OperationRecordMapper.java new file mode 100644 index 0000000..8750c2a --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/OperationRecordMapper.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.OperationRecord; +import com.gxwebsoft.common.system.param.OperationRecordParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 操作日志Mapper + * + * @author WebSoft + * @since 2018-12-24 16:10:03 + */ +public interface OperationRecordMapper extends BaseMapper { + + /** + * 添加, 排除租户拦截 + * + * @param entity OperationRecord + * @return int + */ + @Override + @InterceptorIgnore(tenantLine = "true") + int insert(OperationRecord entity); + + /** + * 分页查询 + * + * @param page 分页参数 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OperationRecordParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OperationRecordParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/OrganizationMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/OrganizationMapper.java new file mode 100644 index 0000000..6f06689 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/OrganizationMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.Organization; +import com.gxwebsoft.common.system.param.OrganizationParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 组织机构Mapper + * + * @author WebSoft + * @since 2020-03-14 11:29:04 + */ +public interface OrganizationMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OrganizationParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OrganizationParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/PaymentMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/PaymentMapper.java new file mode 100644 index 0000000..c58aeb8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/PaymentMapper.java @@ -0,0 +1,40 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.Payment; +import com.gxwebsoft.common.system.param.PaymentParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 支付方式Mapper + * + * @author 科技小王子 + * @since 2024-05-11 12:39:11 + */ +public interface PaymentMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") PaymentParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") PaymentParam param); + + @InterceptorIgnore(tenantLine = "true") + Payment getByType(@Param("param") PaymentParam paymentParam); +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/PlugMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/PlugMapper.java new file mode 100644 index 0000000..600b1a2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/PlugMapper.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.Plug; +import com.gxwebsoft.common.system.param.PlugParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 插件扩展Mapper + * + * @author 科技小王子 + * @since 2023-05-18 11:57:37 + */ +public interface PlugMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + @InterceptorIgnore(tenantLine = "true") + List selectPageRel(@Param("page") IPage page, + @Param("param") PlugParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") PlugParam param); + + @InterceptorIgnore(tenantLine = "true") + List getMenuByClone(@Param("param") PlugParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/RoleMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/RoleMapper.java new file mode 100644 index 0000000..b00f275 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/RoleMapper.java @@ -0,0 +1,14 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gxwebsoft.common.system.entity.Role; + +/** + * 角色Mapper + * + * @author WebSoft + * @since 2018-12-24 16:10:44 + */ +public interface RoleMapper extends BaseMapper { + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/RoleMenuMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/RoleMenuMapper.java new file mode 100644 index 0000000..a225765 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/RoleMenuMapper.java @@ -0,0 +1,39 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gxwebsoft.common.system.entity.Menu; +import com.gxwebsoft.common.system.entity.RoleMenu; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 角色菜单Mapper + * + * @author WebSoft + * @since 2018-12-24 16:10:21 + */ +public interface RoleMenuMapper extends BaseMapper { + + /** + * 查询用户的菜单 + * + * @param userId 用户id + * @param menuType 菜单类型 + * @return List + */ + @InterceptorIgnore(tenantLine = "true") + List listMenuByUserId(@Param("userId") Integer userId, @Param("menuType") Integer menuType); + + /** + * 根据角色id查询菜单 + * + * @param roleIds 角色id + * @param menuType 菜单类型 + * @return List + */ + @InterceptorIgnore(tenantLine = "true") + List listMenuByRoleIds(@Param("roleIds") List roleIds, @Param("menuType") Integer menuType); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/SettingMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/SettingMapper.java new file mode 100644 index 0000000..243f2d8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/SettingMapper.java @@ -0,0 +1,41 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.Setting; +import com.gxwebsoft.common.system.param.SettingParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 系统设置Mapper + * + * @author WebSoft + * @since 2022-11-19 13:54:27 + */ +public interface SettingMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") SettingParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") SettingParam param); + + @InterceptorIgnore(tenantLine = "true") + Setting getBySettingKeyIgnore(@Param("param") SettingParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/TenantMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/TenantMapper.java new file mode 100644 index 0000000..17f4a25 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/TenantMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.Tenant; +import com.gxwebsoft.common.system.param.TenantParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 租户Mapper + * + * @author 科技小王子 + * @since 2023-07-17 17:49:53 + */ +public interface TenantMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") TenantParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") TenantParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/UserBalanceLogMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/UserBalanceLogMapper.java new file mode 100644 index 0000000..f986c44 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/UserBalanceLogMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.UserBalanceLog; +import com.gxwebsoft.common.system.param.UserBalanceLogParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 用户余额变动明细表Mapper + * + * @author 科技小王子 + * @since 2023-04-21 15:59:09 + */ +public interface UserBalanceLogMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") UserBalanceLogParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") UserBalanceLogParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/UserCollectionMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/UserCollectionMapper.java new file mode 100644 index 0000000..b7330da --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/UserCollectionMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.UserCollection; +import com.gxwebsoft.common.system.param.UserCollectionParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 我的收藏Mapper + * + * @author 科技小王子 + * @since 2024-04-28 18:08:32 + */ +public interface UserCollectionMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") UserCollectionParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") UserCollectionParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/UserFileMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/UserFileMapper.java new file mode 100644 index 0000000..d9e4bb4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/UserFileMapper.java @@ -0,0 +1,14 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gxwebsoft.common.system.entity.UserFile; + +/** + * 用户文件Mapper + * + * @author WebSoft + * @since 2022-07-21 14:34:40 + */ +public interface UserFileMapper extends BaseMapper { + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/UserMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/UserMapper.java new file mode 100644 index 0000000..41c8be0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/UserMapper.java @@ -0,0 +1,70 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.cms.entity.CmsWebsite; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.param.UserParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 用户Mapper + * + * @author WebSoft + * @since 2018-12-24 16:10:14 + */ +public interface UserMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") UserParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") UserParam param); + + /** + * 根据账号查询 + * + * @param username 账号 + * @param tenantId 租户id + * @return User + */ + @InterceptorIgnore(tenantLine = "true") + User selectByUsername(@Param("username") String username, @Param("tenantId") Integer tenantId); + + @InterceptorIgnore(tenantLine = "true") + List getOne(@Param("param") UserParam param); + + List selectListStatisticsRel(@Param("param") UserParam param); + + @InterceptorIgnore(tenantLine = "true") + void updateByUserId(@Param("param") User param); + + /** + * 根据用户ID查询用户(忽略租户隔离) + * @param userId 用户ID + * @return User + */ + @InterceptorIgnore(tenantLine = "true") + User selectByIdIgnoreTenant(@Param("userId") Integer userId); + + @InterceptorIgnore(tenantLine = "true") + List pageAdminByPhone(@Param("param") UserParam param); + + @InterceptorIgnore(tenantLine = "true") + List listByAlert(); +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/UserRefereeMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/UserRefereeMapper.java new file mode 100644 index 0000000..e729045 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/UserRefereeMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.UserReferee; +import com.gxwebsoft.common.system.param.UserRefereeParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 用户推荐关系表Mapper + * + * @author 科技小王子 + * @since 2023-10-07 22:56:36 + */ +public interface UserRefereeMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") UserRefereeParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") UserRefereeParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/UserRoleMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/UserRoleMapper.java new file mode 100644 index 0000000..51b38c8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/UserRoleMapper.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.common.system.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gxwebsoft.common.system.entity.Role; +import com.gxwebsoft.common.system.entity.UserRole; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 用户角色Mapper + * + * @author WebSoft + * @since 2018-12-24 16:10:02 + */ +public interface UserRoleMapper extends BaseMapper { + + /** + * 批量添加用户角色 + * + * @param userId 用户id + * @param roleIds 角色id集合 + * @return int + */ + int insertBatch(@Param("userId") Integer userId, @Param("roleIds") List roleIds); + + /** + * 根据用户id查询角色 + * + * @param userId 用户id + * @return List + */ + @InterceptorIgnore(tenantLine = "true") + List selectByUserId(@Param("userId") Integer userId); + + /** + * 批量根据用户id查询角色 + * + * @param userIds 用户id集合 + * @return List + */ + List selectByUserIds(@Param("userIds") List userIds); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/CompanyCommentMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/CompanyCommentMapper.xml new file mode 100644 index 0000000..0e04c48 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/CompanyCommentMapper.xml @@ -0,0 +1,53 @@ + + + + + + + SELECT a.* + FROM sys_company_comment a + + + AND a.id = #{param.id} + + + AND a.parent_id = #{param.parentId} + + + AND a.user_id = #{param.userId} + + + AND a.company_id = #{param.companyId} + + + AND a.rate = #{param.rate} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/CompanyContentMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/CompanyContentMapper.xml new file mode 100644 index 0000000..06207e5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/CompanyContentMapper.xml @@ -0,0 +1,38 @@ + + + + + + + SELECT a.* + FROM sys_company_content a + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/CompanyGitMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/CompanyGitMapper.xml new file mode 100644 index 0000000..bf8c616 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/CompanyGitMapper.xml @@ -0,0 +1,65 @@ + + + + + + + SELECT a.* + FROM sys_company_git a + + + AND a.id = #{param.id} + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.brand = #{param.brand} + + + AND a.company_id = #{param.companyId} + + + AND a.domain LIKE CONCAT('%', #{param.domain}, '%') + + + AND a.account LIKE CONCAT('%', #{param.account}, '%') + + + AND a.password LIKE CONCAT('%', #{param.password}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND ( + a.title LIKE CONCAT('%', #{param.keywords}, '%') + OR a.domain LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/CompanyMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/CompanyMapper.xml new file mode 100644 index 0000000..ad61d39 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/CompanyMapper.xml @@ -0,0 +1,198 @@ + + + + + + + SELECT a.*,b.tenant_id,b.tenant_name,b.tenant_code,c.title as categoryName + FROM gxwebsoft_core.sys_company a + LEFT JOIN gxwebsoft_core.sys_tenant b ON a.tenant_id = b.tenant_id + LEFT JOIN gxwebsoft_core.cms_navigation c ON a.category_id = c.navigation_id + + + AND a.company_id = #{param.companyId} + + + AND a.type = #{param.type} + + + AND a.official = #{param.official} + + + AND a.category_id = #{param.categoryId} + + + AND a.short_name LIKE CONCAT('%', #{param.shortName}, '%') + + + AND a.company_name LIKE CONCAT('%', #{param.companyName}, '%') + + + AND a.company_type = #{param.companyType} + + + AND a.company_logo LIKE CONCAT('%', #{param.companyLogo}, '%') + + + AND a.domain LIKE CONCAT('%', #{param.domain}, '%') + + + AND a.phone = #{param.phone} + + + AND a.Invoice_header LIKE CONCAT('%', #{param.invoiceHeader}, '%') + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') + + + AND a.version = #{param.version} + + + AND a.members = #{param.members} + + + AND a.industry_parent LIKE CONCAT('%', #{param.industryParent}, '%') + + + AND a.industry_child LIKE CONCAT('%', #{param.industryChild}, '%') + + + AND a.departments = #{param.departments} + + + AND a.country LIKE CONCAT('%', #{param.country}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.longitude LIKE CONCAT('%', #{param.longitude}, '%') + + + AND a.latitude LIKE CONCAT('%', #{param.latitude}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.authentication = #{param.authentication} + + + AND a.status = #{param.status} + + + AND a.app_type = #{param.appType} + + + AND a.user_id = #{param.userId} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND a.authoritative = #{param.authoritative} + + + AND a.recommend = 1 + + + AND a.short_name = #{param.appName} + + + AND a.email = #{param.email} + + + AND a.merchant_id = #{param.merchantId} + + + AND a.company_id IN + + #{item} + + + + AND (a.company_name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.short_name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.tenant_id = #{param.keywords} + OR a.phone = #{param.keywords} + OR a.domain LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + + + + + + + + + + + + UPDATE sys_company SET storage = #{param.storage} WHERE company_id = #{param.companyId} + + + + + UPDATE sys_company SET deleted = 1 WHERE company_id = #{param.companyId} + + + + UPDATE sys_company SET deleted = 0 WHERE company_id = #{param.companyId} + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/CompanyParameterMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/CompanyParameterMapper.xml new file mode 100644 index 0000000..eabfba2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/CompanyParameterMapper.xml @@ -0,0 +1,50 @@ + + + + + + + SELECT a.* + FROM sys_company_parameter a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.value LIKE CONCAT('%', #{param.value}, '%') + + + AND a.company_id = #{param.companyId} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/CompanyUrlMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/CompanyUrlMapper.xml new file mode 100644 index 0000000..6db9462 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/CompanyUrlMapper.xml @@ -0,0 +1,59 @@ + + + + + + + SELECT a.* + FROM sys_company_url a + + + AND a.id = #{param.id} + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.company_id = #{param.companyId} + + + AND a.domain LIKE CONCAT('%', #{param.domain}, '%') + + + AND a.account LIKE CONCAT('%', #{param.account}, '%') + + + AND a.password LIKE CONCAT('%', #{param.password}, '%') + + + AND a.qrcode LIKE CONCAT('%', #{param.qrcode}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/DictDataMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/DictDataMapper.xml new file mode 100644 index 0000000..a831629 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/DictDataMapper.xml @@ -0,0 +1,71 @@ + + + + + + + SELECT a.*, + b.dict_code, + b.dict_name + FROM gxwebsoft_core.sys_dict_data a + LEFT JOIN gxwebsoft_core.sys_dict b ON a.dict_id = b.dict_id + + AND a.deleted = 0 + + AND a.dict_data_id = #{param.dictDataId} + + + AND a.dict_id = #{param.dictId} + + + AND a.dict_data_code LIKE CONCAT('%', #{param.dictDataCode}, '%') + + + AND a.dict_data_name LIKE CONCAT('%', #{param.dictDataName}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND b.dict_code = #{param.dictCode} + + + AND b.dict_name = #{param.dictName} + + + AND ( + a.dict_data_code LIKE CONCAT('%', #{param.keywords}, '%') + OR a.dict_data_name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/DictMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/DictMapper.xml new file mode 100644 index 0000000..db709ae --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/DictMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/DictionaryDataMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/DictionaryDataMapper.xml new file mode 100644 index 0000000..886303b --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/DictionaryDataMapper.xml @@ -0,0 +1,71 @@ + + + + + + + SELECT a.*, + b.dict_code, + b.dict_name + FROM sys_dictionary_data a + LEFT JOIN gxwebsoft_core.sys_dictionary b ON a.dict_id = b.dict_id + + AND a.deleted = 0 + + AND a.dict_data_id = #{param.dictDataId} + + + AND a.dict_id = #{param.dictId} + + + AND a.dict_data_code LIKE CONCAT('%', #{param.dictDataCode}, '%') + + + AND a.dict_data_name LIKE CONCAT('%', #{param.dictDataName}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND b.dict_code = #{param.dictCode} + + + AND b.dict_name = #{param.dictName} + + + AND ( + a.dict_data_code LIKE CONCAT('%', #{param.keywords}, '%') + OR a.dict_data_name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/DictionaryMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/DictionaryMapper.xml new file mode 100644 index 0000000..8cd0cff --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/DictionaryMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/DomainMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/DomainMapper.xml new file mode 100644 index 0000000..1299cf7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/DomainMapper.xml @@ -0,0 +1,62 @@ + + + + + + + SELECT a.* + FROM sys_domain a + + + AND a.id = #{param.id} + + + AND a.domain LIKE CONCAT('%', #{param.domain}, '%') + + + AND a.host_name LIKE CONCAT('%', #{param.hostName}, '%') + + + AND a.host_value LIKE CONCAT('%', #{param.hostValue}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.type = #{param.type} + + + AND a.status = #{param.status} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.user_id = #{param.userId} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/EmailRecordMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/EmailRecordMapper.xml new file mode 100644 index 0000000..7b5ad62 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/EmailRecordMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/FileRecordMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/FileRecordMapper.xml new file mode 100644 index 0000000..1a7dd22 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/FileRecordMapper.xml @@ -0,0 +1,76 @@ + + + + + + + SELECT a.*, + b.username create_username, + b.nickname create_nickname, + b.avatar, + c.merchant_code + FROM sys_file_record a + LEFT JOIN gxwebsoft_core.sys_user b ON a.create_user_id = b.user_id + LEFT JOIN shop_merchant c ON a.merchant_code = c.merchant_code + + + AND a.id = #{param.id} + + + AND a.`name` LIKE CONCAT('%', #{param.name}, '%') + + + AND a.path LIKE CONCAT('%', #{param.path}, '%') + + + AND a.create_user_id = #{param.createUserId} + + + AND a.group_id = #{param.groupId} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND b.username = #{param.createUsername} + + + AND b.nickname LIKE CONCAT('%', #{param.createNickname}, '%') + + + AND a.content_type LIKE CONCAT('%', #{param.contentType}, '%') + + + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/LoginRecordMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/LoginRecordMapper.xml new file mode 100644 index 0000000..397c525 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/LoginRecordMapper.xml @@ -0,0 +1,62 @@ + + + + + + + SELECT a.*, + b.user_id, + b.nickname + FROM sys_login_record a + LEFT JOIN gxwebsoft_core.sys_user b ON a.username = b.username + + + AND a.id = #{param.id} + + + AND a.username LIKE CONCAT('%', #{param.username}, '%') + + + AND a.os LIKE CONCAT('%', #{param.os}, '%') + + + AND a.device LIKE CONCAT('%', #{param.device}, '%') + + + AND a.browser LIKE CONCAT('%', #{param.browser}, '%') + + + AND a.ip LIKE CONCAT('%', #{param.ip}, '%') + + + AND a.login_type LIKE CONCAT('%', #{param.loginType}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND b.user_id = #{param.userId} + + + AND b.nickname LIKE CONCAT('%', #{param.nickname}, '%') + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/MenuMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/MenuMapper.xml new file mode 100644 index 0000000..0897489 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/MenuMapper.xml @@ -0,0 +1,32 @@ + + + + + + + SELECT a.* + FROM sys_menu a + + + AND a.menu_id = #{param.menuId} + + + AND a.parent_id = #{param.parentId} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.tenant_id = #{param.tenantId} + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/OperationRecordMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/OperationRecordMapper.xml new file mode 100644 index 0000000..56b7fad --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/OperationRecordMapper.xml @@ -0,0 +1,71 @@ + + + + + + + SELECT a.*, + b.nickname, + b.username + FROM gxwebsoft_core.sys_operation_record a + LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id + + + AND a.id = #{param.id} + + + AND a.user_id = #{param.userId} + + + AND a.module LIKE CONCAT('%', #{param.module}, '%') + + + AND a.description LIKE CONCAT('%', #{param.description}, '%') + + + AND a.url LIKE CONCAT('%', #{param.url}, '%') + + + AND a.request_method = #{param.requestMethod} + + + AND a.method LIKE CONCAT('%', #{param.method}, '%') + + + AND a.description LIKE CONCAT('%', #{param.description}, '%') + + + AND a.ip LIKE CONCAT('%', #{param.ip}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.`status` = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND b.username LIKE CONCAT('%', #{param.username}, '%') + + + AND b.nickname LIKE CONCAT('%', #{param.nickname}, '%') + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/OrganizationMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/OrganizationMapper.xml new file mode 100644 index 0000000..ed5d3c8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/OrganizationMapper.xml @@ -0,0 +1,98 @@ + + + + + + + SELECT ta.* + FROM sys_dictionary_data ta + LEFT JOIN gxwebsoft_core.sys_dictionary tb + ON ta.dict_id = tb.dict_id + AND tb.deleted = 0 + WHERE ta.deleted = 0 + AND tb.dict_code = 'organization_type' + + + + + SELECT a.*, + b.dict_data_name organization_type_name, + c.nickname leader_nickname, + c.username leader_username + FROM sys_organization a + LEFT JOIN ( + + ) b ON a.organization_type = b.dict_data_code + LEFT JOIN gxwebsoft_core.sys_user c ON a.leader_id = c.user_id + + AND a.deleted = 0 + + AND a.organization_id = #{param.organizationId} + + + AND a.parent_id = #{param.parentId} + + + AND a.organization_name LIKE CONCAT('%', #{param.organizationName}, '%') + + + AND a.organization_full_name LIKE CONCAT('%', #{param.organizationFullName}, '%') + + + AND a.organization_code LIKE CONCAT('%', #{param.organizationCode}, '%') + + + AND a.organization_type = #{param.organizationType} + + + AND a.province = #{param.province} + + + AND a.city = #{param.city} + + + AND a.region = #{param.province} + + + AND a.zip_code = #{param.zipCode} + + + AND a.leader_id = #{param.leaderId} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND b.dict_data_name LIKE CONCAT('%', #{param.organizationTypeName}, '%') + + + AND c.nickname LIKE CONCAT('%', #{param.leaderNickname}, '%') + + + AND c.username LIKE CONCAT('%', #{param.leaderUsername}, '%') + + + AND ( + a.organization_name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/PaymentMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/PaymentMapper.xml new file mode 100644 index 0000000..d54c4bc --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/PaymentMapper.xml @@ -0,0 +1,90 @@ + + + + + + + SELECT a.* + FROM gxwebsoft_core.sys_payment a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.type = #{param.type} + + + AND a.code = #{param.code} + + + AND a.wechat_type = #{param.wechatType} + + + AND a.app_id LIKE CONCAT('%', #{param.appId}, '%') + + + AND a.mch_id LIKE CONCAT('%', #{param.mchId}, '%') + + + AND a.api_key LIKE CONCAT('%', #{param.apiKey}, '%') + + + AND a.apiclient_cert LIKE CONCAT('%', #{param.apiclientCert}, '%') + + + AND a.apiclient_key LIKE CONCAT('%', #{param.apiclientKey}, '%') + + + AND a.merchant_serial_number LIKE CONCAT('%', #{param.merchantSerialNumber}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.tenant_id = #{param.tenantId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/PlugMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/PlugMapper.xml new file mode 100644 index 0000000..45e3aac --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/PlugMapper.xml @@ -0,0 +1,105 @@ + + + + + + + SELECT a.*,b.tenant_name,c.company_name,c.short_name,c.domain + FROM sys_plug a + LEFT JOIN gxwebsoft_core.sys_tenant b ON a.tenant_id = b.tenant_id + LEFT JOIN gxwebsoft_core.sys_company c ON a.tenant_id = c.tenant_id + + + AND a.plug_id = #{param.plugId} + + + AND a.menu_id = #{param.menuId} + + + AND a.parent_id = #{param.parentId} + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.path LIKE CONCAT('%', #{param.path}, '%') + + + AND a.component LIKE CONCAT('%', #{param.component}, '%') + + + AND a.menu_type = #{param.menuType} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.authority LIKE CONCAT('%', #{param.authority}, '%') + + + AND a.target LIKE CONCAT('%', #{param.target}, '%') + + + AND a.icon LIKE CONCAT('%', #{param.icon}, '%') + + + AND a.color LIKE CONCAT('%', #{param.color}, '%') + + + AND a.hide = #{param.hide} + + + AND a.active LIKE CONCAT('%', #{param.active}, '%') + + + AND a.meta LIKE CONCAT('%', #{param.meta}, '%') + + + AND a.app_id = #{param.appId} + + + AND a.user_id = #{param.userId} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.title LIKE CONCAT('%', #{param.keywords}, '%') + OR a.menu_id = #{param.keywords} + OR c.company_name LIKE CONCAT('%', #{param.keywords}, '%') + OR c.short_name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/RoleMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/RoleMapper.xml new file mode 100644 index 0000000..9f6facc --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/RoleMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/RoleMenuMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/RoleMenuMapper.xml new file mode 100644 index 0000000..141c53c --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/RoleMenuMapper.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/SettingMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/SettingMapper.xml new file mode 100644 index 0000000..f99a88f --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/SettingMapper.xml @@ -0,0 +1,33 @@ + + + + + + + SELECT a.* + FROM gxwebsoft_core.sys_setting a + + + AND a.setting_key = #{param.settingKey} + + + AND a.setting_id = #{param.settingId} + + + AND a.tenant_id = #{param.tenantId} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/TenantMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/TenantMapper.xml new file mode 100644 index 0000000..83ba5b2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/TenantMapper.xml @@ -0,0 +1,56 @@ + + + + + + + SELECT a.* + FROM sys_tenant a + + + AND a.tenant_id = #{param.tenantId} + + + AND a.tenant_name LIKE CONCAT('%', #{param.tenantName}, '%') + + + AND a.tenant_code LIKE CONCAT('%', #{param.tenantCode}, '%') + + + AND a.logo LIKE CONCAT('%', #{param.logo}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.user_id = #{param.userId} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/UserCollectionMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/UserCollectionMapper.xml new file mode 100644 index 0000000..9b60a69 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/UserCollectionMapper.xml @@ -0,0 +1,38 @@ + + + + + + + SELECT a.* + FROM sys_user_collection a + + + AND a.id = #{param.id} + + + AND a.tid = #{param.tid} + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/UserFileMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/UserFileMapper.xml new file mode 100644 index 0000000..872b232 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/UserFileMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/UserMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/UserMapper.xml new file mode 100644 index 0000000..c16fae8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/UserMapper.xml @@ -0,0 +1,264 @@ + + + + + + + SELECT ta.* + FROM gxwebsoft_core.sys_dictionary_data ta + LEFT JOIN gxwebsoft_core.sys_dictionary tb + ON ta.dict_id = tb.dict_id + AND tb.deleted = 0 + WHERE ta.deleted = 0 + AND tb.dict_code = 'sex' + + + + + SELECT a.user_id, + GROUP_CONCAT(b.role_name) role_name + FROM gxwebsoft_core.sys_user_role a + LEFT JOIN gxwebsoft_core.sys_role b ON a.role_id = b.role_id + GROUP BY a.user_id + + + + + SELECT a.*, + c.dict_data_name sex_name, + e.tenant_name, + h.dealer_id + FROM gxwebsoft_core.sys_user a + LEFT JOIN ( + + ) c ON a.sex = c.dict_data_code + LEFT JOIN( + + ) d ON a.user_id = d.user_id + LEFT JOIN gxwebsoft_core.sys_tenant e ON a.tenant_id = e.tenant_id + LEFT JOIN gxwebsoft_core.sys_user_referee h ON a.user_id = h.user_id and h.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.username LIKE CONCAT('%', #{param.username}, '%') + + + AND a.nickname LIKE CONCAT('%', #{param.nickname}, '%') + + + AND a.type = #{param.type} + + + AND a.sex = #{param.sex} + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.email LIKE CONCAT('%', #{param.email}, '%') + + + AND a.email_verified = #{param.emailVerified} + + + AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') + + + AND a.company_name LIKE CONCAT('%', #{param.companyName}, '%') + + + AND a.id_card LIKE CONCAT('%', #{param.idCard}, '%') + + + AND a.birthday LIKE CONCAT('%', #{param.birthday}, '%') + + + AND a.organization_id = #{param.organizationId} + + + AND a.organization_id > 0 + + + AND a.platform = #{param.platform} + + + AND a.`status` = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND a.recommend = #{param.recommend} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id IN (SELECT user_id FROM sys_user_role WHERE role_id=#{param.roleId}) + + + AND a.user_id IN + + #{item} + + + + AND a.phones IN + + #{item} + + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND i.city_mate LIKE CONCAT('%', #{param.cityMate}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND c.dict_data_name = #{param.sexName} + + + AND ( + a.username LIKE CONCAT('%', #{param.keywords}, '%') + OR a.user_id = #{param.keywords} + OR a.nickname LIKE CONCAT('%', #{param.keywords}, '%') + OR a.real_name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.alias LIKE CONCAT('%', #{param.keywords}, '%') + OR a.phone LIKE CONCAT('%', #{param.keywords}, '%') + OR a.email LIKE CONCAT('%', #{param.keywords}, '%') + OR c.dict_data_name LIKE CONCAT('%', #{param.keywords}, '%') + OR d.role_name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + AND a.organization_id IN (SELECT organization_id FROM sys_organization WHERE parent_id=#{param.parentId}) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE gxwebsoft_core.sys_user SET grade_id = #{param.gradeId} WHERE user_id = #{param.userId} + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/UserRefereeMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/UserRefereeMapper.xml new file mode 100644 index 0000000..67943f7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/UserRefereeMapper.xml @@ -0,0 +1,50 @@ + + + + + + + SELECT a.* + FROM sys_user_referee a + + + AND a.id = #{param.id} + + + AND a.dealer_id = #{param.dealerId} + + + AND a.user_id = #{param.userId} + + + AND a.level = #{param.level} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/UserRoleMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/UserRoleMapper.xml new file mode 100644 index 0000000..cdaa3c3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/UserRoleMapper.xml @@ -0,0 +1,35 @@ + + + + + + INSERT INTO gxwebsoft_core.sys_user_role(user_id, role_id) VALUES + + (#{userId}, #{roleId}) + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/common/system/param/AlipayParam.java b/src/main/java/com/gxwebsoft/common/system/param/AlipayParam.java new file mode 100644 index 0000000..9888a3c --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/AlipayParam.java @@ -0,0 +1,31 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** + * 登录参数 + * + * @author WebSoft + * @since 2021-08-30 17:35:16 + */ +@Data +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "登录参数") +public class AlipayParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "支付宝授权码") + private String authCode; + + @Schema(description = "登录账号") + private String username; + + @Schema(description = "租户id") + private Integer tenantId; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/CacheParam.java b/src/main/java/com/gxwebsoft/common/system/param/CacheParam.java new file mode 100644 index 0000000..082e278 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/CacheParam.java @@ -0,0 +1,25 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** + * 缓存管理 + * + * @author WebSoft + * @since 2021-08-30 17:35:16 + */ +@Data +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "缓存管理") +public class CacheParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "key") + private String key; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/CompanyCommentParam.java b/src/main/java/com/gxwebsoft/common/system/param/CompanyCommentParam.java new file mode 100644 index 0000000..b2fdcf8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/CompanyCommentParam.java @@ -0,0 +1,58 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 应用评论查询参数 + * + * @author 科技小王子 + * @since 2024-10-17 15:30:24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CompanyCommentParam对象", description = "应用评论查询参数") +public class CompanyCommentParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "父级ID") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "评分") + @QueryField(type = QueryType.EQ) + private BigDecimal rate; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "评论内容") + private String comments; + + @Schema(description = "状态") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/CompanyContentParam.java b/src/main/java/com/gxwebsoft/common/system/param/CompanyContentParam.java new file mode 100644 index 0000000..1a5ff5e --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/CompanyContentParam.java @@ -0,0 +1,35 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 应用详情查询参数 + * + * @author 科技小王子 + * @since 2024-10-16 13:41:21 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CompanyContentParam对象", description = "应用详情查询参数") +public class CompanyContentParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "详细内容") + private String content; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/CompanyGitParam.java b/src/main/java/com/gxwebsoft/common/system/param/CompanyGitParam.java new file mode 100644 index 0000000..7786857 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/CompanyGitParam.java @@ -0,0 +1,60 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 代码仓库查询参数 + * + * @author 科技小王子 + * @since 2024-10-19 18:08:51 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CompanyGitParam对象", description = "代码仓库查询参数") +public class CompanyGitParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "仓库名称") + private String title; + + @Schema(description = "厂商") + @QueryField(type = QueryType.EQ) + private String brand; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "仓库地址") + private String domain; + + @Schema(description = "账号") + private String account; + + @Schema(description = "密码") + private String password; + + @Schema(description = "仓库描述") + private String comments; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1待确认") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/CompanyParam.java b/src/main/java/com/gxwebsoft/common/system/param/CompanyParam.java new file mode 100644 index 0000000..6c48c51 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/CompanyParam.java @@ -0,0 +1,167 @@ +package com.gxwebsoft.common.system.param; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Set; + +/** + * 企业信息查询参数 + * + * @author 科技小王子 + * @since 2023-05-27 14:57:34 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CompanyParam对象", description = "企业信息查询参数") +public class CompanyParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "企业id") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "应用类型") + private Integer type; + + @Schema(description = "是否官方") + private Boolean official; + + @Schema(description = "企业简称") + private String shortName; + + @Schema(description = "企业全称") + private String companyName; + + @Schema(description = "企业标识") + private String companyCode; + + @Schema(description = "类型 10企业 20政府单位") + @QueryField(type = QueryType.EQ) + private String companyType; + + @Schema(description = "企业类型 多选") + private String companyTypeMultiple; + + @Schema(description = "应用标识") + private String companyLogo; + + @Schema(description = "栏目分类") + @QueryField(type = QueryType.EQ) + private Integer categoryId; + + @Schema(description = "企业域名") + private String domain; + + @Schema(description = "联系电话") + private String phone; + + @Schema(description = "电子邮箱") + @QueryField(type = QueryType.EQ) + private String email; + + @Schema(description = "企业法人") + private String businessEntity; + + @Schema(description = "发票抬头") + private String invoiceHeader; + + @Schema(description = "服务开始时间") + private String startTime; + + @Schema(description = "服务到期时间") + private String expirationTime; + + @Schema(description = "应用版本 10体验版 20授权版 30旗舰版") + @QueryField(type = QueryType.EQ) + private Integer version; + + @Schema(description = "成员数量") + @QueryField(type = QueryType.EQ) + private Integer members; + + @Schema(description = "行业类型(父级)") + private String industryParent; + + @Schema(description = "行业类型(子级)") + private String industryChild; + + @Schema(description = "部门数量") + @QueryField(type = QueryType.EQ) + private Integer departments; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否实名认证") + @QueryField(type = QueryType.EQ) + private Integer authentication; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Boolean recommend; + + @Schema(description = "应用类型 app应用 plug插件") + private String appType; + + @Schema(description = "状态") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "商户ID") + @QueryField(type = QueryType.EQ) + private Long merchantId; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "是否默认企业主体") + @QueryField(type = QueryType.EQ) + private Boolean authoritative; + + @Schema(description = "租户号") + private Integer tenantId; + + @Schema(description = "应用名称") + @QueryField(type = QueryType.EQ) + private String appName; + + @Schema(description = "企业id集合") + @TableField(exist = false) + private Set companyIds; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/CompanyParameterParam.java b/src/main/java/com/gxwebsoft/common/system/param/CompanyParameterParam.java new file mode 100644 index 0000000..91c97b0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/CompanyParameterParam.java @@ -0,0 +1,50 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 应用参数查询参数 + * + * @author 科技小王子 + * @since 2024-10-17 15:30:24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CompanyParameterParam对象", description = "应用参数查询参数") +public class CompanyParameterParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "参数名称") + private String name; + + @Schema(description = "参数内容") + private String value; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1待确认") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/CompanyUrlParam.java b/src/main/java/com/gxwebsoft/common/system/param/CompanyUrlParam.java new file mode 100644 index 0000000..e0576e4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/CompanyUrlParam.java @@ -0,0 +1,59 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 应用域名查询参数 + * + * @author 科技小王子 + * @since 2024-10-17 15:30:24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CompanyUrlParam对象", description = "应用域名查询参数") +public class CompanyUrlParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "域名类型") + private String type; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "域名") + private String domain; + + @Schema(description = "账号") + private String account; + + @Schema(description = "密码") + private String password; + + @Schema(description = "二维码") + private String qrcode; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1待确认") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/DictDataParam.java b/src/main/java/com/gxwebsoft/common/system/param/DictDataParam.java new file mode 100644 index 0000000..19e4c0a --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/DictDataParam.java @@ -0,0 +1,55 @@ +package com.gxwebsoft.common.system.param; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 字典数据查询参数 + * + * @author WebSoft + * @since 2021-08-28 22:12:02 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "字典数据查询参数") +public class DictDataParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "字典数据id") + @QueryField(type = QueryType.EQ) + private Integer dictDataId; + + @Schema(description = "字典id") + @QueryField(type = QueryType.EQ) + private Integer dictId; + + @Schema(description = "字典数据标识") + private String dictDataCode; + + @Schema(description = "字典数据名称") + private String dictDataName; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "字典代码") + @TableField(exist = false) + private String dictCode; + + @Schema(description = "字典名称") + @TableField(exist = false) + private String dictName; + + @Schema(description = "字典数据代码或字典数据名称") + @TableField(exist = false) + private String keywords; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/DictParam.java b/src/main/java/com/gxwebsoft/common/system/param/DictParam.java new file mode 100644 index 0000000..2957409 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/DictParam.java @@ -0,0 +1,38 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 字典查询参数 + * + * @author WebSoft + * @since 2021-08-28 22:12:01 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "字典查询参数") +public class DictParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + @Schema(description = "字典id") + private Integer dictId; + + @Schema(description = "字典标识") + private String dictCode; + + @Schema(description = "字典名称") + private String dictName; + + @Schema(description = "备注") + private String comments; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/DictionaryDataParam.java b/src/main/java/com/gxwebsoft/common/system/param/DictionaryDataParam.java new file mode 100644 index 0000000..f9cbc21 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/DictionaryDataParam.java @@ -0,0 +1,55 @@ +package com.gxwebsoft.common.system.param; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 字典数据查询参数 + * + * @author WebSoft + * @since 2021-08-28 22:12:02 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "字典数据查询参数") +public class DictionaryDataParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "字典数据id") + @QueryField(type = QueryType.EQ) + private Integer dictDataId; + + @Schema(description = "字典id") + @QueryField(type = QueryType.EQ) + private Integer dictId; + + @Schema(description = "字典数据标识") + private String dictDataCode; + + @Schema(description = "字典数据名称") + private String dictDataName; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "字典代码") + @TableField(exist = false) + private String dictCode; + + @Schema(description = "字典名称") + @TableField(exist = false) + private String dictName; + + @Schema(description = "字典数据代码或字典数据名称") + @TableField(exist = false) + private String keywords; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/DictionaryParam.java b/src/main/java/com/gxwebsoft/common/system/param/DictionaryParam.java new file mode 100644 index 0000000..0e70378 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/DictionaryParam.java @@ -0,0 +1,38 @@ +package com.gxwebsoft.common.system.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 字典查询参数 + * + * @author WebSoft + * @since 2021-08-28 22:12:01 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "字典查询参数") +public class DictionaryParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + @Schema(description = "字典id") + private Integer dictId; + + @Schema(description = "字典标识") + private String dictCode; + + @Schema(description = "字典名称") + private String dictName; + + @Schema(description = "备注") + private String comments; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/DomainParam.java b/src/main/java/com/gxwebsoft/common/system/param/DomainParam.java new file mode 100644 index 0000000..c842644 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/DomainParam.java @@ -0,0 +1,61 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 授权域名查询参数 + * + * @author 科技小王子 + * @since 2024-09-19 23:56:33 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "DomainParam对象", description = "授权域名查询参数") +public class DomainParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "域名") + private String domain; + + @Schema(description = "主机记录") + private String hostName; + + @Schema(description = "记录值") + private String hostValue; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "类型 0常规 1后台 2商家端") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "状态") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/FileRecordParam.java b/src/main/java/com/gxwebsoft/common/system/param/FileRecordParam.java new file mode 100644 index 0000000..bb8d33e --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/FileRecordParam.java @@ -0,0 +1,70 @@ +package com.gxwebsoft.common.system.param; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 文件上传记录查询参数 + * + * @author WebSoft + * @since 2021-08-30 11:29:31 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "文件上传记录查询参数") +public class FileRecordParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + @Schema(description = "主键id") + private Integer id; + + @QueryField(type = QueryType.EQ) + @Schema(description = "分组ID") + private String groupId; + + @Schema(description = "文件名称") + private String name; + + @Schema(description = "文件存储路径") + private String path; + + @QueryField(type = QueryType.EQ) + @Schema(description = "创建人") + private Integer createUserId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "文件类型") + private String contentType; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "创建人账号") + @TableField(exist = false) + private String createUsername; + + @Schema(description = "创建人名称") + @TableField(exist = false) + private String createNickname; + + @Schema(description = "用户头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "商户编号") + private String merchantCode; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/LoginParam.java b/src/main/java/com/gxwebsoft/common/system/param/LoginParam.java new file mode 100644 index 0000000..039db8b --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/LoginParam.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** + * 登录参数 + * + * @author WebSoft + * @since 2021-08-30 17:35:16 + */ +@Data +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "登录参数") +public class LoginParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "账号") + private String username; + + @Schema(description = "手机号码") + private String phone; + + @Schema(description = "短信验证码") + private String code; + + @Schema(description = "密码") + private String password; + + @Schema(description = "租户id") + private Integer tenantId; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/LoginRecordParam.java b/src/main/java/com/gxwebsoft/common/system/param/LoginRecordParam.java new file mode 100644 index 0000000..833b056 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/LoginRecordParam.java @@ -0,0 +1,60 @@ +package com.gxwebsoft.common.system.param; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 登录日志查询参数 + * + * @author WebSoft + * @since 2021-08-29 19:09:23 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "登录日志查询参数") +public class LoginRecordParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + @Schema(description = "主键id") + private Integer id; + + @Schema(description = "用户账号") + private String username; + + @Schema(description = "操作系统") + private String os; + + @Schema(description = "设备名") + private String device; + + @Schema(description = "浏览器类型") + private String browser; + + @Schema(description = "ip地址") + private String ip; + + @QueryField(type = QueryType.EQ) + @Schema(description = "操作类型, 0登录成功, 1登录失败, 2退出登录, 3续签token") + private Integer loginType; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "用户id") + @TableField(exist = false) + private Integer userId; + + @Schema(description = "用户昵称") + @TableField(exist = false) + private String nickname; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/MenuImportParam.java b/src/main/java/com/gxwebsoft/common/system/param/MenuImportParam.java new file mode 100644 index 0000000..7245b24 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/MenuImportParam.java @@ -0,0 +1,60 @@ +package com.gxwebsoft.common.system.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 菜单导入参数 + * + * @author WebSoft + * @since 2025-09-30 + */ +@Data +public class MenuImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "菜单ID") + private Integer menuId; + + @Excel(name = "父级ID") + private Integer parentId; + + @Excel(name = "菜单名称") + private String title; + + @Excel(name = "路由地址") + private String path; + + @Excel(name = "组件路径") + private String component; + + @Excel(name = "模块ID") + private String modules; + + @Excel(name = "模块API") + private String modulesUrl; + + @Excel(name = "菜单类型") + private Integer menuType; + + @Excel(name = "排序号") + private Integer sortNumber; + + @Excel(name = "权限标识") + private String authority; + + @Excel(name = "图标") + private String icon; + + @Excel(name = "是否隐藏") + private Integer hide; + + @Excel(name = "关联应用") + private Integer appId; + + @Excel(name = "租户id") + private Integer tenantId; + +} \ No newline at end of file diff --git a/src/main/java/com/gxwebsoft/common/system/param/MenuParam.java b/src/main/java/com/gxwebsoft/common/system/param/MenuParam.java new file mode 100644 index 0000000..33fd5bd --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/MenuParam.java @@ -0,0 +1,83 @@ +package com.gxwebsoft.common.system.param; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 菜单查询参数 + * + * @author WebSoft + * @since 2021-08-29 19:36:10 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "菜单查询参数") +public class MenuParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "菜单id") + @QueryField(type = QueryType.EQ) + private Integer menuId; + + @Schema(description = "上级id, 0是顶级") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "菜单名称") + private String title; + + @Schema(description = "菜单路由关键字") + private String path; + + @Schema(description = "菜单组件地址") + private String component; + + @Schema(description = "模块ID") + private String modules; + + @Schema(description = "菜单类型, 0菜单, 1按钮") + @QueryField(type = QueryType.EQ) + private Integer menuType; + + @Schema(description = "打开方式, 0当前页, 1新窗口") + @TableField(exist = false) + private Integer openType; + + @Schema(description = "权限标识") + private String authority; + + @Schema(description = "菜单图标") + private String icon; + + @Schema(description = "关联应用") + private Integer appId; + + @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示左侧菜单)") + @QueryField(type = QueryType.EQ) + private Integer hide; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户ID") + @QueryField(type = QueryType.EQ) + private Integer tenantId; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "租户名称") + @TableField(exist = false) + private String tenantName; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/OperationRecordParam.java b/src/main/java/com/gxwebsoft/common/system/param/OperationRecordParam.java new file mode 100644 index 0000000..26b6478 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/OperationRecordParam.java @@ -0,0 +1,67 @@ +package com.gxwebsoft.common.system.param; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 操作日志参数 + * + * @author WebSoft + * @since 2021-08-29 20:35:09 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "操作日志参数") +public class OperationRecordParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键id") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "用户id") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "操作模块") + private String module; + + @Schema(description = "操作功能") + private String description; + + @Schema(description = "请求地址") + private String url; + + @Schema(description = "请求方式") + private String requestMethod; + + @Schema(description = "调用方法") + private String method; + + @Schema(description = "ip地址") + private String ip; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0成功, 1异常") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "用户账号") + @TableField(exist = false) + private String username; + + @Schema(description = "用户昵称") + @TableField(exist = false) + private String nickname; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/OrganizationParam.java b/src/main/java/com/gxwebsoft/common/system/param/OrganizationParam.java new file mode 100644 index 0000000..5081089 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/OrganizationParam.java @@ -0,0 +1,81 @@ +package com.gxwebsoft.common.system.param; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 组织机构查询参数 + * + * @author WebSoft + * @since 2021-08-29 20:35:09 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "组织机构查询参数") +public class OrganizationParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "机构id") + @QueryField(type = QueryType.EQ) + private Integer organizationId; + + @Schema(description = "上级id, 0是顶级") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "机构名称") + private String organizationName; + + @Schema(description = "机构全称") + private String organizationFullName; + + @Schema(description = "机构代码") + private String organizationCode; + + @Schema(description = "机构类型(字典代码)") + private String organizationType; + + @Schema(description = "所在省份") + @QueryField(type = QueryType.EQ) + private String province; + + @Schema(description = "所在城市") + @QueryField(type = QueryType.EQ) + private String city; + + @Schema(description = "所在辖区") + @QueryField(type = QueryType.EQ) + private String region; + + @Schema(description = "邮政编码") + @QueryField(type = QueryType.EQ) + private String zipCode; + + @Schema(description = "负责人id") + @QueryField(type = QueryType.EQ) + private Integer leaderId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "机构类型名称") + @TableField(exist = false) + private String organizationTypeName; + + @Schema(description = "负责人姓名") + @TableField(exist = false) + private String leaderNickname; + + @Schema(description = "负责人账号") + @TableField(exist = false) + private String leaderUsername; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/PaymentParam.java b/src/main/java/com/gxwebsoft/common/system/param/PaymentParam.java new file mode 100644 index 0000000..c814fcd --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/PaymentParam.java @@ -0,0 +1,81 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 支付方式查询参数 + * + * @author 科技小王子 + * @since 2024-05-11 12:39:11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "PaymentParam对象", description = "支付方式查询参数") +public class PaymentParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "支付方式") + private String name; + + @Schema(description = "类型") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "标识") + @QueryField(type = QueryType.EQ) + private String code; + + @Schema(description = "微信商户号类型 1普通商户2子商户") + @QueryField(type = QueryType.EQ) + private Integer wechatType; + + @Schema(description = "应用ID") + private String appId; + + @Schema(description = "商户号") + private String mchId; + + @Schema(description = "设置APIv3密钥") + private String apiKey; + + @Schema(description = "证书文件 (CERT)") + private String apiclientCert; + + @Schema(description = "证书文件 (KEY)") + private String apiclientKey; + + @Schema(description = "商户证书序列号") + private String merchantSerialNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "文章排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0启用, 1禁用") + @QueryField(type = QueryType.EQ) + private Boolean status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "租户ID") + @QueryField(type = QueryType.EQ) + private Integer tenantId; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/PlugParam.java b/src/main/java/com/gxwebsoft/common/system/param/PlugParam.java new file mode 100644 index 0000000..3c32d42 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/PlugParam.java @@ -0,0 +1,95 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 插件扩展查询参数 + * + * @author 科技小王子 + * @since 2023-05-18 11:57:37 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "PlugParam对象", description = "插件扩展查询参数") +public class PlugParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "插件id") + @QueryField(type = QueryType.EQ) + private Integer plugId; + + @Schema(description = "菜单id") + @QueryField(type = QueryType.EQ) + private Integer menuId; + + @Schema(description = "上级id, 0是顶级") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "菜单名称") + private String title; + + @Schema(description = "菜单路由地址") + private String path; + + @Schema(description = "菜单组件地址, 目录可为空") + private String component; + + @Schema(description = "类型, 0菜单, 1按钮") + @QueryField(type = QueryType.EQ) + private Integer menuType; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "权限标识") + private String authority; + + @Schema(description = "打开位置") + private String target; + + @Schema(description = "菜单图标") + private String icon; + + @Schema(description = "图标颜色") + private String color; + + @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") + @QueryField(type = QueryType.EQ) + private Integer hide; + + @Schema(description = "菜单侧栏选中的path") + private String active; + + @Schema(description = "其它路由元信息") + private String meta; + + @Schema(description = "关联应用ID") + @QueryField(type = QueryType.EQ) + private Integer appId; + + @Schema(description = "状态") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "商户编码") + private String merchantCode; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/RoleParam.java b/src/main/java/com/gxwebsoft/common/system/param/RoleParam.java new file mode 100644 index 0000000..d07e3b5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/RoleParam.java @@ -0,0 +1,41 @@ +package com.gxwebsoft.common.system.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 角色查询参数 + * + * @author WebSoft + * @since 2021-08-29 20:35:09 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "角色查询参数") +public class RoleParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "角色id") + @QueryField(type = QueryType.EQ) + private Integer roleId; + + @Schema(description = "角色标识") + private String roleCode; + + @Schema(description = "角色名称") + private String roleName; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "租户ID") + private Integer tenantId; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/SettingParam.java b/src/main/java/com/gxwebsoft/common/system/param/SettingParam.java new file mode 100644 index 0000000..324195b --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/SettingParam.java @@ -0,0 +1,50 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 系统设置查询参数 + * + * @author WebSoft + * @since 2022-11-19 13:54:27 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "SettingParam对象", description = "系统设置查询参数") +public class SettingParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "id") + @QueryField(type = QueryType.EQ) + private Integer settingId; + + @Schema(description = "设置项标示") + @QueryField(type = QueryType.EQ) + private String settingKey; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "同步更新租户名称") + private String tenantName; + + @Schema(description = "租户名称") + private Integer tenantId; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/SmsCaptchaParam.java b/src/main/java/com/gxwebsoft/common/system/param/SmsCaptchaParam.java new file mode 100644 index 0000000..7d1f5b5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/SmsCaptchaParam.java @@ -0,0 +1,31 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** + * 发送短信验证码参数 + * + * @author WebSoft + * @since 2021-08-30 17:35:16 + */ +@Data +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "发送短信验证码参数") +public class SmsCaptchaParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "短信签名") + private String signName; + + @Schema(description = "手机号码") + private String phone; + + @Schema(description = "短信模板") + private String TemplateParam; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/TenantParam.java b/src/main/java/com/gxwebsoft/common/system/param/TenantParam.java new file mode 100644 index 0000000..03b57c3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/TenantParam.java @@ -0,0 +1,55 @@ +package com.gxwebsoft.common.system.param; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 租户查询参数 + * + * @author 科技小王子 + * @since 2023-07-17 17:49:53 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "TenantParam对象", description = "租户查询参数") +public class TenantParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "租户名称") + private String tenantName; + + @Schema(description = "租户编号") + private String tenantCode; + + @Schema(description = "logo") + private String logo; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "租户id") + @QueryField(type = QueryType.EQ) + private Integer tenantId; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/UpdatePasswordParam.java b/src/main/java/com/gxwebsoft/common/system/param/UpdatePasswordParam.java new file mode 100644 index 0000000..8b67b74 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/UpdatePasswordParam.java @@ -0,0 +1,31 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** + * 修改密码参数 + * + * @author WebSoft + * @since 2021-08-30 17:35:16 + */ +@Data +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "修改密码参数") +public class UpdatePasswordParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "原始密码") + private String oldPassword; + + @Schema(description = "新密码") + private String password; + + @Schema(description = "手机号码") + private String phone; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/UserBalanceLogParam.java b/src/main/java/com/gxwebsoft/common/system/param/UserBalanceLogParam.java new file mode 100644 index 0000000..1977e31 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/UserBalanceLogParam.java @@ -0,0 +1,77 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 用户余额变动明细表查询参数 + * + * @author 科技小王子 + * @since 2023-04-21 15:59:09 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "UserBalanceLogParam对象", description = "用户余额变动明细表查询参数") +public class UserBalanceLogParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer logId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "余额变动场景(10用户充值 20用户消费 30管理员操作 40订单退款)") + @QueryField(type = QueryType.EQ) + private Integer scene; + + @Schema(description = "变动金额") + @QueryField(type = QueryType.EQ) + private BigDecimal money; + + @Schema(description = "变动后余额") + @QueryField(type = QueryType.EQ) + private BigDecimal balance; + + @Schema(description = "描述/说明") + private String describe; + + @Schema(description = "管理员备注") + private String remark; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "商户编码") + private String merchantCode; + + @Schema(description = "昵称") + private String nickname; + + @Schema(description = "余额变动场景筛选") + private String sceneMultiple; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/UserCollectionParam.java b/src/main/java/com/gxwebsoft/common/system/param/UserCollectionParam.java new file mode 100644 index 0000000..85106e3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/UserCollectionParam.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 我的收藏查询参数 + * + * @author 科技小王子 + * @since 2024-04-28 18:08:32 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "UserCollectionParam对象", description = "我的收藏查询参数") +public class UserCollectionParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "租户ID") + @QueryField(type = QueryType.EQ) + private Integer tid; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/UserFileParam.java b/src/main/java/com/gxwebsoft/common/system/param/UserFileParam.java new file mode 100644 index 0000000..5404354 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/UserFileParam.java @@ -0,0 +1,40 @@ +package com.gxwebsoft.common.system.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户文件查询参数 + * + * @author WebSoft + * @since 2022-07-21 14:34:40 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "UserFileParam对象", description = "用户文件查询参数") +public class UserFileParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键id") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "用户id") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "文件名称") + private String name; + + @Schema(description = "上级id") + @QueryField(type = QueryType.EQ) + private Integer parentId; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/UserImportParam.java b/src/main/java/com/gxwebsoft/common/system/param/UserImportParam.java new file mode 100644 index 0000000..153a783 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/UserImportParam.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.common.system.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 用户导入参数 + * + * @author WebSoft + * @since 2011-10-15 17:33:34 + */ +@Data +public class UserImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "账号") + private String username; + + @Excel(name = "密码") + private String password; + + @Excel(name = "昵称") + private String nickname; + + @Excel(name = "手机号") + private String phone; + + @Excel(name = "邮箱") + private String email; + + @Excel(name = "组织机构") + private String organizationName; + + @Excel(name = "性别") + private String sexName; + + @Excel(name = "角色") + private String roleName; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/UserParam.java b/src/main/java/com/gxwebsoft/common/system/param/UserParam.java new file mode 100644 index 0000000..2ade1fd --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/UserParam.java @@ -0,0 +1,249 @@ +package com.gxwebsoft.common.system.param; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Set; + +/** + * 用户查询参数 + * + * @author WebSoft + * @since 2021-08-29 20:35:09 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "用户查询参数") +public class UserParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "用户id") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "用户类型, 0普通用户 10企业用户") + private Integer type; + + @Schema(description = "账号") + private String username; + + @Schema(description = "昵称") + private String nickname; + + @Schema(description = "用户编码") + private String userCode; + + @Schema(description = "性别(字典)") + @QueryField(type = QueryType.EQ) + private String sex; + + @Schema(description = "手机号") + private String phone; + + @Schema(description = "邮箱") + private String email; + + @Schema(description = "邮箱是否验证, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer emailVerified; + + @Schema(description = "别名") + private String alias; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "身份证号") + private String idCard; + + @Schema(description = "出生日期") + private String birthday; + + @Schema(description = "年龄") + private Integer age; + + @Schema(description = "可用余额") + private BigDecimal balance; + + @Schema(description = "机构id") + @QueryField(type = QueryType.EQ) + private Integer organizationId; + + @Schema(description = "用户分组ID") + @QueryField(type = QueryType.EQ) + private Integer groupId; + + @Schema(description = "注册来源客户端") + @QueryField(type = QueryType.EQ) + private String platform; + + @Schema(description = "是否下线会员") + private Integer offline; + + @Schema(description = "上级机构ID") + @QueryField(type = QueryType.IN) + private Integer parentId; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "角色id") + @TableField(exist = false) + private Integer roleId; + + @Schema(description = "角色标识") + @TableField(exist = false) + private String roleCode; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "关注数") + private Integer followers; + + @Schema(description = "粉丝数") + private Integer fans; + + @Schema(description = "获赞数") + private Integer likes; + + @Schema(description = "评论数") + private Integer commentNumbers; + + @Schema(description = "择偶区域") + @TableField(exist = false) + private String cityMate; + + @Schema(description = "机构名称") + @TableField(exist = false) + private String organizationName; + + @Schema(description = "公司名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "公司名称") + private String customerName; + + @Schema(description = "性别名称") + @TableField(exist = false) + private String sexName; + + @Schema(description = "推荐状态") + @TableField(exist = false) + private Integer recommend; + + @Schema(description = "搜索关键字") + @TableField(exist = false) + private String keywords; + + @Schema(description = "会员等级") + @TableField(exist = false) + private Integer gradeId; + + @Schema(description = "按角色搜索") + @TableField(exist = false) + private String roleIds; + + @Schema(description = "用户类型 sys系统用户 org机构职员 member商城会员 ") + @TableField(exist = false) + private String userType; + + @Schema(description = "支付宝授权码") + @TableField(exist = false) + private String authCode; + + @Schema(description = "微信凭证code") + @TableField(exist = false) + private String code; + + @Schema(description = "推荐人ID") + @QueryField(type = QueryType.IN) + private Integer refereeId; + + @Schema(description = "租户ID") + private Integer tenantId; + + @Schema(description = "二维码类型") + @TableField(exist = false) + private String codeType; + + @Schema(description = "二维码内容 填网址扫码后可跳转") + @TableField(exist = false) + private String codeContent; + + @Schema(description = "是否内部职员") + @TableField(exist = false) + private Boolean isStaff; + + @Schema(description = "是否管理员") + @TableField(exist = false) + private Boolean isAdmin; + + @Schema(description = "openid") + private String openid; + + @Schema(description = "unionid") + private String unionid; + + @Schema(description = "最后结算时间") + @TableField(exist = false) + private String settlementTime; + + @Schema(description = "报餐时间") + @TableField(exist = false) + private String deliveryTime; + + @Schema(description = "用户ID集合") + @TableField(exist = false) + private Set userIds; + + @Schema(description = "用户手机号码集合") + @TableField(exist = false) + private Set phones; + + @Schema(description = "是否查询用户详细资料表") + @TableField(exist = false) + private Boolean showProfile; + + @Schema(description = "openId") + @TableField(exist = false) + private String openId; + + @Schema(description = "可管理的商户") + @QueryField(type = QueryType.LIKE) + private String merchants; + + @Schema(description = "商户ID") + @QueryField(type = QueryType.EQ) + private Long merchantId; + + @Schema(description = "商户名称") + private String merchantName; + + @Schema(description = "关联用户ID") + @TableField(exist = false) + private Integer sysUserId; +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/UserRefereeParam.java b/src/main/java/com/gxwebsoft/common/system/param/UserRefereeParam.java new file mode 100644 index 0000000..3d5389c --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/UserRefereeParam.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户推荐关系表查询参数 + * + * @author 科技小王子 + * @since 2023-10-07 22:56:36 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "UserRefereeParam对象", description = "用户推荐关系表查询参数") +public class UserRefereeParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "推荐人ID") + @QueryField(type = QueryType.EQ) + private Integer dealerId; + + @Schema(description = "用户id(被推荐人)") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "推荐关系层级(1,2,3)") + @QueryField(type = QueryType.EQ) + private Integer level; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/param/VersionParam.java b/src/main/java/com/gxwebsoft/common/system/param/VersionParam.java new file mode 100644 index 0000000..ad369da --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/param/VersionParam.java @@ -0,0 +1,70 @@ +package com.gxwebsoft.common.system.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 版本更新查询参数 + * + * @author 科技小王子 + * @since 2024-01-15 18:52:24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "VersionParam对象", description = "版本更新查询参数") +public class VersionParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "版本名") + private String versionName; + + @Schema(description = "版本号") + @QueryField(type = QueryType.EQ) + private Integer versionCode; + + @Schema(description = "下载链接") + private String androidDownloadUrl; + + @Schema(description = "下载链接") + private String iosDownloadUrl; + + @Schema(description = "更新日志") + private String updateInfo; + + @Schema(description = "强制更新") + @QueryField(type = QueryType.EQ) + private Integer isHard; + + @Schema(description = "热更") + @QueryField(type = QueryType.EQ) + private Integer isHot; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "文章排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/result/CaptchaResult.java b/src/main/java/com/gxwebsoft/common/system/result/CaptchaResult.java new file mode 100644 index 0000000..46bd08f --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/result/CaptchaResult.java @@ -0,0 +1,30 @@ +package com.gxwebsoft.common.system.result; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 验证码返回结果 + * + * @author WebSoft + * @since 2021-08-30 17:35:16 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "验证码返回结果") +public class CaptchaResult implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "图形验证码base64数据") + private String base64; + + @Schema(description = "验证码文本") + private String text; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/result/LoginResult.java b/src/main/java/com/gxwebsoft/common/system/result/LoginResult.java new file mode 100644 index 0000000..940d8e9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/result/LoginResult.java @@ -0,0 +1,31 @@ +package com.gxwebsoft.common.system.result; + +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 登录返回结果 + * + * @author WebSoft + * @since 2021-08-30 17:35:16 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "登录返回结果") +public class LoginResult implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "access_token") + private String access_token; + + @Schema(description = "用户信息") + private User user; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/result/RedisResult.java b/src/main/java/com/gxwebsoft/common/system/result/RedisResult.java new file mode 100644 index 0000000..f53282b --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/result/RedisResult.java @@ -0,0 +1,34 @@ +package com.gxwebsoft.common.system.result; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * Redis缓存数据 + * + * @author WebSoft + * @since 2021-08-30 17:35:16 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "缓存数据返回") +public class RedisResult implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "key") + private String key; + + @Schema(description = "数据") + private T data; + + @Schema(description = "过期时间") + private LocalDateTime expireTime; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/result/SmsCaptchaResult.java b/src/main/java/com/gxwebsoft/common/system/result/SmsCaptchaResult.java new file mode 100644 index 0000000..8f5bb2a --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/result/SmsCaptchaResult.java @@ -0,0 +1,26 @@ +package com.gxwebsoft.common.system.result; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 短信验证码返回结果 + * + * @author WebSoft + * @since 2021-08-30 17:35:16 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Schema(description = "短信验证码返回结果") +public class SmsCaptchaResult implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "短信验证码") + private String text; +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/CompanyCommentService.java b/src/main/java/com/gxwebsoft/common/system/service/CompanyCommentService.java new file mode 100644 index 0000000..10ca95a --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/CompanyCommentService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.CompanyComment; +import com.gxwebsoft.common.system.param.CompanyCommentParam; + +import java.util.List; + +/** + * 应用评论Service + * + * @author 科技小王子 + * @since 2024-10-17 15:30:24 + */ +public interface CompanyCommentService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CompanyCommentParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CompanyCommentParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CompanyComment + */ + CompanyComment getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/CompanyContentService.java b/src/main/java/com/gxwebsoft/common/system/service/CompanyContentService.java new file mode 100644 index 0000000..e4e1ab4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/CompanyContentService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.CompanyContent; +import com.gxwebsoft.common.system.param.CompanyContentParam; + +import java.util.List; + +/** + * 应用详情Service + * + * @author 科技小王子 + * @since 2024-10-16 13:41:21 + */ +public interface CompanyContentService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CompanyContentParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CompanyContentParam param); + + /** + * 根据id查询 + * + * @param id + * @return CompanyContent + */ + CompanyContent getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/CompanyGitService.java b/src/main/java/com/gxwebsoft/common/system/service/CompanyGitService.java new file mode 100644 index 0000000..f3ac263 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/CompanyGitService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.CompanyGit; +import com.gxwebsoft.common.system.param.CompanyGitParam; + +import java.util.List; + +/** + * 代码仓库Service + * + * @author 科技小王子 + * @since 2024-10-19 18:08:51 + */ +public interface CompanyGitService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CompanyGitParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CompanyGitParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return CompanyGit + */ + CompanyGit getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/CompanyParameterService.java b/src/main/java/com/gxwebsoft/common/system/service/CompanyParameterService.java new file mode 100644 index 0000000..4ffa4c0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/CompanyParameterService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.CompanyParameter; +import com.gxwebsoft.common.system.param.CompanyParameterParam; + +import java.util.List; + +/** + * 应用参数Service + * + * @author 科技小王子 + * @since 2024-10-17 15:30:24 + */ +public interface CompanyParameterService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CompanyParameterParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CompanyParameterParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return CompanyParameter + */ + CompanyParameter getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/CompanyService.java b/src/main/java/com/gxwebsoft/common/system/service/CompanyService.java new file mode 100644 index 0000000..d675f59 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/CompanyService.java @@ -0,0 +1,51 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Company; +import com.gxwebsoft.common.system.param.CompanyParam; + +import java.util.List; + +/** + * 企业信息Service + * + * @author 科技小王子 + * @since 2023-05-27 14:57:34 + */ +public interface CompanyService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CompanyParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CompanyParam param); + + /** + * 根据id查询 + * + * @param companyId 企业id + * @return Company + */ + Company getByIdRel(Integer companyId); + + Company getByTenantIdRel(Integer tenantId); + + PageResult pageRelAll(CompanyParam param); + + void updateByCompanyId(Company company); + + boolean removeCompanyAll(Integer companyId); + + boolean undeleteAll(Integer companyId); +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/CompanyUrlService.java b/src/main/java/com/gxwebsoft/common/system/service/CompanyUrlService.java new file mode 100644 index 0000000..c2b2479 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/CompanyUrlService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.CompanyUrl; +import com.gxwebsoft.common.system.param.CompanyUrlParam; + +import java.util.List; + +/** + * 应用域名Service + * + * @author 科技小王子 + * @since 2024-10-17 15:30:24 + */ +public interface CompanyUrlService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CompanyUrlParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CompanyUrlParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return CompanyUrl + */ + CompanyUrl getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/DictDataService.java b/src/main/java/com/gxwebsoft/common/system/service/DictDataService.java new file mode 100644 index 0000000..86b94bf --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/DictDataService.java @@ -0,0 +1,52 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.*; +import com.gxwebsoft.common.system.entity.DictData; +import com.gxwebsoft.common.system.param.DictDataParam; + +import java.util.List; + +/** + * 字典数据Service + * + * @author WebSoft + * @since 2020-03-14 11:29:04 + */ +public interface DictDataService extends IService { + + /** + * 关联分页查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(DictDataParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(DictDataParam param); + + /** + * 根据id查询 + * + * @param dictDataId 字典数据id + * @return DictData + */ + DictData getByIdRel(Integer dictDataId); + + /** + * 根据dictCode和dictDataName查询 + * + * @param dictCode 字典标识 + * @param dictDataName 字典项名称 + * @return DictData + */ + DictData getByDictCodeAndName(String dictCode, String dictDataName); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/DictService.java b/src/main/java/com/gxwebsoft/common/system/service/DictService.java new file mode 100644 index 0000000..8aef5ba --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/DictService.java @@ -0,0 +1,14 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.system.entity.Dict; + +/** + * 字典Service + * + * @author WebSoft + * @since 2020-03-14 11:29:03 + */ +public interface DictService extends IService { + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/DictionaryDataService.java b/src/main/java/com/gxwebsoft/common/system/service/DictionaryDataService.java new file mode 100644 index 0000000..881fd5a --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/DictionaryDataService.java @@ -0,0 +1,51 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.DictionaryData; +import com.gxwebsoft.common.system.param.DictionaryDataParam; + +import java.util.List; + +/** + * 字典数据Service + * + * @author WebSoft + * @since 2020-03-14 11:29:04 + */ +public interface DictionaryDataService extends IService { + + /** + * 关联分页查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(DictionaryDataParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(DictionaryDataParam param); + + /** + * 根据id查询 + * + * @param dictDataId 字典数据id + * @return DictionaryData + */ + DictionaryData getByIdRel(Integer dictDataId); + + /** + * 根据dictCode和dictDataName查询 + * + * @param dictCode 字典标识 + * @param dictDataName 字典项名称 + * @return DictionaryData + */ + DictionaryData getByDictCodeAndName(String dictCode, String dictDataName); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/DictionaryService.java b/src/main/java/com/gxwebsoft/common/system/service/DictionaryService.java new file mode 100644 index 0000000..4705494 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/DictionaryService.java @@ -0,0 +1,14 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.system.entity.Dictionary; + +/** + * 字典Service + * + * @author WebSoft + * @since 2020-03-14 11:29:03 + */ +public interface DictionaryService extends IService { + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/DomainService.java b/src/main/java/com/gxwebsoft/common/system/service/DomainService.java new file mode 100644 index 0000000..2996471 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/DomainService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Domain; +import com.gxwebsoft.common.system.param.DomainParam; + +import java.util.List; + +/** + * 授权域名Service + * + * @author 科技小王子 + * @since 2024-09-19 23:56:33 + */ +public interface DomainService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(DomainParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(DomainParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return Domain + */ + Domain getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/DomainServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/DomainServiceImpl.java new file mode 100644 index 0000000..9323228 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/DomainServiceImpl.java @@ -0,0 +1,46 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Domain; +import com.gxwebsoft.common.system.mapper.DomainMapper; +import com.gxwebsoft.common.system.param.DomainParam; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 授权域名Service实现 + * + * @author 科技小王子 + * @since 2024-09-19 23:56:33 + */ +@Service +public class DomainServiceImpl extends ServiceImpl implements DomainService { + + @Override + public PageResult pageRel(DomainParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(DomainParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public Domain getByIdRel(Integer id) { + DomainParam param = new DomainParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/EmailRecordService.java b/src/main/java/com/gxwebsoft/common/system/service/EmailRecordService.java new file mode 100644 index 0000000..b99a195 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/EmailRecordService.java @@ -0,0 +1,51 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.system.entity.EmailRecord; + +import javax.mail.MessagingException; +import java.io.IOException; +import java.util.Map; + +/** + * 邮件发送记录Service + * + * @author WebSoft + * @since 2019-06-19 04:07:02 + */ +public interface EmailRecordService extends IService { + + /** + * 发送普通邮件 + * + * @param title 标题 + * @param content 内容 + * @param toEmails 收件人 + */ + void sendTextEmail(String title, String content, String[] toEmails); + + /** + * 发送富文本邮件 + * + * @param title 标题 + * @param html 富文本 + * @param toEmails 收件人 + * @throws MessagingException MessagingException + */ + void sendFullTextEmail(String title, String html, String[] toEmails) throws MessagingException; + + /** + * 发送模板邮件 + * + * @param title 标题 + * @param path 模板路径 + * @param map 填充数据 + * @param toEmails 收件人 + * @throws MessagingException MessagingException + * @throws IOException IOException + */ + void sendHtmlEmail(String title, String path, Map map, String[] toEmails) + throws MessagingException, IOException; + + void sendEmail(String title, String content, String receiver); +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/FileRecordService.java b/src/main/java/com/gxwebsoft/common/system/service/FileRecordService.java new file mode 100644 index 0000000..3dd09ac --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/FileRecordService.java @@ -0,0 +1,58 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.FileRecord; +import com.gxwebsoft.common.system.param.FileRecordParam; + +import java.io.File; +import java.util.List; + +/** + * 文件上传记录Service + * + * @author WebSoft + * @since 2021-08-30 11:20:15 + */ +public interface FileRecordService extends IService { + + /** + * 关联分页查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(FileRecordParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(FileRecordParam param); + + /** + * 根据id查询 + * + * @param id id + * @return FileRecord + */ + FileRecord getByIdRel(Integer id); + + /** + * 根据path查询 + * + * @param path 文件路径 + * @return FileRecord + */ + FileRecord getByIdPath(String path); + + /** + * 异步删除文件 + * + * @param files 文件数组 + */ + void deleteFileAsync(List files); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/LoginRecordService.java b/src/main/java/com/gxwebsoft/common/system/service/LoginRecordService.java new file mode 100644 index 0000000..0c4adbf --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/LoginRecordService.java @@ -0,0 +1,54 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.LoginRecord; +import com.gxwebsoft.common.system.param.LoginRecordParam; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 登录日志Service + * + * @author WebSoft + * @since 2018-12-24 16:10:41 + */ +public interface LoginRecordService extends IService { + + /** + * 关联分页查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(LoginRecordParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(LoginRecordParam param); + + /** + * 根据id查询 + * + * @param id id + * @return LoginRecord + */ + LoginRecord getByIdRel(Integer id); + + /** + * 异步添加 + * + * @param username 用户账号 + * @param type 操作类型 + * @param comments 备注 + * @param tenantId 租户id + * @param request HttpServletRequest + */ + void saveAsync(String username, Integer type, String comments, Integer tenantId, HttpServletRequest request); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/MenuService.java b/src/main/java/com/gxwebsoft/common/system/service/MenuService.java new file mode 100644 index 0000000..db8e967 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/MenuService.java @@ -0,0 +1,18 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.system.entity.Menu; +import com.gxwebsoft.common.system.param.MenuParam; + +/** + * 菜单Service + * + * @author WebSoft + * @since 2018-12-24 16:10:31 + */ +public interface MenuService extends IService { + + Boolean cloneMenu(MenuParam param); + + Boolean install(Integer id); +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/OperationRecordService.java b/src/main/java/com/gxwebsoft/common/system/service/OperationRecordService.java new file mode 100644 index 0000000..227c4e6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/OperationRecordService.java @@ -0,0 +1,49 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.OperationRecord; +import com.gxwebsoft.common.system.param.OperationRecordParam; + +import java.util.List; + +/** + * 操作日志Service + * + * @author WebSoft + * @since 2018-12-24 16:10:01 + */ +public interface OperationRecordService extends IService { + + /** + * 关联分页查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OperationRecordParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OperationRecordParam param); + + /** + * 根据id查询 + * + * @param id id + * @return OperationRecord + */ + OperationRecord getByIdRel(Integer id); + + /** + * 异步添加 + * + * @param operationRecord OperationRecord + */ + void saveAsync(OperationRecord operationRecord); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/OrganizationService.java b/src/main/java/com/gxwebsoft/common/system/service/OrganizationService.java new file mode 100644 index 0000000..94d3407 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/OrganizationService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Organization; +import com.gxwebsoft.common.system.param.OrganizationParam; + +import java.util.List; + +/** + * 组织机构Service + * + * @author WebSoft + * @since 2020-03-14 11:29:04 + */ +public interface OrganizationService extends IService { + + /** + * 关联分页查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OrganizationParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OrganizationParam param); + + /** + * 根据id查询 + * + * @param organizationId 机构id + * @return Organization + */ + Organization getByIdRel(Integer organizationId); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/PaymentService.java b/src/main/java/com/gxwebsoft/common/system/service/PaymentService.java new file mode 100644 index 0000000..ae4f571 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/PaymentService.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Payment; +import com.gxwebsoft.common.system.param.PaymentParam; + +import java.util.List; + +/** + * 支付方式Service + * + * @author 科技小王子 + * @since 2024-05-11 12:39:11 + */ +public interface PaymentService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(PaymentParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(PaymentParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return Payment + */ + Payment getByIdRel(Integer id); + + Payment getByType(PaymentParam paymentParam); +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/PlugService.java b/src/main/java/com/gxwebsoft/common/system/service/PlugService.java new file mode 100644 index 0000000..18d1194 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/PlugService.java @@ -0,0 +1,44 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Plug; +import com.gxwebsoft.common.system.param.PlugParam; + +import java.util.List; + +/** + * 插件扩展Service + * + * @author 科技小王子 + * @since 2023-05-18 11:57:37 + */ +public interface PlugService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(PlugParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(PlugParam param); + + /** + * 根据id查询 + * + * @param menuId 菜单id + * @return Plug + */ + Plug getByIdRel(Integer menuId); + + Boolean cloneMenu(PlugParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/RoleMenuService.java b/src/main/java/com/gxwebsoft/common/system/service/RoleMenuService.java new file mode 100644 index 0000000..05a3d4f --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/RoleMenuService.java @@ -0,0 +1,35 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.system.entity.Menu; +import com.gxwebsoft.common.system.entity.RoleMenu; + +import java.util.List; + +/** + * 角色菜单Service + * + * @author WebSoft + * @since 2018-12-24 16:10:44 + */ +public interface RoleMenuService extends IService { + + /** + * 查询用户对应的菜单 + * + * @param userId 用户id + * @param menuType 菜单类型 + * @return List + */ + List listMenuByUserId(Integer userId, Integer menuType); + + /** + * 查询用户对应的菜单 + * + * @param roleIds 角色id + * @param menuType 菜单类型 + * @return List + */ + List listMenuByRoleIds(List roleIds, Integer menuType); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/RoleService.java b/src/main/java/com/gxwebsoft/common/system/service/RoleService.java new file mode 100644 index 0000000..3e76263 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/RoleService.java @@ -0,0 +1,14 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.system.entity.Role; + +/** + * 角色Service + * + * @author WebSoft + * @since 2018-12-24 16:10:32 + */ +public interface RoleService extends IService { + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/SettingService.java b/src/main/java/com/gxwebsoft/common/system/service/SettingService.java new file mode 100644 index 0000000..1478c90 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/SettingService.java @@ -0,0 +1,67 @@ +package com.gxwebsoft.common.system.service; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Setting; +import com.gxwebsoft.common.system.param.SettingParam; +import com.wechat.pay.java.core.Config; + +import java.util.List; + +/** + * 系统设置Service + * + * @author WebSoft + * @since 2022-11-19 13:54:27 + */ +public interface SettingService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(SettingParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(SettingParam param); + + /** + * 根据id查询 + * + * @param settingId id + * @return Setting + */ + Setting getByIdRel(Integer settingId); + + /** + * 通过key获取设置内容 + * @param key key + * @return Setting + */ + JSONObject getBySettingKey(String key,Integer tenantId); + + /** + * 跨租户获取设置内容 + * @param key 设置键 + * @param tenantId 租户ID + * @return JSONObject + */ + JSONObject getBySettingKeyIgnoreTenant(String key, Integer tenantId); + + Setting getData(String settingKey); + + JSONObject getCache(String key); + + void initConfig(Setting setting); + + Config getConfig(Integer tenantId); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/TenantService.java b/src/main/java/com/gxwebsoft/common/system/service/TenantService.java new file mode 100644 index 0000000..42614a4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/TenantService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Tenant; +import com.gxwebsoft.common.system.param.TenantParam; + +import java.util.List; + +/** + * 租户Service + * + * @author 科技小王子 + * @since 2023-07-17 17:49:53 + */ +public interface TenantService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(TenantParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(TenantParam param); + + /** + * 根据id查询 + * + * @param tenantId 租户id + * @return Tenant + */ + Tenant getByIdRel(Integer tenantId); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/UserBalanceLogService.java b/src/main/java/com/gxwebsoft/common/system/service/UserBalanceLogService.java new file mode 100644 index 0000000..eaa4e0d --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/UserBalanceLogService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.UserBalanceLog; +import com.gxwebsoft.common.system.param.UserBalanceLogParam; + +import java.util.List; + +/** + * 用户余额变动明细表Service + * + * @author 科技小王子 + * @since 2023-04-21 15:59:09 + */ +public interface UserBalanceLogService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(UserBalanceLogParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(UserBalanceLogParam param); + + /** + * 根据id查询 + * + * @param logId 主键ID + * @return UserBalanceLog + */ + UserBalanceLog getByIdRel(Integer logId); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/UserCollectionService.java b/src/main/java/com/gxwebsoft/common/system/service/UserCollectionService.java new file mode 100644 index 0000000..421c682 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/UserCollectionService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.UserCollection; +import com.gxwebsoft.common.system.param.UserCollectionParam; + +import java.util.List; + +/** + * 我的收藏Service + * + * @author 科技小王子 + * @since 2024-04-28 18:08:32 + */ +public interface UserCollectionService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(UserCollectionParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(UserCollectionParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return UserCollection + */ + UserCollection getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/UserCollectionServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/UserCollectionServiceImpl.java new file mode 100644 index 0000000..f5c174f --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/UserCollectionServiceImpl.java @@ -0,0 +1,46 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.UserCollection; +import com.gxwebsoft.common.system.mapper.UserCollectionMapper; +import com.gxwebsoft.common.system.param.UserCollectionParam; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 我的收藏Service实现 + * + * @author 科技小王子 + * @since 2024-04-28 18:08:32 + */ +@Service +public class UserCollectionServiceImpl extends ServiceImpl implements UserCollectionService { + + @Override + public PageResult pageRel(UserCollectionParam param) { + PageParam page = new PageParam<>(param); + //page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(UserCollectionParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + //page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public UserCollection getByIdRel(Integer id) { + UserCollectionParam param = new UserCollectionParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/UserFileService.java b/src/main/java/com/gxwebsoft/common/system/service/UserFileService.java new file mode 100644 index 0000000..2c8abe6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/UserFileService.java @@ -0,0 +1,14 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.system.entity.UserFile; + +/** + * 用户文件Service + * + * @author WebSoft + * @since 2022-07-21 14:34:40 + */ +public interface UserFileService extends IService { + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/UserRefereeService.java b/src/main/java/com/gxwebsoft/common/system/service/UserRefereeService.java new file mode 100644 index 0000000..e715c4f --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/UserRefereeService.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.UserReferee; +import com.gxwebsoft.common.system.param.UserRefereeParam; + +import java.util.List; + +/** + * 用户推荐关系表Service + * + * @author 科技小王子 + * @since 2023-10-07 22:56:36 + */ +public interface UserRefereeService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(UserRefereeParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(UserRefereeParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return UserReferee + */ + UserReferee getByIdRel(Integer id); + + UserReferee check(Integer dealerId, Integer userId); + + UserReferee getByUserId(Integer userId); +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/UserRoleService.java b/src/main/java/com/gxwebsoft/common/system/service/UserRoleService.java new file mode 100644 index 0000000..c87365b --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/UserRoleService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.system.entity.Role; +import com.gxwebsoft.common.system.entity.UserRole; + +import java.util.List; + +/** + * 用户角色Service + * + * @author WebSoft + * @since 2018-12-24 16:10:35 + */ +public interface UserRoleService extends IService { + + /** + * 批量添加用户角色 + * + * @param userId 用户id + * @param roleIds 角色id集合 + * @return int + */ + int saveBatch(Integer userId, List roleIds); + + /** + * 根据用户id查询角色 + * + * @param userId 用户id + * @return List + */ + List listByUserId(Integer userId); + + /** + * 批量根据用户id查询角色 + * + * @param userIds 用户id集合 + * @return List + */ + List listByUserIds(List userIds); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/UserService.java b/src/main/java/com/gxwebsoft/common/system/service/UserService.java new file mode 100644 index 0000000..2230d94 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/UserService.java @@ -0,0 +1,123 @@ +package com.gxwebsoft.common.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.cms.entity.CmsWebsite; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.param.UserParam; +import org.springframework.security.core.userdetails.UserDetailsService; + +import java.util.List; + +/** + * 用户Service + * + * @author WebSoft + * @since 2018-12-24 16:10:52 + */ +public interface UserService extends IService, UserDetailsService { + + /** + * 关联分页查询用户 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(UserParam param); + + /** + * 关联查询全部用户 + * + * @param param 查询参数 + * @return List + */ + List listRel(UserParam param); + + /** + * 根据id查询用户 + * + * @param userId 用户id + * @return User + */ + User getByIdRel(Integer userId); + + /** + * 根据账号查询用户 + * + * @param username 账号 + * @return User + */ + User getByUsername(String username); + + /** + * 根据账号查询用户 + * + * @param username 账号 + * @param tenantId 租户id + * @return User + */ + User getByUsername(String username, Integer tenantId); + + /** + * 添加用户 + * + * @param user 用户信息 + * @return boolean + */ + boolean saveUser(User user); + + /** + * 修改用户 + * + * @param user 用户信息 + * @return boolean + */ + boolean updateUser(User user); + + /** + * 比较用户密码 + * + * @param dbPassword 数据库存储的密码 + * @param inputPassword 用户输入的密码 + * @return boolean + */ + boolean comparePassword(String dbPassword, String inputPassword); + + /** + * md5加密用户密码 + * + * @param password 密码明文 + * @return 密文 + */ + String encodePassword(String password); + + /** + * 跟进手机号码查询用户 + * @param phone 手机号码 + * @return 用户信息 + */ + User getByPhone(String phone); + + User getByUnionId(UserParam userParam); + + User getByOauthId(UserParam userParam); + + List listStatisticsRel(UserParam param); + + /** + * 更新会员不限租户 + * @param user 用户信息 + */ + void updateByUserId(User user); + + /** + * 根据用户ID查询用户(忽略租户隔离) + * @param userId 用户ID + * @return User + */ + User getByIdIgnoreTenant(Integer userId); + + List pageAdminByPhone(UserParam param); + + List listByAlert(); +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/CompanyCommentServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/CompanyCommentServiceImpl.java new file mode 100644 index 0000000..e945e66 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/CompanyCommentServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.CompanyComment; +import com.gxwebsoft.common.system.mapper.CompanyCommentMapper; +import com.gxwebsoft.common.system.param.CompanyCommentParam; +import com.gxwebsoft.common.system.service.CompanyCommentService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 应用评论Service实现 + * + * @author 科技小王子 + * @since 2024-10-17 15:30:24 + */ +@Service +public class CompanyCommentServiceImpl extends ServiceImpl implements CompanyCommentService { + + @Override + public PageResult pageRel(CompanyCommentParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CompanyCommentParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public CompanyComment getByIdRel(Integer id) { + CompanyCommentParam param = new CompanyCommentParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/CompanyContentServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/CompanyContentServiceImpl.java new file mode 100644 index 0000000..b8604a6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/CompanyContentServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.CompanyContent; +import com.gxwebsoft.common.system.mapper.CompanyContentMapper; +import com.gxwebsoft.common.system.param.CompanyContentParam; +import com.gxwebsoft.common.system.service.CompanyContentService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 应用详情Service实现 + * + * @author 科技小王子 + * @since 2024-10-16 13:41:21 + */ +@Service +public class CompanyContentServiceImpl extends ServiceImpl implements CompanyContentService { + + @Override + public PageResult pageRel(CompanyContentParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CompanyContentParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public CompanyContent getByIdRel(Integer id) { + CompanyContentParam param = new CompanyContentParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/CompanyGitServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/CompanyGitServiceImpl.java new file mode 100644 index 0000000..a954d4b --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/CompanyGitServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.CompanyGit; +import com.gxwebsoft.common.system.mapper.CompanyGitMapper; +import com.gxwebsoft.common.system.param.CompanyGitParam; +import com.gxwebsoft.common.system.service.CompanyGitService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 代码仓库Service实现 + * + * @author 科技小王子 + * @since 2024-10-19 18:08:51 + */ +@Service +public class CompanyGitServiceImpl extends ServiceImpl implements CompanyGitService { + + @Override + public PageResult pageRel(CompanyGitParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CompanyGitParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public CompanyGit getByIdRel(Integer id) { + CompanyGitParam param = new CompanyGitParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/CompanyParameterServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/CompanyParameterServiceImpl.java new file mode 100644 index 0000000..4b77612 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/CompanyParameterServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.CompanyParameter; +import com.gxwebsoft.common.system.mapper.CompanyParameterMapper; +import com.gxwebsoft.common.system.param.CompanyParameterParam; +import com.gxwebsoft.common.system.service.CompanyParameterService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 应用参数Service实现 + * + * @author 科技小王子 + * @since 2024-10-17 15:30:24 + */ +@Service +public class CompanyParameterServiceImpl extends ServiceImpl implements CompanyParameterService { + + @Override + public PageResult pageRel(CompanyParameterParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CompanyParameterParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public CompanyParameter getByIdRel(Integer id) { + CompanyParameterParam param = new CompanyParameterParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/CompanyServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/CompanyServiceImpl.java new file mode 100644 index 0000000..8bdb503 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/CompanyServiceImpl.java @@ -0,0 +1,86 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Company; +import com.gxwebsoft.common.system.mapper.CompanyMapper; +import com.gxwebsoft.common.system.param.CompanyParam; +import com.gxwebsoft.common.system.service.CompanyService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 企业信息Service实现 + * + * @author 科技小王子 + * @since 2023-05-27 14:57:34 + */ +@Service +public class CompanyServiceImpl extends ServiceImpl implements CompanyService { + + @Override + public PageResult pageRel(CompanyParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number desc,create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CompanyParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public Company getByIdRel(Integer companyId) { + CompanyParam param = new CompanyParam(); + param.setCompanyId(companyId); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public Company getByTenantIdRel(Integer tenantId) { + CompanyParam param = new CompanyParam(); +// final Company one = param.getOne(baseMapper.selectListRel(param)); + param.setAuthoritative(true); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public PageResult pageRelAll(CompanyParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number desc,create_time desc"); + List list = baseMapper.selectPageRelAll(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public void updateByCompanyId(Company company) { + baseMapper.updateByCompanyId(company); + } + + @Override + public boolean removeCompanyAll(Integer companyId){ + if (baseMapper.removeCompanyAll(companyId)) { + return true; + } + return false; + } + + @Override + public boolean undeleteAll(Integer companyId){ + if (baseMapper.undeleteAll(companyId)) { + return true; + } + return false; + } + + + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/CompanyUrlServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/CompanyUrlServiceImpl.java new file mode 100644 index 0000000..a7922cb --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/CompanyUrlServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.CompanyUrl; +import com.gxwebsoft.common.system.mapper.CompanyUrlMapper; +import com.gxwebsoft.common.system.param.CompanyUrlParam; +import com.gxwebsoft.common.system.service.CompanyUrlService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 应用域名Service实现 + * + * @author 科技小王子 + * @since 2024-10-17 15:30:24 + */ +@Service +public class CompanyUrlServiceImpl extends ServiceImpl implements CompanyUrlService { + + @Override + public PageResult pageRel(CompanyUrlParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CompanyUrlParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public CompanyUrl getByIdRel(Integer id) { + CompanyUrlParam param = new CompanyUrlParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/DictDataServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/DictDataServiceImpl.java new file mode 100644 index 0000000..e30a0fe --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/DictDataServiceImpl.java @@ -0,0 +1,52 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.DictData; +import com.gxwebsoft.common.system.mapper.DictDataMapper; +import com.gxwebsoft.common.system.param.DictDataParam; +import com.gxwebsoft.common.system.service.DictDataService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 字典数据Service实现 + * + * @author WebSoft + * @since 2020-03-14 11:29:04 + */ +@Service +public class DictDataServiceImpl extends ServiceImpl + implements DictDataService { + + @Override + public PageResult pageRel(DictDataParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number"); + return new PageResult<>(baseMapper.selectPageRel(page, param), page.getTotal()); + } + + @Override + public List listRel(DictDataParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number"); + return page.sortRecords(baseMapper.selectListRel(param)); + } + + @Override + public DictData getByIdRel(Integer dictDataId) { + DictDataParam param = new DictDataParam(); + param.setDictDataId(dictDataId); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public DictData getByDictCodeAndName(String dictCode, String dictDataName) { + List list = baseMapper.getByDictCodeAndName(dictCode, dictDataName); + return CommonUtil.listGetOne(list); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/DictServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/DictServiceImpl.java new file mode 100644 index 0000000..6b09f90 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/DictServiceImpl.java @@ -0,0 +1,18 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.system.entity.Dict; +import com.gxwebsoft.common.system.mapper.DictMapper; +import com.gxwebsoft.common.system.service.DictService; +import org.springframework.stereotype.Service; + +/** + * 字典Service实现 + * + * @author WebSoft + * @since 2020-03-14 11:29:03 + */ +@Service +public class DictServiceImpl extends ServiceImpl implements DictService { + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/DictionaryDataServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/DictionaryDataServiceImpl.java new file mode 100644 index 0000000..0f26dd2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/DictionaryDataServiceImpl.java @@ -0,0 +1,52 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.DictionaryData; +import com.gxwebsoft.common.system.mapper.DictionaryDataMapper; +import com.gxwebsoft.common.system.param.DictionaryDataParam; +import com.gxwebsoft.common.system.service.DictionaryDataService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 字典数据Service实现 + * + * @author WebSoft + * @since 2020-03-14 11:29:04 + */ +@Service +public class DictionaryDataServiceImpl extends ServiceImpl + implements DictionaryDataService { + + @Override + public PageResult pageRel(DictionaryDataParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number"); + return new PageResult<>(baseMapper.selectPageRel(page, param), page.getTotal()); + } + + @Override + public List listRel(DictionaryDataParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number"); + return page.sortRecords(baseMapper.selectListRel(param)); + } + + @Override + public DictionaryData getByIdRel(Integer dictDataId) { + DictionaryDataParam param = new DictionaryDataParam(); + param.setDictDataId(dictDataId); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public DictionaryData getByDictCodeAndName(String dictCode, String dictDataName) { + List list = baseMapper.getByDictCodeAndName(dictCode, dictDataName); + return CommonUtil.listGetOne(list); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/DictionaryServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/DictionaryServiceImpl.java new file mode 100644 index 0000000..74d6fe1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/DictionaryServiceImpl.java @@ -0,0 +1,18 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.system.entity.Dictionary; +import com.gxwebsoft.common.system.mapper.DictionaryMapper; +import com.gxwebsoft.common.system.service.DictionaryService; +import org.springframework.stereotype.Service; + +/** + * 字典Service实现 + * + * @author WebSoft + * @since 2020-03-14 11:29:03 + */ +@Service +public class DictionaryServiceImpl extends ServiceImpl implements DictionaryService { + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/EmailRecordServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/EmailRecordServiceImpl.java new file mode 100644 index 0000000..6cf05fe --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/EmailRecordServiceImpl.java @@ -0,0 +1,99 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.system.entity.EmailRecord; +import com.gxwebsoft.common.system.mapper.EmailRecordMapper; +import com.gxwebsoft.common.system.service.EmailRecordService; +import org.beetl.core.Configuration; +import org.beetl.core.GroupTemplate; +import org.beetl.core.Template; +import org.beetl.core.resource.ClasspathResourceLoader; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.mail.SimpleMailMessage; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.mail.javamail.MimeMessageHelper; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + + +import javax.mail.MessagingException; +import javax.mail.internet.MimeMessage; +import java.io.IOException; +import java.util.Map; + +/** + * 邮件发送记录Service实现 + * + * @author WebSoft + * @since 2019-06-19 04:07:54 + */ +@Service +public class EmailRecordServiceImpl extends ServiceImpl + implements EmailRecordService { + // 发件邮箱 + @Value("${spring.mail.username:}") + private String formEmail; + @Autowired(required = false) + private JavaMailSender mailSender; + + @Override + public void sendTextEmail(String title, String content, String[] toEmails) { + if (mailSender == null) { + System.out.println("邮件服务未配置,跳过发送邮件: " + title); + return; + } + SimpleMailMessage message = new SimpleMailMessage(); + message.setFrom(formEmail); + message.setTo(toEmails); + message.setSubject(title); + message.setText(content); + mailSender.send(message); + } + + @Override + public void sendFullTextEmail(String title, String html, String[] toEmails) throws MessagingException { + if (mailSender == null) { + System.out.println("邮件服务未配置,跳过发送邮件: " + title); + return; + } + MimeMessage mimeMessage = mailSender.createMimeMessage(); + MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true); + helper.setFrom(formEmail); + helper.setTo(toEmails); + helper.setSubject(title); + // 发送邮件 + helper.setText(html, true); + mailSender.send(mimeMessage); + } + + @Override + public void sendHtmlEmail(String title, String path, Map map, String[] toEmails) + throws MessagingException, IOException { + ClasspathResourceLoader resourceLoader = new ClasspathResourceLoader("templates/"); + Configuration cfg = Configuration.defaultConfiguration(); + GroupTemplate gt = new GroupTemplate(resourceLoader, cfg); + Template t = gt.getTemplate(path); // 加载html模板 + t.binding(map); // 填充数据 + String html = t.render(); // 获得渲染后的html + sendFullTextEmail(title, html, toEmails); // 发送邮件 + } + + @Async + @Override + public void sendEmail(String title, String content, String receiver) { + // 发送邮件通知 + EmailRecord emailRecord = new EmailRecord(); + emailRecord.setTitle(title); + emailRecord.setContent(content); + emailRecord.setReceiver(receiver); + emailRecord.setCreateUserId(42); + if (mailSender != null) { + sendTextEmail(title,content,receiver.split(",")); + } else { + System.out.println("邮件服务未配置,跳过发送邮件: " + title); + } + save(emailRecord); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/FileRecordServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/FileRecordServiceImpl.java new file mode 100644 index 0000000..72c9c27 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/FileRecordServiceImpl.java @@ -0,0 +1,63 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.FileRecord; +import com.gxwebsoft.common.system.mapper.FileRecordMapper; +import com.gxwebsoft.common.system.param.FileRecordParam; +import com.gxwebsoft.common.system.service.FileRecordService; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.util.List; + +/** + * 文件上传记录Service实现 + * + * @author WebSoft + * @since 2021-08-30 11:21:01 + */ +@Service +public class FileRecordServiceImpl extends ServiceImpl implements FileRecordService { + + @Override + public PageResult pageRel(FileRecordParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return new PageResult<>(baseMapper.selectPageRel(page, param), page.getTotal()); + } + + @Override + public List listRel(FileRecordParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(baseMapper.selectListRel(param)); + } + + @Override + public FileRecord getByIdRel(Integer id) { + FileRecordParam param = new FileRecordParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public FileRecord getByIdPath(String path) { + return CommonUtil.listGetOne(baseMapper.getByIdPath(path)); + } + + @Async + @Override + public void deleteFileAsync(List files) { + for (File file : files) { + try { + file.delete(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/LoginRecordServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/LoginRecordServiceImpl.java new file mode 100644 index 0000000..28497e7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/LoginRecordServiceImpl.java @@ -0,0 +1,78 @@ +package com.gxwebsoft.common.system.service.impl; + +import cn.hutool.extra.servlet.ServletUtil; +import cn.hutool.http.useragent.UserAgent; +import cn.hutool.http.useragent.UserAgentUtil; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.LoginRecord; +import com.gxwebsoft.common.system.mapper.LoginRecordMapper; +import com.gxwebsoft.common.system.param.LoginRecordParam; +import com.gxwebsoft.common.system.service.LoginRecordService; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 登录日志Service实现 + * + * @author WebSoft + * @since 2018-12-24 16:10:14 + */ +@Service +public class LoginRecordServiceImpl extends ServiceImpl + implements LoginRecordService { + + @Override + public PageResult pageRel(LoginRecordParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return new PageResult<>(baseMapper.selectPageRel(page, param), page.getTotal()); + } + + @Override + public List listRel(LoginRecordParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(baseMapper.selectListRel(param)); + } + + @Override + public LoginRecord getByIdRel(Integer id) { + LoginRecordParam param = new LoginRecordParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Async + @Override + public void saveAsync(String username, Integer type, String comments, Integer tenantId, + HttpServletRequest request) { + if (username == null) { + return; + } + LoginRecord loginRecord = new LoginRecord(); + loginRecord.setUsername(username); + loginRecord.setLoginType(type); + loginRecord.setComments(comments); + loginRecord.setTenantId(tenantId); + UserAgent ua = UserAgentUtil.parse(ServletUtil.getHeaderIgnoreCase(request, "User-Agent")); + if (ua != null) { + if (ua.getPlatform() != null) { + loginRecord.setOs(ua.getPlatform().toString()); + } + if (ua.getOs() != null) { + loginRecord.setDevice(ua.getOs().toString()); + } + if (ua.getBrowser() != null) { + loginRecord.setBrowser(ua.getBrowser().toString()); + } + } + loginRecord.setIp(ServletUtil.getClientIP(request)); + baseMapper.insert(loginRecord); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/MenuServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/MenuServiceImpl.java new file mode 100644 index 0000000..969aee3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/MenuServiceImpl.java @@ -0,0 +1,139 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.system.entity.Menu; +import com.gxwebsoft.common.system.entity.Role; +import com.gxwebsoft.common.system.entity.RoleMenu; +import com.gxwebsoft.common.system.mapper.MenuMapper; +import com.gxwebsoft.common.system.param.MenuParam; +import com.gxwebsoft.common.system.service.MenuService; +import com.gxwebsoft.common.system.service.RoleMenuService; +import com.gxwebsoft.common.system.service.RoleService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 菜单Service实现 + * + * @author WebSoft + * @since 2018-12-24 16:10:10 + */ +@Service +public class MenuServiceImpl extends ServiceImpl implements MenuService { + private Integer plugMenuId; + @Resource + private RoleService roleService; + @Resource + private RoleMenuService roleMenuService; + + @Override + @Transactional(rollbackFor = {Exception.class}, isolation = Isolation.SERIALIZABLE) + public Boolean cloneMenu(MenuParam param) { +// System.out.println("准备待克隆的菜单数据 = " + param); + // 删除本项目菜单 + baseMapper.delete(new LambdaQueryWrapper().eq(Menu::getDeleted,0)); + // 顶级栏目 + param.setParentId(0); +// final List list = baseMapper.getMenuByClone(param); +//// final List menuIds = list.stream().map(Menu::getMenuId).collect(Collectors.toList()); + doCloneMenu(baseMapper.getMenuByClone(param)); + return true; + } + + @Override + @Transactional(rollbackFor = {Exception.class}, isolation = Isolation.SERIALIZABLE) + public Boolean install(Integer id) { + // 1.插件绑定的菜单ID + final MenuParam param = new MenuParam(); + param.setMenuId(id); + final List list = baseMapper.getMenuByClone(param); + // TODO 克隆当前插件到顶级菜单 + doCloneMenu(list); + + // 2.查找当前租户的超管权限的roleId + final Role superAdmin = roleService.getOne(new LambdaQueryWrapper().eq(Role::getRoleCode, "superAdmin")); + final Integer roleId = superAdmin.getRoleId(); + final Integer tenantId = superAdmin.getTenantId(); + // 3.勾选菜单根权限 + final RoleMenu roleMenu0 = new RoleMenu(); + roleMenu0.setRoleId(roleId); + roleMenu0.setMenuId(this.plugMenuId); + roleMenuService.save(roleMenu0); + + // 4.勾选根节点下的子菜单权限 + final MenuParam menuParam = new MenuParam(); + menuParam.setParentId(this.plugMenuId); + menuParam.setTenantId(tenantId); + final List menuList = baseMapper.getMenuByClone(menuParam); + menuList.forEach(d->{ + RoleMenu roleMenu = new RoleMenu(); + roleMenu.setRoleId(roleId); + roleMenu.setMenuId(d.getMenuId()); + roleMenuService.save(roleMenu); + }); + // 5.调整新插件的排序 + final Menu menu = baseMapper.selectById(this.plugMenuId); + menu.setSortNumber(100); + baseMapper.updateById(menu); + return true; + } + + // 克隆菜单 + private void doCloneMenu(List list) { + final MenuParam param = new MenuParam(); + list.forEach(d -> { + Menu menu = new Menu(); + menu.setParentId(0); + menu.setTitle(d.getTitle()); + menu.setPath(d.getPath()); + menu.setComponent(d.getComponent()); + menu.setMenuType(d.getMenuType()); + menu.setSortNumber(d.getSortNumber()); + menu.setAuthority(d.getAuthority()); + menu.setIcon(d.getIcon()); + menu.setHide(d.getHide()); + menu.setMeta(d.getMeta()); + save(menu); + this.plugMenuId = menu.getMenuId(); + // 二级菜单 + param.setParentId(d.getMenuId()); + final List list1 = baseMapper.getMenuByClone(param); + list1.forEach(d1 -> { + final Menu menu1 = new Menu(); + menu1.setParentId(menu.getMenuId()); + menu1.setTitle(d1.getTitle()); + menu1.setPath(d1.getPath()); + menu1.setComponent(d1.getComponent()); + menu1.setMenuType(d1.getMenuType()); + menu1.setSortNumber(d1.getSortNumber()); + menu1.setAuthority(d1.getAuthority()); + menu1.setIcon(d1.getIcon()); + menu1.setHide(d1.getHide()); + menu1.setMeta(d1.getMeta()); + save(menu1); + // 三级菜单 + param.setParentId(d1.getMenuId()); + final List list2 = baseMapper.getMenuByClone(param); + list2.forEach(d2 -> { + final Menu menu2 = new Menu(); + menu2.setParentId(menu1.getMenuId()); + menu2.setTitle(d2.getTitle()); + menu2.setPath(d2.getPath()); + menu2.setComponent(d2.getComponent()); + menu2.setMenuType(d2.getMenuType()); + menu2.setSortNumber(d2.getSortNumber()); + menu2.setAuthority(d2.getAuthority()); + menu2.setIcon(d2.getIcon()); + menu2.setHide(d2.getHide()); + menu2.setMeta(d2.getMeta()); + save(menu2); + }); + }); + }); + } +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/OperationRecordServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/OperationRecordServiceImpl.java new file mode 100644 index 0000000..8095bf4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/OperationRecordServiceImpl.java @@ -0,0 +1,52 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.OperationRecord; +import com.gxwebsoft.common.system.mapper.OperationRecordMapper; +import com.gxwebsoft.common.system.param.OperationRecordParam; +import com.gxwebsoft.common.system.service.OperationRecordService; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 操作日志Service实现 + * + * @author WebSoft + * @since 2018-12-24 16:10:02 + */ +@Service +public class OperationRecordServiceImpl extends ServiceImpl + implements OperationRecordService { + + @Override + public PageResult pageRel(OperationRecordParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return new PageResult<>(baseMapper.selectPageRel(page, param), page.getTotal()); + } + + @Override + public List listRel(OperationRecordParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(baseMapper.selectListRel(param)); + } + + @Override + public OperationRecord getByIdRel(Integer id) { + OperationRecordParam param = new OperationRecordParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Async + @Override + public void saveAsync(OperationRecord operationRecord) { + baseMapper.insert(operationRecord); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/OrganizationServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/OrganizationServiceImpl.java new file mode 100644 index 0000000..b2bb53f --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/OrganizationServiceImpl.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Organization; +import com.gxwebsoft.common.system.mapper.OrganizationMapper; +import com.gxwebsoft.common.system.param.OrganizationParam; +import com.gxwebsoft.common.system.service.OrganizationService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 组织机构Service实现 + * + * @author WebSoft + * @since 2020-03-14 11:29:04 + */ +@Service +public class OrganizationServiceImpl extends ServiceImpl + implements OrganizationService { + + @Override + public PageResult pageRel(OrganizationParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number"); + return new PageResult<>(baseMapper.selectPageRel(page, param), page.getTotal()); + } + + @Override + public List listRel(OrganizationParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number"); + return page.sortRecords(baseMapper.selectListRel(param)); + } + + @Override + public Organization getByIdRel(Integer organizationId) { + OrganizationParam param = new OrganizationParam(); + param.setOrganizationId(organizationId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/PaymentServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/PaymentServiceImpl.java new file mode 100644 index 0000000..9e2d798 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/PaymentServiceImpl.java @@ -0,0 +1,52 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Payment; +import com.gxwebsoft.common.system.mapper.PaymentMapper; +import com.gxwebsoft.common.system.param.PaymentParam; +import com.gxwebsoft.common.system.service.PaymentService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 支付方式Service实现 + * + * @author 科技小王子 + * @since 2024-05-11 12:39:11 + */ +@Service +public class PaymentServiceImpl extends ServiceImpl implements PaymentService { + + @Override + public PageResult pageRel(PaymentParam param) { + PageParam page = new PageParam<>(param); + //page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(PaymentParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + //page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public Payment getByIdRel(Integer id) { + PaymentParam param = new PaymentParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public Payment getByType(PaymentParam paymentParam) { + return baseMapper.getByType(paymentParam); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/PlugServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/PlugServiceImpl.java new file mode 100644 index 0000000..aee07a6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/PlugServiceImpl.java @@ -0,0 +1,112 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Plug; +import com.gxwebsoft.common.system.mapper.PlugMapper; +import com.gxwebsoft.common.system.param.PlugParam; +import com.gxwebsoft.common.system.service.PlugService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * 插件扩展Service实现 + * + * @author 科技小王子 + * @since 2023-05-18 11:57:37 + */ +@Service +public class PlugServiceImpl extends ServiceImpl implements PlugService { + + @Override + public PageResult pageRel(PlugParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(PlugParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public Plug getByIdRel(Integer menuId) { + PlugParam param = new PlugParam(); + param.setMenuId(menuId); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + @Transactional(rollbackFor = {Exception.class}, isolation = Isolation.SERIALIZABLE) + public Boolean cloneMenu(PlugParam param) { +// System.out.println("准备待克隆的菜单数据 = " + param); + // 删除本项目菜单 + baseMapper.delete(new LambdaQueryWrapper().eq(Plug::getDeleted,0)); + // 顶级栏目 + param.setParentId(0); + final List list = baseMapper.getMenuByClone(param); +// final List menuIds = list.stream().map(Menu::getMenuId).collect(Collectors.toList()); + + list.forEach(d -> { + Plug plug = new Plug(); + plug.setParentId(0); + plug.setTitle(d.getTitle()); + plug.setPath(d.getPath()); + plug.setComponent(d.getComponent()); + plug.setMenuType(d.getMenuType()); + plug.setSortNumber(d.getSortNumber()); + plug.setAuthority(d.getAuthority()); + plug.setIcon(d.getIcon()); + plug.setHide(d.getHide()); + plug.setMeta(d.getMeta()); + save(plug); + // 二级菜单 + param.setParentId(d.getMenuId()); + final List list1 = baseMapper.getMenuByClone(param); + list1.forEach(d1 -> { + final Plug menu1 = new Plug(); + menu1.setParentId(plug.getMenuId()); + menu1.setTitle(d1.getTitle()); + menu1.setPath(d1.getPath()); + menu1.setComponent(d1.getComponent()); + menu1.setMenuType(d1.getMenuType()); + menu1.setSortNumber(d1.getSortNumber()); + menu1.setAuthority(d1.getAuthority()); + menu1.setIcon(d1.getIcon()); + menu1.setHide(d1.getHide()); + menu1.setMeta(d1.getMeta()); + save(menu1); + // 三级菜单 + param.setParentId(d1.getMenuId()); + final List list2 = baseMapper.getMenuByClone(param); + list2.forEach(d2 -> { + final Plug menu2 = new Plug(); + menu2.setParentId(menu1.getMenuId()); + menu2.setTitle(d2.getTitle()); + menu2.setPath(d2.getPath()); + menu2.setComponent(d2.getComponent()); + menu2.setMenuType(d2.getMenuType()); + menu2.setSortNumber(d2.getSortNumber()); + menu2.setAuthority(d2.getAuthority()); + menu2.setIcon(d2.getIcon()); + menu2.setHide(d2.getHide()); + menu2.setMeta(d2.getMeta()); + save(menu2); + }); + }); + }); + return true; + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/RoleMenuServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/RoleMenuServiceImpl.java new file mode 100644 index 0000000..737c5e3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/RoleMenuServiceImpl.java @@ -0,0 +1,31 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.system.entity.Menu; +import com.gxwebsoft.common.system.entity.RoleMenu; +import com.gxwebsoft.common.system.mapper.RoleMenuMapper; +import com.gxwebsoft.common.system.service.RoleMenuService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 角色菜单Service实现 + * + * @author WebSoft + * @since 2018-12-24 16:10:12 + */ +@Service +public class RoleMenuServiceImpl extends ServiceImpl implements RoleMenuService { + + @Override + public List listMenuByUserId(Integer userId, Integer menuType) { + return baseMapper.listMenuByUserId(userId, menuType); + } + + @Override + public List listMenuByRoleIds(List roleIds, Integer menuType) { + return baseMapper.listMenuByRoleIds(roleIds, menuType); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/RoleServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/RoleServiceImpl.java new file mode 100644 index 0000000..f543abd --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/RoleServiceImpl.java @@ -0,0 +1,18 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.system.entity.Role; +import com.gxwebsoft.common.system.mapper.RoleMapper; +import com.gxwebsoft.common.system.service.RoleService; +import org.springframework.stereotype.Service; + +/** + * 角色服务实现类 + * + * @author WebSoft + * @since 2018-12-24 16:10:11 + */ +@Service +public class RoleServiceImpl extends ServiceImpl implements RoleService { + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/SettingServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/SettingServiceImpl.java new file mode 100644 index 0000000..f72ab1d --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/SettingServiceImpl.java @@ -0,0 +1,198 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.annotation.IgnoreTenant; +import com.gxwebsoft.common.core.config.ConfigProperties; +import com.gxwebsoft.common.core.exception.BusinessException; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Setting; +import com.gxwebsoft.common.system.mapper.SettingMapper; +import com.gxwebsoft.common.system.param.SettingParam; +import com.gxwebsoft.common.system.service.SettingService; +import com.gxwebsoft.cms.entity.CmsWebsiteField; +import com.gxwebsoft.cms.service.CmsWebsiteFieldService; +import com.wechat.pay.java.core.Config; +import com.wechat.pay.java.core.RSAConfig; +import com.wechat.pay.java.service.payments.jsapi.JsapiService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 系统设置Service实现 + * + * @author WebSoft + * @since 2022-11-19 13:54:27 + */ +@Service +public class SettingServiceImpl extends ServiceImpl implements SettingService { + // 本地缓存 + public static Map configMap = new HashMap<>(); + public static JsapiService service = null; + public static Config config = null; + @Resource + private ConfigProperties pathConfig; + @Resource + private StringRedisTemplate stringRedisTemplate; + @Resource + private CmsWebsiteFieldService cmsWebsiteFieldService; + + @Value("${spring.profiles.active:prod}") + private String activeProfile; + @Autowired + private SettingService settingService; + + @Override + public PageResult pageRel(SettingParam param) { + PageParam page = new PageParam<>(param); + //page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(SettingParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + //page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public Setting getByIdRel(Integer settingId) { + SettingParam param = new SettingParam(); + param.setSettingId(settingId); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public JSONObject getBySettingKey(String key, Integer tenantId) { + System.out.println("tenantId = " + tenantId); + final JSONObject settingKey = settingService.getBySettingKey("setting_key", tenantId); + System.out.println("settingKey = " + settingKey); + Setting setting = this.getOne(new QueryWrapper().eq("setting_key", key), false); + System.out.println("setting1 = " + setting); + if(setting == null){ + if ("mp-weixin".equals(key)) { + throw new BusinessException("小程序未配置1"); + } + if ("payment".equals(key)) { + throw new BusinessException("支付未配置"); + } + if ("sms".equals(key)) { + throw new BusinessException("短信未配置"); + } + if ("wx-work".equals(key)){ + throw new BusinessException("企业微信未配置"); + } + if ("setting".equals(key)) { + throw new BusinessException("基本信息未配置"); + } + if ("wx-official".equals(key)) { + throw new BusinessException("微信公众号未配置"); + } + if ("printer".equals(key)) { + throw new BusinessException("打印机未配置"); + } + } + return JSON.parseObject(setting.getContent()); + } + + @Override + @IgnoreTenant("跨租户获取指定租户的设置配置") + public JSONObject getBySettingKeyIgnoreTenant(String key, Integer tenantId) { + throw new BusinessException("此方法已废弃,请使用缓存方式获取配置:mp-weixin:" + tenantId); + } + + @Override + public Setting getData(String settingKey) { + return query().eq("setting_key", settingKey).one(); + } + + @Override + public JSONObject getCache(String key) { + final String cache = stringRedisTemplate.opsForValue().get(key); + final JSONObject jsonObject = JSONObject.parseObject(cache); + if(jsonObject == null){ + throw new BusinessException("域名未配置"); + } + return jsonObject; + } + + @Override + public void initConfig(Setting data) { + if (data.getSettingKey().equals("payment")) { + final JSONObject jsonObject = JSONObject.parseObject(data.getContent()); + final String mchId = jsonObject.getString("mchId"); + final String apiclientKey = jsonObject.getString("apiclientKey"); + final String privateKey = pathConfig.getUploadPath().concat(apiclientKey); + final String apiclientCert = pathConfig.getUploadPath().concat(jsonObject.getString("apiclientCert")); + final String merchantSerialNumber = jsonObject.getString("merchantSerialNumber"); + final String apiV3key = jsonObject.getString("wechatApiKey"); + if(config == null){ + // 根据环境选择不同的证书路径配置 + if ("dev".equals(activeProfile)) { + // 开发环境:使用配置文件的upload-path拼接证书路径 - 租户ID 10550 + System.out.println("=== 开发环境:使用配置文件upload-path拼接证书路径 ==="); + String uploadPath = pathConfig.getUploadPath(); // 获取配置的upload-path + String tenantId = "10550"; // 租户ID + String certBasePath = uploadPath + "dev/wechat/" + tenantId + "/"; + String devPrivateKeyPath = certBasePath + "apiclient_key.pem"; + String devCertPath = certBasePath + "apiclient_cert.pem"; + + System.out.println("配置的upload-path: " + uploadPath); + System.out.println("证书基础路径: " + certBasePath); + System.out.println("私钥文件路径: " + devPrivateKeyPath); + System.out.println("证书文件路径: " + devCertPath); + + config = new RSAConfig.Builder() + .merchantId("1246610101") + .privateKeyFromPath(devPrivateKeyPath) + .merchantSerialNumber("2903B872D5CA36E525FAEC37AEDB22E54ECDE7B7") + .wechatPayCertificatesFromPath(devCertPath) + .build(); + System.out.println("开发环境证书路径配置完成"); + } else { + // 生产环境:使用数据库存储的路径 + System.out.println("=== 生产环境:使用数据库存储的证书路径 ==="); + config = new RSAConfig.Builder() + .merchantId(mchId) + .privateKeyFromPath(privateKey) + .merchantSerialNumber(merchantSerialNumber) + .wechatPayCertificatesFromPath(apiclientCert) + .build(); + System.out.println("生产环境证书路径: " + privateKey); + } + configMap.put(data.getTenantId().toString(),config); + System.out.println("当前环境: " + activeProfile); + System.out.println("config = " + config); + } + if (service == null) { + service = new JsapiService.Builder().config(config).build(); + } + } + } + + @Override + public Config getConfig(Integer tenantId) { + if(configMap.get(tenantId.toString()) == null){ + final Setting payment = getOne(new LambdaQueryWrapper().eq(Setting::getSettingKey, "payment")); + this.initConfig(payment); + return configMap.get(tenantId.toString()); + } + return configMap.get(tenantId.toString()); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/TenantServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/TenantServiceImpl.java new file mode 100644 index 0000000..99c423e --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/TenantServiceImpl.java @@ -0,0 +1,46 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.system.mapper.TenantMapper; +import com.gxwebsoft.common.system.service.TenantService; +import com.gxwebsoft.common.system.entity.Tenant; +import com.gxwebsoft.common.system.param.TenantParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 租户Service实现 + * + * @author 科技小王子 + * @since 2023-07-17 17:49:53 + */ +@Service +public class TenantServiceImpl extends ServiceImpl implements TenantService { + + @Override + public PageResult pageRel(TenantParam param) { + PageParam page = new PageParam<>(param); + //page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(TenantParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + //page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public Tenant getByIdRel(Integer tenantId) { + TenantParam param = new TenantParam(); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/UserBalanceLogServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/UserBalanceLogServiceImpl.java new file mode 100644 index 0000000..2286471 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/UserBalanceLogServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.UserBalanceLog; +import com.gxwebsoft.common.system.mapper.UserBalanceLogMapper; +import com.gxwebsoft.common.system.param.UserBalanceLogParam; +import com.gxwebsoft.common.system.service.UserBalanceLogService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 用户余额变动明细表Service实现 + * + * @author 科技小王子 + * @since 2023-04-21 15:59:09 + */ +@Service +public class UserBalanceLogServiceImpl extends ServiceImpl implements UserBalanceLogService { + + @Override + public PageResult pageRel(UserBalanceLogParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(UserBalanceLogParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public UserBalanceLog getByIdRel(Integer logId) { + UserBalanceLogParam param = new UserBalanceLogParam(); + param.setLogId(logId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/UserFileServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/UserFileServiceImpl.java new file mode 100644 index 0000000..b5712c3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/UserFileServiceImpl.java @@ -0,0 +1,18 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.system.mapper.UserFileMapper; +import com.gxwebsoft.common.system.service.UserFileService; +import com.gxwebsoft.common.system.entity.UserFile; +import org.springframework.stereotype.Service; + +/** + * 用户文件Service实现 + * + * @author WebSoft + * @since 2022-07-21 14:34:40 + */ +@Service +public class UserFileServiceImpl extends ServiceImpl implements UserFileService { + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/UserRefereeServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/UserRefereeServiceImpl.java new file mode 100644 index 0000000..3055b98 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/UserRefereeServiceImpl.java @@ -0,0 +1,74 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.UserReferee; +import com.gxwebsoft.common.system.mapper.UserRefereeMapper; +import com.gxwebsoft.common.system.param.UserRefereeParam; +import com.gxwebsoft.common.system.service.UserRefereeService; +import com.gxwebsoft.common.system.service.UserService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 用户推荐关系表Service实现 + * + * @author 科技小王子 + * @since 2023-10-07 22:56:36 + */ +@Service +public class UserRefereeServiceImpl extends ServiceImpl implements UserRefereeService { + + @Resource + private UserService userService; + + @Override + public PageResult pageRel(UserRefereeParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + for (UserReferee userReferee : list) { + userReferee.setUser(userService.getById(userReferee.getUserId())); + } + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(UserRefereeParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public UserReferee getByIdRel(Integer id) { + UserRefereeParam param = new UserRefereeParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public UserReferee check(Integer dealerId, Integer userId) { + return getOne( + new LambdaQueryWrapper() + .eq(UserReferee::getDealerId, dealerId) + .eq(UserReferee::getUserId, userId) + ); + } + + @Override + public UserReferee getByUserId(Integer userId) { + return getOne( + new LambdaQueryWrapper() + .eq(UserReferee::getUserId, userId) + .last("limit 1") + ); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/UserRoleServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/UserRoleServiceImpl.java new file mode 100644 index 0000000..a2a3d11 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/UserRoleServiceImpl.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.common.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.system.entity.Role; +import com.gxwebsoft.common.system.entity.UserRole; +import com.gxwebsoft.common.system.mapper.UserRoleMapper; +import com.gxwebsoft.common.system.service.UserRoleService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 用户角色Service实现 + * + * @author WebSoft + * @since 2018-12-24 16:10:36 + */ +@Service +public class UserRoleServiceImpl extends ServiceImpl implements UserRoleService { + + + @Override + public int saveBatch(Integer userId, List roleIds) { + return baseMapper.insertBatch(userId, roleIds); + } + + @Override + public List listByUserId(Integer userId) { + return baseMapper.selectByUserId(userId); + } + + @Override + public List listByUserIds(List userIds) { + return baseMapper.selectByUserIds(userIds); + } + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/UserServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/UserServiceImpl.java new file mode 100644 index 0000000..b321832 --- /dev/null +++ b/src/main/java/com/gxwebsoft/common/system/service/impl/UserServiceImpl.java @@ -0,0 +1,246 @@ +package com.gxwebsoft.common.system.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.entity.CmsWebsite; +import com.gxwebsoft.cms.param.CmsWebsiteParam; +import com.gxwebsoft.cms.service.CmsWebsiteService; +import com.gxwebsoft.common.core.exception.BusinessException; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.Company; +import com.gxwebsoft.common.system.entity.Role; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.entity.UserRole; +import com.gxwebsoft.common.system.mapper.UserMapper; +import com.gxwebsoft.common.system.param.CompanyParam; +import com.gxwebsoft.common.system.param.UserParam; +import com.gxwebsoft.common.system.service.CompanyService; +import com.gxwebsoft.common.system.service.RoleMenuService; +import com.gxwebsoft.common.system.service.UserRoleService; +import com.gxwebsoft.common.system.service.UserService; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import javax.annotation.Resource; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 用户Service实现 + * + * @author WebSoft + * @since 2018-12-24 16:10:14 + */ +@Service +public class UserServiceImpl extends ServiceImpl implements UserService { + @Resource + private UserRoleService userRoleService; + @Resource + private RoleMenuService roleMenuService; + @Resource + private BCryptPasswordEncoder bCryptPasswordEncoder; + @Resource + private CmsWebsiteService cmsWebsiteService; + @Resource + private CompanyService companyService; + @Resource + private RedisUtil redisUtil; + + @Override + public PageResult pageRel(UserParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + // 查询用户的角色 + selectUserRoles(list); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(UserParam param) { + List list = baseMapper.selectListRel(param); + // 查询用户的角色 + selectUserRoles(list); + // 排序 + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public User getByIdRel(Integer userId) { + UserParam param = new UserParam(); + param.setUserId(userId); + User user = param.getOne(baseMapper.selectListRel(param)); + if (user != null) { + user.setRoles(userRoleService.listByUserId(user.getUserId())); + user.setAuthorities(roleMenuService.listMenuByUserId(user.getUserId(), null)); + } + return user; + } + + @Override + public User getByUsername(String username) { + return getByUsername(username, null); + } + + @Override + public User getByUsername(String username, Integer tenantId) { + if (StrUtil.isBlank(username)) { + return null; + } + User user = baseMapper.selectByUsername(username, tenantId); + if (user != null) { + user.setRoles(userRoleService.listByUserId(user.getUserId())); + user.setAuthorities(roleMenuService.listMenuByUserId(user.getUserId(), null)); + } + return user; + } + + @Override + public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { + return getByUsername(username); + } + + @Transactional(rollbackFor = {Exception.class}, isolation = Isolation.SERIALIZABLE) + @Override + public boolean saveUser(User user) { + if (StrUtil.isNotEmpty(user.getUsername()) && baseMapper.selectCount(new LambdaQueryWrapper() + .eq(User::getUsername, user.getUsername())) > 0) { + throw new BusinessException("账号已存在"); + } + if (StrUtil.isNotEmpty(user.getPhone()) && baseMapper.selectCount(new LambdaQueryWrapper() + .eq(User::getPhone, user.getPhone())) > 0) { + throw new BusinessException("手机号已存在"); + } + if (StrUtil.isNotEmpty(user.getEmail()) && baseMapper.selectCount(new LambdaQueryWrapper() + .eq(User::getEmail, user.getEmail())) > 0) { + throw new BusinessException("邮箱已存在"); + } + boolean result = baseMapper.insert(user) > 0; + if (result && user.getRoles() != null && user.getRoles().size() > 0) { + List roleIds = user.getRoles().stream().map(Role::getRoleId).collect(Collectors.toList()); + if (userRoleService.saveBatch(user.getUserId(), roleIds) < roleIds.size()) { + throw new BusinessException("用户角色添加失败"); + } + } + return result; + } + + @Transactional(rollbackFor = {Exception.class}) + @Override + public boolean updateUser(User user) { + if (StrUtil.isNotEmpty(user.getUsername()) && baseMapper.selectCount(new LambdaQueryWrapper() + .eq(User::getUsername, user.getUsername()) + .ne(User::getUserId, user.getUserId())) > 0) { + throw new BusinessException("账号已存在"); + } + if (StrUtil.isNotEmpty(user.getPhone()) && baseMapper.selectCount(new LambdaQueryWrapper() + .eq(User::getPhone, user.getPhone()) + .ne(User::getUserId, user.getUserId())) > 0) { + throw new BusinessException("手机号已存在"); + } + if (StrUtil.isNotEmpty(user.getEmail()) && baseMapper.selectCount(new LambdaQueryWrapper() + .eq(User::getEmail, user.getEmail()) + .ne(User::getUserId, user.getUserId())) > 0) { + throw new BusinessException("邮箱已存在"); + } + boolean result = baseMapper.updateById(user) > 0; + if (result && user.getRoles() != null && user.getRoles().size() > 0) { + userRoleService.remove(new LambdaUpdateWrapper().eq(UserRole::getUserId, user.getUserId())); + List roleIds = user.getRoles().stream().map(Role::getRoleId).collect(Collectors.toList()); + if (userRoleService.saveBatch(user.getUserId(), roleIds) < roleIds.size()) { + throw new BusinessException("用户角色添加失败"); + } + } + return result; + } + + @Override + public boolean comparePassword(String dbPassword, String inputPassword) { + return bCryptPasswordEncoder.matches(inputPassword, dbPassword); + } + + @Override + public String encodePassword(String password) { + return password == null ? null : bCryptPasswordEncoder.encode(password); + } + + @Override + public User getByPhone(String phone) { + return query().eq("phone", phone).one(); + } + + @Override + public User getByUnionId(UserParam param) { + return param.getOne(baseMapper.getOne(param)); + } + + @Override + public User getByOauthId(UserParam userParam) { + return userParam.getOne(baseMapper.getOne(userParam)); + } + + @Override + public List listStatisticsRel(UserParam param) { + List list = baseMapper.selectListStatisticsRel(param); + return list; + } + + /** + * 更新用户信息(跨租户) + * + * @param user 用户信息 + */ + @Override + public void updateByUserId(User user) { + baseMapper.updateByUserId(user); + } + + @Override + public List pageAdminByPhone(UserParam param) { + return baseMapper.pageAdminByPhone(param); + } + + @Override + public List listByAlert() { + return baseMapper.listByAlert(); + } + + @Override + public User getByIdIgnoreTenant(Integer userId) { + if (userId == null) { + return null; + } + return baseMapper.selectByIdIgnoreTenant(userId); + } + + /** + * 批量查询用户的角色 + * + * @param users 用户集合 + */ + private void selectUserRoles(List users) { + if (users != null && users.size() > 0) { + List userIds = users.stream().map(User::getUserId).collect(Collectors.toList()); + List userRoles = userRoleService.listByUserIds(userIds); + for (User user : users) { + List roles = userRoles.stream().filter(d -> user.getUserId().equals(d.getUserId())) + .collect(Collectors.toList()); + user.setRoles(roles); + } + } + } +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/BatchImportSupport.java b/src/main/java/com/gxwebsoft/credit/controller/BatchImportSupport.java new file mode 100644 index 0000000..ca07a1d --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/BatchImportSupport.java @@ -0,0 +1,855 @@ +package com.gxwebsoft.credit.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.support.SFunction; +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.credit.entity.CreditCompany; +import com.gxwebsoft.credit.service.CreditCompanyService; +import org.springframework.stereotype.Component; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.TransactionDefinition; +import org.springframework.transaction.support.TransactionTemplate; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.function.BiConsumer; +import java.util.function.BiFunction; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.Supplier; +import java.util.regex.Pattern; + +/** + * credit 模块 Excel 导入批处理支持: + * - 分批 upsert(批内一次查库 + 批量 insert/update) + * - 每批独立事务(REQUIRES_NEW),避免单次导入事务过大拖垮数据库 + */ +@Component +public class BatchImportSupport { + + private final TransactionTemplate requiresNewTx; + private static final Pattern PARTY_SPLIT_PATTERN = Pattern.compile("[,,;;、\\n\\r\\t/|]+"); + + public BatchImportSupport(PlatformTransactionManager transactionManager) { + TransactionTemplate template = new TransactionTemplate(transactionManager); + template.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); + this.requiresNewTx = template; + } + + public int runInNewTx(Supplier supplier) { + return requiresNewTx.execute(status -> supplier.get()); + } + + public static final class CompanyIdRefreshStats { + public final boolean anyDataRead; + public final int updated; + public final int matched; + public final int notFound; + public final int ambiguous; + + private CompanyIdRefreshStats(boolean anyDataRead, int updated, int matched, int notFound, int ambiguous) { + this.anyDataRead = anyDataRead; + this.updated = updated; + this.matched = matched; + this.notFound = notFound; + this.ambiguous = ambiguous; + } + + public Map toMap() { + Map result = new LinkedHashMap<>(); + result.put("updated", updated); + result.put("matched", matched); + result.put("notFound", notFound); + result.put("ambiguous", ambiguous); + return result; + } + } + + /** + * 按企业名称匹配 CreditCompany(name / matchName) 并回填 companyId。 + * + *

默认仅更新 companyId 为空/0 的记录(onlyNull=true);onlyNull=false 时会覆盖更新(仅当 companyId 不同)。

+ * + *

注意:为避免跨租户误更新,当 currentTenantId 为空时会按记录自身 tenantId 维度匹配, + * tenantId 为空的记录将被跳过并计入 notFound。

+ */ + public CompanyIdRefreshStats refreshCompanyIdByCompanyName(IService service, + CreditCompanyService creditCompanyService, + Integer currentTenantId, + Boolean onlyNull, + Integer limit, + SFunction idGetter, + BiConsumer idSetter, + SFunction nameGetter, + SFunction companyIdGetter, + BiConsumer companyIdSetter, + SFunction hasDataGetter, + BiConsumer hasDataSetter, + SFunction tenantIdGetter, + Supplier patchFactory) { + // Keep existing API; delegate to the multi-column implementation. + return refreshCompanyIdByCompanyNames(service, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + idGetter, + idSetter, + companyIdGetter, + companyIdSetter, + hasDataGetter, + hasDataSetter, + tenantIdGetter, + patchFactory, + nameGetter); + } + + /** + * 按多列“当事人/企业名称”匹配 CreditCompany(name / matchName) 并回填 companyId。 + * + *

按传入列顺序优先匹配:原告/上诉人 > 被告/被上诉人 > 其他当事人/第三人等。

+ * + *

同一列若匹配到多个不同企业则视为歧义;若最终无法得到唯一 companyId,则跳过并计入 ambiguous/notFound。

+ */ + @SafeVarargs + public final CompanyIdRefreshStats refreshCompanyIdByCompanyNames(IService service, + CreditCompanyService creditCompanyService, + Integer currentTenantId, + Boolean onlyNull, + Integer limit, + SFunction idGetter, + BiConsumer idSetter, + SFunction companyIdGetter, + BiConsumer companyIdSetter, + SFunction hasDataGetter, + BiConsumer hasDataSetter, + SFunction tenantIdGetter, + Supplier patchFactory, + SFunction... nameGetters) { + boolean onlyNullFlag = (onlyNull == null) || Boolean.TRUE.equals(onlyNull); + + if (nameGetters == null || nameGetters.length == 0) { + return new CompanyIdRefreshStats(false, 0, 0, 0, 0); + } + + // 1) 读取待处理数据(仅取必要字段,避免一次性拉全表字段) + @SuppressWarnings({"rawtypes", "unchecked"}) + SFunction[] selectColumns = (SFunction[]) new SFunction[4 + nameGetters.length]; + int colIdx = 0; + selectColumns[colIdx++] = idGetter; + selectColumns[colIdx++] = companyIdGetter; + selectColumns[colIdx++] = hasDataGetter; + selectColumns[colIdx++] = tenantIdGetter; + for (SFunction ng : nameGetters) { + selectColumns[colIdx++] = ng; + } + + var query = service.lambdaQuery() + .select(selectColumns) + .eq(currentTenantId != null, tenantIdGetter, currentTenantId) + .and(w -> { + // Only process rows that have at least one name column populated. + for (int i = 0; i < nameGetters.length; i++) { + if (i == 0) { + w.isNotNull(nameGetters[i]); + } else { + w.or().isNotNull(nameGetters[i]); + } + } + }); + if (onlyNullFlag) { + // Historically some tables used 0 as the "unset" companyId, while others left it NULL. + // Treat both as "unset" so refresh won't silently do nothing. + query.and(w -> w.isNull(companyIdGetter).or().eq(companyIdGetter, 0)); + } + if (limit != null && limit > 0) { + query.last("limit " + Math.min(limit, 200000)); + } + List rows = query.list(); + + if (CollectionUtils.isEmpty(rows)) { + return new CompanyIdRefreshStats(false, 0, 0, 0, 0); + } + + // 2) 按租户维度匹配(避免管理员/跨租户场景误匹配) + Map> rowsByTenant = new LinkedHashMap<>(); + int missingTenant = 0; + for (T row : rows) { + if (row == null) { + continue; + } + Integer tenantId = currentTenantId != null ? currentTenantId : tenantIdGetter.apply(row); + if (tenantId == null) { + // 未知租户下不做跨租户匹配,避免误更新 + missingTenant++; + continue; + } + rowsByTenant.computeIfAbsent(tenantId, k -> new ArrayList<>()).add(row); + } + + // 3) 批量更新 companyId + int updated = 0; + int matched = 0; + int notFound = 0; + int ambiguous = 0; + final int batchSize = 500; + List updates = new ArrayList<>(batchSize); + + final int inChunkSize = 900; + for (Map.Entry> entry : rowsByTenant.entrySet()) { + Integer tenantId = entry.getKey(); + List tenantRows = entry.getValue(); + if (tenantId == null || CollectionUtils.isEmpty(tenantRows)) { + continue; + } + + // 3.1) 查询当前租户下的 companyId 映射 + LinkedHashMap companyIdByName = new LinkedHashMap<>(); + LinkedHashMap ambiguousByName = new LinkedHashMap<>(); + LinkedHashSet nameSet = new LinkedHashSet<>(); + for (T row : tenantRows) { + if (row == null) { + continue; + } + for (SFunction ng : nameGetters) { + for (String name : splitPartyNames(ng.apply(row))) { + if (name != null) { + nameSet.add(name); + } + } + } + } + List allNames = new ArrayList<>(nameSet); + for (int i = 0; i < allNames.size(); i += inChunkSize) { + List chunk = allNames.subList(i, Math.min(allNames.size(), i + inChunkSize)); + if (CollectionUtils.isEmpty(chunk)) { + continue; + } + List companies = creditCompanyService.lambdaQuery() + .select(CreditCompany::getId, CreditCompany::getName, CreditCompany::getMatchName, CreditCompany::getTenantId) + .eq(CreditCompany::getTenantId, tenantId) + .and(w -> w.in(CreditCompany::getName, chunk).or().in(CreditCompany::getMatchName, chunk)) + .list(); + + for (CreditCompany c : companies) { + if (c == null || c.getId() == null) { + continue; + } + addCompanyNameMapping(companyIdByName, ambiguousByName, normalizeCompanyName(c.getName()), c.getId()); + addCompanyNameMapping(companyIdByName, ambiguousByName, normalizeCompanyName(c.getMatchName()), c.getId()); + } + } + + // 3.2) 更新当前租户下的数据 companyId + for (T row : tenantRows) { + if (row == null) { + continue; + } + + Integer companyId = null; + boolean hasAmbiguousName = false; + for (SFunction ng : nameGetters) { + LinkedHashSet idsForColumn = new LinkedHashSet<>(); + for (String key : splitPartyNames(ng.apply(row))) { + if (key == null) { + continue; + } + Integer amb = ambiguousByName.get(key); + if (amb != null && amb > 0) { + hasAmbiguousName = true; + continue; + } + Integer cid = companyIdByName.get(key); + if (cid != null) { + idsForColumn.add(cid); + } + } + if (idsForColumn.size() == 1) { + companyId = idsForColumn.iterator().next(); + break; + } + if (idsForColumn.size() > 1) { + // Multiple companies matched within one column (e.g. multiple plaintiffs) -> ambiguous. + hasAmbiguousName = true; + } + } + + if (companyId == null) { + if (hasAmbiguousName) { + ambiguous++; + } else { + notFound++; + } + continue; + } + matched++; + + Integer oldCompanyId = row != null ? companyIdGetter.apply(row) : null; + Boolean oldHasData = row != null ? hasDataGetter.apply(row) : null; + boolean needUpdate; + if (onlyNullFlag) { + needUpdate = (oldCompanyId == null) || oldCompanyId == 0; + } else { + needUpdate = oldCompanyId == null || !companyId.equals(oldCompanyId); + } + // 若已匹配到企业,但 hasData 未标记,则也需要回填 hasData=1 + if (!Boolean.TRUE.equals(oldHasData)) { + needUpdate = true; + } + if (!needUpdate) { + continue; + } + + Integer id = row != null ? idGetter.apply(row) : null; + if (id == null) { + continue; + } + T patch = patchFactory.get(); + idSetter.accept(patch, id); + companyIdSetter.accept(patch, companyId); + hasDataSetter.accept(patch, Boolean.TRUE); + updates.add(patch); + if (updates.size() >= batchSize) { + List batch = new ArrayList<>(updates); + updates.clear(); + updated += runInNewTx(() -> service.updateBatchById(batch, batchSize) ? batch.size() : 0); + } + } + } + + // currentTenantId 为空时,租户缺失的数据不做匹配更新,避免误更新 + if (currentTenantId == null && missingTenant > 0) { + notFound += missingTenant; + } + + if (!updates.isEmpty()) { + List batch = new ArrayList<>(updates); + updates.clear(); + updated += runInNewTx(() -> service.updateBatchById(batch, batchSize) ? batch.size() : 0); + } + + return new CompanyIdRefreshStats(true, updated, matched, notFound, ambiguous); + } + + /** + * 批量 upsert:优先按 code 匹配;code 为空时按 name 匹配。 + */ + public int upsertByCodeOrName(IService service, + List items, + SFunction idColumn, + BiConsumer idSetter, + SFunction codeColumn, + Function codeGetter, + SFunction nameColumn, + Function nameGetter, + Consumer> extraConditions, + int batchSize) { + if (CollectionUtils.isEmpty(items)) { + return 0; + } + + List codes = new ArrayList<>(); + List names = new ArrayList<>(); + for (T item : items) { + if (item == null) { + continue; + } + String code = normalize(codeGetter.apply(item)); + if (code != null) { + codes.add(code); + } else { + String name = normalize(nameGetter.apply(item)); + if (name != null) { + names.add(name); + } + } + } + + Map idByCode = new HashMap<>(); + if (!codes.isEmpty()) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if (extraConditions != null) { + extraConditions.accept(wrapper); + } + wrapper.in(codeColumn, codes); + wrapper.select(idColumn, codeColumn); + for (T dbRow : service.list(wrapper)) { + String code = normalize(codeGetter.apply(dbRow)); + Integer id = extractId(dbRow, idColumn); + if (code != null && id != null) { + idByCode.putIfAbsent(code, id); + } + } + } + + Map idByName = new HashMap<>(); + if (!names.isEmpty()) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if (extraConditions != null) { + extraConditions.accept(wrapper); + } + wrapper.in(nameColumn, names); + wrapper.select(idColumn, nameColumn); + for (T dbRow : service.list(wrapper)) { + String name = normalize(nameGetter.apply(dbRow)); + Integer id = extractId(dbRow, idColumn); + if (name != null && id != null) { + idByName.putIfAbsent(name, id); + } + } + } + + List updates = new ArrayList<>(); + List inserts = new ArrayList<>(); + for (T item : items) { + if (item == null) { + continue; + } + String code = normalize(codeGetter.apply(item)); + Integer id = null; + if (code != null) { + id = idByCode.get(code); + } else { + String name = normalize(nameGetter.apply(item)); + if (name != null) { + id = idByName.get(name); + } + } + + if (id != null) { + idSetter.accept(item, id); + updates.add(item); + } else { + inserts.add(item); + } + } + + if (!updates.isEmpty()) { + service.updateBatchById(updates, batchSize); + } + if (!inserts.isEmpty()) { + service.saveBatch(inserts, batchSize); + } + return updates.size() + inserts.size(); + } + + /** + * 批量 upsert:按单字段 key 匹配(key 非空)。 + */ + public int upsertBySingleKey(IService service, + List items, + SFunction idColumn, + BiConsumer idSetter, + SFunction keyColumn, + Function keyGetter, + Consumer> extraConditions, + int batchSize) { + if (CollectionUtils.isEmpty(items)) { + return 0; + } + + List keys = new ArrayList<>(items.size()); + for (T item : items) { + if (item == null) { + continue; + } + String key = normalize(keyGetter.apply(item)); + if (key != null) { + keys.add(key); + } + } + + Map idByKey = new HashMap<>(); + if (!keys.isEmpty()) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if (extraConditions != null) { + extraConditions.accept(wrapper); + } + wrapper.in(keyColumn, keys); + wrapper.select(idColumn, keyColumn); + for (T dbRow : service.list(wrapper)) { + String key = normalize(keyGetter.apply(dbRow)); + Integer id = extractId(dbRow, idColumn); + if (key != null && id != null) { + idByKey.putIfAbsent(key, id); + } + } + } + + List updates = new ArrayList<>(); + List inserts = new ArrayList<>(); + for (T item : items) { + if (item == null) { + continue; + } + String key = normalize(keyGetter.apply(item)); + Integer id = key != null ? idByKey.get(key) : null; + if (id != null) { + idSetter.accept(item, id); + updates.add(item); + } else { + inserts.add(item); + } + } + + if (!updates.isEmpty()) { + service.updateBatchById(updates, batchSize); + } + if (!inserts.isEmpty()) { + service.saveBatch(inserts, batchSize); + } + return updates.size() + inserts.size(); + } + + /** + * 批量 upsert:按单字段 key 匹配(key 非空)。当匹配到已存在记录时: + * - 覆盖更新 + * - 将 counter(通常是 recommend)在数据库原值基础上 +1,用于记录“被更新次数” + * + *

注意:counter 会被覆盖写入(不是 SQL 自增),因此该方法适合导入场景。

+ */ + public int upsertBySingleKeyAndIncrementCounterOnUpdate(IService service, + List items, + SFunction idColumn, + BiConsumer idSetter, + SFunction keyColumn, + Function keyGetter, + SFunction counterColumn, + BiConsumer counterSetter, + Consumer> extraConditions, + int batchSize) { + if (CollectionUtils.isEmpty(items)) { + return 0; + } + + List keys = new ArrayList<>(items.size()); + for (T item : items) { + if (item == null) { + continue; + } + String key = normalize(keyGetter.apply(item)); + if (key != null) { + keys.add(key); + } + } + + Map idByKey = new HashMap<>(); + Map counterByKey = new HashMap<>(); + if (!keys.isEmpty()) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if (extraConditions != null) { + extraConditions.accept(wrapper); + } + wrapper.in(keyColumn, keys); + wrapper.select(idColumn, keyColumn, counterColumn); + for (T dbRow : service.list(wrapper)) { + String key = normalize(keyGetter.apply(dbRow)); + Integer id = extractId(dbRow, idColumn); + if (key == null || id == null) { + continue; + } + idByKey.putIfAbsent(key, id); + if (counterColumn != null) { + counterByKey.putIfAbsent(key, counterColumn.apply(dbRow)); + } + } + } + + List updates = new ArrayList<>(); + List inserts = new ArrayList<>(); + for (T item : items) { + if (item == null) { + continue; + } + String key = normalize(keyGetter.apply(item)); + Integer id = key != null ? idByKey.get(key) : null; + if (id != null) { + idSetter.accept(item, id); + Integer old = key != null ? counterByKey.get(key) : null; + if (counterSetter != null) { + counterSetter.accept(item, old == null ? 1 : old + 1); + } + updates.add(item); + } else { + // insert:如果未提供 counterSetter,则不做处理;如果提供则默认 0。 + if (counterSetter != null) { + counterSetter.accept(item, 0); + } + inserts.add(item); + } + } + + if (!updates.isEmpty()) { + service.updateBatchById(updates, batchSize); + } + if (!inserts.isEmpty()) { + service.saveBatch(inserts, batchSize); + } + return updates.size() + inserts.size(); + } + + /** + * 批量 upsert:优先按 code 匹配;code 为空时按 name 匹配。匹配到已存在记录时 counter +1。 + */ + public int upsertByCodeOrNameAndIncrementCounterOnUpdate(IService service, + List items, + SFunction idColumn, + BiConsumer idSetter, + SFunction codeColumn, + Function codeGetter, + SFunction nameColumn, + Function nameGetter, + SFunction counterColumn, + BiConsumer counterSetter, + Consumer> extraConditions, + int batchSize) { + if (CollectionUtils.isEmpty(items)) { + return 0; + } + + List codes = new ArrayList<>(); + List names = new ArrayList<>(); + for (T item : items) { + if (item == null) { + continue; + } + String code = normalize(codeGetter.apply(item)); + if (code != null) { + codes.add(code); + } else { + String name = normalize(nameGetter.apply(item)); + if (name != null) { + names.add(name); + } + } + } + + Map idByCode = new HashMap<>(); + Map counterByCode = new HashMap<>(); + if (!codes.isEmpty()) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if (extraConditions != null) { + extraConditions.accept(wrapper); + } + wrapper.in(codeColumn, codes); + wrapper.select(idColumn, codeColumn, counterColumn); + for (T dbRow : service.list(wrapper)) { + String code = normalize(codeGetter.apply(dbRow)); + Integer id = extractId(dbRow, idColumn); + if (code == null || id == null) { + continue; + } + idByCode.putIfAbsent(code, id); + if (counterColumn != null) { + counterByCode.putIfAbsent(code, counterColumn.apply(dbRow)); + } + } + } + + Map idByName = new HashMap<>(); + Map counterByName = new HashMap<>(); + if (!names.isEmpty()) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if (extraConditions != null) { + extraConditions.accept(wrapper); + } + wrapper.in(nameColumn, names); + wrapper.select(idColumn, nameColumn, counterColumn); + for (T dbRow : service.list(wrapper)) { + String name = normalize(nameGetter.apply(dbRow)); + Integer id = extractId(dbRow, idColumn); + if (name == null || id == null) { + continue; + } + idByName.putIfAbsent(name, id); + if (counterColumn != null) { + counterByName.putIfAbsent(name, counterColumn.apply(dbRow)); + } + } + } + + List updates = new ArrayList<>(); + List inserts = new ArrayList<>(); + for (T item : items) { + if (item == null) { + continue; + } + String code = normalize(codeGetter.apply(item)); + Integer id = null; + Integer old = null; + if (code != null) { + id = idByCode.get(code); + old = counterByCode.get(code); + } else { + String name = normalize(nameGetter.apply(item)); + if (name != null) { + id = idByName.get(name); + old = counterByName.get(name); + } + } + + if (id != null) { + idSetter.accept(item, id); + if (counterSetter != null) { + counterSetter.accept(item, old == null ? 1 : old + 1); + } + updates.add(item); + } else { + if (counterSetter != null) { + counterSetter.accept(item, 0); + } + inserts.add(item); + } + } + + if (!updates.isEmpty()) { + service.updateBatchById(updates, batchSize); + } + if (!inserts.isEmpty()) { + service.saveBatch(inserts, batchSize); + } + return updates.size() + inserts.size(); + } + + /** + * 批量失败时降级逐行,尽量保留“第 N 行”错误定位。 + */ + public int persistChunkWithFallback(List items, + List excelRowNumbers, + Supplier batchPersist, + BiFunction rowPersist, + List errorMessages) { + if (CollectionUtils.isEmpty(items)) { + return 0; + } + try { + return runInNewTx(batchPersist); + } catch (Exception batchException) { + int successCount = 0; + for (int i = 0; i < items.size(); i++) { + T item = items.get(i); + int excelRowNumber = (excelRowNumbers != null && i < excelRowNumbers.size()) ? excelRowNumbers.get(i) : -1; + try { + int delta = runInNewTx(() -> rowPersist.apply(item, excelRowNumber) ? 1 : 0); + successCount += delta; + } catch (Exception e) { + if (errorMessages != null) { + if (excelRowNumber > 0) { + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + } else { + errorMessages.add(e.getMessage()); + } + } + } + } + return successCount; + } + } + + /** + * 批量失败时降级逐行:允许调用方自定义“成功条数”的计算口径(例如:仅统计 insert 入库条数)。 + * + *

batchPersistCount / rowPersistCount 返回的是“需要累计的条数增量”,并不等同于“是否成功”。

+ */ + public int persistChunkWithFallbackCount(List items, + List excelRowNumbers, + Supplier batchPersistCount, + BiFunction rowPersistCount, + List errorMessages) { + if (CollectionUtils.isEmpty(items)) { + return 0; + } + try { + return runInNewTx(batchPersistCount); + } catch (Exception batchException) { + int count = 0; + for (int i = 0; i < items.size(); i++) { + T item = items.get(i); + int excelRowNumber = (excelRowNumbers != null && i < excelRowNumbers.size()) ? excelRowNumbers.get(i) : -1; + try { + Integer delta = runInNewTx(() -> rowPersistCount.apply(item, excelRowNumber)); + if (delta != null && delta > 0) { + count += delta; + } + } catch (Exception e) { + if (errorMessages != null) { + if (excelRowNumber > 0) { + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + } else { + errorMessages.add(e.getMessage()); + } + } + } + } + return count; + } + } + + private static String normalize(String value) { + if (value == null) { + return null; + } + String trimmed = value.trim(); + return trimmed.isEmpty() ? null : trimmed; + } + + private static String normalizeCompanyName(String name) { + if (name == null) { + return null; + } + // 兼容 Excel/网页复制带来的全角空格 + String v = name.replace(' ', ' ').trim(); + return v.isEmpty() ? null : v; + } + + /** + * Split a "party names" cell into normalized company name candidates. + * Supports common separators used in Excel/web copy (comma/semicolon/Chinese list delimiter/newlines). + */ + private static List splitPartyNames(String raw) { + List result = new ArrayList<>(); + String v = normalizeCompanyName(raw); + if (v == null) { + return result; + } + String[] parts = PARTY_SPLIT_PATTERN.split(v); + if (parts == null || parts.length == 0) { + result.add(v); + return result; + } + for (String p : parts) { + String item = normalizeCompanyName(p); + if (item != null) { + result.add(item); + } + } + return result; + } + + private static void addCompanyNameMapping(Map idByName, + Map ambiguousByName, + String key, + Integer companyId) { + if (key == null || companyId == null) { + return; + } + Integer existing = idByName.get(key); + if (existing == null) { + idByName.put(key, companyId); + return; + } + if (!existing.equals(companyId)) { + ambiguousByName.put(key, 1); + } + } + + private static Integer extractId(T entity, SFunction idColumn) { + // SFunction 是 getter method ref,直接调用即可 + return idColumn.apply(entity); + } +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditAdministrativeLicenseController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditAdministrativeLicenseController.java new file mode 100644 index 0000000..8564fcc --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditAdministrativeLicenseController.java @@ -0,0 +1,696 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditAdministrativeLicense; +import com.gxwebsoft.credit.param.CreditAdministrativeLicenseImportParam; +import com.gxwebsoft.credit.param.CreditAdministrativeLicenseParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditAdministrativeLicenseService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 行政许可控制器 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Tag(name = "行政许可管理") +@RestController +@RequestMapping("/api/credit/credit-administrative-license") +public class CreditAdministrativeLicenseController extends BaseController { + @Resource + private CreditAdministrativeLicenseService creditAdministrativeLicenseService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询行政许可") + @GetMapping("/page") + public ApiResult> page(CreditAdministrativeLicenseParam param) { + // 使用关联查询 + return success(creditAdministrativeLicenseService.pageRel(param)); + } + + @Operation(summary = "查询全部行政许可") + @GetMapping() + public ApiResult> list(CreditAdministrativeLicenseParam param) { + // 使用关联查询 + return success(creditAdministrativeLicenseService.listRel(param)); + } + + @Operation(summary = "根据id查询行政许可") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditAdministrativeLicenseService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:save')") + @OperationLog + @Operation(summary = "添加行政许可") + @PostMapping() + public ApiResult save(@RequestBody CreditAdministrativeLicense creditAdministrativeLicense) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditAdministrativeLicense.setUserId(loginUser.getUserId()); + // } + if (creditAdministrativeLicenseService.save(creditAdministrativeLicense)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:update')") + @OperationLog + @Operation(summary = "修改行政许可") + @PutMapping() + public ApiResult update(@RequestBody CreditAdministrativeLicense creditAdministrativeLicense) { + if (creditAdministrativeLicenseService.updateById(creditAdministrativeLicense)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:remove')") + @OperationLog + @Operation(summary = "删除行政许可") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditAdministrativeLicenseService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:save')") + @OperationLog + @Operation(summary = "批量添加行政许可") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditAdministrativeLicenseService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:update')") + @OperationLog + @Operation(summary = "批量修改行政许可") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditAdministrativeLicenseService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:remove')") + @OperationLog + @Operation(summary = "批量删除行政许可") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditAdministrativeLicenseService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditAdministrativeLicenseService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditAdministrativeLicense::getId, + CreditAdministrativeLicense::setId, + CreditAdministrativeLicense::getName, + CreditAdministrativeLicense::getCompanyId, + CreditAdministrativeLicense::setCompanyId, + CreditAdministrativeLicense::getHasData, + CreditAdministrativeLicense::setHasData, + CreditAdministrativeLicense::getTenantId, + CreditAdministrativeLicense::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入行政许可 + */ + @PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:save')") + @Operation(summary = "批量导入行政许可") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.readAnySheet( + file, CreditAdministrativeLicenseImportParam.class, this::isEmptyImportRow); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可编号"); + Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可证名称"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditAdministrativeLicenseImportParam param = list.get(i); + try { + CreditAdministrativeLicense item = convertImportParamToEntity(param); + String link = null; + if (!ImportHelper.isBlank(item.getCode())) { + link = urlByCode.get(item.getCode().trim()); + } + if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName())) { + link = urlByName.get(item.getName().trim()); + } + if (link != null && !link.isEmpty()) { + item.setUrl(link); + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getName())) { + errorMessages.add("第" + excelRowNumber + "行:决定文书/许可证名称不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertByCodeOrName( + creditAdministrativeLicenseService, + chunkItems, + CreditAdministrativeLicense::getId, + CreditAdministrativeLicense::setId, + CreditAdministrativeLicense::getCode, + CreditAdministrativeLicense::getCode, + CreditAdministrativeLicense::getName, + CreditAdministrativeLicense::getName, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditAdministrativeLicenseService.save(rowItem); + if (!saved) { + CreditAdministrativeLicense existing = null; + if (!ImportHelper.isBlank(rowItem.getCode())) { + existing = creditAdministrativeLicenseService.lambdaQuery() + .eq(CreditAdministrativeLicense::getCode, rowItem.getCode()) + .one(); + } + if (existing == null) { + existing = creditAdministrativeLicenseService.lambdaQuery() + .eq(CreditAdministrativeLicense::getName, rowItem.getName()) + .one(); + } + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditAdministrativeLicenseService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertByCodeOrName( + creditAdministrativeLicenseService, + chunkItems, + CreditAdministrativeLicense::getId, + CreditAdministrativeLicense::setId, + CreditAdministrativeLicense::getCode, + CreditAdministrativeLicense::getCode, + CreditAdministrativeLicense::getName, + CreditAdministrativeLicense::getName, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditAdministrativeLicenseService.save(rowItem); + if (!saved) { + CreditAdministrativeLicense existing = null; + if (!ImportHelper.isBlank(rowItem.getCode())) { + existing = creditAdministrativeLicenseService.lambdaQuery() + .eq(CreditAdministrativeLicense::getCode, rowItem.getCode()) + .one(); + } + if (existing == null) { + existing = creditAdministrativeLicenseService.lambdaQuery() + .eq(CreditAdministrativeLicense::getName, rowItem.getName()) + .one(); + } + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditAdministrativeLicenseService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.ADMINISTRATIVE_LICENSE, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 批量导入历史行政许可(仅解析“历史行政许可”选项卡) + * 规则:优先按编号(code)匹配;code 为空时按名称(name)匹配;匹配到则覆盖更新(recommend++ 记录更新次数)。 + */ + @PreAuthorize("hasAuthority('credit:creditAdministrativeLicense:save')") + @Operation(summary = "批量导入历史行政许可") + @PostMapping("/import/history") + public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史行政许可"); + if (sheetIndex < 0) { + return fail("未读取到数据,请确认文件中存在“历史行政许可”选项卡且表头与示例格式一致", null); + } + + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditAdministrativeLicenseImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可编号"); + Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "决定文书/许可证名称"); + + LinkedHashMap latestByKey = new LinkedHashMap<>(); + LinkedHashMap latestRowByKey = new LinkedHashMap<>(); + + for (int i = 0; i < list.size(); i++) { + CreditAdministrativeLicenseImportParam param = list.get(i); + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + try { + CreditAdministrativeLicense item = convertImportParamToEntity(param); + if (item.getCode() != null) { + item.setCode(item.getCode().trim()); + } + if (item.getName() != null) { + item.setName(item.getName().trim()); + } + + if (ImportHelper.isBlank(item.getName())) { + errorMessages.add("第" + excelRowNumber + "行:决定文书/许可证名称不能为空"); + continue; + } + + String link = null; + if (!ImportHelper.isBlank(item.getCode())) { + link = urlByCode.get(item.getCode()); + } + if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName())) { + link = urlByName.get(item.getName()); + } + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + // 历史导入的数据统一标记为“失效” + item.setDataStatus("失效"); + + String dedupKey = !ImportHelper.isBlank(item.getCode()) ? ("CODE:" + item.getCode()) : ("NAME:" + item.getName()); + latestByKey.put(dedupKey, item); + latestRowByKey.put(dedupKey, excelRowNumber); + } catch (Exception e) { + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (latestByKey.isEmpty()) { + if (errorMessages.isEmpty()) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + return success("导入完成,成功0条,失败" + errorMessages.size() + "条", errorMessages); + } + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (Map.Entry entry : latestByKey.entrySet()) { + String dedupKey = entry.getKey(); + CreditAdministrativeLicense item = entry.getValue(); + Integer rowNo = latestRowByKey.get(dedupKey); + chunkItems.add(item); + chunkRowNumbers.add(rowNo != null ? rowNo : -1); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertByCodeOrNameAndIncrementCounterOnUpdate( + creditAdministrativeLicenseService, + chunkItems, + CreditAdministrativeLicense::getId, + CreditAdministrativeLicense::setId, + CreditAdministrativeLicense::getCode, + CreditAdministrativeLicense::getCode, + CreditAdministrativeLicense::getName, + CreditAdministrativeLicense::getName, + CreditAdministrativeLicense::getRecommend, + CreditAdministrativeLicense::setRecommend, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + if (rowItem.getRecommend() == null) { + rowItem.setRecommend(0); + } + boolean saved = creditAdministrativeLicenseService.save(rowItem); + if (!saved) { + CreditAdministrativeLicense existing = null; + if (!ImportHelper.isBlank(rowItem.getCode())) { + existing = creditAdministrativeLicenseService.lambdaQuery() + .eq(CreditAdministrativeLicense::getCode, rowItem.getCode()) + .select(CreditAdministrativeLicense::getId, CreditAdministrativeLicense::getRecommend) + .one(); + } + if (existing == null && !ImportHelper.isBlank(rowItem.getName())) { + existing = creditAdministrativeLicenseService.lambdaQuery() + .eq(CreditAdministrativeLicense::getName, rowItem.getName()) + .select(CreditAdministrativeLicense::getId, CreditAdministrativeLicense::getRecommend) + .one(); + } + if (existing != null) { + rowItem.setId(existing.getId()); + Integer old = existing.getRecommend(); + rowItem.setRecommend(old == null ? 1 : old + 1); + if (creditAdministrativeLicenseService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertByCodeOrNameAndIncrementCounterOnUpdate( + creditAdministrativeLicenseService, + chunkItems, + CreditAdministrativeLicense::getId, + CreditAdministrativeLicense::setId, + CreditAdministrativeLicense::getCode, + CreditAdministrativeLicense::getCode, + CreditAdministrativeLicense::getName, + CreditAdministrativeLicense::getName, + CreditAdministrativeLicense::getRecommend, + CreditAdministrativeLicense::setRecommend, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + if (rowItem.getRecommend() == null) { + rowItem.setRecommend(0); + } + boolean saved = creditAdministrativeLicenseService.save(rowItem); + if (!saved) { + CreditAdministrativeLicense existing = null; + if (!ImportHelper.isBlank(rowItem.getCode())) { + existing = creditAdministrativeLicenseService.lambdaQuery() + .eq(CreditAdministrativeLicense::getCode, rowItem.getCode()) + .select(CreditAdministrativeLicense::getId, CreditAdministrativeLicense::getRecommend) + .one(); + } + if (existing == null && !ImportHelper.isBlank(rowItem.getName())) { + existing = creditAdministrativeLicenseService.lambdaQuery() + .eq(CreditAdministrativeLicense::getName, rowItem.getName()) + .select(CreditAdministrativeLicense::getId, CreditAdministrativeLicense::getRecommend) + .one(); + } + if (existing != null) { + rowItem.setId(existing.getId()); + Integer old = existing.getRecommend(); + rowItem.setRecommend(old == null ? 1 : old + 1); + if (creditAdministrativeLicenseService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.ADMINISTRATIVE_LICENSE, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载行政许可导入模板 + */ + @Operation(summary = "下载行政许可导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditAdministrativeLicenseImportParam example = new CreditAdministrativeLicenseImportParam(); + example.setCode("(2024)示例许可编号"); + example.setName("示例行政许可名称"); + example.setStatusText("有效"); + example.setType("行政许可"); + example.setValidityStart("2024-01-01"); + example.setValidityEnd("2029-01-01"); + example.setLicensingAuthority("某某许可机关"); + example.setLicenseContent("许可内容示例"); + example.setDataSourceUnit("数据来源单位示例"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("行政许可导入模板", "行政许可", CreditAdministrativeLicenseImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_administrative_license_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditAdministrativeLicenseImportParam param) { + if (param == null) { + return true; + } + if (isImportHeaderRow(param)) { + return true; + } + return ImportHelper.isBlank(param.getCode()) + && ImportHelper.isBlank(param.getName()) + && ImportHelper.isBlank(param.getStatusText()); + } + + private boolean isImportHeaderRow(CreditAdministrativeLicenseImportParam param) { + return isHeaderValue(param.getCode(), "决定文书/许可编号") + || isHeaderValue(param.getName(), "决定文书/许可证名称") + || isHeaderValue(param.getStatusText(), "许可状态"); + } + + private static boolean isHeaderValue(String value, String headerText) { + if (value == null) { + return false; + } + return headerText.equals(value.trim()); + } + + private CreditAdministrativeLicense convertImportParamToEntity(CreditAdministrativeLicenseImportParam param) { + CreditAdministrativeLicense entity = new CreditAdministrativeLicense(); + + entity.setCode(param.getCode()); + entity.setName(param.getName()); + entity.setStatusText(param.getStatusText()); + entity.setType(param.getType()); + entity.setValidityStart(param.getValidityStart()); + entity.setValidityEnd(param.getValidityEnd()); + entity.setLicensingAuthority(param.getLicensingAuthority()); + entity.setLicenseContent(param.getLicenseContent()); + entity.setDataSourceUnit(param.getDataSourceUnit()); + entity.setComments(param.getComments()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditBankruptcyController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditBankruptcyController.java new file mode 100644 index 0000000..2ba6a4a --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditBankruptcyController.java @@ -0,0 +1,627 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditBankruptcy; +import com.gxwebsoft.credit.param.CreditBankruptcyImportParam; +import com.gxwebsoft.credit.param.CreditBankruptcyParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditBankruptcyService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 破产重整控制器 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Tag(name = "破产重整管理") +@RestController +@RequestMapping("/api/credit/credit-bankruptcy") +public class CreditBankruptcyController extends BaseController { + @Resource + private CreditBankruptcyService creditBankruptcyService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询破产重整") + @GetMapping("/page") + public ApiResult> page(CreditBankruptcyParam param) { + // 使用关联查询 + return success(creditBankruptcyService.pageRel(param)); + } + + @Operation(summary = "查询全部破产重整") + @GetMapping() + public ApiResult> list(CreditBankruptcyParam param) { + // 使用关联查询 + return success(creditBankruptcyService.listRel(param)); + } + + @Operation(summary = "根据id查询破产重整") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditBankruptcyService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditBankruptcy:save')") + @OperationLog + @Operation(summary = "添加破产重整") + @PostMapping() + public ApiResult save(@RequestBody CreditBankruptcy creditBankruptcy) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditBankruptcy.setUserId(loginUser.getUserId()); + // } + if (creditBankruptcyService.save(creditBankruptcy)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditBankruptcy:update')") + @OperationLog + @Operation(summary = "修改破产重整") + @PutMapping() + public ApiResult update(@RequestBody CreditBankruptcy creditBankruptcy) { + if (creditBankruptcyService.updateById(creditBankruptcy)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditBankruptcy:remove')") + @OperationLog + @Operation(summary = "删除破产重整") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditBankruptcyService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditBankruptcy:save')") + @OperationLog + @Operation(summary = "批量添加破产重整") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditBankruptcyService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditBankruptcy:update')") + @OperationLog + @Operation(summary = "批量修改破产重整") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditBankruptcyService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditBankruptcy:remove')") + @OperationLog + @Operation(summary = "批量删除破产重整") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditBankruptcyService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditBankruptcy:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditBankruptcyService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditBankruptcy::getId, + CreditBankruptcy::setId, + CreditBankruptcy::getParty, + CreditBankruptcy::getCompanyId, + CreditBankruptcy::setCompanyId, + CreditBankruptcy::getHasData, + CreditBankruptcy::setHasData, + CreditBankruptcy::getTenantId, + CreditBankruptcy::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入破产重整 + */ + @PreAuthorize("hasAuthority('credit:creditBankruptcy:save')") + @Operation(summary = "批量导入破产重整") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.readAnySheet( + file, CreditBankruptcyImportParam.class, this::isEmptyImportRow); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditBankruptcyImportParam param = list.get(i); + try { + CreditBankruptcy item = convertImportParamToEntity(param); + if (!ImportHelper.isBlank(item.getCode())) { + String link = urlByCode.get(item.getCode().trim()); + if (link != null && !link.isEmpty()) { + item.setUrl(link); + } + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getCode())) { + errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditBankruptcyService, + chunkItems, + CreditBankruptcy::getId, + CreditBankruptcy::setId, + CreditBankruptcy::getCode, + CreditBankruptcy::getCode, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditBankruptcyService.save(rowItem); + if (!saved) { + CreditBankruptcy existing = creditBankruptcyService.lambdaQuery() + .eq(CreditBankruptcy::getCode, rowItem.getCode()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditBankruptcyService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditBankruptcyService, + chunkItems, + CreditBankruptcy::getId, + CreditBankruptcy::setId, + CreditBankruptcy::getCode, + CreditBankruptcy::getCode, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditBankruptcyService.save(rowItem); + if (!saved) { + CreditBankruptcy existing = creditBankruptcyService.lambdaQuery() + .eq(CreditBankruptcy::getCode, rowItem.getCode()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditBankruptcyService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.BANKRUPTCY, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 批量导入历史破产重整(仅解析“历史破产重整”选项卡) + * 规则:案号/唯一标识相同则覆盖更新(recommend++ 记录更新次数);不存在则插入。 + */ + @PreAuthorize("hasAuthority('credit:creditBankruptcy:save')") + @Operation(summary = "批量导入历史破产重整") + @PostMapping("/import/history") + public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史破产重整"); + if (sheetIndex < 0) { + return fail("未读取到数据,请确认文件中存在“历史破产重整”选项卡且表头与示例格式一致", null); + } + + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditBankruptcyImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + + LinkedHashMap latestByCode = new LinkedHashMap<>(); + LinkedHashMap latestRowByCode = new LinkedHashMap<>(); + + for (int i = 0; i < list.size(); i++) { + CreditBankruptcyImportParam param = list.get(i); + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + try { + CreditBankruptcy item = convertImportParamToEntity(param); + if (item.getCode() != null) { + item.setCode(item.getCode().trim()); + } + if (ImportHelper.isBlank(item.getCode())) { + errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + String link = urlByCode.get(item.getCode()); + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + latestByCode.put(item.getCode(), item); + latestRowByCode.put(item.getCode(), excelRowNumber); + } catch (Exception e) { + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (latestByCode.isEmpty()) { + if (errorMessages.isEmpty()) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + return success("导入完成,成功0条,失败" + errorMessages.size() + "条", errorMessages); + } + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (Map.Entry entry : latestByCode.entrySet()) { + String code = entry.getKey(); + CreditBankruptcy item = entry.getValue(); + Integer rowNo = latestRowByCode.get(code); + chunkItems.add(item); + chunkRowNumbers.add(rowNo != null ? rowNo : -1); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKeyAndIncrementCounterOnUpdate( + creditBankruptcyService, + chunkItems, + CreditBankruptcy::getId, + CreditBankruptcy::setId, + CreditBankruptcy::getCode, + CreditBankruptcy::getCode, + CreditBankruptcy::getRecommend, + CreditBankruptcy::setRecommend, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + if (rowItem.getRecommend() == null) { + rowItem.setRecommend(0); + } + boolean saved = creditBankruptcyService.save(rowItem); + if (!saved) { + CreditBankruptcy existing = creditBankruptcyService.lambdaQuery() + .eq(CreditBankruptcy::getCode, rowItem.getCode()) + .select(CreditBankruptcy::getId, CreditBankruptcy::getRecommend) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + Integer old = existing.getRecommend(); + rowItem.setRecommend(old == null ? 1 : old + 1); + if (creditBankruptcyService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKeyAndIncrementCounterOnUpdate( + creditBankruptcyService, + chunkItems, + CreditBankruptcy::getId, + CreditBankruptcy::setId, + CreditBankruptcy::getCode, + CreditBankruptcy::getCode, + CreditBankruptcy::getRecommend, + CreditBankruptcy::setRecommend, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + if (rowItem.getRecommend() == null) { + rowItem.setRecommend(0); + } + boolean saved = creditBankruptcyService.save(rowItem); + if (!saved) { + CreditBankruptcy existing = creditBankruptcyService.lambdaQuery() + .eq(CreditBankruptcy::getCode, rowItem.getCode()) + .select(CreditBankruptcy::getId, CreditBankruptcy::getRecommend) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + Integer old = existing.getRecommend(); + rowItem.setRecommend(old == null ? 1 : old + 1); + if (creditBankruptcyService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.BANKRUPTCY, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载破产重整导入模板 + */ + @Operation(summary = "下载破产重整导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditBankruptcyImportParam example = new CreditBankruptcyImportParam(); + example.setCode("(2024)示例案号"); + example.setType("破产清算"); + example.setParty("某某公司"); + example.setCourt("某某人民法院"); + example.setPublicDate("2024-01-10"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("破产重整导入模板", "破产重整", CreditBankruptcyImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_bankruptcy_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditBankruptcyImportParam param) { + if (param == null) { + return true; + } + if (isImportHeaderRow(param)) { + return true; + } + return ImportHelper.isBlank(param.getCode()) + && ImportHelper.isBlank(param.getParty()) + && ImportHelper.isBlank(param.getCourt()); + } + + private boolean isImportHeaderRow(CreditBankruptcyImportParam param) { + return isHeaderValue(param.getCode(), "案号") + || isHeaderValue(param.getType(), "案件类型") + || isHeaderValue(param.getParty(), "当事人"); + } + + private static boolean isHeaderValue(String value, String headerText) { + if (value == null) { + return false; + } + return headerText.equals(value.trim()); + } + + private CreditBankruptcy convertImportParamToEntity(CreditBankruptcyImportParam param) { + CreditBankruptcy entity = new CreditBankruptcy(); + + entity.setCode(param.getCode()); + entity.setType(param.getType()); + entity.setParty(param.getParty()); + entity.setCourt(param.getCourt()); + entity.setPublicDate(param.getPublicDate()); + entity.setComments(param.getComments()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditBranchController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditBranchController.java new file mode 100644 index 0000000..8c81cb1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditBranchController.java @@ -0,0 +1,420 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditBranch; +import com.gxwebsoft.credit.param.CreditBranchImportParam; +import com.gxwebsoft.credit.param.CreditBranchParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditBranchService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 分支机构控制器 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Tag(name = "分支机构管理") +@RestController +@RequestMapping("/api/credit/credit-branch") +public class CreditBranchController extends BaseController { + @Resource + private CreditBranchService creditBranchService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询分支机构") + @GetMapping("/page") + public ApiResult> page(CreditBranchParam param) { + // 使用关联查询 + return success(creditBranchService.pageRel(param)); + } + + @Operation(summary = "查询全部分支机构") + @GetMapping() + public ApiResult> list(CreditBranchParam param) { + // 使用关联查询 + return success(creditBranchService.listRel(param)); + } + + @Operation(summary = "根据id查询分支机构") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditBranchService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditBranch:save')") + @OperationLog + @Operation(summary = "添加分支机构") + @PostMapping() + public ApiResult save(@RequestBody CreditBranch creditBranch) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditBranch.setUserId(loginUser.getUserId()); + // } + if (creditBranchService.save(creditBranch)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditBranch:update')") + @OperationLog + @Operation(summary = "修改分支机构") + @PutMapping() + public ApiResult update(@RequestBody CreditBranch creditBranch) { + if (creditBranchService.updateById(creditBranch)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditBranch:remove')") + @OperationLog + @Operation(summary = "删除分支机构") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditBranchService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditBranch:save')") + @OperationLog + @Operation(summary = "批量添加分支机构") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditBranchService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditBranch:update')") + @OperationLog + @Operation(summary = "批量修改分支机构") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditBranchService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditBranch:remove')") + @OperationLog + @Operation(summary = "批量删除分支机构") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditBranchService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditBranch:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditBranchService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditBranch::getId, + CreditBranch::setId, + CreditBranch::getName, + CreditBranch::getCompanyId, + CreditBranch::setCompanyId, + CreditBranch::getHasData, + CreditBranch::setHasData, + CreditBranch::getTenantId, + CreditBranch::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入分支机构 + */ + @PreAuthorize("hasAuthority('credit:creditBranch:save')") + @Operation(summary = "批量导入分支机构") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.readAnySheet( + file, CreditBranchImportParam.class, this::isEmptyImportRow); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "分支机构名称"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditBranchImportParam param = list.get(i); + try { + CreditBranch item = convertImportParamToEntity(param); + if (!ImportHelper.isBlank(item.getName())) { + String link = urlByName.get(item.getName().trim()); + if (link != null && !link.isEmpty()) { + item.setUrl(link); + } + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getName())) { + errorMessages.add("第" + excelRowNumber + "行:分支机构名称不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditBranchService, + chunkItems, + CreditBranch::getId, + CreditBranch::setId, + CreditBranch::getName, + CreditBranch::getName, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditBranchService.save(rowItem); + if (!saved) { + CreditBranch existing = creditBranchService.lambdaQuery() + .eq(CreditBranch::getName, rowItem.getName()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditBranchService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditBranchService, + chunkItems, + CreditBranch::getId, + CreditBranch::setId, + CreditBranch::getName, + CreditBranch::getName, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditBranchService.save(rowItem); + if (!saved) { + CreditBranch existing = creditBranchService.lambdaQuery() + .eq(CreditBranch::getName, rowItem.getName()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditBranchService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.BRANCH, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载分支机构导入模板 + */ + @Operation(summary = "下载分支机构导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditBranchImportParam example = new CreditBranchImportParam(); + example.setName("某某公司分支机构"); + example.setCurator("张三"); + example.setRegion("广西南宁"); + example.setEstablishDate("2020-06-01"); + example.setStatusText("存续"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("分支机构导入模板", "分支机构", CreditBranchImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_branch_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditBranchImportParam param) { + if (param == null) { + return true; + } + if (isImportHeaderRow(param)) { + return true; + } + return ImportHelper.isBlank(param.getName()) + && ImportHelper.isBlank(param.getCurator()) + && ImportHelper.isBlank(param.getRegion()); + } + + private boolean isImportHeaderRow(CreditBranchImportParam param) { + return isHeaderValue(param.getName(), "分支机构名称") + || isHeaderValue(param.getCurator(), "负责人") + || isHeaderValue(param.getRegion(), "地区"); + } + + private static boolean isHeaderValue(String value, String headerText) { + if (value == null) { + return false; + } + return headerText.equals(value.trim()); + } + + private CreditBranch convertImportParamToEntity(CreditBranchImportParam param) { + CreditBranch entity = new CreditBranch(); + + entity.setName(param.getName()); + entity.setCurator(param.getCurator()); + entity.setRegion(param.getRegion()); + entity.setEstablishDate(param.getEstablishDate()); + entity.setStatusText(param.getStatusText()); + entity.setComments(param.getComments()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditBreachOfTrustController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditBreachOfTrustController.java new file mode 100644 index 0000000..880afde --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditBreachOfTrustController.java @@ -0,0 +1,638 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditBreachOfTrust; +import com.gxwebsoft.credit.param.CreditBreachOfTrustImportParam; +import com.gxwebsoft.credit.param.CreditBreachOfTrustParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditBreachOfTrustService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 失信被执行人控制器 + * + * @author 科技小王子 + * @since 2025-12-19 19:46:14 + */ +@Tag(name = "失信被执行人管理") +@RestController +@RequestMapping("/api/credit/credit-breach-of-trust") +public class CreditBreachOfTrustController extends BaseController { + @Resource + private CreditBreachOfTrustService creditBreachOfTrustService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询失信被执行人") + @GetMapping("/page") + public ApiResult> page(CreditBreachOfTrustParam param) { + // 使用关联查询 + return success(creditBreachOfTrustService.pageRel(param)); + } + + @Operation(summary = "查询全部失信被执行人") + @GetMapping() + public ApiResult> list(CreditBreachOfTrustParam param) { + // 使用关联查询 + return success(creditBreachOfTrustService.listRel(param)); + } + + @Operation(summary = "根据id查询失信被执行人") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditBreachOfTrustService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditBreachOfTrust:save')") + @OperationLog + @Operation(summary = "添加失信被执行人") + @PostMapping() + public ApiResult save(@RequestBody CreditBreachOfTrust creditBreachOfTrust) { + if (creditBreachOfTrustService.save(creditBreachOfTrust)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditBreachOfTrust:update')") + @OperationLog + @Operation(summary = "修改失信被执行人") + @PutMapping() + public ApiResult update(@RequestBody CreditBreachOfTrust creditBreachOfTrust) { + if (creditBreachOfTrustService.updateById(creditBreachOfTrust)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditBreachOfTrust:remove')") + @OperationLog + @Operation(summary = "删除失信被执行人") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditBreachOfTrustService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditBreachOfTrust:save')") + @OperationLog + @Operation(summary = "批量添加失信被执行人") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditBreachOfTrustService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditBreachOfTrust:update')") + @OperationLog + @Operation(summary = "批量修改失信被执行人") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditBreachOfTrustService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditBreachOfTrust:remove')") + @OperationLog + @Operation(summary = "批量删除失信被执行人") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditBreachOfTrustService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditBreachOfTrust:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditBreachOfTrustService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditBreachOfTrust::getId, + CreditBreachOfTrust::setId, + CreditBreachOfTrust::getPlaintiffAppellant, + CreditBreachOfTrust::getCompanyId, + CreditBreachOfTrust::setCompanyId, + CreditBreachOfTrust::getHasData, + CreditBreachOfTrust::setHasData, + CreditBreachOfTrust::getTenantId, + CreditBreachOfTrust::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入失信被执行人 + */ + @PreAuthorize("hasAuthority('credit:creditBreachOfTrust:save')") + @Operation(summary = "批量导入失信被执行人") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "失信被执行人", 0); + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditBreachOfTrustImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditBreachOfTrustImportParam param = list.get(i); + try { + CreditBreachOfTrust item = convertImportParamToEntity(param); + if (!ImportHelper.isBlank(item.getCaseNumber())) { + String link = urlByCaseNumber.get(item.getCaseNumber().trim()); + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getCaseNumber())) { + errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditBreachOfTrustService, + chunkItems, + CreditBreachOfTrust::getId, + CreditBreachOfTrust::setId, + CreditBreachOfTrust::getCaseNumber, + CreditBreachOfTrust::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditBreachOfTrustService.save(rowItem); + if (!saved) { + CreditBreachOfTrust existing = creditBreachOfTrustService.lambdaQuery() + .eq(CreditBreachOfTrust::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditBreachOfTrustService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditBreachOfTrustService, + chunkItems, + CreditBreachOfTrust::getId, + CreditBreachOfTrust::setId, + CreditBreachOfTrust::getCaseNumber, + CreditBreachOfTrust::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditBreachOfTrustService.save(rowItem); + if (!saved) { + CreditBreachOfTrust existing = creditBreachOfTrustService.lambdaQuery() + .eq(CreditBreachOfTrust::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditBreachOfTrustService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.BREACH_OF_TRUST, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 批量导入历史失信被执行人(仅解析“历史失信被执行人”选项卡) + * 规则:案号相同则覆盖更新(recommend++ 记录更新次数);案号不存在则插入。 + */ + @PreAuthorize("hasAuthority('credit:creditBreachOfTrust:save')") + @Operation(summary = "批量导入历史失信被执行人") + @PostMapping("/import/history") + public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史失信被执行人"); + if (sheetIndex < 0) { + return fail("未读取到数据,请确认文件中存在“历史失信被执行人”选项卡且表头与示例格式一致", null); + } + + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditBreachOfTrustImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + + // 同案号多条:以导入文件中“最后一条”为准(视为最新) + LinkedHashMap latestByCaseNumber = new LinkedHashMap<>(); + LinkedHashMap latestRowByCaseNumber = new LinkedHashMap<>(); + + for (int i = 0; i < list.size(); i++) { + CreditBreachOfTrustImportParam param = list.get(i); + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + try { + CreditBreachOfTrust item = convertImportParamToEntity(param); + if (item.getCaseNumber() != null) { + item.setCaseNumber(item.getCaseNumber().trim()); + } + if (ImportHelper.isBlank(item.getCaseNumber())) { + errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + String link = urlByCaseNumber.get(item.getCaseNumber()); + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + // 历史导入的数据统一标记为“失效” + item.setDataStatus("失效"); + + latestByCaseNumber.put(item.getCaseNumber(), item); + latestRowByCaseNumber.put(item.getCaseNumber(), excelRowNumber); + } catch (Exception e) { + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (latestByCaseNumber.isEmpty()) { + if (errorMessages.isEmpty()) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + return success("导入完成,成功0条,失败" + errorMessages.size() + "条", errorMessages); + } + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (Map.Entry entry : latestByCaseNumber.entrySet()) { + String caseNumber = entry.getKey(); + CreditBreachOfTrust item = entry.getValue(); + Integer rowNo = latestRowByCaseNumber.get(caseNumber); + chunkItems.add(item); + chunkRowNumbers.add(rowNo != null ? rowNo : -1); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKeyAndIncrementCounterOnUpdate( + creditBreachOfTrustService, + chunkItems, + CreditBreachOfTrust::getId, + CreditBreachOfTrust::setId, + CreditBreachOfTrust::getCaseNumber, + CreditBreachOfTrust::getCaseNumber, + CreditBreachOfTrust::getRecommend, + CreditBreachOfTrust::setRecommend, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + if (rowItem.getRecommend() == null) { + rowItem.setRecommend(0); + } + boolean saved = creditBreachOfTrustService.save(rowItem); + if (!saved) { + CreditBreachOfTrust existing = creditBreachOfTrustService.lambdaQuery() + .eq(CreditBreachOfTrust::getCaseNumber, rowItem.getCaseNumber()) + .select(CreditBreachOfTrust::getId, CreditBreachOfTrust::getRecommend) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + Integer old = existing.getRecommend(); + rowItem.setRecommend(old == null ? 1 : old + 1); + if (creditBreachOfTrustService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKeyAndIncrementCounterOnUpdate( + creditBreachOfTrustService, + chunkItems, + CreditBreachOfTrust::getId, + CreditBreachOfTrust::setId, + CreditBreachOfTrust::getCaseNumber, + CreditBreachOfTrust::getCaseNumber, + CreditBreachOfTrust::getRecommend, + CreditBreachOfTrust::setRecommend, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + if (rowItem.getRecommend() == null) { + rowItem.setRecommend(0); + } + boolean saved = creditBreachOfTrustService.save(rowItem); + if (!saved) { + CreditBreachOfTrust existing = creditBreachOfTrustService.lambdaQuery() + .eq(CreditBreachOfTrust::getCaseNumber, rowItem.getCaseNumber()) + .select(CreditBreachOfTrust::getId, CreditBreachOfTrust::getRecommend) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + Integer old = existing.getRecommend(); + rowItem.setRecommend(old == null ? 1 : old + 1); + if (creditBreachOfTrustService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.BREACH_OF_TRUST, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载失信被执行人导入模板 + */ + @Operation(summary = "下载失信被执行人导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditBreachOfTrustImportParam example = new CreditBreachOfTrustImportParam(); + example.setDataType("失信被执行人"); + example.setCaseNumber("(2024)示例案号"); + example.setPlaintiffAppellant("原告示例"); + example.setAppellee("被告示例"); + example.setOtherPartiesThirdParty("第三人示例"); + example.setInvolvedAmount("20,293.91"); + example.setDataStatus("正常"); + example.setOccurrenceTime("2024-01-01"); + example.setCourtName("示例法院"); + example.setReleaseDate("2024-01-01"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("失信被执行人导入模板", "失信被执行人", CreditBreachOfTrustImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_breach_of_trust_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditBreachOfTrustImportParam param) { + if (param == null) { + return true; + } + return ImportHelper.isBlank(param.getCaseNumber()) + && ImportHelper.isBlank(param.getPlaintiffAppellant()) + && ImportHelper.isBlank(param.getPlaintiffAppellant2()) + && ImportHelper.isBlank(param.getAppellee()) + && ImportHelper.isBlank(param.getAppellee2()); + } + + private CreditBreachOfTrust convertImportParamToEntity(CreditBreachOfTrustImportParam param) { + CreditBreachOfTrust entity = new CreditBreachOfTrust(); + + entity.setDataType(param.getDataType()); + entity.setCaseNumber(param.getCaseNumber()); + + String plaintiffAppellant = !ImportHelper.isBlank(param.getPlaintiffAppellant2()) + ? param.getPlaintiffAppellant2() + : param.getPlaintiffAppellant(); + entity.setPlaintiffAppellant(plaintiffAppellant); + + String appellee = !ImportHelper.isBlank(param.getAppellee2()) + ? param.getAppellee2() + : param.getAppellee(); + entity.setAppellee(appellee); + + entity.setOtherPartiesThirdParty(param.getOtherPartiesThirdParty()); + entity.setDataStatus(param.getDataStatus()); + + entity.setInvolvedAmount(!ImportHelper.isBlank(param.getInvolvedAmount2()) + ? param.getInvolvedAmount2() + : param.getInvolvedAmount()); + entity.setOccurrenceTime(!ImportHelper.isBlank(param.getOccurrenceTime2()) + ? param.getOccurrenceTime2() + : param.getOccurrenceTime()); + entity.setCourtName(!ImportHelper.isBlank(param.getCourtName2()) + ? param.getCourtName2() + : param.getCourtName()); + entity.setReleaseDate(param.getReleaseDate()); + entity.setComments(param.getComments()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditCaseFilingController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditCaseFilingController.java new file mode 100644 index 0000000..a19fa93 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditCaseFilingController.java @@ -0,0 +1,443 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditCaseFiling; +import com.gxwebsoft.credit.param.CreditCaseFilingImportParam; +import com.gxwebsoft.credit.param.CreditCaseFilingParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditCaseFilingService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 司法大数据控制器 + * + * @author 科技小王子 + * @since 2025-12-19 19:47:23 + */ +@Tag(name = "司法大数据管理") +@RestController +@RequestMapping("/api/credit/credit-case-filing") +public class CreditCaseFilingController extends BaseController { + @Resource + private CreditCaseFilingService creditCaseFilingService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询司法大数据") + @GetMapping("/page") + public ApiResult> page(CreditCaseFilingParam param) { + // 使用关联查询 + return success(creditCaseFilingService.pageRel(param)); + } + + @Operation(summary = "查询全部司法大数据") + @GetMapping() + public ApiResult> list(CreditCaseFilingParam param) { + // 使用关联查询 + return success(creditCaseFilingService.listRel(param)); + } + + @Operation(summary = "根据id查询司法大数据") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditCaseFilingService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditCaseFiling:save')") + @OperationLog + @Operation(summary = "添加司法大数据") + @PostMapping() + public ApiResult save(@RequestBody CreditCaseFiling creditCaseFiling) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditCaseFiling.setUserId(loginUser.getUserId()); + // } + if (creditCaseFilingService.save(creditCaseFiling)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCaseFiling:update')") + @OperationLog + @Operation(summary = "修改司法大数据") + @PutMapping() + public ApiResult update(@RequestBody CreditCaseFiling creditCaseFiling) { + if (creditCaseFilingService.updateById(creditCaseFiling)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCaseFiling:remove')") + @OperationLog + @Operation(summary = "删除司法大数据") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditCaseFilingService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCaseFiling:save')") + @OperationLog + @Operation(summary = "批量添加司法大数据") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditCaseFilingService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCaseFiling:update')") + @OperationLog + @Operation(summary = "批量修改司法大数据") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditCaseFilingService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCaseFiling:remove')") + @OperationLog + @Operation(summary = "批量删除司法大数据") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditCaseFilingService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditCaseFiling:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditCaseFilingService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditCaseFiling::getId, + CreditCaseFiling::setId, + CreditCaseFiling::getAppellee, + CreditCaseFiling::getCompanyId, + CreditCaseFiling::setCompanyId, + CreditCaseFiling::getHasData, + CreditCaseFiling::setHasData, + CreditCaseFiling::getTenantId, + CreditCaseFiling::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入立案信息 + */ + @PreAuthorize("hasAuthority('credit:creditCaseFiling:save')") + @Operation(summary = "批量导入立案信息") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "立案信息", 0); + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditCaseFilingImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + // easypoi 默认不会读取单元格超链接地址;url 通常挂在“案号”列的超链接中,需要额外读取回填。 + Map urlByCaseNumber = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditCaseFilingImportParam param = list.get(i); + try { + CreditCaseFiling item = convertImportParamToEntity(param); + if (!ImportHelper.isBlank(item.getCaseNumber())) { + String link = urlByCaseNumber.get(item.getCaseNumber().trim()); + if (link != null && !link.isEmpty()) { + item.setUrl(link); + } + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getCaseNumber())) { + errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditCaseFilingService, + chunkItems, + CreditCaseFiling::getId, + CreditCaseFiling::setId, + CreditCaseFiling::getCaseNumber, + CreditCaseFiling::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditCaseFilingService.save(rowItem); + if (!saved) { + CreditCaseFiling existing = creditCaseFilingService.lambdaQuery() + .eq(CreditCaseFiling::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditCaseFilingService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditCaseFilingService, + chunkItems, + CreditCaseFiling::getId, + CreditCaseFiling::setId, + CreditCaseFiling::getCaseNumber, + CreditCaseFiling::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditCaseFilingService.save(rowItem); + if (!saved) { + CreditCaseFiling existing = creditCaseFilingService.lambdaQuery() + .eq(CreditCaseFiling::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditCaseFilingService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.CASE_FILING, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载立案信息导入模板 + */ + @Operation(summary = "下载立案信息导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditCaseFilingImportParam example = new CreditCaseFilingImportParam(); + example.setDataType("立案信息"); + example.setPlaintiffAppellant("原告示例"); + example.setAppellee("被告示例"); + example.setOtherPartiesThirdParty2("第三人示例"); + example.setInvolvedAmount("100000"); + example.setDataStatus("正常"); + example.setCaseNumber("(2024)示例案号"); + example.setCauseOfAction("案由示例"); + example.setCourtName("示例法院"); + example.setOccurrenceTime("2024-01-01"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("立案信息导入模板", "立案信息", CreditCaseFilingImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_case_filing_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditCaseFilingImportParam param) { + if (param == null) { + return true; + } + return ImportHelper.isBlank(param.getCaseNumber()) + && ImportHelper.isBlank(param.getPlaintiffAppellant()) + && ImportHelper.isBlank(param.getAppellee()) + && ImportHelper.isBlank(param.getCauseOfAction()) + && ImportHelper.isBlank(param.getOtherPartiesThirdParty()) + && ImportHelper.isBlank(param.getOtherPartiesThirdParty2()) + && ImportHelper.isBlank(param.getCourtName()) + && ImportHelper.isBlank(param.getCourtName2()) + && ImportHelper.isBlank(param.getOccurrenceTime()) + && ImportHelper.isBlank(param.getOccurrenceTime2()) + && ImportHelper.isBlank(param.getInvolvedAmount()) + && ImportHelper.isBlank(param.getInvolvedAmount2()) + && ImportHelper.isBlank(param.getDataStatus()) + && ImportHelper.isBlank(param.getDataType()) + && ImportHelper.isBlank(param.getComments()); + } + + private CreditCaseFiling convertImportParamToEntity(CreditCaseFilingImportParam param) { + CreditCaseFiling entity = new CreditCaseFiling(); + + // Template compatibility: prefer new columns when present. + String occurrenceTime = !ImportHelper.isBlank(param.getOccurrenceTime2()) + ? param.getOccurrenceTime2() + : param.getOccurrenceTime(); + String otherPartiesThirdParty = !ImportHelper.isBlank(param.getOtherPartiesThirdParty2()) + ? param.getOtherPartiesThirdParty2() + : param.getOtherPartiesThirdParty(); + String courtName = !ImportHelper.isBlank(param.getCourtName2()) + ? param.getCourtName2() + : param.getCourtName(); + String involvedAmount = !ImportHelper.isBlank(param.getInvolvedAmount2()) + ? param.getInvolvedAmount2() + : param.getInvolvedAmount(); + + entity.setDataType(param.getDataType()); + entity.setPlaintiffAppellant(param.getPlaintiffAppellant()); + entity.setAppellee(param.getAppellee()); + entity.setDataStatus(param.getDataStatus()); + + entity.setCaseNumber(param.getCaseNumber()); + entity.setCauseOfAction(param.getCauseOfAction()); + entity.setOtherPartiesThirdParty(otherPartiesThirdParty); + entity.setCourtName(courtName); + entity.setOccurrenceTime(occurrenceTime); + entity.setInvolvedAmount(involvedAmount); + entity.setComments(param.getComments()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditCompanyController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditCompanyController.java new file mode 100644 index 0000000..828fa0e --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditCompanyController.java @@ -0,0 +1,548 @@ +package com.gxwebsoft.credit.controller; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditCompany; +import com.gxwebsoft.credit.param.CreditCompanyImportParam; +import com.gxwebsoft.credit.param.CreditCompanyParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 企业控制器 + * + * @author 科技小王子 + * @since 2025-12-17 08:28:03 + */ +@Tag(name = "企业管理") +@RestController +@RequestMapping("/api/credit/credit-company") +public class CreditCompanyController extends BaseController { + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询企业") + @GetMapping("/page") + public ApiResult> page(CreditCompanyParam param) { + // 使用关联查询 + return success(creditCompanyService.pageRel(param)); + } + + @Operation(summary = "查询全部企业") + @GetMapping() + public ApiResult> list(CreditCompanyParam param) { + // 使用关联查询 + return success(creditCompanyService.listRel(param)); + } + + @Operation(summary = "根据id查询企业") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditCompanyService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditCompany:save')") + @OperationLog + @Operation(summary = "添加企业") + @PostMapping() + public ApiResult save(@RequestBody CreditCompany creditCompany) { + if (creditCompanyService.save(creditCompany)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCompany:update')") + @OperationLog + @Operation(summary = "修改企业") + @PutMapping() + public ApiResult update(@RequestBody CreditCompany creditCompany) { + if (creditCompanyService.updateById(creditCompany)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCompany:remove')") + @OperationLog + @Operation(summary = "删除企业") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditCompanyService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCompany:save')") + @OperationLog + @Operation(summary = "批量添加企业") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditCompanyService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCompany:update')") + @OperationLog + @Operation(summary = "批量修改企业") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditCompanyService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCompany:remove')") + @OperationLog + @Operation(summary = "批量删除企业") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditCompanyService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 批量导入企业 + */ + @PreAuthorize("hasAuthority('credit:creditJudiciary:save')") + @Operation(summary = "批量导入企业") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int insertedCount = 0; + Set touchedMatchNames = new HashSet<>(); + + try { + List list = null; + int usedTitleRows = 0; + int usedHeadRows = 0; + int[][] tryConfigs = new int[][]{{1, 1}, {0, 1}, {0, 2}, {0, 3}}; + + for (int[] config : tryConfigs) { + list = filterEmptyRows(tryImport(file, config[0], config[1])); + if (!CollectionUtils.isEmpty(list)) { + usedTitleRows = config[0]; + usedHeadRows = config[1]; + break; + } + } + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, 0, usedTitleRows, usedHeadRows, "原文件导入名称"); + Map urlByMatchName = ExcelImportSupport.readHyperlinksByHeaderKey(file, 0, usedTitleRows, usedHeadRows, "系统匹配企业名称"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditCompanyImportParam param = list.get(i); + try { + CreditCompany item = convertImportParamToEntity(param); + String link = null; + if (item.getName() != null) { + link = urlByName.get(item.getName().trim()); + } + if ((link == null || link.isEmpty()) && item.getMatchName() != null) { + link = urlByMatchName.get(item.getMatchName().trim()); + } + if (link != null && !link.isEmpty()) { + item.setUrl(link); + } + + // 设置默认值 + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + // 验证必填字段 + if (item.getMatchName() == null || item.getMatchName().trim().isEmpty()) { + errorMessages.add("第" + excelRowNumber + "行:项目名称不能为空"); + continue; + } +// if (item.getCode() == null || item.getCode().trim().isEmpty()) { +// errorMessages.add("第" + excelRowNumber + "行:唯一标识不能为空"); +// continue; +// } + + touchedMatchNames.add(item.getMatchName().trim()); + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + insertedCount += batchImportSupport.persistChunkWithFallbackCount( + chunkItems, + chunkRowNumbers, + () -> { + int delta = countInsertedByMatchName(chunkItems); + batchImportSupport.upsertBySingleKey( + creditCompanyService, + chunkItems, + CreditCompany::getId, + CreditCompany::setId, + CreditCompany::getMatchName, + CreditCompany::getMatchName, + null, + mpBatchSize + ); + return delta; + }, + (rowItem, rowNumber) -> { + boolean saved = creditCompanyService.save(rowItem); + if (saved) { + return 1; // insert 入库 + } + CreditCompany existing = creditCompanyService.getByMatchName(rowItem.getMatchName()); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditCompanyService.updateById(rowItem)) { + return 0; // update 不计入“入库”条数 + } + } + throw new RuntimeException("保存失败"); + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + insertedCount += batchImportSupport.persistChunkWithFallbackCount( + chunkItems, + chunkRowNumbers, + () -> { + int delta = countInsertedByMatchName(chunkItems); + batchImportSupport.upsertBySingleKey( + creditCompanyService, + chunkItems, + CreditCompany::getId, + CreditCompany::setId, + CreditCompany::getMatchName, + CreditCompany::getMatchName, + null, + mpBatchSize + ); + return delta; + }, + (rowItem, rowNumber) -> { + boolean saved = creditCompanyService.save(rowItem); + if (saved) { + return 1; // insert 入库 + } + CreditCompany existing = creditCompanyService.getByMatchName(rowItem.getMatchName()); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditCompanyService.updateById(rowItem)) { + return 0; // update 不计入“入库”条数 + } + } + throw new RuntimeException("保存失败"); + }, + errorMessages + ); + } + + // 导入完成后,按 matchName 定位本次涉及的企业并回填“关联记录数”字段(避免 companyId/自增 id 在导入对象里拿不到)。 + if (!touchedMatchNames.isEmpty()) { + Set touchedCompanyIds = new HashSet<>(); + List allMatchNames = new ArrayList<>(touchedMatchNames); + final int inChunkSize = 800; + for (int i = 0; i < allMatchNames.size(); i += inChunkSize) { + List chunk = allMatchNames.subList(i, Math.min(allMatchNames.size(), i + inChunkSize)); + List dbRows = creditCompanyService.lambdaQuery() + .select(CreditCompany::getId) + .in(CreditCompany::getMatchName, chunk) + .list(); + if (!CollectionUtils.isEmpty(dbRows)) { + for (CreditCompany row : dbRows) { + if (row != null && row.getId() != null) { + touchedCompanyIds.add(row.getId()); + } + } + } + } + creditCompanyRecordCountService.refreshAll(touchedCompanyIds); + } + + if (errorMessages.isEmpty()) { + return success("成功入库" + insertedCount + "条数据", null); + } else { + return success("导入完成,入库" + insertedCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载企业导入模板 + */ + @Operation(summary = "下载企业导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditCompanyImportParam example = new CreditCompanyImportParam(); + example.setName("示例客户"); + example.setCode("C0001"); + example.setMatchName("匹配名称"); + example.setRegistrationStatus("登记状态"); + example.setLegalPerson("法定代表人"); + example.setRegisteredCapital("注册资本"); + example.setPaidinCapital("实缴资本"); + example.setEstablishDate("成立日期"); + example.setAddress("地址"); + example.setTel("电话"); + example.setMoreTel("更多电话"); + example.setEmail("邮箱"); + example.setMoreEmail("更多邮箱"); + example.setProvince("省"); + example.setCity("市"); + example.setRegion("区"); + example.setInstitutionType("机构类型"); + example.setTaxpayerCode("纳税人识别号"); + example.setRegistrationNumber("注册号"); + example.setOrganizationalCode("组织机构代码"); + example.setNumberOfInsuredPersons("参保人数"); + example.setAnnualReport("入库时间"); + example.setBusinessTerm("营业期限"); + example.setNationalStandardIndustryCategories("国标行业门类"); + example.setNationalStandardIndustryCategories2("国标行业大类"); + example.setNationalStandardIndustryCategories3("国标行业中类"); + example.setNationalStandardIndustryCategories4("国标行业小类"); + example.setNationalStandardIndustryCategories5("企查查行业门类"); + example.setNationalStandardIndustryCategories6("企查查行业大类"); + example.setNationalStandardIndustryCategories7("企查查行业中类"); + example.setNationalStandardIndustryCategories8("企查查行业小类"); + example.setCompanySize("企业规模"); + example.setFormerName("曾用名"); + example.setEnglishName("英文名"); + example.setDomain("官网"); + example.setMailingAddress("通信地址"); + example.setCompanyProfile("企业简介"); + example.setNatureOfBusiness("经营范围"); + example.setRegistrationAuthority("登记机关"); + example.setTaxpayerQualification("纳税人资质"); + example.setLatestAnnualReportYear("最新年报年份"); + example.setLatestAnnualReportOnOperatingRevenue("最新年报营业额"); + example.setEnterpriseScoreCheck("企查分"); + example.setCreditRating("信用等级"); + example.setCechnologyScore("科创分"); + example.setCechnologyLevel("科创等级"); + example.setSmallEnterprise("是否小微企业"); + templateList.add(example); + + ExportParams exportParams = new ExportParams("一级企业主表导入模板", "企业"); + + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, CreditCompanyImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_company_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private List tryImport(MultipartFile file, int titleRows, int headRows) throws Exception { + ImportParams importParams = new ImportParams(); + importParams.setTitleRows(titleRows); + importParams.setHeadRows(headRows); + importParams.setStartSheetIndex(0); + importParams.setSheetNum(1); + return ExcelImportUtil.importExcel(file.getInputStream(), CreditCompanyImportParam.class, importParams); + } + + /** + * 过滤掉完全空白的导入行,避免空行导致导入失败 + */ + private List filterEmptyRows(List rawList) { + if (CollectionUtils.isEmpty(rawList)) { + return rawList; + } + rawList.removeIf(this::isEmptyImportRow); + return rawList; + } + + private boolean isEmptyImportRow(CreditCompanyImportParam param) { + if (param == null) { + return true; + } + return isBlank(param.getName()) + && isBlank(param.getCode()); + } + + private boolean isBlank(String value) { + return value == null || value.trim().isEmpty(); + } + + /** + * 入库条数以 insert 为准:matchName 在数据库中不存在时计 1,否则计 0。 + * + *

统计口径需与批量 upsert 的匹配字段保持一致(matchName)。

+ */ + private int countInsertedByMatchName(List items) { + if (CollectionUtils.isEmpty(items)) { + return 0; + } + List matchNames = new ArrayList<>(items.size()); + for (CreditCompany item : items) { + if (item == null) { + continue; + } + String key = item.getMatchName(); + if (!isBlank(key)) { + matchNames.add(key.trim()); + } + } + if (matchNames.isEmpty()) { + return 0; + } + + Set existing = new HashSet<>(); + List dbRows = creditCompanyService.lambdaQuery() + .select(CreditCompany::getMatchName) + .in(CreditCompany::getMatchName, matchNames) + .list(); + if (!CollectionUtils.isEmpty(dbRows)) { + for (CreditCompany row : dbRows) { + String v = row != null ? row.getMatchName() : null; + if (!isBlank(v)) { + existing.add(v.trim()); + } + } + } + + int count = 0; + for (CreditCompany item : items) { + String key = item != null ? item.getMatchName() : null; + if (!isBlank(key) && !existing.contains(key.trim())) { + count++; + } + } + return count; + } + + /** + * 将CreditCompanyImportParam转换为CreditCompany实体 + */ + private CreditCompany convertImportParamToEntity(CreditCompanyImportParam param) { + CreditCompany entity = new CreditCompany(); + + entity.setCode(param.getCode()); + entity.setName(param.getName()); + entity.setMatchName(param.getMatchName()); + entity.setRegistrationStatus(param.getRegistrationStatus()); + entity.setLegalPerson(param.getLegalPerson()); + entity.setRegisteredCapital(param.getRegisteredCapital()); + entity.setPaidinCapital(param.getPaidinCapital()); + entity.setEstablishDate(param.getEstablishDate()); + entity.setAddress(param.getAddress()); + entity.setTel(param.getTel()); + entity.setMoreTel(param.getMoreTel()); + entity.setEmail(param.getEmail()); + entity.setMoreEmail(param.getMoreEmail()); + entity.setProvince(param.getProvince()); + entity.setCity(param.getCity()); + entity.setRegion(param.getRegion()); + entity.setInstitutionType(param.getInstitutionType()); + entity.setTaxpayerCode(param.getTaxpayerCode()); + entity.setRegistrationNumber(param.getRegistrationNumber()); + entity.setOrganizationalCode(param.getOrganizationalCode()); + entity.setNumberOfInsuredPersons(param.getNumberOfInsuredPersons()); + entity.setAnnualReport(param.getAnnualReport()); + entity.setBusinessTerm(param.getBusinessTerm()); + entity.setNationalStandardIndustryCategories(param.getNationalStandardIndustryCategories()); + entity.setNationalStandardIndustryCategories2(param.getNationalStandardIndustryCategories2()); + entity.setNationalStandardIndustryCategories3(param.getNationalStandardIndustryCategories3()); + entity.setNationalStandardIndustryCategories4(param.getNationalStandardIndustryCategories4()); + entity.setNationalStandardIndustryCategories5(param.getNationalStandardIndustryCategories5()); + entity.setNationalStandardIndustryCategories6(param.getNationalStandardIndustryCategories6()); + entity.setNationalStandardIndustryCategories7(param.getNationalStandardIndustryCategories7()); + entity.setNationalStandardIndustryCategories8(param.getNationalStandardIndustryCategories8()); + entity.setCompanySize(param.getCompanySize()); + entity.setFormerName(param.getFormerName()); + entity.setEnglishName(param.getEnglishName()); + entity.setDomain(param.getDomain()); + entity.setMailingAddress(param.getMailingAddress()); + entity.setCompanyProfile(param.getCompanyProfile()); + entity.setNatureOfBusiness(param.getNatureOfBusiness()); + entity.setRegistrationAuthority(param.getRegistrationAuthority()); + entity.setTaxpayerQualification(param.getTaxpayerQualification()); + entity.setLatestAnnualReportYear(param.getLatestAnnualReportYear()); + entity.setLatestAnnualReportOnOperatingRevenue(param.getLatestAnnualReportOnOperatingRevenue()); + entity.setEnterpriseScoreCheck(param.getEnterpriseScoreCheck()); + entity.setCreditRating(param.getCreditRating()); + entity.setCechnologyScore(param.getCechnologyScore()); + entity.setCechnologyLevel(param.getCechnologyLevel()); + entity.setSmallEnterprise(param.getSmallEnterprise()); + + return entity; + } + + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditCompetitorController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditCompetitorController.java new file mode 100644 index 0000000..9540c30 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditCompetitorController.java @@ -0,0 +1,412 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditCompetitor; +import com.gxwebsoft.credit.param.CreditCompetitorImportParam; +import com.gxwebsoft.credit.param.CreditCompetitorParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditCompetitorService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 竞争对手控制器 + * + * @author 科技小王子 + * @since 2025-12-19 19:49:05 + */ +@Tag(name = "竞争对手管理") +@RestController +@RequestMapping("/api/credit/credit-competitor") +public class CreditCompetitorController extends BaseController { + @Resource + private CreditCompetitorService creditCompetitorService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询竞争对手") + @GetMapping("/page") + public ApiResult> page(CreditCompetitorParam param) { + // 使用关联查询 + return success(creditCompetitorService.pageRel(param)); + } + + @Operation(summary = "查询全部竞争对手") + @GetMapping() + public ApiResult> list(CreditCompetitorParam param) { + // 使用关联查询 + return success(creditCompetitorService.listRel(param)); + } + + @Operation(summary = "根据id查询竞争对手") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditCompetitorService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditCompetitor:save')") + @OperationLog + @Operation(summary = "添加竞争对手") + @PostMapping() + public ApiResult save(@RequestBody CreditCompetitor creditCompetitor) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditCompetitor.setUserId(loginUser.getUserId()); + // } + if (creditCompetitorService.save(creditCompetitor)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCompetitor:update')") + @OperationLog + @Operation(summary = "修改竞争对手") + @PutMapping() + public ApiResult update(@RequestBody CreditCompetitor creditCompetitor) { + if (creditCompetitorService.updateById(creditCompetitor)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCompetitor:remove')") + @OperationLog + @Operation(summary = "删除竞争对手") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditCompetitorService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCompetitor:save')") + @OperationLog + @Operation(summary = "批量添加竞争对手") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditCompetitorService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCompetitor:update')") + @OperationLog + @Operation(summary = "批量修改竞争对手") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditCompetitorService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCompetitor:remove')") + @OperationLog + @Operation(summary = "批量删除竞争对手") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditCompetitorService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditCompetitor:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditCompetitorService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditCompetitor::getId, + CreditCompetitor::setId, + CreditCompetitor::getName, + CreditCompetitor::getCompanyId, + CreditCompetitor::setCompanyId, + CreditCompetitor::getHasData, + CreditCompetitor::setHasData, + CreditCompetitor::getTenantId, + CreditCompetitor::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入竞争对手 + */ + @PreAuthorize("hasAuthority('credit:creditCompetitor:save')") + @Operation(summary = "批量导入竞争对手") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "竞争对手", 2); + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditCompetitorImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByName = ExcelImportSupport.readUrlByKey( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "企业名称"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditCompetitorImportParam param = list.get(i); + try { + CreditCompetitor item = convertImportParamToEntity(param); + // name 才是持久化字段;companyName 为关联查询的临时字段(exist=false),导入时不应使用。 + if (!ImportHelper.isBlank(item.getName())) { + String link = urlByName.get(item.getName().trim()); + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getName())) { + errorMessages.add("第" + excelRowNumber + "行:企业名称不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditCompetitorService, + chunkItems, + CreditCompetitor::getId, + CreditCompetitor::setId, + CreditCompetitor::getName, + CreditCompetitor::getName, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditCompetitorService.save(rowItem); + if (!saved) { + CreditCompetitor existing = creditCompetitorService.lambdaQuery() + .eq(CreditCompetitor::getName, rowItem.getName()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditCompetitorService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditCompetitorService, + chunkItems, + CreditCompetitor::getId, + CreditCompetitor::setId, + CreditCompetitor::getName, + CreditCompetitor::getName, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditCompetitorService.save(rowItem); + if (!saved) { + CreditCompetitor existing = creditCompetitorService.lambdaQuery() + .eq(CreditCompetitor::getName, rowItem.getName()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditCompetitorService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.COMPETITOR, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载竞争对手导入模板 + */ + @Operation(summary = "下载竞争对手导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditCompetitorImportParam example = new CreditCompetitorImportParam(); + example.setName("示例科技有限公司"); + example.setLegalRepresentative("张三"); + example.setRegisteredCapital("5000"); + example.setEstablishmentDate("2015-01-01"); + example.setRegistrationStatus("存续"); + example.setIndustry("软件和信息服务业"); + example.setProvince("广东省"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("竞争对手导入模板", "竞争对手", CreditCompetitorImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_competitor_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditCompetitorImportParam param) { + if (param == null) { + return true; + } + return ImportHelper.isBlank(param.getName()) + && ImportHelper.isBlank(param.getLegalRepresentative()) + && ImportHelper.isBlank(param.getRegisteredCapital()) + && ImportHelper.isBlank(param.getEstablishmentDate()); + } + + private CreditCompetitor convertImportParamToEntity(CreditCompetitorImportParam param) { + CreditCompetitor entity = new CreditCompetitor(); + + entity.setName(param.getName()); + entity.setLegalRepresentative(param.getLegalRepresentative()); + entity.setRegisteredCapital(param.getRegisteredCapital()); + entity.setEstablishmentDate(param.getEstablishmentDate()); + entity.setRegistrationStatus(param.getRegistrationStatus()); + entity.setIndustry(param.getIndustry()); + entity.setProvince(param.getProvince()); + entity.setComments(param.getComments()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditCourtAnnouncementController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditCourtAnnouncementController.java new file mode 100644 index 0000000..ef66aa6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditCourtAnnouncementController.java @@ -0,0 +1,432 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditCourtAnnouncement; +import com.gxwebsoft.credit.param.CreditCourtAnnouncementImportParam; +import com.gxwebsoft.credit.param.CreditCourtAnnouncementParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditCourtAnnouncementService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 法院公告司法大数据控制器 + * + * @author 科技小王子 + * @since 2025-12-19 19:49:13 + */ +@Tag(name = "法院公告司法大数据管理") +@RestController +@RequestMapping("/api/credit/credit-court-announcement") +public class CreditCourtAnnouncementController extends BaseController { + @Resource + private CreditCourtAnnouncementService creditCourtAnnouncementService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询法院公告司法大数据") + @GetMapping("/page") + public ApiResult> page(CreditCourtAnnouncementParam param) { + // 使用关联查询 + return success(creditCourtAnnouncementService.pageRel(param)); + } + + @Operation(summary = "查询全部法院公告司法大数据") + @GetMapping() + public ApiResult> list(CreditCourtAnnouncementParam param) { + // 使用关联查询 + return success(creditCourtAnnouncementService.listRel(param)); + } + + @Operation(summary = "根据id查询法院公告司法大数据") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditCourtAnnouncementService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditCourtAnnouncement:save')") + @OperationLog + @Operation(summary = "添加法院公告司法大数据") + @PostMapping() + public ApiResult save(@RequestBody CreditCourtAnnouncement creditCourtAnnouncement) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditCourtAnnouncement.setUserId(loginUser.getUserId()); + // } + if (creditCourtAnnouncementService.save(creditCourtAnnouncement)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCourtAnnouncement:update')") + @OperationLog + @Operation(summary = "修改法院公告司法大数据") + @PutMapping() + public ApiResult update(@RequestBody CreditCourtAnnouncement creditCourtAnnouncement) { + if (creditCourtAnnouncementService.updateById(creditCourtAnnouncement)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCourtAnnouncement:remove')") + @OperationLog + @Operation(summary = "删除法院公告司法大数据") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditCourtAnnouncementService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCourtAnnouncement:save')") + @OperationLog + @Operation(summary = "批量添加法院公告司法大数据") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditCourtAnnouncementService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCourtAnnouncement:update')") + @OperationLog + @Operation(summary = "批量修改法院公告司法大数据") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditCourtAnnouncementService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCourtAnnouncement:remove')") + @OperationLog + @Operation(summary = "批量删除法院公告司法大数据") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditCourtAnnouncementService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditCourtAnnouncement:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditCourtAnnouncementService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditCourtAnnouncement::getId, + CreditCourtAnnouncement::setId, + CreditCourtAnnouncement::getAppellee, + CreditCourtAnnouncement::getCompanyId, + CreditCourtAnnouncement::setCompanyId, + CreditCourtAnnouncement::getHasData, + CreditCourtAnnouncement::setHasData, + CreditCourtAnnouncement::getTenantId, + CreditCourtAnnouncement::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入法院公告司法大数据 + */ + @PreAuthorize("hasAuthority('credit:creditCourtAnnouncement:save')") + @Operation(summary = "批量导入法院公告司法大数据") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + // 兼容多 sheet 文件:优先定位“法院公告”sheet,否则默认第 0 个。 + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "法院公告", 0); + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditCourtAnnouncementImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditCourtAnnouncementImportParam param = list.get(i); + try { + CreditCourtAnnouncement item = convertImportParamToEntity(param); + if (!ImportHelper.isBlank(item.getCaseNumber())) { + String link = urlByCaseNumber.get(item.getCaseNumber().trim()); + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getCaseNumber())) { + errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditCourtAnnouncementService, + chunkItems, + CreditCourtAnnouncement::getId, + CreditCourtAnnouncement::setId, + CreditCourtAnnouncement::getCaseNumber, + CreditCourtAnnouncement::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditCourtAnnouncementService.save(rowItem); + if (!saved) { + CreditCourtAnnouncement existing = creditCourtAnnouncementService.lambdaQuery() + .eq(CreditCourtAnnouncement::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditCourtAnnouncementService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditCourtAnnouncementService, + chunkItems, + CreditCourtAnnouncement::getId, + CreditCourtAnnouncement::setId, + CreditCourtAnnouncement::getCaseNumber, + CreditCourtAnnouncement::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditCourtAnnouncementService.save(rowItem); + if (!saved) { + CreditCourtAnnouncement existing = creditCourtAnnouncementService.lambdaQuery() + .eq(CreditCourtAnnouncement::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditCourtAnnouncementService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.COURT_ANNOUNCEMENT, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载法院公告司法大数据导入模板 + */ + @Operation(summary = "下载法院公告司法大数据导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditCourtAnnouncementImportParam example = new CreditCourtAnnouncementImportParam(); + example.setDataType("法院公告"); + example.setPlaintiffAppellant("原告示例"); + example.setAppellee("被告示例"); + example.setOtherPartiesThirdParty("第三人示例"); + example.setOccurrenceTime("2024-01-01"); + example.setCaseNumber("(2024)示例案号"); + example.setCauseOfAction("案由示例"); + example.setCourtName("示例法院"); + example.setInvolvedAmount("100000"); + example.setDataStatus("正常"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("法院公告导入模板", "法院公告", CreditCourtAnnouncementImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_court_announcement_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditCourtAnnouncementImportParam param) { + if (param == null) { + return true; + } + return ImportHelper.isBlank(param.getCaseNumber()) + && ImportHelper.isBlank(param.getCauseOfAction()); + } + + private CreditCourtAnnouncement convertImportParamToEntity(CreditCourtAnnouncementImportParam param) { + CreditCourtAnnouncement entity = new CreditCourtAnnouncement(); + + String dataType = !ImportHelper.isBlank(param.getDataType2()) + ? param.getDataType2() + : param.getDataType(); + String plaintiffAppellant = !ImportHelper.isBlank(param.getPlaintiffAppellant2()) + ? param.getPlaintiffAppellant2() + : param.getPlaintiffAppellant(); + String otherPartiesThirdParty = !ImportHelper.isBlank(param.getOtherPartiesThirdParty2()) + ? param.getOtherPartiesThirdParty2() + : param.getOtherPartiesThirdParty(); + String involvedAmount = !ImportHelper.isBlank(param.getInvolvedAmount2()) + ? param.getInvolvedAmount2() + : param.getInvolvedAmount(); + + String occurrenceTime = !ImportHelper.isBlank(param.getOccurrenceTime2()) + ? param.getOccurrenceTime2() + : param.getOccurrenceTime(); + + entity.setDataType(dataType); + entity.setPlaintiffAppellant(plaintiffAppellant); + entity.setAppellee(param.getAppellee()); + entity.setOtherPartiesThirdParty(otherPartiesThirdParty); + entity.setOccurrenceTime(occurrenceTime); + entity.setCaseNumber(param.getCaseNumber()); + entity.setCauseOfAction(param.getCauseOfAction()); + entity.setCourtName(param.getCourtName()); + entity.setInvolvedAmount(involvedAmount); + entity.setDataStatus(param.getDataStatus()); + entity.setComments(param.getComments()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditCourtSessionController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditCourtSessionController.java new file mode 100644 index 0000000..481e530 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditCourtSessionController.java @@ -0,0 +1,636 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditCourtSession; +import com.gxwebsoft.credit.param.CreditCourtSessionImportParam; +import com.gxwebsoft.credit.param.CreditCourtSessionParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditCourtSessionService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 开庭公告司法大数据控制器 + * + * @author 科技小王子 + * @since 2025-12-19 19:49:33 + */ +@Tag(name = "开庭公告司法大数据管理") +@RestController +@RequestMapping("/api/credit/credit-court-session") +public class CreditCourtSessionController extends BaseController { + @Resource + private CreditCourtSessionService creditCourtSessionService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询开庭公告司法大数据") + @GetMapping("/page") + public ApiResult> page(CreditCourtSessionParam param) { + // 使用关联查询 + return success(creditCourtSessionService.pageRel(param)); + } + + @Operation(summary = "查询全部开庭公告司法大数据") + @GetMapping() + public ApiResult> list(CreditCourtSessionParam param) { + // 使用关联查询 + return success(creditCourtSessionService.listRel(param)); + } + + @Operation(summary = "根据id查询开庭公告司法大数据") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditCourtSessionService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditCourtSession:save')") + @OperationLog + @Operation(summary = "添加开庭公告司法大数据") + @PostMapping() + public ApiResult save(@RequestBody CreditCourtSession creditCourtSession) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditCourtSession.setUserId(loginUser.getUserId()); + // } + if (creditCourtSessionService.save(creditCourtSession)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCourtSession:update')") + @OperationLog + @Operation(summary = "修改开庭公告司法大数据") + @PutMapping() + public ApiResult update(@RequestBody CreditCourtSession creditCourtSession) { + if (creditCourtSessionService.updateById(creditCourtSession)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCourtSession:remove')") + @OperationLog + @Operation(summary = "删除开庭公告司法大数据") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditCourtSessionService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCourtSession:save')") + @OperationLog + @Operation(summary = "批量添加开庭公告司法大数据") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditCourtSessionService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCourtSession:update')") + @OperationLog + @Operation(summary = "批量修改开庭公告司法大数据") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditCourtSessionService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCourtSession:remove')") + @OperationLog + @Operation(summary = "批量删除开庭公告司法大数据") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditCourtSessionService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditCourtSession:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditCourtSessionService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditCourtSession::getId, + CreditCourtSession::setId, + CreditCourtSession::getAppellee, + CreditCourtSession::getCompanyId, + CreditCourtSession::setCompanyId, + CreditCourtSession::getHasData, + CreditCourtSession::setHasData, + CreditCourtSession::getTenantId, + CreditCourtSession::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入开庭公告司法大数据 + */ + @PreAuthorize("hasAuthority('credit:creditCourtSession:save')") + @Operation(summary = "批量导入开庭公告司法大数据") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + // 兼容多 sheet 文件:优先定位“开庭公告”sheet,否则默认第 0 个。 + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "开庭公告", 0); + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditCourtSessionImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditCourtSessionImportParam param = list.get(i); + try { + CreditCourtSession item = convertImportParamToEntity(param); + if (!ImportHelper.isBlank(item.getCaseNumber())) { + String link = urlByCaseNumber.get(item.getCaseNumber().trim()); + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getCaseNumber())) { + errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditCourtSessionService, + chunkItems, + CreditCourtSession::getId, + CreditCourtSession::setId, + CreditCourtSession::getCaseNumber, + CreditCourtSession::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditCourtSessionService.save(rowItem); + if (!saved) { + CreditCourtSession existing = creditCourtSessionService.lambdaQuery() + .eq(CreditCourtSession::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditCourtSessionService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditCourtSessionService, + chunkItems, + CreditCourtSession::getId, + CreditCourtSession::setId, + CreditCourtSession::getCaseNumber, + CreditCourtSession::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditCourtSessionService.save(rowItem); + if (!saved) { + CreditCourtSession existing = creditCourtSessionService.lambdaQuery() + .eq(CreditCourtSession::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditCourtSessionService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.COURT_SESSION, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 批量导入历史开庭公告(仅解析“历史开庭公告”选项卡) + * 规则:案号相同则覆盖更新(recommend++ 记录更新次数);案号不存在则插入。 + */ + @PreAuthorize("hasAuthority('credit:creditCourtSession:save')") + @Operation(summary = "批量导入历史开庭公告司法大数据") + @PostMapping("/import/history") + public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史开庭公告"); + if (sheetIndex < 0) { + return fail("未读取到数据,请确认文件中存在“历史开庭公告”选项卡且表头与示例格式一致", null); + } + + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditCourtSessionImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + + LinkedHashMap latestByCaseNumber = new LinkedHashMap<>(); + LinkedHashMap latestRowByCaseNumber = new LinkedHashMap<>(); + + for (int i = 0; i < list.size(); i++) { + CreditCourtSessionImportParam param = list.get(i); + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + try { + CreditCourtSession item = convertImportParamToEntity(param); + if (item.getCaseNumber() != null) { + item.setCaseNumber(item.getCaseNumber().trim()); + } + if (ImportHelper.isBlank(item.getCaseNumber())) { + errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + String link = urlByCaseNumber.get(item.getCaseNumber()); + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + // 历史导入的数据统一标记为“失效” + item.setDataStatus("失效"); + + latestByCaseNumber.put(item.getCaseNumber(), item); + latestRowByCaseNumber.put(item.getCaseNumber(), excelRowNumber); + } catch (Exception e) { + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (latestByCaseNumber.isEmpty()) { + if (errorMessages.isEmpty()) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + return success("导入完成,成功0条,失败" + errorMessages.size() + "条", errorMessages); + } + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (Map.Entry entry : latestByCaseNumber.entrySet()) { + String caseNumber = entry.getKey(); + CreditCourtSession item = entry.getValue(); + Integer rowNo = latestRowByCaseNumber.get(caseNumber); + chunkItems.add(item); + chunkRowNumbers.add(rowNo != null ? rowNo : -1); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKeyAndIncrementCounterOnUpdate( + creditCourtSessionService, + chunkItems, + CreditCourtSession::getId, + CreditCourtSession::setId, + CreditCourtSession::getCaseNumber, + CreditCourtSession::getCaseNumber, + CreditCourtSession::getRecommend, + CreditCourtSession::setRecommend, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + if (rowItem.getRecommend() == null) { + rowItem.setRecommend(0); + } + boolean saved = creditCourtSessionService.save(rowItem); + if (!saved) { + CreditCourtSession existing = creditCourtSessionService.lambdaQuery() + .eq(CreditCourtSession::getCaseNumber, rowItem.getCaseNumber()) + .select(CreditCourtSession::getId, CreditCourtSession::getRecommend) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + Integer old = existing.getRecommend(); + rowItem.setRecommend(old == null ? 1 : old + 1); + if (creditCourtSessionService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKeyAndIncrementCounterOnUpdate( + creditCourtSessionService, + chunkItems, + CreditCourtSession::getId, + CreditCourtSession::setId, + CreditCourtSession::getCaseNumber, + CreditCourtSession::getCaseNumber, + CreditCourtSession::getRecommend, + CreditCourtSession::setRecommend, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + if (rowItem.getRecommend() == null) { + rowItem.setRecommend(0); + } + boolean saved = creditCourtSessionService.save(rowItem); + if (!saved) { + CreditCourtSession existing = creditCourtSessionService.lambdaQuery() + .eq(CreditCourtSession::getCaseNumber, rowItem.getCaseNumber()) + .select(CreditCourtSession::getId, CreditCourtSession::getRecommend) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + Integer old = existing.getRecommend(); + rowItem.setRecommend(old == null ? 1 : old + 1); + if (creditCourtSessionService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.COURT_SESSION, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载开庭公告司法大数据导入模板 + */ + @Operation(summary = "下载开庭公告司法大数据导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditCourtSessionImportParam example = new CreditCourtSessionImportParam(); + example.setDataType("开庭公告"); + example.setPlaintiffAppellant("原告示例"); + example.setAppellee("被告示例"); + example.setOtherPartiesThirdParty2("第三人示例"); + example.setCaseNumber("(2024)示例案号"); + example.setCauseOfAction("案由示例"); + example.setCourtName("示例法院"); + example.setOccurrenceTime("2024-01-01"); + example.setInvolvedAmount("100000"); + example.setDataStatus("正常"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("开庭公告导入模板", "开庭公告", CreditCourtSessionImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_court_session_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditCourtSessionImportParam param) { + if (param == null) { + return true; + } + return ImportHelper.isBlank(param.getCaseNumber()) + && ImportHelper.isBlank(param.getCauseOfAction()); + } + + private CreditCourtSession convertImportParamToEntity(CreditCourtSessionImportParam param) { + CreditCourtSession entity = new CreditCourtSession(); + + // Template compatibility: prefer new columns ("发生时间"/"其他当事人/第三人") when present. + String occurrenceTime = !ImportHelper.isBlank(param.getOccurrenceTime2()) + ? param.getOccurrenceTime2() + : param.getOccurrenceTime(); + String otherPartiesThirdParty = !ImportHelper.isBlank(param.getOtherPartiesThirdParty2()) + ? param.getOtherPartiesThirdParty2() + : param.getOtherPartiesThirdParty(); + String involvedAmount = !ImportHelper.isBlank(param.getInvolvedAmount2()) + ? param.getInvolvedAmount2() + : param.getInvolvedAmount(); + + entity.setDataType(param.getDataType()); + entity.setPlaintiffAppellant(param.getPlaintiffAppellant()); + entity.setAppellee(param.getAppellee()); + entity.setDataStatus(param.getDataStatus()); + entity.setInvolvedAmount(involvedAmount); + + entity.setOtherPartiesThirdParty(otherPartiesThirdParty); + entity.setOccurrenceTime(occurrenceTime); + entity.setCaseNumber(param.getCaseNumber()); + entity.setCauseOfAction(param.getCauseOfAction()); + entity.setCourtName(param.getCourtName()); + entity.setComments(param.getComments()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditCustomerController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditCustomerController.java new file mode 100644 index 0000000..5c2e4cc --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditCustomerController.java @@ -0,0 +1,572 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditCustomer; +import com.gxwebsoft.credit.param.CreditCustomerImportParam; +import com.gxwebsoft.credit.param.CreditCustomerParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditCustomerService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.dao.DataIntegrityViolationException; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 客户控制器 + * + * @author 科技小王子 + * @since 2025-12-21 21:20:58 + */ +@Tag(name = "客户管理") +@RestController +@RequestMapping("/api/credit/credit-customer") +public class CreditCustomerController extends BaseController { + @Resource + private CreditCustomerService creditCustomerService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询客户") + @GetMapping("/page") + public ApiResult> page(CreditCustomerParam param) { + // 使用关联查询 + return success(creditCustomerService.pageRel(param)); + } + + @Operation(summary = "查询全部客户") + @GetMapping() + public ApiResult> list(CreditCustomerParam param) { + // 使用关联查询 + return success(creditCustomerService.listRel(param)); + } + + @Operation(summary = "根据id查询客户") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditCustomerService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditCustomer:save')") + @OperationLog + @Operation(summary = "添加客户") + @PostMapping() + public ApiResult save(@RequestBody CreditCustomer creditCustomer) { + if (creditCustomerService.save(creditCustomer)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCustomer:update')") + @OperationLog + @Operation(summary = "修改客户") + @PutMapping() + public ApiResult update(@RequestBody CreditCustomer creditCustomer) { + if (creditCustomerService.updateById(creditCustomer)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCustomer:remove')") + @OperationLog + @Operation(summary = "删除客户") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditCustomerService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCustomer:save')") + @OperationLog + @Operation(summary = "批量添加客户") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditCustomerService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCustomer:update')") + @OperationLog + @Operation(summary = "批量修改客户") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditCustomerService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditCustomer:remove')") + @OperationLog + @Operation(summary = "批量删除客户") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditCustomerService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditCustomer:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditCustomerService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditCustomer::getId, + CreditCustomer::setId, + CreditCustomer::getName, + CreditCustomer::getCompanyId, + CreditCustomer::setCompanyId, + CreditCustomer::getHasData, + CreditCustomer::setHasData, + CreditCustomer::getTenantId, + CreditCustomer::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入客户 + */ + @PreAuthorize("hasAuthority('credit:creditCustomer:save')") + @Operation(summary = "批量导入客户") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "客户", 4); + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditCustomerImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByName = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "客户"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditCustomerImportParam param = list.get(i); + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + try { + CreditCustomer item = convertImportParamToEntity(param); + if (!ImportHelper.isBlank(item.getName())) { + String link = urlByName.get(item.getName().trim()); + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + if (ImportHelper.isBlank(item.getName())) { + errorMessages.add("第" + excelRowNumber + "行:客户不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> { + // 批内一次查库,避免逐行查/写导致数据库压力过大 + List names = new ArrayList<>(chunkItems.size()); + for (CreditCustomer it : chunkItems) { + if (it != null && !ImportHelper.isBlank(it.getName())) { + names.add(it.getName().trim()); + } + } + List existingList = names.isEmpty() + ? new ArrayList<>() + : creditCustomerService.lambdaQuery() + .in(CreditCustomer::getName, names) + .list(); + java.util.Map existingByName = new java.util.HashMap<>(); + for (CreditCustomer existing : existingList) { + if (existing != null && !ImportHelper.isBlank(existing.getName())) { + existingByName.putIfAbsent(existing.getName().trim(), existing); + } + } + + java.util.Map latestByName = new java.util.HashMap<>(); + int acceptedRows = 0; + for (int idx = 0; idx < chunkItems.size(); idx++) { + CreditCustomer it = chunkItems.get(idx); + int rowNo = (idx < chunkRowNumbers.size()) ? chunkRowNumbers.get(idx) : -1; + if (it == null || ImportHelper.isBlank(it.getName())) { + continue; + } + String name = it.getName().trim(); + CreditCustomer existing = existingByName.get(name); + if (existing != null) { + Integer existingTenantId = existing.getTenantId(); + if (it.getTenantId() != null + && existingTenantId != null + && !it.getTenantId().equals(existingTenantId)) { + errorMessages.add("第" + rowNo + "行:客户名称已存在且归属其他租户,无法导入"); + continue; + } + it.setId(existing.getId()); + if (existingTenantId != null) { + it.setTenantId(existingTenantId); + } + } + // 同名多行:保留最后一行的值(等价于“先插入/更新,再被后续行更新”) + latestByName.put(name, it); + acceptedRows++; + } + + List updates = new ArrayList<>(); + List inserts = new ArrayList<>(); + for (CreditCustomer it : latestByName.values()) { + if (it.getId() != null) { + updates.add(it); + } else { + inserts.add(it); + } + } + if (!updates.isEmpty()) { + creditCustomerService.updateBatchById(updates, mpBatchSize); + } + if (!inserts.isEmpty()) { + creditCustomerService.saveBatch(inserts, mpBatchSize); + } + return acceptedRows; + }, + (rowItem, rowNumber) -> { + CreditCustomer existing = creditCustomerService.lambdaQuery() + .eq(CreditCustomer::getName, rowItem.getName()) + .one(); + if (existing != null) { + Integer existingTenantId = existing.getTenantId(); + if (rowItem.getTenantId() != null + && existingTenantId != null + && !rowItem.getTenantId().equals(existingTenantId)) { + errorMessages.add("第" + rowNumber + "行:客户名称已存在且归属其他租户,无法导入"); + return false; + } + rowItem.setId(existing.getId()); + if (existingTenantId != null) { + rowItem.setTenantId(existingTenantId); + } + return creditCustomerService.updateById(rowItem); + } + + try { + return creditCustomerService.save(rowItem); + } catch (DataIntegrityViolationException e) { + if (!isDuplicateCustomerName(e)) { + throw e; + } + CreditCustomer dbExisting = creditCustomerService.lambdaQuery() + .eq(CreditCustomer::getName, rowItem.getName()) + .one(); + if (dbExisting != null) { + Integer existingTenantId = dbExisting.getTenantId(); + rowItem.setId(dbExisting.getId()); + if (existingTenantId != null) { + rowItem.setTenantId(existingTenantId); + } + return creditCustomerService.updateById(rowItem); + } + } + errorMessages.add("第" + rowNumber + "行:保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> { + List names = new ArrayList<>(chunkItems.size()); + for (CreditCustomer it : chunkItems) { + if (it != null && !ImportHelper.isBlank(it.getName())) { + names.add(it.getName().trim()); + } + } + List existingList = names.isEmpty() + ? new ArrayList<>() + : creditCustomerService.lambdaQuery() + .in(CreditCustomer::getName, names) + .list(); + java.util.Map existingByName = new java.util.HashMap<>(); + for (CreditCustomer existing : existingList) { + if (existing != null && !ImportHelper.isBlank(existing.getName())) { + existingByName.putIfAbsent(existing.getName().trim(), existing); + } + } + + java.util.Map latestByName = new java.util.HashMap<>(); + int acceptedRows = 0; + for (int idx = 0; idx < chunkItems.size(); idx++) { + CreditCustomer it = chunkItems.get(idx); + int rowNo = (idx < chunkRowNumbers.size()) ? chunkRowNumbers.get(idx) : -1; + if (it == null || ImportHelper.isBlank(it.getName())) { + continue; + } + String name = it.getName().trim(); + CreditCustomer existing = existingByName.get(name); + if (existing != null) { + Integer existingTenantId = existing.getTenantId(); + if (it.getTenantId() != null + && existingTenantId != null + && !it.getTenantId().equals(existingTenantId)) { + errorMessages.add("第" + rowNo + "行:客户名称已存在且归属其他租户,无法导入"); + continue; + } + it.setId(existing.getId()); + if (existingTenantId != null) { + it.setTenantId(existingTenantId); + } + } + latestByName.put(name, it); + acceptedRows++; + } + + List updates = new ArrayList<>(); + List inserts = new ArrayList<>(); + for (CreditCustomer it : latestByName.values()) { + if (it.getId() != null) { + updates.add(it); + } else { + inserts.add(it); + } + } + if (!updates.isEmpty()) { + creditCustomerService.updateBatchById(updates, mpBatchSize); + } + if (!inserts.isEmpty()) { + creditCustomerService.saveBatch(inserts, mpBatchSize); + } + return acceptedRows; + }, + (rowItem, rowNumber) -> { + CreditCustomer existing = creditCustomerService.lambdaQuery() + .eq(CreditCustomer::getName, rowItem.getName()) + .one(); + if (existing != null) { + Integer existingTenantId = existing.getTenantId(); + if (rowItem.getTenantId() != null + && existingTenantId != null + && !rowItem.getTenantId().equals(existingTenantId)) { + errorMessages.add("第" + rowNumber + "行:客户名称已存在且归属其他租户,无法导入"); + return false; + } + rowItem.setId(existing.getId()); + if (existingTenantId != null) { + rowItem.setTenantId(existingTenantId); + } + return creditCustomerService.updateById(rowItem); + } + + try { + return creditCustomerService.save(rowItem); + } catch (DataIntegrityViolationException e) { + if (!isDuplicateCustomerName(e)) { + throw e; + } + CreditCustomer dbExisting = creditCustomerService.lambdaQuery() + .eq(CreditCustomer::getName, rowItem.getName()) + .one(); + if (dbExisting != null) { + Integer existingTenantId = dbExisting.getTenantId(); + rowItem.setId(dbExisting.getId()); + if (existingTenantId != null) { + rowItem.setTenantId(existingTenantId); + } + return creditCustomerService.updateById(rowItem); + } + } + errorMessages.add("第" + rowNumber + "行:保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.CUSTOMER, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载客户导入模板 + */ + @Operation(summary = "下载客户导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditCustomerImportParam example = new CreditCustomerImportParam(); + example.setName("示例客户"); + example.setStatusTxt("合作中"); + example.setPrice("88.8"); + example.setPublicDate("2024-01-01"); + example.setDataSource("公开渠道"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("客户导入模板", "客户", CreditCustomerImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_customer_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditCustomerImportParam param) { + if (param == null) { + return true; + } + return ImportHelper.isBlank(param.getName()) + && ImportHelper.isBlank(param.getStatusTxt()) + && ImportHelper.isBlank(param.getPrice()); + } + + private CreditCustomer convertImportParamToEntity(CreditCustomerImportParam param) { + CreditCustomer entity = new CreditCustomer(); + + entity.setName(normalizeString(param.getName())); + entity.setStatusTxt(normalizeString(param.getStatusTxt())); + entity.setPrice(normalizeString(param.getPrice())); + entity.setPublicDate(normalizeString(param.getPublicDate())); + entity.setDataSource(normalizeString(param.getDataSource())); + entity.setComments(normalizeString(param.getComments())); + + return entity; + } + + private String normalizeString(String value) { + if (ImportHelper.isBlank(value)) { + return null; + } + return value.trim(); + } + + private boolean isDuplicateCustomerName(DataIntegrityViolationException e) { + Throwable mostSpecificCause = e.getMostSpecificCause(); + String message = mostSpecificCause != null ? mostSpecificCause.getMessage() : e.getMessage(); + if (message == null) { + return false; + } + String lower = message.toLowerCase(); + if (!lower.contains("duplicate")) { + return false; + } + return lower.contains("credit_customer.name") + || lower.contains("for key 'name'") + || lower.contains("for key `name`"); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditDeliveryNoticeController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditDeliveryNoticeController.java new file mode 100644 index 0000000..74e6c5d --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditDeliveryNoticeController.java @@ -0,0 +1,434 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditDeliveryNotice; +import com.gxwebsoft.credit.param.CreditDeliveryNoticeImportParam; +import com.gxwebsoft.credit.param.CreditDeliveryNoticeParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditDeliveryNoticeService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 送达公告司法大数据控制器 + * + * @author 科技小王子 + * @since 2025-12-19 19:49:52 + */ +@Tag(name = "送达公告司法大数据管理") +@RestController +@RequestMapping("/api/credit/credit-delivery-notice") +public class CreditDeliveryNoticeController extends BaseController { + @Resource + private CreditDeliveryNoticeService creditDeliveryNoticeService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询送达公告司法大数据") + @GetMapping("/page") + public ApiResult> page(CreditDeliveryNoticeParam param) { + // 使用关联查询 + return success(creditDeliveryNoticeService.pageRel(param)); + } + + @Operation(summary = "查询全部送达公告司法大数据") + @GetMapping() + public ApiResult> list(CreditDeliveryNoticeParam param) { + // 使用关联查询 + return success(creditDeliveryNoticeService.listRel(param)); + } + + @Operation(summary = "根据id查询送达公告司法大数据") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditDeliveryNoticeService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditDeliveryNotice:save')") + @OperationLog + @Operation(summary = "添加送达公告司法大数据") + @PostMapping() + public ApiResult save(@RequestBody CreditDeliveryNotice creditDeliveryNotice) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditDeliveryNotice.setUserId(loginUser.getUserId()); + // } + if (creditDeliveryNoticeService.save(creditDeliveryNotice)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditDeliveryNotice:update')") + @OperationLog + @Operation(summary = "修改送达公告司法大数据") + @PutMapping() + public ApiResult update(@RequestBody CreditDeliveryNotice creditDeliveryNotice) { + if (creditDeliveryNoticeService.updateById(creditDeliveryNotice)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditDeliveryNotice:remove')") + @OperationLog + @Operation(summary = "删除送达公告司法大数据") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditDeliveryNoticeService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditDeliveryNotice:save')") + @OperationLog + @Operation(summary = "批量添加送达公告司法大数据") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditDeliveryNoticeService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditDeliveryNotice:update')") + @OperationLog + @Operation(summary = "批量修改送达公告司法大数据") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditDeliveryNoticeService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditDeliveryNotice:remove')") + @OperationLog + @Operation(summary = "批量删除送达公告司法大数据") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditDeliveryNoticeService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditDeliveryNotice:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditDeliveryNoticeService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditDeliveryNotice::getId, + CreditDeliveryNotice::setId, + CreditDeliveryNotice::getOtherPartiesThirdParty, + CreditDeliveryNotice::getCompanyId, + CreditDeliveryNotice::setCompanyId, + CreditDeliveryNotice::getHasData, + CreditDeliveryNotice::setHasData, + CreditDeliveryNotice::getTenantId, + CreditDeliveryNotice::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入送达公告司法大数据 + */ + @PreAuthorize("hasAuthority('credit:creditDeliveryNotice:save')") + @Operation(summary = "批量导入送达公告司法大数据") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "送达公告", 0); + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditDeliveryNoticeImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + // URL 通常以超链接形式存在于“案号”列里 + Map urlByCaseNumber = ExcelImportSupport.readHyperlinksByHeaderKey( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditDeliveryNoticeImportParam param = list.get(i); + try { + CreditDeliveryNotice item = convertImportParamToEntity(param); + if (!ImportHelper.isBlank(item.getCaseNumber())) { + String link = urlByCaseNumber.get(item.getCaseNumber().trim()); + if (link != null && !link.isEmpty()) { + item.setUrl(link); + } + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getCaseNumber())) { + errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditDeliveryNoticeService, + chunkItems, + CreditDeliveryNotice::getId, + CreditDeliveryNotice::setId, + CreditDeliveryNotice::getCaseNumber, + CreditDeliveryNotice::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditDeliveryNoticeService.save(rowItem); + if (!saved) { + CreditDeliveryNotice existing = creditDeliveryNoticeService.lambdaQuery() + .eq(CreditDeliveryNotice::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditDeliveryNoticeService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditDeliveryNoticeService, + chunkItems, + CreditDeliveryNotice::getId, + CreditDeliveryNotice::setId, + CreditDeliveryNotice::getCaseNumber, + CreditDeliveryNotice::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditDeliveryNoticeService.save(rowItem); + if (!saved) { + CreditDeliveryNotice existing = creditDeliveryNoticeService.lambdaQuery() + .eq(CreditDeliveryNotice::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditDeliveryNoticeService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.DELIVERY_NOTICE, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载送达公告导入模板 + */ + @Operation(summary = "下载送达公告导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditDeliveryNoticeImportParam example = new CreditDeliveryNoticeImportParam(); + example.setDataType("送达公告"); + example.setPlaintiffAppellant("原告示例"); + example.setAppellee("被告示例"); + example.setOtherPartiesThirdParty2("第三人示例"); + example.setInvolvedAmount("100000"); + example.setDataStatus("正常"); + example.setOccurrenceTime("2024-01-01"); + example.setCaseNumber("(2024)示例案号"); + example.setCauseOfAction("案由示例"); + example.setCourtName("示例法院"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("送达公告导入模板", "送达公告", CreditDeliveryNoticeImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_delivery_notice_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditDeliveryNoticeImportParam param) { + if (param == null) { + return true; + } + return ImportHelper.isBlank(param.getCaseNumber()) + && ImportHelper.isBlank(param.getCauseOfAction()) + && ImportHelper.isBlank(param.getOtherPartiesThirdParty()) + && ImportHelper.isBlank(param.getOtherPartiesThirdParty2()) + && ImportHelper.isBlank(param.getPlaintiffAppellant()) + && ImportHelper.isBlank(param.getAppellee()); + } + + private CreditDeliveryNotice convertImportParamToEntity(CreditDeliveryNoticeImportParam param) { + CreditDeliveryNotice entity = new CreditDeliveryNotice(); + + String occurrenceTime = !ImportHelper.isBlank(param.getOccurrenceTime2()) + ? param.getOccurrenceTime2() + : param.getOccurrenceTime(); + String otherPartiesThirdParty = !ImportHelper.isBlank(param.getOtherPartiesThirdParty2()) + ? param.getOtherPartiesThirdParty2() + : param.getOtherPartiesThirdParty(); + String courtName = !ImportHelper.isBlank(param.getCourtName2()) + ? param.getCourtName2() + : param.getCourtName(); + String involvedAmount = !ImportHelper.isBlank(param.getInvolvedAmount2()) + ? param.getInvolvedAmount2() + : param.getInvolvedAmount(); + + entity.setDataType(param.getDataType()); + entity.setPlaintiffAppellant(param.getPlaintiffAppellant()); + entity.setAppellee(param.getAppellee()); + entity.setInvolvedAmount(involvedAmount); + entity.setDataStatus(param.getDataStatus()); + + entity.setOtherPartiesThirdParty(otherPartiesThirdParty); + entity.setOccurrenceTime(occurrenceTime); + entity.setCaseNumber(param.getCaseNumber()); + entity.setCauseOfAction(param.getCauseOfAction()); + entity.setCourtName(courtName); + entity.setComments(param.getComments()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditExternalController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditExternalController.java new file mode 100644 index 0000000..22c67cb --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditExternalController.java @@ -0,0 +1,424 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditExternal; +import com.gxwebsoft.credit.param.CreditExternalImportParam; +import com.gxwebsoft.credit.param.CreditExternalParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditExternalService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 对外投资控制器 + * + * @author 科技小王子 + * @since 2025-12-19 19:50:12 + */ +@Tag(name = "对外投资管理") +@RestController +@RequestMapping("/api/credit/credit-external") +public class CreditExternalController extends BaseController { + @Resource + private CreditExternalService creditExternalService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询对外投资") + @GetMapping("/page") + public ApiResult> page(CreditExternalParam param) { + // 使用关联查询 + return success(creditExternalService.pageRel(param)); + } + + @Operation(summary = "查询全部对外投资") + @GetMapping() + public ApiResult> list(CreditExternalParam param) { + // 使用关联查询 + return success(creditExternalService.listRel(param)); + } + + @Operation(summary = "根据id查询对外投资") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditExternalService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditExternal:save')") + @OperationLog + @Operation(summary = "添加对外投资") + @PostMapping() + public ApiResult save(@RequestBody CreditExternal creditExternal) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditExternal.setUserId(loginUser.getUserId()); + // } + if (creditExternalService.save(creditExternal)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditExternal:update')") + @OperationLog + @Operation(summary = "修改对外投资") + @PutMapping() + public ApiResult update(@RequestBody CreditExternal creditExternal) { + if (creditExternalService.updateById(creditExternal)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditExternal:remove')") + @OperationLog + @Operation(summary = "删除对外投资") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditExternalService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditExternal:save')") + @OperationLog + @Operation(summary = "批量添加对外投资") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditExternalService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditExternal:update')") + @OperationLog + @Operation(summary = "批量修改对外投资") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditExternalService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditExternal:remove')") + @OperationLog + @Operation(summary = "批量删除对外投资") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditExternalService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditExternal:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditExternalService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditExternal::getId, + CreditExternal::setId, + CreditExternal::getName, + CreditExternal::getCompanyId, + CreditExternal::setCompanyId, + CreditExternal::getHasData, + CreditExternal::setHasData, + CreditExternal::getTenantId, + CreditExternal::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入对外投资 + */ + @PreAuthorize("hasAuthority('credit:creditExternal:save')") + @Operation(summary = "批量导入对外投资") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "对外投资", 0); + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditExternalImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByName = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "被投资企业名称"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditExternalImportParam param = list.get(i); + try { + CreditExternal item = convertImportParamToEntity(param); + if (!ImportHelper.isBlank(item.getName())) { + String link = urlByName.get(item.getName().trim()); + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getName())) { + errorMessages.add("第" + excelRowNumber + "行:被投资企业名称不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditExternalService, + chunkItems, + CreditExternal::getId, + CreditExternal::setId, + CreditExternal::getName, + CreditExternal::getName, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditExternalService.save(rowItem); + if (!saved) { + CreditExternal existing = creditExternalService.lambdaQuery() + .eq(CreditExternal::getName, rowItem.getName()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditExternalService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditExternalService, + chunkItems, + CreditExternal::getId, + CreditExternal::setId, + CreditExternal::getName, + CreditExternal::getName, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditExternalService.save(rowItem); + if (!saved) { + CreditExternal existing = creditExternalService.lambdaQuery() + .eq(CreditExternal::getName, rowItem.getName()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditExternalService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.EXTERNAL, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载对外投资导入模板 + */ + @Operation(summary = "下载对外投资导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditExternalImportParam example = new CreditExternalImportParam(); + example.setName("示例科技有限公司"); + example.setStatusTxt("存续"); + example.setLegalRepresentative("李四"); + example.setRegisteredCapital("10000"); + example.setEstablishmentDate("2018-06-01"); + example.setShareholdingRatio("20"); + example.setSubscribedInvestmentAmount("2000"); + example.setSubscribedInvestmentDate("2019-01-01"); + example.setIndirectShareholdingRatio("5"); + example.setInvestmentDate("2019-06-01"); + example.setRegion("上海"); + example.setIndustry("信息技术"); + example.setInvestmentCount(1); + example.setRelatedProductsInstitutions("关联产品示例"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("对外投资导入模板", "对外投资", CreditExternalImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_external_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditExternalImportParam param) { + if (param == null) { + return true; + } + return ImportHelper.isBlank(param.getName()) + && ImportHelper.isBlank(param.getLegalRepresentative()) + && ImportHelper.isBlank(param.getRegisteredCapital()) + && ImportHelper.isBlank(param.getEstablishmentDate()); + } + + private CreditExternal convertImportParamToEntity(CreditExternalImportParam param) { + CreditExternal entity = new CreditExternal(); + + entity.setName(param.getName()); + entity.setStatusTxt(param.getStatusTxt()); + entity.setLegalRepresentative(param.getLegalRepresentative()); + entity.setRegisteredCapital(param.getRegisteredCapital()); + entity.setEstablishmentDate(param.getEstablishmentDate()); + entity.setShareholdingRatio(param.getShareholdingRatio()); + entity.setSubscribedInvestmentAmount(param.getSubscribedInvestmentAmount()); + entity.setSubscribedInvestmentDate(param.getSubscribedInvestmentDate()); + entity.setIndirectShareholdingRatio(param.getIndirectShareholdingRatio()); + entity.setInvestmentDate(param.getInvestmentDate()); + entity.setRegion(param.getRegion()); + entity.setIndustry(param.getIndustry()); + entity.setInvestmentCount(param.getInvestmentCount()); + entity.setRelatedProductsInstitutions(param.getRelatedProductsInstitutions()); + entity.setComments(param.getComments()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditFinalVersionController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditFinalVersionController.java new file mode 100644 index 0000000..e3335ce --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditFinalVersionController.java @@ -0,0 +1,641 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditFinalVersion; +import com.gxwebsoft.credit.param.CreditFinalVersionImportParam; +import com.gxwebsoft.credit.param.CreditFinalVersionParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditFinalVersionService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 终本案件控制器 + * + * @author 科技小王子 + * @since 2025-12-19 19:50:19 + */ +@Tag(name = "终本案件管理") +@RestController +@RequestMapping("/api/credit/credit-final-version") +public class CreditFinalVersionController extends BaseController { + @Resource + private CreditFinalVersionService creditFinalVersionService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询终本案件") + @GetMapping("/page") + public ApiResult> page(CreditFinalVersionParam param) { + // 使用关联查询 + return success(creditFinalVersionService.pageRel(param)); + } + + @Operation(summary = "查询全部终本案件") + @GetMapping() + public ApiResult> list(CreditFinalVersionParam param) { + // 使用关联查询 + return success(creditFinalVersionService.listRel(param)); + } + + @Operation(summary = "根据id查询终本案件") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditFinalVersionService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditFinalVersion:save')") + @OperationLog + @Operation(summary = "添加终本案件") + @PostMapping() + public ApiResult save(@RequestBody CreditFinalVersion creditFinalVersion) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditFinalVersion.setUserId(loginUser.getUserId()); + // } + if (creditFinalVersionService.save(creditFinalVersion)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditFinalVersion:update')") + @OperationLog + @Operation(summary = "修改终本案件") + @PutMapping() + public ApiResult update(@RequestBody CreditFinalVersion creditFinalVersion) { + if (creditFinalVersionService.updateById(creditFinalVersion)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditFinalVersion:remove')") + @OperationLog + @Operation(summary = "删除终本案件") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditFinalVersionService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditFinalVersion:save')") + @OperationLog + @Operation(summary = "批量添加终本案件") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditFinalVersionService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditFinalVersion:update')") + @OperationLog + @Operation(summary = "批量修改终本案件") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditFinalVersionService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditFinalVersion:remove')") + @OperationLog + @Operation(summary = "批量删除终本案件") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditFinalVersionService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditFinalVersion:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditFinalVersionService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditFinalVersion::getId, + CreditFinalVersion::setId, + CreditFinalVersion::getAppellee, + CreditFinalVersion::getCompanyId, + CreditFinalVersion::setCompanyId, + CreditFinalVersion::getHasData, + CreditFinalVersion::setHasData, + CreditFinalVersion::getTenantId, + CreditFinalVersion::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入终本案件 + */ + @PreAuthorize("hasAuthority('credit:creditFinalVersion:save')") + @Operation(summary = "批量导入终本案件") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + // 按选项卡名称读取(客户提供的文件可能不是把目标 sheet 放在第一个) + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "终本案件", 0); + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditFinalVersionImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditFinalVersionImportParam param = list.get(i); + try { + CreditFinalVersion item = convertImportParamToEntity(param); + if (!ImportHelper.isBlank(item.getCaseNumber())) { + String link = urlByCaseNumber.get(item.getCaseNumber().trim()); + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getCaseNumber())) { + errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditFinalVersionService, + chunkItems, + CreditFinalVersion::getId, + CreditFinalVersion::setId, + CreditFinalVersion::getCaseNumber, + CreditFinalVersion::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditFinalVersionService.save(rowItem); + if (!saved) { + CreditFinalVersion existing = creditFinalVersionService.lambdaQuery() + .eq(CreditFinalVersion::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditFinalVersionService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditFinalVersionService, + chunkItems, + CreditFinalVersion::getId, + CreditFinalVersion::setId, + CreditFinalVersion::getCaseNumber, + CreditFinalVersion::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditFinalVersionService.save(rowItem); + if (!saved) { + CreditFinalVersion existing = creditFinalVersionService.lambdaQuery() + .eq(CreditFinalVersion::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditFinalVersionService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.FINAL_VERSION, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 批量导入历史终本案件(仅解析“历史终本案件”选项卡) + * 规则:案号相同则覆盖更新(recommend++ 记录更新次数);案号不存在则插入。 + */ + @PreAuthorize("hasAuthority('credit:creditFinalVersion:save')") + @Operation(summary = "批量导入历史终本案件") + @PostMapping("/import/history") + public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史终本案件"); + if (sheetIndex < 0) { + return fail("未读取到数据,请确认文件中存在“历史终本案件”选项卡且表头与示例格式一致", null); + } + + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditFinalVersionImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + + LinkedHashMap latestByCaseNumber = new LinkedHashMap<>(); + LinkedHashMap latestRowByCaseNumber = new LinkedHashMap<>(); + + for (int i = 0; i < list.size(); i++) { + CreditFinalVersionImportParam param = list.get(i); + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + try { + CreditFinalVersion item = convertImportParamToEntity(param); + if (item.getCaseNumber() != null) { + item.setCaseNumber(item.getCaseNumber().trim()); + } + if (ImportHelper.isBlank(item.getCaseNumber())) { + errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + String link = urlByCaseNumber.get(item.getCaseNumber()); + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + // 历史导入的数据统一标记为“失效” + item.setDataStatus("失效"); + + latestByCaseNumber.put(item.getCaseNumber(), item); + latestRowByCaseNumber.put(item.getCaseNumber(), excelRowNumber); + } catch (Exception e) { + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (latestByCaseNumber.isEmpty()) { + if (errorMessages.isEmpty()) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + return success("导入完成,成功0条,失败" + errorMessages.size() + "条", errorMessages); + } + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (Map.Entry entry : latestByCaseNumber.entrySet()) { + String caseNumber = entry.getKey(); + CreditFinalVersion item = entry.getValue(); + Integer rowNo = latestRowByCaseNumber.get(caseNumber); + chunkItems.add(item); + chunkRowNumbers.add(rowNo != null ? rowNo : -1); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKeyAndIncrementCounterOnUpdate( + creditFinalVersionService, + chunkItems, + CreditFinalVersion::getId, + CreditFinalVersion::setId, + CreditFinalVersion::getCaseNumber, + CreditFinalVersion::getCaseNumber, + CreditFinalVersion::getRecommend, + CreditFinalVersion::setRecommend, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + if (rowItem.getRecommend() == null) { + rowItem.setRecommend(0); + } + boolean saved = creditFinalVersionService.save(rowItem); + if (!saved) { + CreditFinalVersion existing = creditFinalVersionService.lambdaQuery() + .eq(CreditFinalVersion::getCaseNumber, rowItem.getCaseNumber()) + .select(CreditFinalVersion::getId, CreditFinalVersion::getRecommend) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + Integer old = existing.getRecommend(); + rowItem.setRecommend(old == null ? 1 : old + 1); + if (creditFinalVersionService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKeyAndIncrementCounterOnUpdate( + creditFinalVersionService, + chunkItems, + CreditFinalVersion::getId, + CreditFinalVersion::setId, + CreditFinalVersion::getCaseNumber, + CreditFinalVersion::getCaseNumber, + CreditFinalVersion::getRecommend, + CreditFinalVersion::setRecommend, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + if (rowItem.getRecommend() == null) { + rowItem.setRecommend(0); + } + boolean saved = creditFinalVersionService.save(rowItem); + if (!saved) { + CreditFinalVersion existing = creditFinalVersionService.lambdaQuery() + .eq(CreditFinalVersion::getCaseNumber, rowItem.getCaseNumber()) + .select(CreditFinalVersion::getId, CreditFinalVersion::getRecommend) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + Integer old = existing.getRecommend(); + rowItem.setRecommend(old == null ? 1 : old + 1); + if (creditFinalVersionService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.FINAL_VERSION, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载终本案件导入模板 + */ + @Operation(summary = "下载终本案件导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditFinalVersionImportParam example = new CreditFinalVersionImportParam(); + example.setCaseNumber("(2024)示例案号"); + example.setPlaintiffAppellant("原告示例"); + example.setAppellee("被告示例"); + example.setOtherPartiesThirdParty("第三人示例"); + example.setInvolvedAmount("20,293.91"); + example.setDataStatus("正常"); + example.setCourtName("示例法院"); + example.setOccurrenceTime("2024-01-01"); + example.setFinalDate("2024-01-01"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("终本案件导入模板", "终本案件", CreditFinalVersionImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_final_version_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditFinalVersionImportParam param) { + if (param == null) { + return true; + } + return ImportHelper.isBlank(param.getCaseNumber()); + } + + private CreditFinalVersion convertImportParamToEntity(CreditFinalVersionImportParam param) { + CreditFinalVersion entity = new CreditFinalVersion(); + + String plaintiffAppellant = !ImportHelper.isBlank(param.getPlaintiffAppellant2()) + ? param.getPlaintiffAppellant2() + : param.getPlaintiffAppellant(); + String appellee = !ImportHelper.isBlank(param.getAppellee2()) + ? param.getAppellee2() + : param.getAppellee(); + String otherPartiesThirdParty = !ImportHelper.isBlank(param.getOtherPartiesThirdParty()) + ? param.getOtherPartiesThirdParty() + : param.getOtherPartiesThirdParty2(); + String involvedAmount = !ImportHelper.isBlank(param.getInvolvedAmount2()) + ? param.getInvolvedAmount2() + : param.getInvolvedAmount(); + String courtName = !ImportHelper.isBlank(param.getCourtName2()) + ? param.getCourtName2() + : param.getCourtName(); + String occurrenceTime = !ImportHelper.isBlank(param.getOccurrenceTime2()) + ? param.getOccurrenceTime2() + : param.getOccurrenceTime(); + + entity.setCaseNumber(param.getCaseNumber()); + entity.setPlaintiffAppellant(plaintiffAppellant); + entity.setAppellee(appellee); + entity.setUnfulfilledAmount(param.getUnfulfilledAmount()); + entity.setInvolvedAmount(involvedAmount); + entity.setOtherPartiesThirdParty(otherPartiesThirdParty); + entity.setDataStatus(param.getDataStatus()); + entity.setCourtName(courtName); + entity.setOccurrenceTime(occurrenceTime); + entity.setFinalDate(param.getFinalDate()); + entity.setComments(param.getComments()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditGqdjController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditGqdjController.java new file mode 100644 index 0000000..c9b8193 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditGqdjController.java @@ -0,0 +1,814 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditGqdj; +import com.gxwebsoft.credit.param.CreditGqdjImportParam; +import com.gxwebsoft.credit.param.CreditGqdjParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditGqdjService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 股权冻结控制器 + * + * @author 科技小王子 + * @since 2025-12-19 19:50:37 + */ +@Tag(name = "股权冻结管理") +@RestController +@RequestMapping("/api/credit/credit-gqdj") +public class CreditGqdjController extends BaseController { + @Resource + private CreditGqdjService creditGqdjService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询股权冻结") + @GetMapping("/page") + public ApiResult> page(CreditGqdjParam param) { + // 使用关联查询 + return success(creditGqdjService.pageRel(param)); + } + + @Operation(summary = "查询全部股权冻结") + @GetMapping() + public ApiResult> list(CreditGqdjParam param) { + // 使用关联查询 + return success(creditGqdjService.listRel(param)); + } + + @Operation(summary = "根据id查询股权冻结") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditGqdjService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditGqdj:save')") + @OperationLog + @Operation(summary = "添加股权冻结") + @PostMapping() + public ApiResult save(@RequestBody CreditGqdj creditGqdj) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditGqdj.setUserId(loginUser.getUserId()); + // } + if (creditGqdjService.save(creditGqdj)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditGqdj:update')") + @OperationLog + @Operation(summary = "修改股权冻结") + @PutMapping() + public ApiResult update(@RequestBody CreditGqdj creditGqdj) { + if (creditGqdjService.updateById(creditGqdj)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditGqdj:remove')") + @OperationLog + @Operation(summary = "删除股权冻结") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditGqdjService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditGqdj:save')") + @OperationLog + @Operation(summary = "批量添加股权冻结") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditGqdjService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditGqdj:update')") + @OperationLog + @Operation(summary = "批量修改股权冻结") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditGqdjService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditGqdj:remove')") + @OperationLog + @Operation(summary = "批量删除股权冻结") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditGqdjService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据当事人/企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId 为空/0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditGqdj:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + // Match companyId by any party/company-name column (e.g. plaintiff/appellant, defendant/appellee). + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyNames( + creditGqdjService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditGqdj::getId, + CreditGqdj::setId, + CreditGqdj::getCompanyId, + CreditGqdj::setCompanyId, + CreditGqdj::getHasData, + CreditGqdj::setHasData, + CreditGqdj::getTenantId, + CreditGqdj::new, + CreditGqdj::getPlaintiffAppellant, + CreditGqdj::getAppellee + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入股权冻结司法大数据 + */ + @PreAuthorize("hasAuthority('credit:creditGqdj:save')") + @Operation(summary = "批量导入股权冻结司法大数据") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "股权冻结", 0); + // Prefer the "best" header configuration; many upstream files have extra title rows or multi-row headers. + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.readBest( + file, + CreditGqdjImportParam.class, + this::isEmptyImportRow, + // Score rows that look like real data (at least has a case number in either column). + p -> p != null + && (!ImportHelper.isBlank(p.getCaseNumber()) + || !ImportHelper.isBlank(p.getCaseNumber2()) + ), + sheetIndex + ); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + // Fallback: try other sheets if the named/default sheet doesn't match. + importResult = ExcelImportSupport.readAnySheetBest( + file, + CreditGqdjImportParam.class, + this::isEmptyImportRow, + p -> p != null + && (!ImportHelper.isBlank(p.getCaseNumber()) + || !ImportHelper.isBlank(p.getCaseNumber2())) + ); + list = importResult.getData(); + usedTitleRows = importResult.getTitleRows(); + usedHeadRows = importResult.getHeadRows(); + usedSheetIndex = importResult.getSheetIndex(); + } + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + // easypoi 默认不会读取单元格超链接地址;url 通常挂在“案号/执行通知文书号”列的超链接中,需要额外读取回填。 + String caseNumberHeader = "执行通知文书号"; + Map urlByCaseNumber = ExcelImportSupport.readHyperlinksByHeaderKey( + file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader); + // Some upstream sources use "案号" as the case number header. + Map urlByCaseNumberFromAh = ExcelImportSupport.readHyperlinksByHeaderKey( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + urlByCaseNumberFromAh.forEach(urlByCaseNumber::putIfAbsent); + // Some upstream sources use "暗号" as the case number header. + Map urlByCaseNumberFromAh2 = ExcelImportSupport.readHyperlinksByHeaderKey( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号"); + urlByCaseNumberFromAh2.forEach(urlByCaseNumber::putIfAbsent); + // 有些源文件会单独提供“url/网址/链接”等列(可能是纯文本也可能是超链接) + Map urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader, "url"); + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader, "URL"); + } + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader, "网址"); + } + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader, "链接"); + } + if (urlByCaseNumberFromUrlCol.isEmpty()) { + // Try again with "案号" as the key column name. + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号", "url"); + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号", "URL"); + } + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号", "网址"); + } + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号", "链接"); + } + } + if (urlByCaseNumberFromUrlCol.isEmpty()) { + // Try again with "暗号" as the key column name. + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号", "url"); + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号", "URL"); + } + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号", "网址"); + } + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号", "链接"); + } + } + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditGqdjImportParam param = list.get(i); + try { + CreditGqdj item = convertImportParamToEntity(param); + if (!ImportHelper.isBlank(item.getCaseNumber())) { + String key = item.getCaseNumber().trim(); + String link = urlByCaseNumber.get(key); + if (ImportHelper.isBlank(link)) { + link = urlByCaseNumberFromUrlCol.get(key); + } + if (link != null && !link.isEmpty()) { + item.setUrl(link); + } + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getCaseNumber())) { + errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditGqdjService, + chunkItems, + CreditGqdj::getId, + CreditGqdj::setId, + CreditGqdj::getCaseNumber, + CreditGqdj::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditGqdjService.save(rowItem); + if (!saved) { + CreditGqdj existing = creditGqdjService.lambdaQuery() + .eq(CreditGqdj::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditGqdjService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditGqdjService, + chunkItems, + CreditGqdj::getId, + CreditGqdj::setId, + CreditGqdj::getCaseNumber, + CreditGqdj::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditGqdjService.save(rowItem); + if (!saved) { + CreditGqdj existing = creditGqdjService.lambdaQuery() + .eq(CreditGqdj::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditGqdjService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.GQDJ, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 批量导入历史股权冻结(仅解析“历史股权冻结”选项卡) + * 规则:执行通知文书号/案号相同则覆盖更新(recommend++ 记录更新次数);不存在则插入。 + */ + @PreAuthorize("hasAuthority('credit:creditGqdj:save')") + @Operation(summary = "批量导入历史股权冻结司法大数据") + @PostMapping("/import/history") + public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史股权冻结"); + if (sheetIndex < 0) { + return fail("未读取到数据,请确认文件中存在“历史股权冻结”选项卡且表头与示例格式一致", null); + } + + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.readBest( + file, + CreditGqdjImportParam.class, + this::isEmptyImportRow, + p -> p != null + && (!ImportHelper.isBlank(p.getCaseNumber()) + || !ImportHelper.isBlank(p.getCaseNumber2())), + sheetIndex + ); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + String caseNumberHeader = "执行通知文书号"; + Map urlByCaseNumber = ExcelImportSupport.readHyperlinksByHeaderKey( + file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader); + Map urlByCaseNumberFromAh = ExcelImportSupport.readHyperlinksByHeaderKey( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + urlByCaseNumberFromAh.forEach(urlByCaseNumber::putIfAbsent); + Map urlByCaseNumberFromAh2 = ExcelImportSupport.readHyperlinksByHeaderKey( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号"); + urlByCaseNumberFromAh2.forEach(urlByCaseNumber::putIfAbsent); + Map urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader, "url"); + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader, "URL"); + } + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader, "网址"); + } + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, caseNumberHeader, "链接"); + } + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号", "url"); + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号", "URL"); + } + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号", "网址"); + } + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号", "链接"); + } + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号", "url"); + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号", "URL"); + } + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号", "网址"); + } + if (urlByCaseNumberFromUrlCol.isEmpty()) { + urlByCaseNumberFromUrlCol = ExcelImportSupport.readKeyValueByHeaders( + file, usedSheetIndex, usedTitleRows, usedHeadRows, "暗号", "链接"); + } + } + } + + LinkedHashMap latestByCaseNumber = new LinkedHashMap<>(); + LinkedHashMap latestRowByCaseNumber = new LinkedHashMap<>(); + + for (int i = 0; i < list.size(); i++) { + CreditGqdjImportParam param = list.get(i); + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + try { + CreditGqdj item = convertImportParamToEntity(param); + if (item.getCaseNumber() != null) { + item.setCaseNumber(item.getCaseNumber().trim()); + } + if (ImportHelper.isBlank(item.getCaseNumber())) { + errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + String key = item.getCaseNumber(); + String link = urlByCaseNumber.get(key); + if (ImportHelper.isBlank(link)) { + link = urlByCaseNumberFromUrlCol.get(key); + } + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + // 历史导入的数据统一标记为“失效” + item.setDataStatus("失效"); + + latestByCaseNumber.put(item.getCaseNumber(), item); + latestRowByCaseNumber.put(item.getCaseNumber(), excelRowNumber); + } catch (Exception e) { + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (latestByCaseNumber.isEmpty()) { + if (errorMessages.isEmpty()) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + return success("导入完成,成功0条,失败" + errorMessages.size() + "条", errorMessages); + } + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (Map.Entry entry : latestByCaseNumber.entrySet()) { + String caseNumber = entry.getKey(); + CreditGqdj item = entry.getValue(); + Integer rowNo = latestRowByCaseNumber.get(caseNumber); + chunkItems.add(item); + chunkRowNumbers.add(rowNo != null ? rowNo : -1); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKeyAndIncrementCounterOnUpdate( + creditGqdjService, + chunkItems, + CreditGqdj::getId, + CreditGqdj::setId, + CreditGqdj::getCaseNumber, + CreditGqdj::getCaseNumber, + CreditGqdj::getRecommend, + CreditGqdj::setRecommend, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + if (rowItem.getRecommend() == null) { + rowItem.setRecommend(0); + } + boolean saved = creditGqdjService.save(rowItem); + if (!saved) { + CreditGqdj existing = creditGqdjService.lambdaQuery() + .eq(CreditGqdj::getCaseNumber, rowItem.getCaseNumber()) + .select(CreditGqdj::getId, CreditGqdj::getRecommend) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + Integer old = existing.getRecommend(); + rowItem.setRecommend(old == null ? 1 : old + 1); + if (creditGqdjService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKeyAndIncrementCounterOnUpdate( + creditGqdjService, + chunkItems, + CreditGqdj::getId, + CreditGqdj::setId, + CreditGqdj::getCaseNumber, + CreditGqdj::getCaseNumber, + CreditGqdj::getRecommend, + CreditGqdj::setRecommend, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + if (rowItem.getRecommend() == null) { + rowItem.setRecommend(0); + } + boolean saved = creditGqdjService.save(rowItem); + if (!saved) { + CreditGqdj existing = creditGqdjService.lambdaQuery() + .eq(CreditGqdj::getCaseNumber, rowItem.getCaseNumber()) + .select(CreditGqdj::getId, CreditGqdj::getRecommend) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + Integer old = existing.getRecommend(); + rowItem.setRecommend(old == null ? 1 : old + 1); + if (creditGqdjService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.GQDJ, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载股权冻结导入模板 + */ + @Operation(summary = "下载股权冻结导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditGqdjImportParam example = new CreditGqdjImportParam(); + example.setDataType("股权冻结"); + example.setPlaintiffAppellant("原告示例"); + example.setAppellee("被告示例"); + example.setCaseNumber("(2024)示例案号"); + example.setInvolvedAmount("100000"); + example.setCourtName("示例法院"); + example.setDataStatus("已公开"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("股权冻结导入模板", "股权冻结", CreditGqdjImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_gqdj_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditGqdjImportParam param) { + if (param == null) { + return true; + } + // Don't over-filter here: if some columns are mapped but case number header differs, + // we still want to read the row and report "案号不能为空" instead of "未读取到数据". + return ImportHelper.isBlank(param.getCaseNumber()) + && ImportHelper.isBlank(param.getCaseNumber2()) + && ImportHelper.isBlank(param.getAppellee()) + && ImportHelper.isBlank(param.getAppellee2()) + && ImportHelper.isBlank(param.getPlaintiffAppellant()) + && ImportHelper.isBlank(param.getPlaintiffAppellant2()) + && ImportHelper.isBlank(param.getInvolvedAmount()) + && ImportHelper.isBlank(param.getCourtName()) + && ImportHelper.isBlank(param.getDataType()) + && ImportHelper.isBlank(param.getDataStatus()) + && ImportHelper.isBlank(param.getDataStatus2()) + && ImportHelper.isBlank(param.getFreezeDateStart()) + && ImportHelper.isBlank(param.getFreezeDateEnd()) + && ImportHelper.isBlank(param.getFreezeDateStart2()) + && ImportHelper.isBlank(param.getFreezeDateEnd2()) + && ImportHelper.isBlank(param.getPublicDate()); + } + + private CreditGqdj convertImportParamToEntity(CreditGqdjImportParam param) { + CreditGqdj entity = new CreditGqdj(); + + // Template compatibility: some sources use alternate headers for the same columns. + String appellee = !ImportHelper.isBlank(param.getAppellee()) ? param.getAppellee() : param.getAppellee2(); + String plaintiffAppellant = !ImportHelper.isBlank(param.getPlaintiffAppellant()) + ? param.getPlaintiffAppellant() + : param.getPlaintiffAppellant2(); + + if (!ImportHelper.isBlank(param.getCaseNumber2())) { + entity.setCaseNumber(param.getCaseNumber2()); + } else { + entity.setCaseNumber(param.getCaseNumber()); + } + entity.setAppellee(appellee); + entity.setPlaintiffAppellant(plaintiffAppellant); + entity.setInvolvedAmount(param.getInvolvedAmount()); + entity.setCourtName(param.getCourtName()); + if (!ImportHelper.isBlank(param.getDataStatus2())) { + entity.setDataStatus(param.getDataStatus2()); + } else { + entity.setDataStatus(param.getDataStatus()); + } + entity.setDataType("股权冻结"); + entity.setPublicDate(param.getPublicDate()); + if (!ImportHelper.isBlank(param.getFreezeDateStart2())) { + entity.setFreezeDateStart(param.getFreezeDateStart2()); + } else { + entity.setFreezeDateStart(param.getFreezeDateStart()); + } + if (!ImportHelper.isBlank(param.getFreezeDateEnd2())) { + entity.setFreezeDateEnd(param.getFreezeDateEnd2()); + } else { + entity.setFreezeDateEnd(param.getFreezeDateEnd()); + } + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditHistoricalLegalPersonController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditHistoricalLegalPersonController.java new file mode 100644 index 0000000..5097d93 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditHistoricalLegalPersonController.java @@ -0,0 +1,511 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditHistoricalLegalPerson; +import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonImportParam; +import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditHistoricalLegalPersonService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 历史法定代表人控制器 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Tag(name = "历史法定代表人管理") +@RestController +@RequestMapping("/api/credit/credit-historical-legal-person") +public class CreditHistoricalLegalPersonController extends BaseController { + @Resource + private CreditHistoricalLegalPersonService creditHistoricalLegalPersonService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询历史法定代表人") + @GetMapping("/page") + public ApiResult> page(CreditHistoricalLegalPersonParam param) { + // 使用关联查询 + return success(creditHistoricalLegalPersonService.pageRel(param)); + } + + @Operation(summary = "查询全部历史法定代表人") + @GetMapping() + public ApiResult> list(CreditHistoricalLegalPersonParam param) { + // 使用关联查询 + return success(creditHistoricalLegalPersonService.listRel(param)); + } + + @Operation(summary = "根据id查询历史法定代表人") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditHistoricalLegalPersonService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditHistoricalLegalPerson:save')") + @OperationLog + @Operation(summary = "添加历史法定代表人") + @PostMapping() + public ApiResult save(@RequestBody CreditHistoricalLegalPerson creditHistoricalLegalPerson) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditHistoricalLegalPerson.setUserId(loginUser.getUserId()); + // } + if (creditHistoricalLegalPersonService.save(creditHistoricalLegalPerson)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditHistoricalLegalPerson:update')") + @OperationLog + @Operation(summary = "修改历史法定代表人") + @PutMapping() + public ApiResult update(@RequestBody CreditHistoricalLegalPerson creditHistoricalLegalPerson) { + if (creditHistoricalLegalPersonService.updateById(creditHistoricalLegalPerson)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditHistoricalLegalPerson:remove')") + @OperationLog + @Operation(summary = "删除历史法定代表人") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditHistoricalLegalPersonService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditHistoricalLegalPerson:save')") + @OperationLog + @Operation(summary = "批量添加历史法定代表人") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditHistoricalLegalPersonService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditHistoricalLegalPerson:update')") + @OperationLog + @Operation(summary = "批量修改历史法定代表人") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditHistoricalLegalPersonService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditHistoricalLegalPerson:remove')") + @OperationLog + @Operation(summary = "批量删除历史法定代表人") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditHistoricalLegalPersonService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditHistoricalLegalPerson:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditHistoricalLegalPersonService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditHistoricalLegalPerson::getId, + CreditHistoricalLegalPerson::setId, + CreditHistoricalLegalPerson::getName, + CreditHistoricalLegalPerson::getCompanyId, + CreditHistoricalLegalPerson::setCompanyId, + CreditHistoricalLegalPerson::getHasData, + CreditHistoricalLegalPerson::setHasData, + CreditHistoricalLegalPerson::getTenantId, + CreditHistoricalLegalPerson::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入历史法定代表人 + */ + @PreAuthorize("hasAuthority('credit:creditHistoricalLegalPerson:save')") + @Operation(summary = "批量导入历史法定代表人") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.readAnySheet( + file, CreditHistoricalLegalPersonImportParam.class, this::isEmptyImportRow); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "名称"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditHistoricalLegalPersonImportParam param = list.get(i); + try { + CreditHistoricalLegalPerson item = convertImportParamToEntity(param); + if (!ImportHelper.isBlank(item.getName())) { + String link = urlByName.get(item.getName().trim()); + if (link != null && !link.isEmpty()) { + item.setUrl(link); + } + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getName())) { + errorMessages.add("第" + excelRowNumber + "行:名称不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> { + // 批内一次查库:按 name in (...) 拉取,再按 registerDate 做内存匹配 + List names = new ArrayList<>(chunkItems.size()); + for (CreditHistoricalLegalPerson it : chunkItems) { + if (it != null && !ImportHelper.isBlank(it.getName())) { + names.add(it.getName().trim()); + } + } + List existingList = names.isEmpty() + ? new ArrayList<>() + : creditHistoricalLegalPersonService.lambdaQuery() + .in(CreditHistoricalLegalPerson::getName, names) + .list(); + + java.util.Map byName = new java.util.HashMap<>(); + java.util.Map byNameDate = new java.util.HashMap<>(); + for (CreditHistoricalLegalPerson existing : existingList) { + if (existing == null || ImportHelper.isBlank(existing.getName())) { + continue; + } + String n = existing.getName().trim(); + byName.putIfAbsent(n, existing); + String d = ImportHelper.isBlank(existing.getRegisterDate()) ? null : existing.getRegisterDate().trim(); + if (d != null) { + byNameDate.putIfAbsent(n + "|" + d, existing); + } + } + + List updates = new ArrayList<>(); + List inserts = new ArrayList<>(); + for (CreditHistoricalLegalPerson it : chunkItems) { + if (it == null || ImportHelper.isBlank(it.getName())) { + continue; + } + String n = it.getName().trim(); + CreditHistoricalLegalPerson existing; + if (!ImportHelper.isBlank(it.getRegisterDate())) { + String d = it.getRegisterDate().trim(); + existing = byNameDate.get(n + "|" + d); + } else { + existing = byName.get(n); + } + if (existing != null) { + it.setId(existing.getId()); + updates.add(it); + } else { + inserts.add(it); + } + } + if (!updates.isEmpty()) { + creditHistoricalLegalPersonService.updateBatchById(updates, mpBatchSize); + } + if (!inserts.isEmpty()) { + creditHistoricalLegalPersonService.saveBatch(inserts, mpBatchSize); + } + return updates.size() + inserts.size(); + }, + (rowItem, rowNumber) -> { + boolean saved = creditHistoricalLegalPersonService.save(rowItem); + if (!saved) { + CreditHistoricalLegalPerson existing = creditHistoricalLegalPersonService.lambdaQuery() + .eq(CreditHistoricalLegalPerson::getName, rowItem.getName()) + .eq(!ImportHelper.isBlank(rowItem.getRegisterDate()), CreditHistoricalLegalPerson::getRegisterDate, rowItem.getRegisterDate()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditHistoricalLegalPersonService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> { + List names = new ArrayList<>(chunkItems.size()); + for (CreditHistoricalLegalPerson it : chunkItems) { + if (it != null && !ImportHelper.isBlank(it.getName())) { + names.add(it.getName().trim()); + } + } + List existingList = names.isEmpty() + ? new ArrayList<>() + : creditHistoricalLegalPersonService.lambdaQuery() + .in(CreditHistoricalLegalPerson::getName, names) + .list(); + + java.util.Map byName = new java.util.HashMap<>(); + java.util.Map byNameDate = new java.util.HashMap<>(); + for (CreditHistoricalLegalPerson existing : existingList) { + if (existing == null || ImportHelper.isBlank(existing.getName())) { + continue; + } + String n = existing.getName().trim(); + byName.putIfAbsent(n, existing); + String d = ImportHelper.isBlank(existing.getRegisterDate()) ? null : existing.getRegisterDate().trim(); + if (d != null) { + byNameDate.putIfAbsent(n + "|" + d, existing); + } + } + + List updates = new ArrayList<>(); + List inserts = new ArrayList<>(); + for (CreditHistoricalLegalPerson it : chunkItems) { + if (it == null || ImportHelper.isBlank(it.getName())) { + continue; + } + String n = it.getName().trim(); + CreditHistoricalLegalPerson existing; + if (!ImportHelper.isBlank(it.getRegisterDate())) { + String d = it.getRegisterDate().trim(); + existing = byNameDate.get(n + "|" + d); + } else { + existing = byName.get(n); + } + if (existing != null) { + it.setId(existing.getId()); + updates.add(it); + } else { + inserts.add(it); + } + } + if (!updates.isEmpty()) { + creditHistoricalLegalPersonService.updateBatchById(updates, mpBatchSize); + } + if (!inserts.isEmpty()) { + creditHistoricalLegalPersonService.saveBatch(inserts, mpBatchSize); + } + return updates.size() + inserts.size(); + }, + (rowItem, rowNumber) -> { + boolean saved = creditHistoricalLegalPersonService.save(rowItem); + if (!saved) { + CreditHistoricalLegalPerson existing = creditHistoricalLegalPersonService.lambdaQuery() + .eq(CreditHistoricalLegalPerson::getName, rowItem.getName()) + .eq(!ImportHelper.isBlank(rowItem.getRegisterDate()), CreditHistoricalLegalPerson::getRegisterDate, rowItem.getRegisterDate()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditHistoricalLegalPersonService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.HISTORICAL_LEGAL_PERSON, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载历史法定代表人导入模板 + */ + @Operation(summary = "下载历史法定代表人导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditHistoricalLegalPersonImportParam example = new CreditHistoricalLegalPersonImportParam(); + example.setName("张三"); + example.setRegisterDate("2020-01-01"); + example.setPublicDate("2023-06-01"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("历史法定代表人导入模板", "历史法定代表人", CreditHistoricalLegalPersonImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_historical_legal_person_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditHistoricalLegalPersonImportParam param) { + if (param == null) { + return true; + } + if (isImportHeaderRow(param)) { + return true; + } + return ImportHelper.isBlank(param.getName()) + && ImportHelper.isBlank(param.getRegisterDate()) + && ImportHelper.isBlank(param.getPublicDate()); + } + + private boolean isImportHeaderRow(CreditHistoricalLegalPersonImportParam param) { + return isHeaderValue(param.getName(), "名称") + || isHeaderValue(param.getRegisterDate(), "任职日期") + || isHeaderValue(param.getPublicDate(), "卸任日期"); + } + + private static boolean isHeaderValue(String value, String headerText) { + if (value == null) { + return false; + } + return headerText.equals(value.trim()); + } + + private CreditHistoricalLegalPerson convertImportParamToEntity(CreditHistoricalLegalPersonImportParam param) { + CreditHistoricalLegalPerson entity = new CreditHistoricalLegalPerson(); + + entity.setName(param.getName()); + entity.setRegisterDate(param.getRegisterDate()); + entity.setPublicDate(param.getPublicDate()); + entity.setComments(param.getComments()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditJudgmentDebtorController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditJudgmentDebtorController.java new file mode 100644 index 0000000..f1626f8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditJudgmentDebtorController.java @@ -0,0 +1,969 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditJudgmentDebtor; +import com.gxwebsoft.credit.param.CreditJudgmentDebtorImportParam; +import com.gxwebsoft.credit.param.CreditJudgmentDebtorParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditJudgmentDebtorService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.usermodel.WorkbookFactory; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.Locale; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +/** + * 被执行人控制器 + * + * @author 科技小王子 + * @since 2025-12-19 19:50:55 + */ +@Tag(name = "被执行人管理") +@RestController +@RequestMapping("/api/credit/credit-judgment-debtor") +public class CreditJudgmentDebtorController extends BaseController { + @Resource + private CreditJudgmentDebtorService creditJudgmentDebtorService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询被执行人") + @GetMapping("/page") + public ApiResult> page(CreditJudgmentDebtorParam param) { + // 使用关联查询 + return success(creditJudgmentDebtorService.pageRel(param)); + } + + @Operation(summary = "查询全部被执行人") + @GetMapping() + public ApiResult> list(CreditJudgmentDebtorParam param) { + // 使用关联查询 + return success(creditJudgmentDebtorService.listRel(param)); + } + + @Operation(summary = "根据id查询被执行人") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditJudgmentDebtorService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditJudgmentDebtor:save')") + @OperationLog + @Operation(summary = "添加被执行人") + @PostMapping() + public ApiResult save(@RequestBody CreditJudgmentDebtor creditJudgmentDebtor) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditJudgmentDebtor.setUserId(loginUser.getUserId()); + // } + if (creditJudgmentDebtorService.save(creditJudgmentDebtor)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditJudgmentDebtor:update')") + @OperationLog + @Operation(summary = "修改被执行人") + @PutMapping() + public ApiResult update(@RequestBody CreditJudgmentDebtor creditJudgmentDebtor) { + if (creditJudgmentDebtorService.updateById(creditJudgmentDebtor)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditJudgmentDebtor:remove')") + @OperationLog + @Operation(summary = "删除被执行人") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditJudgmentDebtorService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditJudgmentDebtor:save')") + @OperationLog + @Operation(summary = "批量添加被执行人") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditJudgmentDebtorService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditJudgmentDebtor:update')") + @OperationLog + @Operation(summary = "批量修改被执行人") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditJudgmentDebtorService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditJudgmentDebtor:remove')") + @OperationLog + @Operation(summary = "批量删除被执行人") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditJudgmentDebtorService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditJudgmentDebtor:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditJudgmentDebtorService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditJudgmentDebtor::getId, + CreditJudgmentDebtor::setId, + CreditJudgmentDebtor::getName, + CreditJudgmentDebtor::getCompanyId, + CreditJudgmentDebtor::setCompanyId, + CreditJudgmentDebtor::getHasData, + CreditJudgmentDebtor::setHasData, + CreditJudgmentDebtor::getTenantId, + CreditJudgmentDebtor::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入被执行人 + */ + @PreAuthorize("hasAuthority('credit:creditJudgmentDebtor:save')") + @Operation(summary = "批量导入被执行人") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + try { + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + ImportOutcome outcome; + if (isZip(file)) { + outcome = importFromZip(file, currentUserId, currentTenantId, companyId); + } else { + outcome = importFromExcel(file, safeFileLabel(file.getOriginalFilename()), currentUserId, currentTenantId, companyId, false); + } + + if (!outcome.anyDataRead) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.JUDGMENT_DEBTOR, outcome.touchedCompanyIds); + + if (outcome.errorMessages.isEmpty()) { + return success("成功导入" + outcome.successCount + "条数据", null); + } + return success("导入完成,成功" + outcome.successCount + "条,失败" + outcome.errorMessages.size() + "条", outcome.errorMessages); + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 批量导入历史被执行人(写入被执行人表 credit_judgment_debtor,仅解析“历史被执行人”选项卡) + * 规则:案号相同则更新;案号不存在则插入;导入文件内案号重复时取最后一条覆盖。 + */ + @PreAuthorize("hasAuthority('credit:creditJudgmentDebtor:save')") + @Operation(summary = "批量导入历史被执行人") + @PostMapping("/import/history") + public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + try { + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + ImportOutcome outcome; + if (isZip(file)) { + outcome = importHistoryFromZip(file, currentUserId, currentTenantId, companyId); + } else { + outcome = importHistoryFromExcel(file, safeFileLabel(file.getOriginalFilename()), currentUserId, currentTenantId, companyId); + } + + if (!outcome.anyDataRead) { + return fail("未读取到数据,请确认文件中存在“历史被执行人”选项卡且表头与示例格式一致", null); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.JUDGMENT_DEBTOR, outcome.touchedCompanyIds); + + if (outcome.errorMessages.isEmpty()) { + return success("成功导入" + outcome.successCount + "条数据", null); + } + return success("导入完成,成功" + outcome.successCount + "条,失败" + outcome.errorMessages.size() + "条", outcome.errorMessages); + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载被执行人导入模板 + */ + @Operation(summary = "下载被执行人导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditJudgmentDebtorImportParam example = new CreditJudgmentDebtorImportParam(); + example.setCaseNumber("(2024)示例案号"); + example.setName("某某公司"); + example.setCode("1234567890"); + example.setOccurrenceTime("2024-01-10"); + example.setAmount("100000"); + example.setDataStatus("已公开"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("被执行人导入模板", "被执行人", CreditJudgmentDebtorImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_judgment_debtor_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditJudgmentDebtorImportParam param) { + if (param == null) { + return true; + } + if (isImportHeaderRow(param)) { + return true; + } + return ImportHelper.isBlank(param.getCaseNumber()); + } + + private boolean isImportHeaderRow(CreditJudgmentDebtorImportParam param) { + return isHeaderValue(param.getName(), "序号") + || isHeaderValue(param.getName1(), "序号") + || isHeaderValue(param.getCaseNumber(), "案号") + || isHeaderValue(param.getName(), "被执行人名称") + || isHeaderValue(param.getName1(), "被执行人") + || isHeaderValue(param.getCode(), "证件号/组织机构代码") + || isHeaderValue(param.getOccurrenceTime(), "立案日期") + || isHeaderValue(param.getCourtName(), "法院") + || isHeaderValue(param.getAmount(), "执行标的(元)") + || isHeaderValue(param.getDataStatus(), "数据状态"); + } + + private static boolean isHeaderValue(String value, String headerText) { + if (value == null) { + return false; + } + return headerText.equals(value.trim()); + } + + private CreditJudgmentDebtor convertImportParamToEntity(CreditJudgmentDebtorImportParam param) { + CreditJudgmentDebtor entity = new CreditJudgmentDebtor(); + + entity.setCaseNumber(param.getCaseNumber()); + entity.setName1(param.getName1()); + String debtorName = ImportHelper.isBlank(param.getName()) ? param.getName1() : param.getName(); + entity.setName(debtorName); + entity.setCode(param.getCode()); + entity.setOccurrenceTime(param.getOccurrenceTime()); + entity.setAmount(param.getAmount()); + entity.setCourtName(param.getCourtName()); + entity.setDataStatus(param.getDataStatus()); + entity.setComments(param.getComments()); + + return entity; + } + + private static class ImportOutcome { + private final boolean anyDataRead; + private final int successCount; + private final List errorMessages; + private final Set touchedCompanyIds; + + private ImportOutcome(boolean anyDataRead, int successCount, List errorMessages, Set touchedCompanyIds) { + this.anyDataRead = anyDataRead; + this.successCount = successCount; + this.errorMessages = errorMessages; + this.touchedCompanyIds = touchedCompanyIds != null ? touchedCompanyIds : new HashSet<>(); + } + } + + private ImportOutcome importFromExcel(MultipartFile excelFile, String fileLabel, Integer currentUserId, Integer currentTenantId, Integer companyId, boolean strictDebtorSheet) throws Exception { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + ExcelImportSupport.ImportResult importResult = readDebtorImport(excelFile, strictDebtorSheet); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return new ImportOutcome(false, 0, errorMessages, touchedCompanyIds); + } + + Map urlByCaseNumber = ExcelImportSupport.readHyperlinksByHeaderKey(excelFile, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(excelFile, usedSheetIndex, usedTitleRows, usedHeadRows, "被执行人名称"); + Map urlByName1 = ExcelImportSupport.readHyperlinksByHeaderKey(excelFile, usedSheetIndex, usedTitleRows, usedHeadRows, "被执行人"); + + String prefix = ImportHelper.isBlank(fileLabel) ? "" : "【" + fileLabel + "】"; + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + for (int i = 0; i < list.size(); i++) { + CreditJudgmentDebtorImportParam param = list.get(i); + try { + CreditJudgmentDebtor item = convertImportParamToEntity(param); + String link = null; + if (!ImportHelper.isBlank(item.getCaseNumber())) { + link = urlByCaseNumber.get(item.getCaseNumber().trim()); + } + if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName())) { + link = urlByName.get(item.getName().trim()); + } + if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName1())) { + link = urlByName1.get(item.getName1().trim()); + } + if (link != null && !link.isEmpty()) { + item.setUrl(link); + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getCaseNumber())) { + errorMessages.add(prefix + "第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += persistImportChunk(chunkItems, chunkRowNumbers, prefix, mpBatchSize, errorMessages); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add(prefix + "第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + if (!chunkItems.isEmpty()) { + successCount += persistImportChunk(chunkItems, chunkRowNumbers, prefix, mpBatchSize, errorMessages); + } + return new ImportOutcome(true, successCount, errorMessages, touchedCompanyIds); + } + + private ImportOutcome importHistoryFromExcel(MultipartFile excelFile, String fileLabel, Integer currentUserId, Integer currentTenantId, Integer companyId) throws Exception { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + int historySheetIndex = ExcelImportSupport.findSheetIndex(excelFile, "历史被执行人"); + if (historySheetIndex < 0) { + return new ImportOutcome(false, 0, errorMessages, touchedCompanyIds); + } + + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.readBest( + excelFile, + CreditJudgmentDebtorImportParam.class, + this::isEmptyImportRow, + this::isScoreImportRow, + historySheetIndex + ); + + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return new ImportOutcome(false, 0, errorMessages, touchedCompanyIds); + } + + Map urlByCaseNumber = ExcelImportSupport.readHyperlinksByHeaderKey(excelFile, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(excelFile, usedSheetIndex, usedTitleRows, usedHeadRows, "被执行人名称"); + Map urlByName1 = ExcelImportSupport.readHyperlinksByHeaderKey(excelFile, usedSheetIndex, usedTitleRows, usedHeadRows, "被执行人"); + + String prefix = ImportHelper.isBlank(fileLabel) ? "" : "【" + fileLabel + "】"; + + // 同案号多条:以导入文件中“最后一条”为准(视为最新),避免批处理中重复 upsert。 + LinkedHashMap latestByCaseNumber = new LinkedHashMap<>(); + LinkedHashMap latestRowByCaseNumber = new LinkedHashMap<>(); + + for (int i = 0; i < list.size(); i++) { + CreditJudgmentDebtorImportParam param = list.get(i); + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + try { + CreditJudgmentDebtor item = convertImportParamToEntity(param); + + if (item.getCaseNumber() != null) { + item.setCaseNumber(item.getCaseNumber().trim()); + } + if (ImportHelper.isBlank(item.getCaseNumber())) { + errorMessages.add(prefix + "第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + String link = urlByCaseNumber.get(item.getCaseNumber()); + if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName())) { + link = urlByName.get(item.getName().trim()); + } + if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName1())) { + link = urlByName1.get(item.getName1().trim()); + } + if (link != null && !link.isEmpty()) { + item.setUrl(link); + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + // 历史导入的数据统一标记为“失效” + item.setDataStatus("失效"); + + latestByCaseNumber.put(item.getCaseNumber(), item); + latestRowByCaseNumber.put(item.getCaseNumber(), excelRowNumber); + } catch (Exception e) { + errorMessages.add(prefix + "第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (latestByCaseNumber.isEmpty()) { + return new ImportOutcome(true, 0, errorMessages, touchedCompanyIds); + } + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (Map.Entry entry : latestByCaseNumber.entrySet()) { + String caseNumber = entry.getKey(); + CreditJudgmentDebtor item = entry.getValue(); + Integer rowNo = latestRowByCaseNumber.get(caseNumber); + chunkItems.add(item); + chunkRowNumbers.add(rowNo != null ? rowNo : -1); + if (chunkItems.size() >= chunkSize) { + successCount += persistHistoryImportChunk(chunkItems, chunkRowNumbers, prefix, mpBatchSize, errorMessages); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } + if (!chunkItems.isEmpty()) { + successCount += persistHistoryImportChunk(chunkItems, chunkRowNumbers, prefix, mpBatchSize, errorMessages); + } + + return new ImportOutcome(true, successCount, errorMessages, touchedCompanyIds); + } + + private int persistHistoryImportChunk(List items, + List excelRowNumbers, + String prefix, + int mpBatchSize, + List errorMessages) { + if (CollectionUtils.isEmpty(items)) { + return 0; + } + + try { + return batchImportSupport.runInNewTx(() -> { + List keys = new ArrayList<>(items.size()); + for (CreditJudgmentDebtor item : items) { + if (item == null || ImportHelper.isBlank(item.getCaseNumber())) { + continue; + } + keys.add(item.getCaseNumber().trim()); + } + + Map existingByCaseNumber = new java.util.HashMap<>(); + if (!keys.isEmpty()) { + List existingList = creditJudgmentDebtorService.lambdaQuery() + .in(CreditJudgmentDebtor::getCaseNumber, keys) + .select(CreditJudgmentDebtor::getId, CreditJudgmentDebtor::getCaseNumber, CreditJudgmentDebtor::getRecommend) + .list(); + for (CreditJudgmentDebtor existing : existingList) { + if (existing == null || ImportHelper.isBlank(existing.getCaseNumber())) { + continue; + } + existingByCaseNumber.putIfAbsent(existing.getCaseNumber().trim(), existing); + } + } + + List updates = new ArrayList<>(); + List inserts = new ArrayList<>(); + for (CreditJudgmentDebtor item : items) { + if (item == null || ImportHelper.isBlank(item.getCaseNumber())) { + continue; + } + String caseNumber = item.getCaseNumber().trim(); + CreditJudgmentDebtor existing = existingByCaseNumber.get(caseNumber); + if (existing != null && existing.getId() != null) { + // 覆盖更新:recommend 记录“被更新次数”,每次更新 +1 + item.setId(existing.getId()); + Integer old = existing.getRecommend(); + item.setRecommend(old == null ? 1 : old + 1); + updates.add(item); + } else { + if (item.getRecommend() == null) { + item.setRecommend(0); + } + inserts.add(item); + } + } + + if (!updates.isEmpty()) { + creditJudgmentDebtorService.updateBatchById(updates, mpBatchSize); + } + if (!inserts.isEmpty()) { + creditJudgmentDebtorService.saveBatch(inserts, mpBatchSize); + } + return updates.size() + inserts.size(); + }); + } catch (Exception batchException) { + int successCount = 0; + for (int i = 0; i < items.size(); i++) { + CreditJudgmentDebtor item = items.get(i); + int excelRowNumber = (excelRowNumbers != null && i < excelRowNumbers.size()) ? excelRowNumbers.get(i) : -1; + try { + int delta = batchImportSupport.runInNewTx(() -> { + if (item == null || ImportHelper.isBlank(item.getCaseNumber())) { + return 0; + } + String caseNumber = item.getCaseNumber().trim(); + CreditJudgmentDebtor existing = creditJudgmentDebtorService.lambdaQuery() + .eq(CreditJudgmentDebtor::getCaseNumber, caseNumber) + .select(CreditJudgmentDebtor::getId, CreditJudgmentDebtor::getRecommend) + .one(); + if (existing != null && existing.getId() != null) { + item.setId(existing.getId()); + Integer old = existing.getRecommend(); + item.setRecommend(old == null ? 1 : old + 1); + return creditJudgmentDebtorService.updateById(item) ? 1 : 0; + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + return creditJudgmentDebtorService.save(item) ? 1 : 0; + }); + if (delta > 0) { + successCount += delta; + } else { + errorMessages.add(prefix + "第" + excelRowNumber + "行:保存失败"); + } + } catch (Exception e) { + errorMessages.add(prefix + "第" + excelRowNumber + "行:" + e.getMessage()); + } + } + return successCount; + } + } + + private int persistImportChunk(List items, + List excelRowNumbers, + String prefix, + int mpBatchSize, + List errorMessages) { + if (CollectionUtils.isEmpty(items)) { + return 0; + } + try { + return batchImportSupport.runInNewTx(() -> batchImportSupport.upsertBySingleKey( + creditJudgmentDebtorService, + items, + CreditJudgmentDebtor::getId, + CreditJudgmentDebtor::setId, + CreditJudgmentDebtor::getCaseNumber, + CreditJudgmentDebtor::getCaseNumber, + null, + mpBatchSize + )); + } catch (Exception batchException) { + int successCount = 0; + for (int i = 0; i < items.size(); i++) { + CreditJudgmentDebtor item = items.get(i); + int excelRowNumber = (excelRowNumbers != null && i < excelRowNumbers.size()) ? excelRowNumbers.get(i) : -1; + try { + int delta = batchImportSupport.runInNewTx(() -> { + boolean saved = creditJudgmentDebtorService.save(item); + if (!saved) { + CreditJudgmentDebtor existing = creditJudgmentDebtorService.lambdaQuery() + .eq(CreditJudgmentDebtor::getCaseNumber, item.getCaseNumber()) + .one(); + if (existing != null) { + item.setId(existing.getId()); + if (creditJudgmentDebtorService.updateById(item)) { + return 1; + } + } + } else { + return 1; + } + return 0; + }); + if (delta > 0) { + successCount += delta; + } else { + errorMessages.add(prefix + "第" + excelRowNumber + "行:保存失败"); + } + } catch (Exception e) { + errorMessages.add(prefix + "第" + excelRowNumber + "行:" + e.getMessage()); + } + } + return successCount; + } + } + + private ImportOutcome importFromZip(MultipartFile zipFile, Integer currentUserId, Integer currentTenantId, Integer companyId) throws Exception { + try { + return importFromZip(zipFile, currentUserId, currentTenantId, companyId, StandardCharsets.UTF_8); + } catch (IllegalArgumentException e) { + return importFromZip(zipFile, currentUserId, currentTenantId, companyId, Charset.forName("GBK")); + } + } + + private ImportOutcome importFromZip(MultipartFile zipFile, Integer currentUserId, Integer currentTenantId, Integer companyId, Charset charset) throws Exception { + List errorMessages = new ArrayList<>(); + int successCount = 0; + boolean anyDataRead = false; + Set touchedCompanyIds = new HashSet<>(); + + try (InputStream is = zipFile.getInputStream(); ZipInputStream zis = new ZipInputStream(is, charset)) { + ZipEntry entry; + while ((entry = zis.getNextEntry()) != null) { + if (entry.isDirectory()) { + continue; + } + String entryName = entry.getName(); + if (!isExcelFileName(entryName)) { + continue; + } + + byte[] bytes = readAllBytes(zis); + String entryFileName = safeFileLabel(entryName); + MultipartFile excelFile = new InMemoryMultipartFile(entryFileName, bytes); + + try { + ImportOutcome outcome = importFromExcel(excelFile, entryFileName, currentUserId, currentTenantId, companyId, true); + if (outcome.anyDataRead) { + anyDataRead = true; + successCount += outcome.successCount; + errorMessages.addAll(outcome.errorMessages); + touchedCompanyIds.addAll(outcome.touchedCompanyIds); + } + } catch (Exception e) { + errorMessages.add("【" + entryFileName + "】解析失败:" + e.getMessage()); + } + } + } + return new ImportOutcome(anyDataRead, successCount, errorMessages, touchedCompanyIds); + } + + private ImportOutcome importHistoryFromZip(MultipartFile zipFile, Integer currentUserId, Integer currentTenantId, Integer companyId) throws Exception { + try { + return importHistoryFromZip(zipFile, currentUserId, currentTenantId, companyId, StandardCharsets.UTF_8); + } catch (IllegalArgumentException e) { + return importHistoryFromZip(zipFile, currentUserId, currentTenantId, companyId, Charset.forName("GBK")); + } + } + + private ImportOutcome importHistoryFromZip(MultipartFile zipFile, Integer currentUserId, Integer currentTenantId, Integer companyId, Charset charset) throws Exception { + List errorMessages = new ArrayList<>(); + int successCount = 0; + boolean anyDataRead = false; + Set touchedCompanyIds = new HashSet<>(); + + try (InputStream is = zipFile.getInputStream(); ZipInputStream zis = new ZipInputStream(is, charset)) { + ZipEntry entry; + while ((entry = zis.getNextEntry()) != null) { + if (entry.isDirectory()) { + continue; + } + String entryName = entry.getName(); + if (!isExcelFileName(entryName)) { + continue; + } + + byte[] bytes = readAllBytes(zis); + String entryFileName = safeFileLabel(entryName); + MultipartFile excelFile = new InMemoryMultipartFile(entryFileName, bytes); + + try { + ImportOutcome outcome = importHistoryFromExcel(excelFile, entryFileName, currentUserId, currentTenantId, companyId); + if (outcome.anyDataRead) { + anyDataRead = true; + successCount += outcome.successCount; + errorMessages.addAll(outcome.errorMessages); + touchedCompanyIds.addAll(outcome.touchedCompanyIds); + } + } catch (Exception e) { + errorMessages.add("【" + entryFileName + "】解析失败:" + e.getMessage()); + } + } + } + return new ImportOutcome(anyDataRead, successCount, errorMessages, touchedCompanyIds); + } + + private static boolean isZip(MultipartFile file) { + String filename = file != null ? file.getOriginalFilename() : null; + if (filename == null) { + return false; + } + return filename.toLowerCase(Locale.ROOT).endsWith(".zip"); + } + + private ExcelImportSupport.ImportResult readDebtorImport(MultipartFile excelFile, boolean strictDebtorSheet) throws Exception { + List debtorSheetIndices = findDebtorSheetIndices(excelFile); + for (Integer sheetIndex : debtorSheetIndices) { + ExcelImportSupport.ImportResult sheetResult = ExcelImportSupport.readBest( + excelFile, + CreditJudgmentDebtorImportParam.class, + this::isEmptyImportRow, + this::isScoreImportRow, + sheetIndex + ); + if (!CollectionUtils.isEmpty(sheetResult.getData())) { + return sheetResult; + } + } + if (strictDebtorSheet) { + return new ExcelImportSupport.ImportResult<>(new ArrayList<>(), 0, 0); + } + return ExcelImportSupport.readAnySheetBest(excelFile, CreditJudgmentDebtorImportParam.class, this::isEmptyImportRow, this::isScoreImportRow); + } + + private boolean isScoreImportRow(CreditJudgmentDebtorImportParam param) { + if (param == null) { + return false; + } + if (isImportHeaderRow(param)) { + return false; + } + return !ImportHelper.isBlank(param.getCaseNumber()); + } + + private List findDebtorSheetIndices(MultipartFile excelFile) throws Exception { + // Prefer an explicitly-named "被执行人" sheet when present. + List preferred = new ArrayList<>(); + List indices = new ArrayList<>(); + try (InputStream is = excelFile.getInputStream(); Workbook workbook = WorkbookFactory.create(is)) { + int sheetCount = workbook.getNumberOfSheets(); + for (int i = 0; i < sheetCount; i++) { + String sheetName = workbook.getSheetName(i); + if (!isDebtorSheetName(sheetName)) { + continue; + } + String normalized = normalizeSheetName(sheetName); + if ("被执行人".equals(normalized)) { + preferred.add(i); + } else { + indices.add(i); + } + } + } + preferred.addAll(indices); + return preferred; + } + + private static boolean isDebtorSheetName(String sheetName) { + if (sheetName == null) { + return false; + } + String normalized = normalizeSheetName(sheetName); + return normalized.contains("被执行人") && !normalized.contains("失信") && !normalized.contains("历史"); + } + + private static String normalizeSheetName(String sheetName) { + if (sheetName == null) { + return ""; + } + return sheetName.replace(" ", "").replace(" ", "").trim(); + } + + private static boolean isExcelFileName(String name) { + if (name == null) { + return false; + } + String lower = name.toLowerCase(Locale.ROOT); + return lower.endsWith(".xlsx") || lower.endsWith(".xls") || lower.endsWith(".xlsm"); + } + + private static String safeFileLabel(String name) { + if (ImportHelper.isBlank(name)) { + return ""; + } + int lastSlash = name.lastIndexOf('/'); + if (lastSlash >= 0 && lastSlash + 1 < name.length()) { + return name.substring(lastSlash + 1); + } + return name; + } + + private static byte[] readAllBytes(InputStream inputStream) throws IOException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + byte[] buffer = new byte[8192]; + int read; + while ((read = inputStream.read(buffer)) != -1) { + out.write(buffer, 0, read); + } + return out.toByteArray(); + } + + private static class InMemoryMultipartFile implements MultipartFile { + private final String originalFilename; + private final byte[] bytes; + + private InMemoryMultipartFile(String originalFilename, byte[] bytes) { + this.originalFilename = originalFilename; + this.bytes = bytes != null ? bytes : new byte[0]; + } + + @Override + public String getName() { + return originalFilename; + } + + @Override + public String getOriginalFilename() { + return originalFilename; + } + + @Override + public String getContentType() { + return null; + } + + @Override + public boolean isEmpty() { + return bytes.length == 0; + } + + @Override + public long getSize() { + return bytes.length; + } + + @Override + public byte[] getBytes() { + return bytes; + } + + @Override + public InputStream getInputStream() { + return new java.io.ByteArrayInputStream(bytes); + } + + @Override + public void transferTo(java.io.File dest) throws IOException { + Files.write(dest.toPath(), bytes); + } + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditJudicialDocumentController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditJudicialDocumentController.java new file mode 100644 index 0000000..2b62709 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditJudicialDocumentController.java @@ -0,0 +1,640 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditJudicialDocument; +import com.gxwebsoft.credit.param.CreditJudicialDocumentImportParam; +import com.gxwebsoft.credit.param.CreditJudicialDocumentParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditJudicialDocumentService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 裁判文书司法大数据控制器 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:03 + */ +@Tag(name = "裁判文书司法大数据管理") +@RestController +@RequestMapping("/api/credit/credit-judicial-document") +public class CreditJudicialDocumentController extends BaseController { + @Resource + private CreditJudicialDocumentService creditJudicialDocumentService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询裁判文书司法大数据") + @GetMapping("/page") + public ApiResult> page(CreditJudicialDocumentParam param) { + // 使用关联查询 + return success(creditJudicialDocumentService.pageRel(param)); + } + + @Operation(summary = "查询全部裁判文书司法大数据") + @GetMapping() + public ApiResult> list(CreditJudicialDocumentParam param) { + // 使用关联查询 + return success(creditJudicialDocumentService.listRel(param)); + } + + @Operation(summary = "根据id查询裁判文书司法大数据") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditJudicialDocumentService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditJudicialDocument:save')") + @OperationLog + @Operation(summary = "添加裁判文书司法大数据") + @PostMapping() + public ApiResult save(@RequestBody CreditJudicialDocument creditJudicialDocument) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditJudicialDocument.setUserId(loginUser.getUserId()); + // } + if (creditJudicialDocumentService.save(creditJudicialDocument)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditJudicialDocument:update')") + @OperationLog + @Operation(summary = "修改裁判文书司法大数据") + @PutMapping() + public ApiResult update(@RequestBody CreditJudicialDocument creditJudicialDocument) { + if (creditJudicialDocumentService.updateById(creditJudicialDocument)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditJudicialDocument:remove')") + @OperationLog + @Operation(summary = "删除裁判文书司法大数据") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditJudicialDocumentService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditJudicialDocument:save')") + @OperationLog + @Operation(summary = "批量添加裁判文书司法大数据") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditJudicialDocumentService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditJudicialDocument:update')") + @OperationLog + @Operation(summary = "批量修改裁判文书司法大数据") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditJudicialDocumentService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditJudicialDocument:remove')") + @OperationLog + @Operation(summary = "批量删除裁判文书司法大数据") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditJudicialDocumentService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditJudicialDocument:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditJudicialDocumentService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditJudicialDocument::getId, + CreditJudicialDocument::setId, + CreditJudicialDocument::getAppellee, + CreditJudicialDocument::getCompanyId, + CreditJudicialDocument::setCompanyId, + CreditJudicialDocument::getHasData, + CreditJudicialDocument::setHasData, + CreditJudicialDocument::getTenantId, + CreditJudicialDocument::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入裁判文书司法大数据 + */ + @PreAuthorize("hasAuthority('credit:creditJudicialDocument:save')") + @Operation(summary = "批量导入裁判文书司法大数据") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + // 支持按选项卡名称导入:默认读取“裁判文书”sheet(不存在则回退到第 0 个sheet) + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "裁判文书", 0); + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditJudicialDocumentImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + Map urlByTitle = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "文书标题"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditJudicialDocumentImportParam param = list.get(i); + try { + CreditJudicialDocument item = convertImportParamToEntity(param); + String link = null; + if (!ImportHelper.isBlank(item.getCaseNumber())) { + link = urlByCaseNumber.get(item.getCaseNumber().trim()); + } + if (ImportHelper.isBlank(link) && !ImportHelper.isBlank(item.getTitle())) { + link = urlByTitle.get(item.getTitle().trim()); + } + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getCaseNumber())) { + errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditJudicialDocumentService, + chunkItems, + CreditJudicialDocument::getId, + CreditJudicialDocument::setId, + CreditJudicialDocument::getCaseNumber, + CreditJudicialDocument::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditJudicialDocumentService.save(rowItem); + if (!saved) { + CreditJudicialDocument existing = creditJudicialDocumentService.lambdaQuery() + .eq(CreditJudicialDocument::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditJudicialDocumentService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditJudicialDocumentService, + chunkItems, + CreditJudicialDocument::getId, + CreditJudicialDocument::setId, + CreditJudicialDocument::getCaseNumber, + CreditJudicialDocument::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditJudicialDocumentService.save(rowItem); + if (!saved) { + CreditJudicialDocument existing = creditJudicialDocumentService.lambdaQuery() + .eq(CreditJudicialDocument::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditJudicialDocumentService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.JUDICIAL_DOCUMENT, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 批量导入历史裁判文书(仅解析“历史裁判文书”选项卡) + * 规则:案号相同则覆盖更新(recommend++ 记录更新次数);案号不存在则插入。 + */ + @PreAuthorize("hasAuthority('credit:creditJudicialDocument:save')") + @Operation(summary = "批量导入历史裁判文书司法大数据") + @PostMapping("/import/history") + public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史裁判文书"); + if (sheetIndex < 0) { + return fail("未读取到数据,请确认文件中存在“历史裁判文书”选项卡且表头与示例格式一致", null); + } + + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditJudicialDocumentImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + Map urlByTitle = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "文书标题"); + + LinkedHashMap latestByCaseNumber = new LinkedHashMap<>(); + LinkedHashMap latestRowByCaseNumber = new LinkedHashMap<>(); + + for (int i = 0; i < list.size(); i++) { + CreditJudicialDocumentImportParam param = list.get(i); + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + try { + CreditJudicialDocument item = convertImportParamToEntity(param); + if (item.getCaseNumber() != null) { + item.setCaseNumber(item.getCaseNumber().trim()); + } + if (ImportHelper.isBlank(item.getCaseNumber())) { + errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + String link = null; + if (!ImportHelper.isBlank(item.getCaseNumber())) { + link = urlByCaseNumber.get(item.getCaseNumber()); + } + if (ImportHelper.isBlank(link) && !ImportHelper.isBlank(item.getTitle())) { + link = urlByTitle.get(item.getTitle().trim()); + } + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + // 历史导入的数据统一标记为“失效” + item.setDataStatus("失效"); + + latestByCaseNumber.put(item.getCaseNumber(), item); + latestRowByCaseNumber.put(item.getCaseNumber(), excelRowNumber); + } catch (Exception e) { + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (latestByCaseNumber.isEmpty()) { + if (errorMessages.isEmpty()) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + return success("导入完成,成功0条,失败" + errorMessages.size() + "条", errorMessages); + } + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (Map.Entry entry : latestByCaseNumber.entrySet()) { + String caseNumber = entry.getKey(); + CreditJudicialDocument item = entry.getValue(); + Integer rowNo = latestRowByCaseNumber.get(caseNumber); + chunkItems.add(item); + chunkRowNumbers.add(rowNo != null ? rowNo : -1); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKeyAndIncrementCounterOnUpdate( + creditJudicialDocumentService, + chunkItems, + CreditJudicialDocument::getId, + CreditJudicialDocument::setId, + CreditJudicialDocument::getCaseNumber, + CreditJudicialDocument::getCaseNumber, + CreditJudicialDocument::getRecommend, + CreditJudicialDocument::setRecommend, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + if (rowItem.getRecommend() == null) { + rowItem.setRecommend(0); + } + boolean saved = creditJudicialDocumentService.save(rowItem); + if (!saved) { + CreditJudicialDocument existing = creditJudicialDocumentService.lambdaQuery() + .eq(CreditJudicialDocument::getCaseNumber, rowItem.getCaseNumber()) + .select(CreditJudicialDocument::getId, CreditJudicialDocument::getRecommend) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + Integer old = existing.getRecommend(); + rowItem.setRecommend(old == null ? 1 : old + 1); + if (creditJudicialDocumentService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKeyAndIncrementCounterOnUpdate( + creditJudicialDocumentService, + chunkItems, + CreditJudicialDocument::getId, + CreditJudicialDocument::setId, + CreditJudicialDocument::getCaseNumber, + CreditJudicialDocument::getCaseNumber, + CreditJudicialDocument::getRecommend, + CreditJudicialDocument::setRecommend, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + if (rowItem.getRecommend() == null) { + rowItem.setRecommend(0); + } + boolean saved = creditJudicialDocumentService.save(rowItem); + if (!saved) { + CreditJudicialDocument existing = creditJudicialDocumentService.lambdaQuery() + .eq(CreditJudicialDocument::getCaseNumber, rowItem.getCaseNumber()) + .select(CreditJudicialDocument::getId, CreditJudicialDocument::getRecommend) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + Integer old = existing.getRecommend(); + rowItem.setRecommend(old == null ? 1 : old + 1); + if (creditJudicialDocumentService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.JUDICIAL_DOCUMENT, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载裁判文书导入模板 + */ + @Operation(summary = "下载裁判文书导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditJudicialDocumentImportParam example = new CreditJudicialDocumentImportParam(); + example.setTitle("裁判文书"); + example.setOtherPartiesThirdParty("第三人示例"); + example.setOccurrenceTime("2024-01-01"); + example.setCaseNumber("(2024)示例案号"); + example.setCauseOfAction("案由示例"); + example.setInvolvedAmount("100000"); + example.setDefendantAppellee("裁判结果示例"); + example.setCourtName("示例法院"); + example.setReleaseDate("2024-01-02"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("裁判文书导入模板", "裁判文书", CreditJudicialDocumentImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_judicial_document_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditJudicialDocumentImportParam param) { + if (param == null) { + return true; + } + return ImportHelper.isBlank(param.getCaseNumber()); + } + + private CreditJudicialDocument convertImportParamToEntity(CreditJudicialDocumentImportParam param) { + CreditJudicialDocument entity = new CreditJudicialDocument(); + + String involvedAmount = !ImportHelper.isBlank(param.getInvolvedAmount2()) + ? param.getInvolvedAmount2() + : param.getInvolvedAmount(); + + entity.setTitle(param.getTitle()); + entity.setType(param.getType()); + entity.setDataStatus(param.getDataStatus()); + entity.setOtherPartiesThirdParty(param.getOtherPartiesThirdParty()); + entity.setOccurrenceTime(param.getOccurrenceTime()); + entity.setCaseNumber(param.getCaseNumber()); + entity.setCauseOfAction(param.getCauseOfAction()); + entity.setInvolvedAmount(involvedAmount); + // Excel导入字段映射补全:否则对应数据库字段(defendant_appellee/release_date)会一直为空 + entity.setDefendantAppellee(param.getDefendantAppellee()); + entity.setReleaseDate(param.getReleaseDate()); + entity.setCourtName(param.getCourtName()); + entity.setComments(param.getComments()); + System.out.println("entity = " + entity); + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditJudiciaryController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditJudiciaryController.java new file mode 100644 index 0000000..51f6ffa --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditJudiciaryController.java @@ -0,0 +1,474 @@ +package com.gxwebsoft.credit.controller; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditJudiciary; +import com.gxwebsoft.credit.param.CreditJudiciaryImportParam; +import com.gxwebsoft.credit.param.CreditJudiciaryParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditJudiciaryService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 司法案件控制器 + * + * @author 科技小王子 + * @since 2025-12-16 15:23:58 + */ +@Tag(name = "司法案件管理") +@RestController +@RequestMapping("/api/credit/credit-judiciary") +public class CreditJudiciaryController extends BaseController { + @Resource + private CreditJudiciaryService creditJudiciaryService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询司法案件") + @GetMapping("/page") + public ApiResult> page(CreditJudiciaryParam param) { + // 使用关联查询 + return success(creditJudiciaryService.pageRel(param)); + } + + @Operation(summary = "查询全部司法案件") + @GetMapping() + public ApiResult> list(CreditJudiciaryParam param) { + // 使用关联查询 + return success(creditJudiciaryService.listRel(param)); + } + + @Operation(summary = "根据id查询司法案件") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditJudiciaryService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditJudiciary:save')") + @OperationLog + @Operation(summary = "添加司法案件") + @PostMapping() + public ApiResult save(@RequestBody CreditJudiciary creditJudiciary) { + if (creditJudiciaryService.save(creditJudiciary)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditJudiciary:update')") + @OperationLog + @Operation(summary = "修改司法案件") + @PutMapping() + public ApiResult update(@RequestBody CreditJudiciary creditJudiciary) { + if (creditJudiciaryService.updateById(creditJudiciary)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditJudiciary:remove')") + @OperationLog + @Operation(summary = "删除司法案件") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditJudiciaryService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditJudiciary:save')") + @OperationLog + @Operation(summary = "批量添加司法案件") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditJudiciaryService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditJudiciary:update')") + @OperationLog + @Operation(summary = "批量修改司法案件") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditJudiciaryService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditJudiciary:remove')") + @OperationLog + @Operation(summary = "批量删除司法案件") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditJudiciaryService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditJudiciary:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditJudiciaryService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditJudiciary::getId, + CreditJudiciary::setId, + CreditJudiciary::getName, + CreditJudiciary::getCompanyId, + CreditJudiciary::setCompanyId, + CreditJudiciary::getHasData, + CreditJudiciary::setHasData, + CreditJudiciary::getTenantId, + CreditJudiciary::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入司法案件 + */ + @PreAuthorize("hasAuthority('credit:creditJudiciary:save')") + @Operation(summary = "批量导入司法案件") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + // 支持按选项卡名称导入:默认读取“司法案件”sheet(不存在则回退到第 0 个sheet) + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "司法案件", 0); + + List list = null; + int usedTitleRows = 0; + int usedHeadRows = 0; + int[][] tryConfigs = new int[][]{{1, 1}, {0, 1}, {0, 2}, {0, 3}}; + + for (int[] config : tryConfigs) { + list = filterEmptyRows(tryImport(file, config[0], config[1], sheetIndex)); + if (!CollectionUtils.isEmpty(list)) { + usedTitleRows = config[0]; + usedHeadRows = config[1]; + break; + } + } + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + // easypoi 默认不会读取单元格超链接地址;url 可能挂在“案号/案件名称”等列的超链接中,需要额外读取回填。 + Map urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, sheetIndex, usedTitleRows, usedHeadRows, "案号"); + Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, sheetIndex, usedTitleRows, usedHeadRows, "案件名称"); + // 有些源文件会单独提供“url/网址/链接”等列(可能是纯文本也可能是超链接) + Map urlByCodeFromUrlCol = ExcelImportSupport.readKeyValueByHeaders(file, sheetIndex, usedTitleRows, usedHeadRows, "案号", "url"); + if (urlByCodeFromUrlCol.isEmpty()) { + urlByCodeFromUrlCol = ExcelImportSupport.readKeyValueByHeaders(file, sheetIndex, usedTitleRows, usedHeadRows, "案号", "URL"); + } + if (urlByCodeFromUrlCol.isEmpty()) { + urlByCodeFromUrlCol = ExcelImportSupport.readKeyValueByHeaders(file, sheetIndex, usedTitleRows, usedHeadRows, "案号", "网址"); + } + if (urlByCodeFromUrlCol.isEmpty()) { + urlByCodeFromUrlCol = ExcelImportSupport.readKeyValueByHeaders(file, sheetIndex, usedTitleRows, usedHeadRows, "案号", "链接"); + } + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditJudiciaryImportParam param = list.get(i); + try { + CreditJudiciary item = convertImportParamToEntity(param); + if (!isBlank(item.getCode())) { + String key = item.getCode().trim(); + String link = urlByCode.get(key); + if (isBlank(link)) { + link = urlByCodeFromUrlCol.get(key); + } + if (!isBlank(link)) { + item.setUrl(link.trim()); + } + } else if (!isBlank(item.getName())) { + String link = urlByName.get(item.getName().trim()); + if (!isBlank(link)) { + item.setUrl(link.trim()); + } + } + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + + // 设置默认值 + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getType() == null) { + item.setType(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + // 验证必填字段 +// if (item.getName() == null || item.getName().trim().isEmpty()) { +// errorMessages.add("第" + excelRowNumber + "行:项目名称不能为空"); +// continue; +// } + if (item.getCode() == null || item.getCode().trim().isEmpty()) { + errorMessages.add("第" + excelRowNumber + "行:唯一标识不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditJudiciaryService, + chunkItems, + CreditJudiciary::getId, + CreditJudiciary::setId, + CreditJudiciary::getName, + CreditJudiciary::getName, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditJudiciaryService.save(rowItem); + if (!saved) { + CreditJudiciary existing = creditJudiciaryService.getByName(rowItem.getName()); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditJudiciaryService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + errorMessages.add("第" + rowNumber + "行:保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditJudiciaryService, + chunkItems, + CreditJudiciary::getId, + CreditJudiciary::setId, + CreditJudiciary::getName, + CreditJudiciary::getName, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditJudiciaryService.save(rowItem); + if (!saved) { + CreditJudiciary existing = creditJudiciaryService.getByName(rowItem.getName()); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditJudiciaryService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + errorMessages.add("第" + rowNumber + "行:保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.JUDICIARY, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载司法案件导入模板 + */ + @Operation(summary = "下载司法案件导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditJudiciaryImportParam example = new CreditJudiciaryImportParam(); + example.setName("示例客户"); + example.setCode("C0001"); + example.setInfoType("执行案件"); + example.setReason("买卖合同纠纷"); + example.setProcessDate("2025-08-27"); + example.setCaseProgress("首次执行"); + example.setCaseIdentity("被执行人"); + example.setCode("(2025)闽0103执5480号"); + example.setCourt("福建省福州市台江区人民法院"); + example.setCaseAmount("5134060.00"); + templateList.add(example); + + ExportParams exportParams = new ExportParams("司法案件导入模板", "司法案件"); + + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, CreditJudiciaryImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_judiciary_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private List tryImport(MultipartFile file, int titleRows, int headRows, int sheetIndex) throws Exception { + ImportParams importParams = new ImportParams(); + importParams.setTitleRows(titleRows); + importParams.setHeadRows(headRows); + importParams.setStartSheetIndex(sheetIndex); + importParams.setSheetNum(1); + return ExcelImportUtil.importExcel(file.getInputStream(), CreditJudiciaryImportParam.class, importParams); + } + + /** + * 过滤掉完全空白的导入行,避免空行导致导入失败 + */ + private List filterEmptyRows(List rawList) { + if (CollectionUtils.isEmpty(rawList)) { + return rawList; + } + rawList.removeIf(this::isEmptyImportRow); + return rawList; + } + + private boolean isEmptyImportRow(CreditJudiciaryImportParam param) { + if (param == null) { + return true; + } + return isBlank(param.getName()) + && isBlank(param.getCode()) + && isBlank(param.getName()) + && isBlank(param.getInfoType()); + } + + private boolean isBlank(String value) { + return value == null || value.trim().isEmpty(); + } + + /** + * 将CreditJudiciaryImportParam转换为CreditJudiciary实体 + */ + private CreditJudiciary convertImportParamToEntity(CreditJudiciaryImportParam param) { + CreditJudiciary entity = new CreditJudiciary(); + + entity.setCode(param.getCode()); + entity.setName(param.getName()); + entity.setInfoType(param.getInfoType()); + entity.setReason(param.getReason()); + entity.setProcessDate(param.getProcessDate()); + entity.setCaseProgress(param.getCaseProgress()); + entity.setCaseIdentity(param.getCaseIdentity()); + entity.setCourt(param.getCourt()); + entity.setCaseAmount(param.getCaseAmount()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditMediationController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditMediationController.java new file mode 100644 index 0000000..1f0e25a --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditMediationController.java @@ -0,0 +1,416 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditMediation; +import com.gxwebsoft.credit.param.CreditMediationImportParam; +import com.gxwebsoft.credit.param.CreditMediationParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditMediationService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 诉前调解司法大数据控制器 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:25 + */ +@Tag(name = "诉前调解司法大数据管理") +@RestController +@RequestMapping("/api/credit/credit-mediation") +public class CreditMediationController extends BaseController { + @Resource + private CreditMediationService creditMediationService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询诉前调解司法大数据") + @GetMapping("/page") + public ApiResult> page(CreditMediationParam param) { + // 使用关联查询 + return success(creditMediationService.pageRel(param)); + } + + @Operation(summary = "查询全部诉前调解司法大数据") + @GetMapping() + public ApiResult> list(CreditMediationParam param) { + // 使用关联查询 + return success(creditMediationService.listRel(param)); + } + + @Operation(summary = "根据id查询诉前调解司法大数据") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditMediationService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditMediation:save')") + @OperationLog + @Operation(summary = "添加诉前调解司法大数据") + @PostMapping() + public ApiResult save(@RequestBody CreditMediation creditMediation) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditMediation.setUserId(loginUser.getUserId()); + // } + if (creditMediationService.save(creditMediation)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditMediation:update')") + @OperationLog + @Operation(summary = "修改诉前调解司法大数据") + @PutMapping() + public ApiResult update(@RequestBody CreditMediation creditMediation) { + if (creditMediationService.updateById(creditMediation)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditMediation:remove')") + @OperationLog + @Operation(summary = "删除诉前调解司法大数据") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditMediationService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditMediation:save')") + @OperationLog + @Operation(summary = "批量添加诉前调解司法大数据") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditMediationService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditMediation:update')") + @OperationLog + @Operation(summary = "批量修改诉前调解司法大数据") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditMediationService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditMediation:remove')") + @OperationLog + @Operation(summary = "批量删除诉前调解司法大数据") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditMediationService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditMediation:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditMediationService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditMediation::getId, + CreditMediation::setId, + CreditMediation::getAppellee, + CreditMediation::getCompanyId, + CreditMediation::setCompanyId, + CreditMediation::getHasData, + CreditMediation::setHasData, + CreditMediation::getTenantId, + CreditMediation::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入诉前调解司法大数据 + */ + @PreAuthorize("hasAuthority('credit:creditMediation:save')") + @Operation(summary = "批量导入诉前调解司法大数据") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "诉前调解", 0); + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditMediationImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditMediationImportParam param = list.get(i); + try { + CreditMediation item = convertImportParamToEntity(param); + if (!ImportHelper.isBlank(item.getCaseNumber())) { + String link = urlByCaseNumber.get(item.getCaseNumber().trim()); + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getCaseNumber())) { + errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditMediationService, + chunkItems, + CreditMediation::getId, + CreditMediation::setId, + CreditMediation::getCaseNumber, + CreditMediation::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditMediationService.save(rowItem); + if (!saved) { + CreditMediation existing = creditMediationService.lambdaQuery() + .eq(CreditMediation::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditMediationService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditMediationService, + chunkItems, + CreditMediation::getId, + CreditMediation::setId, + CreditMediation::getCaseNumber, + CreditMediation::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditMediationService.save(rowItem); + if (!saved) { + CreditMediation existing = creditMediationService.lambdaQuery() + .eq(CreditMediation::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditMediationService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.MEDIATION, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载诉前调解导入模板 + */ + @Operation(summary = "下载诉前调解导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditMediationImportParam example = new CreditMediationImportParam(); + example.setOtherPartiesThirdParty("当事人"); + example.setCaseNumber("(2024)示例案号"); + example.setCauseOfAction("案由示例"); + example.setCourtName("示例法院"); + example.setOccurrenceTime("2024-01-01"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("诉前调解导入模板", "诉前调解", CreditMediationImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_mediation_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditMediationImportParam param) { + if (param == null) { + return true; + } + return ImportHelper.isBlank(param.getCaseNumber()) + && ImportHelper.isBlank(param.getCauseOfAction()); + } + + private CreditMediation convertImportParamToEntity(CreditMediationImportParam param) { + CreditMediation entity = new CreditMediation(); + + // Template compatibility: prefer new columns ("发生时间"/"其他当事人/第三人"), fallback to legacy ones ("立案日期"/"当事人"). + String occurrenceTime = !ImportHelper.isBlank(param.getOccurrenceTime2()) + ? param.getOccurrenceTime2() + : param.getOccurrenceTime(); + String otherPartiesThirdParty = !ImportHelper.isBlank(param.getOtherPartiesThirdParty2()) + ? param.getOtherPartiesThirdParty2() + : param.getOtherPartiesThirdParty(); + + entity.setOccurrenceTime(occurrenceTime); + entity.setOtherPartiesThirdParty(otherPartiesThirdParty); + entity.setCaseNumber(param.getCaseNumber()); + entity.setCauseOfAction(param.getCauseOfAction()); + entity.setCourtName(param.getCourtName()); + entity.setComments(param.getComments()); + entity.setPlaintiffAppellant(param.getPlaintiffAppellant()); + entity.setAppellee(param.getAppellee()); + entity.setInvolvedAmount(param.getInvolvedAmount()); + entity.setDataStatus(param.getDataStatus()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditNearbyCompanyController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditNearbyCompanyController.java new file mode 100644 index 0000000..8a2ba1a --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditNearbyCompanyController.java @@ -0,0 +1,475 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditNearbyCompany; +import com.gxwebsoft.credit.param.CreditNearbyCompanyImportParam; +import com.gxwebsoft.credit.param.CreditNearbyCompanyParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditNearbyCompanyService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 附近企业控制器 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Tag(name = "附近企业管理") +@RestController +@RequestMapping("/api/credit/credit-nearby-company") +public class CreditNearbyCompanyController extends BaseController { + @Resource + private CreditNearbyCompanyService creditNearbyCompanyService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询附近企业") + @GetMapping("/page") + public ApiResult> page(CreditNearbyCompanyParam param) { + // 使用关联查询 + return success(creditNearbyCompanyService.pageRel(param)); + } + + @Operation(summary = "查询全部附近企业") + @GetMapping() + public ApiResult> list(CreditNearbyCompanyParam param) { + // 使用关联查询 + return success(creditNearbyCompanyService.listRel(param)); + } + + @Operation(summary = "根据id查询附近企业") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditNearbyCompanyService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditNearbyCompany:save')") + @OperationLog + @Operation(summary = "添加附近企业") + @PostMapping() + public ApiResult save(@RequestBody CreditNearbyCompany creditNearbyCompany) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditNearbyCompany.setUserId(loginUser.getUserId()); + // } + if (creditNearbyCompanyService.save(creditNearbyCompany)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditNearbyCompany:update')") + @OperationLog + @Operation(summary = "修改附近企业") + @PutMapping() + public ApiResult update(@RequestBody CreditNearbyCompany creditNearbyCompany) { + if (creditNearbyCompanyService.updateById(creditNearbyCompany)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditNearbyCompany:remove')") + @OperationLog + @Operation(summary = "删除附近企业") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditNearbyCompanyService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditNearbyCompany:save')") + @OperationLog + @Operation(summary = "批量添加附近企业") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditNearbyCompanyService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditNearbyCompany:update')") + @OperationLog + @Operation(summary = "批量修改附近企业") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditNearbyCompanyService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditNearbyCompany:remove')") + @OperationLog + @Operation(summary = "批量删除附近企业") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditNearbyCompanyService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditNearbyCompany:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditNearbyCompanyService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditNearbyCompany::getId, + CreditNearbyCompany::setId, + CreditNearbyCompany::getName, + CreditNearbyCompany::getCompanyId, + CreditNearbyCompany::setCompanyId, + CreditNearbyCompany::getHasData, + CreditNearbyCompany::setHasData, + CreditNearbyCompany::getTenantId, + CreditNearbyCompany::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入附近企业 + */ + @PreAuthorize("hasAuthority('credit:creditNearbyCompany:save')") + @Operation(summary = "批量导入附近企业") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId, + @RequestParam(value = "parentId", required = false) Integer parentId, + @RequestParam(value = "type", required = false) Integer type) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.readAnySheet( + file, CreditNearbyCompanyImportParam.class, this::isEmptyImportRow); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByCode = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "统一社会信用代码"); + Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "企业名称"); + + // 避免逐行写库:按批处理,显著降低 SQL 次数与事务开销 + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditNearbyCompanyImportParam param = list.get(i); + try { + CreditNearbyCompany item = convertImportParamToEntity(param); + String link = null; + if (!ImportHelper.isBlank(item.getCode())) { + link = urlByCode.get(item.getCode().trim()); + } + if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName())) { + link = urlByName.get(item.getName().trim()); + } + if (link != null && !link.isEmpty()) { + item.setUrl(link); + } + + if (item.getParentId() == null && parentId != null) { + item.setParentId(parentId); + } + if (item.getType() == null && type != null) { + item.setType(type); + } + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getName())) { + errorMessages.add("第" + excelRowNumber + "行:企业名称不能为空"); + continue; + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += persistImportChunk(chunkItems, chunkRowNumbers, companyId, parentId, type, currentTenantId, mpBatchSize, errorMessages); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += persistImportChunk(chunkItems, chunkRowNumbers, companyId, parentId, type, currentTenantId, mpBatchSize, errorMessages); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.NEARBY_COMPANY, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + private int persistImportChunk(List items, + List excelRowNumbers, + Integer companyId, + Integer parentId, + Integer type, + Integer tenantId, + int mpBatchSize, + List errorMessages) { + return batchImportSupport.persistChunkWithFallback( + items, + excelRowNumbers, + () -> batchImportSupport.upsertByCodeOrName( + creditNearbyCompanyService, + items, + CreditNearbyCompany::getId, + CreditNearbyCompany::setId, + CreditNearbyCompany::getCode, + CreditNearbyCompany::getCode, + CreditNearbyCompany::getName, + CreditNearbyCompany::getName, + wrapper -> { + if (companyId != null) { + wrapper.eq(CreditNearbyCompany::getCompanyId, companyId); + } + if (parentId != null) { + wrapper.eq(CreditNearbyCompany::getParentId, parentId); + } + if (type != null) { + wrapper.eq(CreditNearbyCompany::getType, type); + } + if (tenantId != null) { + wrapper.eq(CreditNearbyCompany::getTenantId, tenantId); + } + }, + mpBatchSize + ), + (item, excelRowNumber) -> { + boolean saved = creditNearbyCompanyService.save(item); + if (!saved) { + CreditNearbyCompany existing = creditNearbyCompanyService.lambdaQuery() + .eq(!ImportHelper.isBlank(item.getCode()), CreditNearbyCompany::getCode, item.getCode()) + .eq(ImportHelper.isBlank(item.getCode()), CreditNearbyCompany::getName, item.getName()) + .eq(item.getCompanyId() != null, CreditNearbyCompany::getCompanyId, item.getCompanyId()) + .eq(item.getParentId() != null, CreditNearbyCompany::getParentId, item.getParentId()) + .eq(item.getType() != null, CreditNearbyCompany::getType, item.getType()) + .eq(item.getTenantId() != null, CreditNearbyCompany::getTenantId, item.getTenantId()) + .one(); + if (existing != null) { + item.setId(existing.getId()); + if (creditNearbyCompanyService.updateById(item)) { + return true; + } + } + } else { + return true; + } + String prefix = excelRowNumber > 0 ? ("第" + excelRowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + /** + * 下载附近企业导入模板 + */ + @Operation(summary = "下载附近企业导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditNearbyCompanyImportParam example = new CreditNearbyCompanyImportParam(); + example.setName("示例科技有限公司"); + example.setRegistrationStatus("存续"); + example.setLegalPerson("李四"); + example.setRegisteredCapital("1000万人民币"); + example.setPaidinCapital("200万人民币"); + example.setEstablishDate("2018-06-01"); + example.setCode("91440101MA5XXXXXXX"); + example.setAddress("广西南宁市某某路1号"); + example.setPhone("13800000000"); + example.setEmail("demo@example.com"); + example.setProvince("广西"); + example.setCity("南宁"); + example.setRegion("青秀区"); + example.setDomain("https://example.com"); + example.setInstitutionType("有限责任公司"); + example.setCompanySize("小微企业"); + example.setRegistrationAuthority("南宁市市场监督管理局"); + example.setTaxpayerQualification("一般纳税人"); + example.setLatestAnnualReportYear("2023"); + example.setLatestAnnualReportOnOperatingRevenue("1000万"); + example.setEnterpriseScoreCheck("85"); + example.setCreditRating("A级"); + example.setCechnologyScore("70"); + example.setCechnologyLevel("良好"); + example.setSmallEnterprise("是"); + example.setCompanyProfile("企业简介示例"); + example.setNatureOfBusiness("经营范围示例"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("附近企业导入模板", "附近企业", CreditNearbyCompanyImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_nearby_company_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditNearbyCompanyImportParam param) { + if (param == null) { + return true; + } + if (isImportHeaderRow(param)) { + return true; + } + return ImportHelper.isBlank(param.getName()) + && ImportHelper.isBlank(param.getCode()) + && ImportHelper.isBlank(param.getLegalPerson()); + } + + private boolean isImportHeaderRow(CreditNearbyCompanyImportParam param) { + return isHeaderValue(param.getName(), "企业名称") + || isHeaderValue(param.getCode(), "统一社会信用代码") + || isHeaderValue(param.getLegalPerson(), "法定代表人"); + } + + private static boolean isHeaderValue(String value, String headerText) { + if (value == null) { + return false; + } + return headerText.equals(value.trim()); + } + + private CreditNearbyCompany convertImportParamToEntity(CreditNearbyCompanyImportParam param) { + CreditNearbyCompany entity = new CreditNearbyCompany(); + + entity.setName(param.getName()); + entity.setRegistrationStatus(param.getRegistrationStatus()); + entity.setLegalPerson(param.getLegalPerson()); + entity.setRegisteredCapital(param.getRegisteredCapital()); + entity.setPaidinCapital(param.getPaidinCapital()); + entity.setEstablishDate(param.getEstablishDate()); + entity.setCode(param.getCode()); + entity.setAddress(param.getAddress()); + entity.setPhone(param.getPhone()); + entity.setEmail(param.getEmail()); + entity.setProvince(param.getProvince()); + entity.setCity(param.getCity()); + entity.setRegion(param.getRegion()); + entity.setDomain(param.getDomain()); + entity.setInstitutionType(param.getInstitutionType()); + entity.setCompanySize(param.getCompanySize()); + entity.setRegistrationAuthority(param.getRegistrationAuthority()); + entity.setTaxpayerQualification(param.getTaxpayerQualification()); + entity.setLatestAnnualReportYear(param.getLatestAnnualReportYear()); + entity.setLatestAnnualReportOnOperatingRevenue(param.getLatestAnnualReportOnOperatingRevenue()); + entity.setEnterpriseScoreCheck(param.getEnterpriseScoreCheck()); + entity.setCreditRating(param.getCreditRating()); + entity.setCechnologyScore(param.getCechnologyScore()); + entity.setCechnologyLevel(param.getCechnologyLevel()); + entity.setSmallEnterprise(param.getSmallEnterprise()); + entity.setCompanyProfile(param.getCompanyProfile()); + entity.setNatureOfBusiness(param.getNatureOfBusiness()); + entity.setComments(param.getComments()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditPatentController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditPatentController.java new file mode 100644 index 0000000..262c43b --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditPatentController.java @@ -0,0 +1,431 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditPatent; +import com.gxwebsoft.credit.param.CreditPatentImportParam; +import com.gxwebsoft.credit.param.CreditPatentParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditPatentService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 专利控制器 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Tag(name = "专利管理") +@RestController +@RequestMapping("/api/credit/credit-patent") +public class CreditPatentController extends BaseController { + @Resource + private CreditPatentService creditPatentService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询专利") + @GetMapping("/page") + public ApiResult> page(CreditPatentParam param) { + // 使用关联查询 + return success(creditPatentService.pageRel(param)); + } + + @Operation(summary = "查询全部专利") + @GetMapping() + public ApiResult> list(CreditPatentParam param) { + // 使用关联查询 + return success(creditPatentService.listRel(param)); + } + + @Operation(summary = "根据id查询专利") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditPatentService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditPatent:save')") + @OperationLog + @Operation(summary = "添加专利") + @PostMapping() + public ApiResult save(@RequestBody CreditPatent creditPatent) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditPatent.setUserId(loginUser.getUserId()); + // } + if (creditPatentService.save(creditPatent)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditPatent:update')") + @OperationLog + @Operation(summary = "修改专利") + @PutMapping() + public ApiResult update(@RequestBody CreditPatent creditPatent) { + if (creditPatentService.updateById(creditPatent)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditPatent:remove')") + @OperationLog + @Operation(summary = "删除专利") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditPatentService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditPatent:save')") + @OperationLog + @Operation(summary = "批量添加专利") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditPatentService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditPatent:update')") + @OperationLog + @Operation(summary = "批量修改专利") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditPatentService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditPatent:remove')") + @OperationLog + @Operation(summary = "批量删除专利") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditPatentService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditPatent:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditPatentService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditPatent::getId, + CreditPatent::setId, + CreditPatent::getPatentApplicant, + CreditPatent::getCompanyId, + CreditPatent::setCompanyId, + CreditPatent::getHasData, + CreditPatent::setHasData, + CreditPatent::getTenantId, + CreditPatent::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入专利 + */ + @PreAuthorize("hasAuthority('credit:creditPatent:save')") + @Operation(summary = "批量导入专利") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.readAnySheet( + file, CreditPatentImportParam.class, this::isEmptyImportRow); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByRegisterNo = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "申请号"); + Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "发明名称"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditPatentImportParam param = list.get(i); + try { + CreditPatent item = convertImportParamToEntity(param); + String link = null; + if (!ImportHelper.isBlank(item.getRegisterNo())) { + link = urlByRegisterNo.get(item.getRegisterNo().trim()); + } + if ((link == null || link.isEmpty()) && !ImportHelper.isBlank(item.getName())) { + link = urlByName.get(item.getName().trim()); + } + if (link != null && !link.isEmpty()) { + item.setUrl(link); + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getRegisterNo())) { + errorMessages.add("第" + excelRowNumber + "行:申请号不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditPatentService, + chunkItems, + CreditPatent::getId, + CreditPatent::setId, + CreditPatent::getRegisterNo, + CreditPatent::getRegisterNo, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditPatentService.save(rowItem); + if (!saved) { + CreditPatent existing = creditPatentService.lambdaQuery() + .eq(CreditPatent::getRegisterNo, rowItem.getRegisterNo()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditPatentService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditPatentService, + chunkItems, + CreditPatent::getId, + CreditPatent::setId, + CreditPatent::getRegisterNo, + CreditPatent::getRegisterNo, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditPatentService.save(rowItem); + if (!saved) { + CreditPatent existing = creditPatentService.lambdaQuery() + .eq(CreditPatent::getRegisterNo, rowItem.getRegisterNo()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditPatentService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.PATENT, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载专利导入模板 + */ + @Operation(summary = "下载专利导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditPatentImportParam example = new CreditPatentImportParam(); + example.setName("一种示例装置及方法"); + example.setType("发明专利"); + example.setStatusText("有效"); + example.setRegisterNo("CN2024XXXXXXXX.X"); + example.setRegisterDate("2024-01-01"); + example.setPublicNo("CN1XXXXXXXXX"); + example.setPublicDate("2024-06-01"); + example.setInventor("张三;李四"); + example.setPatentApplicant("示例科技有限公司"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("专利导入模板", "专利", CreditPatentImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_patent_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditPatentImportParam param) { + if (param == null) { + return true; + } + if (isImportHeaderRow(param)) { + return true; + } + return ImportHelper.isBlank(param.getPublicNo()); + } + + private boolean isImportHeaderRow(CreditPatentImportParam param) { + return isHeaderValue(param.getRegisterNo(), "申请号") + || isHeaderValue(param.getName(), "发明名称") + || isHeaderValue(param.getPatentApplicant(), "申请(专利权)人"); + } + + private static boolean isHeaderValue(String value, String headerText) { + if (value == null) { + return false; + } + return headerText.equals(value.trim()); + } + + private CreditPatent convertImportParamToEntity(CreditPatentImportParam param) { + CreditPatent entity = new CreditPatent(); + + entity.setName(param.getName()); + entity.setType(param.getType()); + entity.setStatusText(param.getStatusText()); + entity.setRegisterNo(param.getRegisterNo()); + entity.setRegisterDate(param.getRegisterDate()); + entity.setPublicNo(param.getPublicNo()); + entity.setPublicDate(param.getPublicDate()); + entity.setInventor(param.getInventor()); + entity.setPatentApplicant(param.getPatentApplicant()); + entity.setComments(param.getComments()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditRiskRelationController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditRiskRelationController.java new file mode 100644 index 0000000..40e4daf --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditRiskRelationController.java @@ -0,0 +1,399 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditRiskRelation; +import com.gxwebsoft.credit.param.CreditRiskRelationImportParam; +import com.gxwebsoft.credit.param.CreditRiskRelationParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditRiskRelationService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 风险关系表控制器 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:41 + */ +@Tag(name = "风险关系表管理") +@RestController +@RequestMapping("/api/credit/credit-risk-relation") +public class CreditRiskRelationController extends BaseController { + @Resource + private CreditRiskRelationService creditRiskRelationService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询风险关系表") + @GetMapping("/page") + public ApiResult> page(CreditRiskRelationParam param) { + // 使用关联查询 + return success(creditRiskRelationService.pageRel(param)); + } + + @Operation(summary = "查询全部风险关系表") + @GetMapping() + public ApiResult> list(CreditRiskRelationParam param) { + // 使用关联查询 + return success(creditRiskRelationService.listRel(param)); + } + + @Operation(summary = "根据id查询风险关系表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditRiskRelationService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditRiskRelation:save')") + @OperationLog + @Operation(summary = "添加风险关系表") + @PostMapping() + public ApiResult save(@RequestBody CreditRiskRelation creditRiskRelation) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditRiskRelation.setUserId(loginUser.getUserId()); + // } + if (creditRiskRelationService.save(creditRiskRelation)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditRiskRelation:update')") + @OperationLog + @Operation(summary = "修改风险关系表") + @PutMapping() + public ApiResult update(@RequestBody CreditRiskRelation creditRiskRelation) { + if (creditRiskRelationService.updateById(creditRiskRelation)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditRiskRelation:remove')") + @OperationLog + @Operation(summary = "删除风险关系表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditRiskRelationService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditRiskRelation:save')") + @OperationLog + @Operation(summary = "批量添加风险关系表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditRiskRelationService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditRiskRelation:update')") + @OperationLog + @Operation(summary = "批量修改风险关系表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditRiskRelationService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditRiskRelation:remove')") + @OperationLog + @Operation(summary = "批量删除风险关系表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditRiskRelationService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditRiskRelation:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditRiskRelationService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditRiskRelation::getId, + CreditRiskRelation::setId, + CreditRiskRelation::getMainBodyName, + CreditRiskRelation::getCompanyId, + CreditRiskRelation::setCompanyId, + CreditRiskRelation::getHasData, + CreditRiskRelation::setHasData, + CreditRiskRelation::getTenantId, + CreditRiskRelation::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入风险关系表 + */ + @PreAuthorize("hasAuthority('credit:creditRiskRelation:save')") + @Operation(summary = "批量导入风险关系表") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "风险关系", 1); + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditRiskRelationImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditRiskRelationImportParam param = list.get(i); + try { + CreditRiskRelation item = convertImportParamToEntity(param); + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getMainBodyName())) { + errorMessages.add("第" + excelRowNumber + "行:主体名称不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditRiskRelationService, + chunkItems, + CreditRiskRelation::getId, + CreditRiskRelation::setId, + CreditRiskRelation::getMainBodyName, + CreditRiskRelation::getMainBodyName, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditRiskRelationService.save(rowItem); + if (!saved) { + CreditRiskRelation existing = creditRiskRelationService.lambdaQuery() + .eq(CreditRiskRelation::getMainBodyName, rowItem.getMainBodyName()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditRiskRelationService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditRiskRelationService, + chunkItems, + CreditRiskRelation::getId, + CreditRiskRelation::setId, + CreditRiskRelation::getMainBodyName, + CreditRiskRelation::getMainBodyName, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditRiskRelationService.save(rowItem); + if (!saved) { + CreditRiskRelation existing = creditRiskRelationService.lambdaQuery() + .eq(CreditRiskRelation::getMainBodyName, rowItem.getMainBodyName()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditRiskRelationService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.RISK_RELATION, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载风险关系导入模板 + */ + @Operation(summary = "下载风险关系导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditRiskRelationImportParam example = new CreditRiskRelationImportParam(); + example.setMainBodyName("示例企业"); + example.setRegistrationStatus("存续"); + example.setRegisteredCapital("8000"); + example.setProvinceRegion("浙江"); + example.setAssociatedRelation("关联企业"); + example.setRiskRelation("存在风险关联"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("风险关系导入模板", "风险关系", CreditRiskRelationImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_risk_relation_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditRiskRelationImportParam param) { + if (param == null) { + return true; + } + return ImportHelper.isBlank(param.getMainBodyName()) + && ImportHelper.isBlank(param.getRegistrationStatus()) + && ImportHelper.isBlank(param.getRegisteredCapital()); + } + + private CreditRiskRelation convertImportParamToEntity(CreditRiskRelationImportParam param) { + CreditRiskRelation entity = new CreditRiskRelation(); + + entity.setMainBodyName(param.getMainBodyName()); + entity.setRegistrationStatus(param.getRegistrationStatus()); + entity.setRegisteredCapital(param.getRegisteredCapital()); + entity.setProvinceRegion(param.getProvinceRegion()); + entity.setAssociatedRelation(param.getAssociatedRelation()); + entity.setRiskRelation(param.getRiskRelation()); + entity.setComments(param.getComments()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditSupplierController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditSupplierController.java new file mode 100644 index 0000000..071aa3c --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditSupplierController.java @@ -0,0 +1,405 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditSupplier; +import com.gxwebsoft.credit.param.CreditSupplierImportParam; +import com.gxwebsoft.credit.param.CreditSupplierParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditSupplierService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 供应商控制器 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:47 + */ +@Tag(name = "供应商管理") +@RestController +@RequestMapping("/api/credit/credit-supplier") +public class CreditSupplierController extends BaseController { + @Resource + private CreditSupplierService creditSupplierService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询供应商") + @GetMapping("/page") + public ApiResult> page(CreditSupplierParam param) { + // 使用关联查询 + return success(creditSupplierService.pageRel(param)); + } + + @Operation(summary = "查询全部供应商") + @GetMapping() + public ApiResult> list(CreditSupplierParam param) { + // 使用关联查询 + return success(creditSupplierService.listRel(param)); + } + + @Operation(summary = "根据id查询供应商") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditSupplierService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditSupplier:save')") + @OperationLog + @Operation(summary = "添加供应商") + @PostMapping() + public ApiResult save(@RequestBody CreditSupplier creditSupplier) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditSupplier.setUserId(loginUser.getUserId()); + // } + if (creditSupplierService.save(creditSupplier)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditSupplier:update')") + @OperationLog + @Operation(summary = "修改供应商") + @PutMapping() + public ApiResult update(@RequestBody CreditSupplier creditSupplier) { + if (creditSupplierService.updateById(creditSupplier)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditSupplier:remove')") + @OperationLog + @Operation(summary = "删除供应商") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditSupplierService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditSupplier:save')") + @OperationLog + @Operation(summary = "批量添加供应商") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditSupplierService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditSupplier:update')") + @OperationLog + @Operation(summary = "批量修改供应商") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditSupplierService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditSupplier:remove')") + @OperationLog + @Operation(summary = "批量删除供应商") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditSupplierService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditSupplier:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditSupplierService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditSupplier::getId, + CreditSupplier::setId, + CreditSupplier::getSupplier, + CreditSupplier::getCompanyId, + CreditSupplier::setCompanyId, + CreditSupplier::getHasData, + CreditSupplier::setHasData, + CreditSupplier::getTenantId, + CreditSupplier::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入供应商 + */ + @PreAuthorize("hasAuthority('credit:creditSupplier:save')") + @Operation(summary = "批量导入供应商") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "供应商", 3); + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditSupplierImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlBySupplier = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "供应商"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditSupplierImportParam param = list.get(i); + try { + CreditSupplier item = convertImportParamToEntity(param); + if (!ImportHelper.isBlank(item.getSupplier())) { + String link = urlBySupplier.get(item.getSupplier().trim()); + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getSupplier())) { + errorMessages.add("第" + excelRowNumber + "行:供应商不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditSupplierService, + chunkItems, + CreditSupplier::getId, + CreditSupplier::setId, + CreditSupplier::getSupplier, + CreditSupplier::getSupplier, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditSupplierService.save(rowItem); + if (!saved) { + CreditSupplier existing = creditSupplierService.lambdaQuery() + .eq(CreditSupplier::getSupplier, rowItem.getSupplier()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditSupplierService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditSupplierService, + chunkItems, + CreditSupplier::getId, + CreditSupplier::setId, + CreditSupplier::getSupplier, + CreditSupplier::getSupplier, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditSupplierService.save(rowItem); + if (!saved) { + CreditSupplier existing = creditSupplierService.lambdaQuery() + .eq(CreditSupplier::getSupplier, rowItem.getSupplier()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditSupplierService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.SUPPLIER, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载供应商导入模板 + */ + @Operation(summary = "下载供应商导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditSupplierImportParam example = new CreditSupplierImportParam(); + example.setSupplier("示例供应商"); + example.setStatusTxt("合作中"); + example.setPurchaseAmount("120"); + example.setPublicDate("2024-02-01"); + example.setDataSource("公开渠道"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("供应商导入模板", "供应商", CreditSupplierImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_supplier_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditSupplierImportParam param) { + if (param == null) { + return true; + } + return ImportHelper.isBlank(param.getSupplier()) + && ImportHelper.isBlank(param.getStatusTxt()) + && ImportHelper.isBlank(param.getPurchaseAmount()); + } + + private CreditSupplier convertImportParamToEntity(CreditSupplierImportParam param) { + CreditSupplier entity = new CreditSupplier(); + + entity.setSupplier(param.getSupplier()); + entity.setStatusTxt(param.getStatusTxt()); + entity.setPurchaseAmount(param.getPurchaseAmount()); + entity.setPublicDate(param.getPublicDate()); + entity.setDataSource(param.getDataSource()); + entity.setComments(param.getComments()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditSuspectedRelationshipController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditSuspectedRelationshipController.java new file mode 100644 index 0000000..46da439 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditSuspectedRelationshipController.java @@ -0,0 +1,552 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditSuspectedRelationship; +import com.gxwebsoft.credit.param.CreditSuspectedRelationshipImportParam; +import com.gxwebsoft.credit.param.CreditSuspectedRelationshipParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditSuspectedRelationshipService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 疑似关系控制器 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Tag(name = "疑似关系管理") +@RestController +@RequestMapping("/api/credit/credit-suspected-relationship") +public class CreditSuspectedRelationshipController extends BaseController { + @Resource + private CreditSuspectedRelationshipService creditSuspectedRelationshipService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询疑似关系") + @GetMapping("/page") + public ApiResult> page(CreditSuspectedRelationshipParam param) { + // 使用关联查询 + return success(creditSuspectedRelationshipService.pageRel(param)); + } + + @Operation(summary = "查询全部疑似关系") + @GetMapping() + public ApiResult> list(CreditSuspectedRelationshipParam param) { + // 使用关联查询 + return success(creditSuspectedRelationshipService.listRel(param)); + } + + @Operation(summary = "根据id查询疑似关系") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditSuspectedRelationshipService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditSuspectedRelationship:save')") + @OperationLog + @Operation(summary = "添加疑似关系") + @PostMapping() + public ApiResult save(@RequestBody CreditSuspectedRelationship creditSuspectedRelationship) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditSuspectedRelationship.setUserId(loginUser.getUserId()); + // } + if (creditSuspectedRelationshipService.save(creditSuspectedRelationship)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditSuspectedRelationship:update')") + @OperationLog + @Operation(summary = "修改疑似关系") + @PutMapping() + public ApiResult update(@RequestBody CreditSuspectedRelationship creditSuspectedRelationship) { + if (creditSuspectedRelationshipService.updateById(creditSuspectedRelationship)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditSuspectedRelationship:remove')") + @OperationLog + @Operation(summary = "删除疑似关系") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditSuspectedRelationshipService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditSuspectedRelationship:save')") + @OperationLog + @Operation(summary = "批量添加疑似关系") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditSuspectedRelationshipService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditSuspectedRelationship:update')") + @OperationLog + @Operation(summary = "批量修改疑似关系") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditSuspectedRelationshipService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditSuspectedRelationship:remove')") + @OperationLog + @Operation(summary = "批量删除疑似关系") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditSuspectedRelationshipService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditSuspectedRelationship:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditSuspectedRelationshipService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditSuspectedRelationship::getId, + CreditSuspectedRelationship::setId, + CreditSuspectedRelationship::getName, + CreditSuspectedRelationship::getCompanyId, + CreditSuspectedRelationship::setCompanyId, + CreditSuspectedRelationship::getHasData, + CreditSuspectedRelationship::setHasData, + CreditSuspectedRelationship::getTenantId, + CreditSuspectedRelationship::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入疑似关系 + */ + @PreAuthorize("hasAuthority('credit:creditSuspectedRelationship:save')") + @Operation(summary = "批量导入疑似关系") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.readAnySheet( + file, CreditSuspectedRelationshipImportParam.class, this::isEmptyImportRow); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByName = ExcelImportSupport.readHyperlinksByHeaderKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "企业名称"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditSuspectedRelationshipImportParam param = list.get(i); + try { + CreditSuspectedRelationship item = convertImportParamToEntity(param); + if (!ImportHelper.isBlank(item.getName())) { + String link = urlByName.get(item.getName().trim()); + if (link != null && !link.isEmpty()) { + item.setUrl(link); + } + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getName())) { + errorMessages.add("第" + excelRowNumber + "行:企业名称不能为空"); + continue; + } + if (ImportHelper.isBlank(item.getRelatedParty())) { + errorMessages.add("第" + excelRowNumber + "行:关联方不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> { + List names = new ArrayList<>(chunkItems.size()); + List relatedParties = new ArrayList<>(chunkItems.size()); + for (CreditSuspectedRelationship it : chunkItems) { + if (it == null) { + continue; + } + if (!ImportHelper.isBlank(it.getName())) { + names.add(it.getName().trim()); + } + if (!ImportHelper.isBlank(it.getRelatedParty())) { + relatedParties.add(it.getRelatedParty().trim()); + } + } + + List existingList = (names.isEmpty() || relatedParties.isEmpty()) + ? new ArrayList<>() + : creditSuspectedRelationshipService.lambdaQuery() + .in(CreditSuspectedRelationship::getName, names) + .in(CreditSuspectedRelationship::getRelatedParty, relatedParties) + .list(); + + java.util.Map byNameRelated = new java.util.HashMap<>(); + java.util.Map byNameRelatedType = new java.util.HashMap<>(); + for (CreditSuspectedRelationship existing : existingList) { + if (existing == null + || ImportHelper.isBlank(existing.getName()) + || ImportHelper.isBlank(existing.getRelatedParty())) { + continue; + } + String n = existing.getName().trim(); + String r = existing.getRelatedParty().trim(); + byNameRelated.putIfAbsent(n + "|" + r, existing); + if (!ImportHelper.isBlank(existing.getType())) { + byNameRelatedType.putIfAbsent(n + "|" + r + "|" + existing.getType().trim(), existing); + } + } + + List updates = new ArrayList<>(); + List inserts = new ArrayList<>(); + for (CreditSuspectedRelationship it : chunkItems) { + if (it == null + || ImportHelper.isBlank(it.getName()) + || ImportHelper.isBlank(it.getRelatedParty())) { + continue; + } + String n = it.getName().trim(); + String r = it.getRelatedParty().trim(); + CreditSuspectedRelationship existing; + if (!ImportHelper.isBlank(it.getType())) { + existing = byNameRelatedType.get(n + "|" + r + "|" + it.getType().trim()); + } else { + existing = byNameRelated.get(n + "|" + r); + } + if (existing != null) { + it.setId(existing.getId()); + updates.add(it); + } else { + inserts.add(it); + } + } + if (!updates.isEmpty()) { + creditSuspectedRelationshipService.updateBatchById(updates, mpBatchSize); + } + if (!inserts.isEmpty()) { + creditSuspectedRelationshipService.saveBatch(inserts, mpBatchSize); + } + return updates.size() + inserts.size(); + }, + (rowItem, rowNumber) -> { + boolean saved = creditSuspectedRelationshipService.save(rowItem); + if (!saved) { + CreditSuspectedRelationship existing = creditSuspectedRelationshipService.lambdaQuery() + .eq(CreditSuspectedRelationship::getName, rowItem.getName()) + .eq(CreditSuspectedRelationship::getRelatedParty, rowItem.getRelatedParty()) + .eq(!ImportHelper.isBlank(rowItem.getType()), CreditSuspectedRelationship::getType, rowItem.getType()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditSuspectedRelationshipService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> { + List names = new ArrayList<>(chunkItems.size()); + List relatedParties = new ArrayList<>(chunkItems.size()); + for (CreditSuspectedRelationship it : chunkItems) { + if (it == null) { + continue; + } + if (!ImportHelper.isBlank(it.getName())) { + names.add(it.getName().trim()); + } + if (!ImportHelper.isBlank(it.getRelatedParty())) { + relatedParties.add(it.getRelatedParty().trim()); + } + } + + List existingList = (names.isEmpty() || relatedParties.isEmpty()) + ? new ArrayList<>() + : creditSuspectedRelationshipService.lambdaQuery() + .in(CreditSuspectedRelationship::getName, names) + .in(CreditSuspectedRelationship::getRelatedParty, relatedParties) + .list(); + + java.util.Map byNameRelated = new java.util.HashMap<>(); + java.util.Map byNameRelatedType = new java.util.HashMap<>(); + for (CreditSuspectedRelationship existing : existingList) { + if (existing == null + || ImportHelper.isBlank(existing.getName()) + || ImportHelper.isBlank(existing.getRelatedParty())) { + continue; + } + String n = existing.getName().trim(); + String r = existing.getRelatedParty().trim(); + byNameRelated.putIfAbsent(n + "|" + r, existing); + if (!ImportHelper.isBlank(existing.getType())) { + byNameRelatedType.putIfAbsent(n + "|" + r + "|" + existing.getType().trim(), existing); + } + } + + List updates = new ArrayList<>(); + List inserts = new ArrayList<>(); + for (CreditSuspectedRelationship it : chunkItems) { + if (it == null + || ImportHelper.isBlank(it.getName()) + || ImportHelper.isBlank(it.getRelatedParty())) { + continue; + } + String n = it.getName().trim(); + String r = it.getRelatedParty().trim(); + CreditSuspectedRelationship existing; + if (!ImportHelper.isBlank(it.getType())) { + existing = byNameRelatedType.get(n + "|" + r + "|" + it.getType().trim()); + } else { + existing = byNameRelated.get(n + "|" + r); + } + if (existing != null) { + it.setId(existing.getId()); + updates.add(it); + } else { + inserts.add(it); + } + } + if (!updates.isEmpty()) { + creditSuspectedRelationshipService.updateBatchById(updates, mpBatchSize); + } + if (!inserts.isEmpty()) { + creditSuspectedRelationshipService.saveBatch(inserts, mpBatchSize); + } + return updates.size() + inserts.size(); + }, + (rowItem, rowNumber) -> { + boolean saved = creditSuspectedRelationshipService.save(rowItem); + if (!saved) { + CreditSuspectedRelationship existing = creditSuspectedRelationshipService.lambdaQuery() + .eq(CreditSuspectedRelationship::getName, rowItem.getName()) + .eq(CreditSuspectedRelationship::getRelatedParty, rowItem.getRelatedParty()) + .eq(!ImportHelper.isBlank(rowItem.getType()), CreditSuspectedRelationship::getType, rowItem.getType()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditSuspectedRelationshipService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.SUSPECTED_RELATIONSHIP, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载疑似关系导入模板 + */ + @Operation(summary = "下载疑似关系导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditSuspectedRelationshipImportParam example = new CreditSuspectedRelationshipImportParam(); + example.setName("示例科技有限公司"); + example.setStatusText("存续"); + example.setLegalPerson("李四"); + example.setRegisteredCapital("1000万人民币"); + example.setCreateDate("2018-06-01"); + example.setRelatedParty("关联方示例"); + example.setType("股权关联"); + example.setDetail("疑似关系详情示例"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("疑似关系导入模板", "疑似关系", CreditSuspectedRelationshipImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_suspected_relationship_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditSuspectedRelationshipImportParam param) { + if (param == null) { + return true; + } + if (isImportHeaderRow(param)) { + return true; + } + return ImportHelper.isBlank(param.getName()) + && ImportHelper.isBlank(param.getRelatedParty()) + && ImportHelper.isBlank(param.getType()); + } + + private boolean isImportHeaderRow(CreditSuspectedRelationshipImportParam param) { + return isHeaderValue(param.getName(), "企业名称") + || isHeaderValue(param.getRelatedParty(), "关联方") + || isHeaderValue(param.getType(), "疑似关系类型"); + } + + private static boolean isHeaderValue(String value, String headerText) { + if (value == null) { + return false; + } + return headerText.equals(value.trim()); + } + + private CreditSuspectedRelationship convertImportParamToEntity(CreditSuspectedRelationshipImportParam param) { + CreditSuspectedRelationship entity = new CreditSuspectedRelationship(); + + entity.setName(param.getName()); + entity.setStatusText(param.getStatusText()); + entity.setLegalPerson(param.getLegalPerson()); + entity.setRegisteredCapital(param.getRegisteredCapital()); + entity.setCreateDate(param.getCreateDate()); + entity.setRelatedParty(param.getRelatedParty()); + entity.setType(param.getType()); + entity.setDetail(param.getDetail()); + entity.setComments(param.getComments()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditUserController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditUserController.java new file mode 100644 index 0000000..d5864b4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditUserController.java @@ -0,0 +1,502 @@ +package com.gxwebsoft.credit.controller; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditUser; +import com.gxwebsoft.credit.param.CreditUserImportParam; +import com.gxwebsoft.credit.param.CreditUserParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditUserService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.usermodel.WorkbookFactory; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.InputStream; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 招投标信息表控制器 + * + * @author 科技小王子 + * @since 2025-12-15 13:16:04 + */ +@Tag(name = "招投标信息表管理") +@RestController +@RequestMapping("/api/credit/credit-user") +public class CreditUserController extends BaseController { + private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + @Resource + private CreditUserService creditUserService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询招投标信息表") + @GetMapping("/page") + public ApiResult> page(CreditUserParam param) { + // 使用关联查询 + return success(creditUserService.pageRel(param)); + } + + @Operation(summary = "查询全部招投标信息表") + @GetMapping() + public ApiResult> list(CreditUserParam param) { + // 使用关联查询 + return success(creditUserService.listRel(param)); + } + + @Operation(summary = "根据id查询招投标信息表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditUserService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditUser:save')") + @OperationLog + @Operation(summary = "添加招投标信息表") + @PostMapping() + public ApiResult save(@RequestBody CreditUser creditUser) { + if (creditUserService.save(creditUser)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditUser:update')") + @OperationLog + @Operation(summary = "修改招投标信息表") + @PutMapping() + public ApiResult update(@RequestBody CreditUser creditUser) { + if (creditUserService.updateById(creditUser)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditUser:remove')") + @OperationLog + @Operation(summary = "删除招投标信息表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditUserService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditUser:save')") + @OperationLog + @Operation(summary = "批量添加招投标信息表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditUserService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditUser:update')") + @OperationLog + @Operation(summary = "批量修改招投标信息表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditUserService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditUser:remove')") + @OperationLog + @Operation(summary = "批量删除招投标信息表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditUserService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditUser:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditUserService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditUser::getId, + CreditUser::setId, + CreditUser::getWinningName, + CreditUser::getCompanyId, + CreditUser::setCompanyId, + CreditUser::getHasData, + CreditUser::setHasData, + CreditUser::getTenantId, + CreditUser::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入招投标信息 + * Excel表头格式:客户名称、唯一标识、类型、企业角色、上级ID、信息类型、所在国家、所在省份、所在城市、所在辖区、街道地址、招采单位名称、中标单位名称、中标金额、备注、是否推荐、到期时间、排序、状态、用户ID、租户ID + */ + @PreAuthorize("hasAuthority('credit:creditUser:save')") + @Operation(summary = "批量导入招投标信息") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "招投标", 0); + List list = null; + int usedTitleRows = 0; + int usedHeadRows = 0; + int[][] tryConfigs = new int[][]{{1, 1}, {0, 1}, {0, 2}, {0, 3}}; + + for (int[] config : tryConfigs) { + list = filterEmptyRows(tryImport(file, config[0], config[1], sheetIndex)); + if (!CollectionUtils.isEmpty(list)) { + usedTitleRows = config[0]; + usedHeadRows = config[1]; + break; + } + } + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlMap = readNameHyperlinks(file, sheetIndex, usedTitleRows, usedHeadRows); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditUserImportParam param = list.get(i); + try { + CreditUser item = convertImportParamToEntity(param); + + String link = urlMap.get(i); + if (link != null && !link.isEmpty()) { + item.setUrl(link); + } + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + // 设置默认值 + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getType() == null) { + item.setType(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + // 验证必填字段 + if (item.getName() == null || item.getName().trim().isEmpty()) { + errorMessages.add("第" + excelRowNumber + "行:项目名称不能为空"); + continue; + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditUserService, + chunkItems, + CreditUser::getId, + CreditUser::setId, + CreditUser::getName, + CreditUser::getName, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditUserService.save(rowItem); + if (!saved) { + CreditUser existing = creditUserService.getByName(rowItem.getName()); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditUserService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + errorMessages.add("第" + rowNumber + "行:保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditUserService, + chunkItems, + CreditUser::getId, + CreditUser::setId, + CreditUser::getName, + CreditUser::getName, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditUserService.save(rowItem); + if (!saved) { + CreditUser existing = creditUserService.getByName(rowItem.getName()); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditUserService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + errorMessages.add("第" + rowNumber + "行:保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.USER, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载招投标信息导入模板 + */ + @Operation(summary = "下载招投标信息导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditUserImportParam example = new CreditUserImportParam(); + example.setCode("CUS001"); + example.setName("示例客户"); + example.setReleaseDate("2023-01-01"); + example.setType(0); + example.setRole("采购方"); + example.setInfoType("企业"); + example.setAddress("广东省-广州市-南沙区"); + example.setProcurementName("示例招采单位"); + example.setWinningName("示例中标单位"); + example.setWinningPrice("100000"); + templateList.add(example); + + ExportParams exportParams = new ExportParams("招投标信息导入模板", "招投标信息"); + + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, CreditUserImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_user_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private List tryImport(MultipartFile file, int titleRows, int headRows, int sheetIndex) throws Exception { + ImportParams importParams = new ImportParams(); + importParams.setTitleRows(titleRows); + importParams.setHeadRows(headRows); + importParams.setStartSheetIndex(sheetIndex); + importParams.setSheetNum(1); + return ExcelImportUtil.importExcel(file.getInputStream(), CreditUserImportParam.class, importParams); + } + + /** + * 读取“项目名称”列的超链接,按数据行顺序返回。 + */ + private Map readNameHyperlinks(MultipartFile file, int sheetIndex, int titleRows, int headRows) throws Exception { + Map result = new HashMap<>(); + try (InputStream is = file.getInputStream(); Workbook workbook = WorkbookFactory.create(is)) { + Sheet sheet = workbook.getSheetAt(sheetIndex); + if (sheet == null) { + return result; + } + int headerRowNum = titleRows + headRows - 1; + Row headerRow = sheet.getRow(headerRowNum); + int nameColIndex = 0; + if (headerRow != null) { + for (int c = headerRow.getFirstCellNum(); c < headerRow.getLastCellNum(); c++) { + Cell cell = headerRow.getCell(c); + if (cell != null && "项目名称".equals(cell.getStringCellValue())) { + nameColIndex = c; + break; + } + } + } + int dataStartRow = titleRows + headRows; + for (int r = dataStartRow; r <= sheet.getLastRowNum(); r++) { + Row row = sheet.getRow(r); + if (row == null) { + continue; + } + Cell cell = row.getCell(nameColIndex); + if (cell != null && cell.getHyperlink() != null) { + String address = cell.getHyperlink().getAddress(); + if (address != null && !address.isEmpty()) { + result.put(r - dataStartRow, address); + } + } + } + } + return result; + } + + /** + * 过滤掉完全空白的导入行,避免空行导致导入失败 + */ + private List filterEmptyRows(List rawList) { + if (CollectionUtils.isEmpty(rawList)) { + return rawList; + } + rawList.removeIf(this::isEmptyImportRow); + return rawList; + } + + private boolean isEmptyImportRow(CreditUserImportParam param) { + if (param == null) { + return true; + } + return isBlank(param.getName()) + && isBlank(param.getCode()) + && isBlank(param.getRole()) + && isBlank(param.getInfoType()) + && isBlank(param.getAddress()) + && isBlank(param.getProcurementName()) + && isBlank(param.getWinningName()) + && isBlank(param.getWinningPrice()); + } + + private boolean isBlank(String value) { + return value == null || value.trim().isEmpty(); + } + + /** + * 将CreditUserImportParam转换为CreditUser实体 + */ + private CreditUser convertImportParamToEntity(CreditUserImportParam param) { + CreditUser entity = new CreditUser(); + + entity.setCode(param.getCode()); + entity.setName(param.getName()); + entity.setReleaseDate(param.getReleaseDate()); + entity.setType(param.getType()); + entity.setRole(param.getRole()); + entity.setInfoType(param.getInfoType()); + entity.setAddress(param.getAddress()); + entity.setProcurementName(param.getProcurementName()); + entity.setWinningName(param.getWinningName()); + entity.setWinningPrice(param.getWinningPrice()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/CreditXgxfController.java b/src/main/java/com/gxwebsoft/credit/controller/CreditXgxfController.java new file mode 100644 index 0000000..8398f3e --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/CreditXgxfController.java @@ -0,0 +1,632 @@ +package com.gxwebsoft.credit.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.credit.entity.CreditXgxf; +import com.gxwebsoft.credit.param.CreditXgxfImportParam; +import com.gxwebsoft.credit.param.CreditXgxfParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import com.gxwebsoft.credit.service.CreditCompanyRecordCountService; +import com.gxwebsoft.credit.service.CreditXgxfService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 限制高消费控制器 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:55 + */ +@Tag(name = "限制高消费管理") +@RestController +@RequestMapping("/api/credit/credit-xgxf") +public class CreditXgxfController extends BaseController { + @Resource + private CreditXgxfService creditXgxfService; + + @Resource + private BatchImportSupport batchImportSupport; + + @Resource + private CreditCompanyService creditCompanyService; + + @Resource + private CreditCompanyRecordCountService creditCompanyRecordCountService; + + @Operation(summary = "分页查询限制高消费") + @GetMapping("/page") + public ApiResult> page(CreditXgxfParam param) { + // 使用关联查询 + return success(creditXgxfService.pageRel(param)); + } + + @Operation(summary = "查询全部限制高消费") + @GetMapping() + public ApiResult> list(CreditXgxfParam param) { + // 使用关联查询 + return success(creditXgxfService.listRel(param)); + } + + @Operation(summary = "根据id查询限制高消费") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(creditXgxfService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('credit:creditXgxf:save')") + @OperationLog + @Operation(summary = "添加限制高消费") + @PostMapping() + public ApiResult save(@RequestBody CreditXgxf creditXgxf) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // creditXgxf.setUserId(loginUser.getUserId()); + // } + if (creditXgxfService.save(creditXgxf)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditXgxf:update')") + @OperationLog + @Operation(summary = "修改限制高消费") + @PutMapping() + public ApiResult update(@RequestBody CreditXgxf creditXgxf) { + if (creditXgxfService.updateById(creditXgxf)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditXgxf:remove')") + @OperationLog + @Operation(summary = "删除限制高消费") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (creditXgxfService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('credit:creditXgxf:save')") + @OperationLog + @Operation(summary = "批量添加限制高消费") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (creditXgxfService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('credit:creditXgxf:update')") + @OperationLog + @Operation(summary = "批量修改限制高消费") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(creditXgxfService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('credit:creditXgxf:remove')") + @OperationLog + @Operation(summary = "批量删除限制高消费") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (creditXgxfService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * 根据企业名称匹配企业并更新 companyId(匹配 CreditCompany.name / CreditCompany.matchName) + * + *

默认仅更新 companyId=0 的记录;如需覆盖更新,传 onlyNull=false。

+ */ + @PreAuthorize("hasAuthority('credit:creditXgxf:update')") + @OperationLog + @Operation(summary = "根据企业名称匹配并更新companyId") + @PostMapping("/company-id/refresh") + public ApiResult> refreshCompanyIdByCompanyName( + @RequestParam(value = "onlyNull", required = false, defaultValue = "true") Boolean onlyNull, + @RequestParam(value = "limit", required = false) Integer limit + ) { + User loginUser = getLoginUser(); + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + + BatchImportSupport.CompanyIdRefreshStats stats = batchImportSupport.refreshCompanyIdByCompanyName( + creditXgxfService, + creditCompanyService, + currentTenantId, + onlyNull, + limit, + CreditXgxf::getId, + CreditXgxf::setId, + CreditXgxf::getDataType, + CreditXgxf::getCompanyId, + CreditXgxf::setCompanyId, + CreditXgxf::getHasData, + CreditXgxf::setHasData, + CreditXgxf::getTenantId, + CreditXgxf::new + ); + + if (!stats.anyDataRead) { + return success("无可更新数据", stats.toMap()); + } + return success("更新完成,更新" + stats.updated + "条", stats.toMap()); + } + + /** + * 批量导入限制高消费司法大数据 + */ + @PreAuthorize("hasAuthority('credit:creditXgxf:save')") + @Operation(summary = "批量导入限制高消费司法大数据") + @PostMapping("/import") + public ApiResult> importBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "限制高消费", 0); + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditXgxfImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + // easypoi 默认不会读取单元格超链接地址;url 可能挂在“案号”等列的超链接中,或单独提供 url/网址/链接 列。 + Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (int i = 0; i < list.size(); i++) { + CreditXgxfImportParam param = list.get(i); + try { + CreditXgxf item = convertImportParamToEntity(param); + if (!ImportHelper.isBlank(item.getCaseNumber())) { + String link = urlByCaseNumber.get(item.getCaseNumber().trim()); + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getRecommend() == null) { + item.setRecommend(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + if (ImportHelper.isBlank(item.getCaseNumber())) { + errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + if (item.getCompanyId() != null && item.getCompanyId() > 0) { + touchedCompanyIds.add(item.getCompanyId()); + } + + chunkItems.add(item); + chunkRowNumbers.add(excelRowNumber); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditXgxfService, + chunkItems, + CreditXgxf::getId, + CreditXgxf::setId, + CreditXgxf::getCaseNumber, + CreditXgxf::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditXgxfService.save(rowItem); + if (!saved) { + CreditXgxf existing = creditXgxfService.lambdaQuery() + .eq(CreditXgxf::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditXgxfService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } catch (Exception e) { + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKey( + creditXgxfService, + chunkItems, + CreditXgxf::getId, + CreditXgxf::setId, + CreditXgxf::getCaseNumber, + CreditXgxf::getCaseNumber, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + boolean saved = creditXgxfService.save(rowItem); + if (!saved) { + CreditXgxf existing = creditXgxfService.lambdaQuery() + .eq(CreditXgxf::getCaseNumber, rowItem.getCaseNumber()) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + if (creditXgxfService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.XGXF, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 批量导入历史限制高消费(仅解析“历史限制高消费”选项卡) + * 规则:案号相同则覆盖更新(recommend++ 记录更新次数);案号不存在则插入。 + */ + @PreAuthorize("hasAuthority('credit:creditXgxf:save')") + @Operation(summary = "批量导入历史限制高消费司法大数据") + @PostMapping("/import/history") + public ApiResult> importHistoryBatch(@RequestParam("file") MultipartFile file, + @RequestParam(value = "companyId", required = false) Integer companyId) { + List errorMessages = new ArrayList<>(); + int successCount = 0; + Set touchedCompanyIds = new HashSet<>(); + + try { + int sheetIndex = ExcelImportSupport.findSheetIndex(file, "历史限制高消费"); + if (sheetIndex < 0) { + return fail("未读取到数据,请确认文件中存在“历史限制高消费”选项卡且表头与示例格式一致", null); + } + + ExcelImportSupport.ImportResult importResult = ExcelImportSupport.read( + file, CreditXgxfImportParam.class, this::isEmptyImportRow, sheetIndex); + List list = importResult.getData(); + int usedTitleRows = importResult.getTitleRows(); + int usedHeadRows = importResult.getHeadRows(); + int usedSheetIndex = importResult.getSheetIndex(); + + if (CollectionUtils.isEmpty(list)) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + Integer currentTenantId = loginUser != null ? loginUser.getTenantId() : null; + Map urlByCaseNumber = ExcelImportSupport.readUrlByKey(file, usedSheetIndex, usedTitleRows, usedHeadRows, "案号"); + + LinkedHashMap latestByCaseNumber = new LinkedHashMap<>(); + LinkedHashMap latestRowByCaseNumber = new LinkedHashMap<>(); + + for (int i = 0; i < list.size(); i++) { + CreditXgxfImportParam param = list.get(i); + int excelRowNumber = i + 1 + usedTitleRows + usedHeadRows; + try { + CreditXgxf item = convertImportParamToEntity(param); + if (item.getCaseNumber() != null) { + item.setCaseNumber(item.getCaseNumber().trim()); + } + if (ImportHelper.isBlank(item.getCaseNumber())) { + errorMessages.add("第" + excelRowNumber + "行:案号不能为空"); + continue; + } + + String link = urlByCaseNumber.get(item.getCaseNumber()); + if (!ImportHelper.isBlank(link)) { + item.setUrl(link.trim()); + } + + if (item.getCompanyId() == null && companyId != null) { + item.setCompanyId(companyId); + } + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getTenantId() == null && currentTenantId != null) { + item.setTenantId(currentTenantId); + } + if (item.getStatus() == null) { + item.setStatus(0); + } + if (item.getDeleted() == null) { + item.setDeleted(0); + } + // 历史导入的数据统一标记为“失效” + item.setDataStatus("失效"); + + latestByCaseNumber.put(item.getCaseNumber(), item); + latestRowByCaseNumber.put(item.getCaseNumber(), excelRowNumber); + } catch (Exception e) { + errorMessages.add("第" + excelRowNumber + "行:" + e.getMessage()); + e.printStackTrace(); + } + } + + if (latestByCaseNumber.isEmpty()) { + if (errorMessages.isEmpty()) { + return fail("未读取到数据,请确认模板表头与示例格式一致", null); + } + return success("导入完成,成功0条,失败" + errorMessages.size() + "条", errorMessages); + } + + final int chunkSize = 500; + final int mpBatchSize = 500; + List chunkItems = new ArrayList<>(chunkSize); + List chunkRowNumbers = new ArrayList<>(chunkSize); + + for (Map.Entry entry : latestByCaseNumber.entrySet()) { + String caseNumber = entry.getKey(); + CreditXgxf item = entry.getValue(); + Integer rowNo = latestRowByCaseNumber.get(caseNumber); + chunkItems.add(item); + chunkRowNumbers.add(rowNo != null ? rowNo : -1); + if (chunkItems.size() >= chunkSize) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKeyAndIncrementCounterOnUpdate( + creditXgxfService, + chunkItems, + CreditXgxf::getId, + CreditXgxf::setId, + CreditXgxf::getCaseNumber, + CreditXgxf::getCaseNumber, + CreditXgxf::getRecommend, + CreditXgxf::setRecommend, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + if (rowItem.getRecommend() == null) { + rowItem.setRecommend(0); + } + boolean saved = creditXgxfService.save(rowItem); + if (!saved) { + CreditXgxf existing = creditXgxfService.lambdaQuery() + .eq(CreditXgxf::getCaseNumber, rowItem.getCaseNumber()) + .select(CreditXgxf::getId, CreditXgxf::getRecommend) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + Integer old = existing.getRecommend(); + rowItem.setRecommend(old == null ? 1 : old + 1); + if (creditXgxfService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + chunkItems.clear(); + chunkRowNumbers.clear(); + } + } + + if (!chunkItems.isEmpty()) { + successCount += batchImportSupport.persistChunkWithFallback( + chunkItems, + chunkRowNumbers, + () -> batchImportSupport.upsertBySingleKeyAndIncrementCounterOnUpdate( + creditXgxfService, + chunkItems, + CreditXgxf::getId, + CreditXgxf::setId, + CreditXgxf::getCaseNumber, + CreditXgxf::getCaseNumber, + CreditXgxf::getRecommend, + CreditXgxf::setRecommend, + null, + mpBatchSize + ), + (rowItem, rowNumber) -> { + if (rowItem.getRecommend() == null) { + rowItem.setRecommend(0); + } + boolean saved = creditXgxfService.save(rowItem); + if (!saved) { + CreditXgxf existing = creditXgxfService.lambdaQuery() + .eq(CreditXgxf::getCaseNumber, rowItem.getCaseNumber()) + .select(CreditXgxf::getId, CreditXgxf::getRecommend) + .one(); + if (existing != null) { + rowItem.setId(existing.getId()); + Integer old = existing.getRecommend(); + rowItem.setRecommend(old == null ? 1 : old + 1); + if (creditXgxfService.updateById(rowItem)) { + return true; + } + } + } else { + return true; + } + String prefix = rowNumber > 0 ? ("第" + rowNumber + "行:") : ""; + errorMessages.add(prefix + "保存失败"); + return false; + }, + errorMessages + ); + } + + creditCompanyRecordCountService.refresh(CreditCompanyRecordCountService.CountType.XGXF, touchedCompanyIds); + + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载限制高消费导入模板 + */ + @Operation(summary = "下载限制高消费导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + List templateList = new ArrayList<>(); + + CreditXgxfImportParam example = new CreditXgxfImportParam(); + example.setDataType("限制高消费"); + example.setPlaintiffAppellant("原告示例"); + example.setAppellee("被告示例"); + example.setOccurrenceTime("2024-01-01"); + example.setCaseNumber("(2024)示例案号"); + example.setInvolvedAmount("100000"); + example.setCourtName("示例法院"); + example.setComments("备注信息"); + templateList.add(example); + + Workbook workbook = ExcelImportSupport.buildTemplate("限制高消费导入模板", "限制高消费", CreditXgxfImportParam.class, templateList); + + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=credit_xgxf_import_template.xlsx"); + + workbook.write(response.getOutputStream()); + workbook.close(); + } + + private boolean isEmptyImportRow(CreditXgxfImportParam param) { + if (param == null) { + return true; + } + return ImportHelper.isBlank(param.getCaseNumber()); + } + + private CreditXgxf convertImportParamToEntity(CreditXgxfImportParam param) { + CreditXgxf entity = new CreditXgxf(); + + entity.setCaseNumber(param.getCaseNumber()); + entity.setType(param.getType()); + entity.setDataType(param.getDataType()); + entity.setPlaintiffUser(param.getPlaintiffUser()); + entity.setDefendantUser(param.getDefendantUser()); + entity.setOtherPartiesThirdParty(param.getOtherPartiesThirdParty()); + entity.setPlaintiffAppellant(param.getPlaintiffAppellant()); + entity.setDataStatus(param.getDataStatus()); + entity.setAppellee(param.getAppellee()); + + // 兼容不同模板字段:如果 *2 有值则以 *2 为准写入主字段 + entity.setInvolvedAmount(!ImportHelper.isBlank(param.getInvolvedAmount2()) + ? param.getInvolvedAmount2() + : param.getInvolvedAmount()); + entity.setOccurrenceTime(!ImportHelper.isBlank(param.getOccurrenceTime2()) + ? param.getOccurrenceTime2() + : param.getOccurrenceTime()); + entity.setCourtName(!ImportHelper.isBlank(param.getCourtName2()) + ? param.getCourtName2() + : param.getCourtName()); + + entity.setReleaseDate(param.getReleaseDate()); + entity.setComments(param.getComments()); + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/ExcelImportSupport.java b/src/main/java/com/gxwebsoft/credit/controller/ExcelImportSupport.java new file mode 100644 index 0000000..6f42476 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/ExcelImportSupport.java @@ -0,0 +1,609 @@ +package com.gxwebsoft.credit.controller; + +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellType; +import org.apache.poi.ss.usermodel.DataFormatter; +import org.apache.poi.ss.usermodel.Hyperlink; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.usermodel.WorkbookFactory; +import org.springframework.util.CollectionUtils; +import org.springframework.web.multipart.MultipartFile; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Predicate; + +/** + * Excel 导入导出通用支持 + */ +public class ExcelImportSupport { + + public static class ImportResult { + private final List data; + private final int titleRows; + private final int headRows; + private final int sheetIndex; + + public ImportResult(List data, int titleRows, int headRows) { + this(data, titleRows, headRows, 0); + } + + public ImportResult(List data, int titleRows, int headRows, int sheetIndex) { + this.data = data; + this.titleRows = titleRows; + this.headRows = headRows; + this.sheetIndex = sheetIndex; + } + + public List getData() { + return data; + } + + public int getTitleRows() { + return titleRows; + } + + public int getHeadRows() { + return headRows; + } + + public int getSheetIndex() { + return sheetIndex; + } + } + + public static ImportResult read(MultipartFile file, Class clazz, Predicate emptyRowPredicate) throws Exception { + return read(file, clazz, emptyRowPredicate, 0); + } + + /** + * 自动尝试所有 sheet(从第 0 个开始),直到读取到非空数据。 + */ + public static ImportResult readAnySheet(MultipartFile file, Class clazz, Predicate emptyRowPredicate) throws Exception { + ImportResult result = read(file, clazz, emptyRowPredicate, 0); + if (!CollectionUtils.isEmpty(result.getData())) { + return result; + } + + int sheetCount = getSheetCount(file); + for (int i = 1; i < sheetCount; i++) { + ImportResult sheetResult = read(file, clazz, emptyRowPredicate, i); + if (!CollectionUtils.isEmpty(sheetResult.getData())) { + return sheetResult; + } + } + return result; + } + + /** + * 自动尝试所有 sheet(从第 0 个开始),并在每个 sheet 内选择“得分”最高的表头配置。 + */ + public static ImportResult readAnySheetBest(MultipartFile file, Class clazz, Predicate emptyRowPredicate, Predicate scoreRowPredicate) throws Exception { + ImportResult result = readBest(file, clazz, emptyRowPredicate, scoreRowPredicate, 0); + if (!CollectionUtils.isEmpty(result.getData())) { + return result; + } + + int sheetCount = getSheetCount(file); + for (int i = 1; i < sheetCount; i++) { + ImportResult sheetResult = readBest(file, clazz, emptyRowPredicate, scoreRowPredicate, i); + if (!CollectionUtils.isEmpty(sheetResult.getData())) { + return sheetResult; + } + } + return result; + } + + /** + * 读取指定 sheet 的 Excel。 + * + * @param sheetIndex 目标 sheet 下标,从 0 开始。第二个选项卡传 1。 + */ + public static ImportResult read(MultipartFile file, Class clazz, Predicate emptyRowPredicate, int sheetIndex) throws Exception { + List list = null; + int usedTitleRows = 0; + int usedHeadRows = 0; + int[][] tryConfigs = new int[][]{{1, 1}, {0, 1}, {2, 1}, {3, 1}, {0, 2}, {0, 3}, {0, 4}}; + Exception lastFailure = null; + boolean anyImported = false; + + for (int[] config : tryConfigs) { + try { + list = filterEmptyRows(importSheet(file, clazz, config[0], config[1], sheetIndex), emptyRowPredicate); + anyImported = true; + } catch (Exception e) { + // Some source files can trigger easypoi/POI runtime exceptions for certain title/head row combinations. + // Keep trying other configurations instead of failing the whole import. + lastFailure = e; + continue; + } + if (!CollectionUtils.isEmpty(list)) { + usedTitleRows = config[0]; + usedHeadRows = config[1]; + break; + } + } + + // Fallback for upstream files with extra banner/title rows or wider multi-row headers. + // Keep the default fast path above for common templates. + if (CollectionUtils.isEmpty(list)) { + final int maxTitleRows = 10; + final int maxHeadRows = 6; + outer: + for (int titleRows = 0; titleRows <= maxTitleRows; titleRows++) { + for (int headRows = 1; headRows <= maxHeadRows; headRows++) { + try { + list = filterEmptyRows(importSheet(file, clazz, titleRows, headRows, sheetIndex), emptyRowPredicate); + anyImported = true; + } catch (Exception e) { + lastFailure = e; + continue; + } + if (!CollectionUtils.isEmpty(list)) { + usedTitleRows = titleRows; + usedHeadRows = headRows; + break outer; + } + } + } + } + if (list == null) { + if (!anyImported && lastFailure != null) { + throw lastFailure; + } + list = Collections.emptyList(); + } + return new ImportResult<>(list, usedTitleRows, usedHeadRows, sheetIndex); + } + + /** + * 读取指定 sheet 的 Excel,并从多组表头配置中挑选“得分”最高的结果。 + */ + public static ImportResult readBest(MultipartFile file, Class clazz, Predicate emptyRowPredicate, Predicate scoreRowPredicate, int sheetIndex) throws Exception { + List bestList = null; + int bestTitleRows = 0; + int bestHeadRows = 0; + int bestScore = -1; + int bestSize = -1; + Exception lastFailure = null; + boolean anyImported = false; + + int[][] tryConfigs = new int[][]{{1, 1}, {0, 1}, {2, 1}, {3, 1}, {0, 2}, {0, 3}, {0, 4}, {1, 2}, {1, 3}, {1, 4}, {2, 2}, {2, 3}, {2, 4}, {3, 2}, {3, 3}, {3, 4}}; + + for (int[] config : tryConfigs) { + List list; + try { + list = filterEmptyRows(importSheet(file, clazz, config[0], config[1], sheetIndex), emptyRowPredicate); + anyImported = true; + } catch (Exception e) { + lastFailure = e; + continue; + } + if (CollectionUtils.isEmpty(list)) { + continue; + } + + int score = 0; + if (scoreRowPredicate != null) { + for (T row : list) { + if (scoreRowPredicate.test(row)) { + score++; + } + } + } + + int size = list.size(); + if (score > bestScore || (score == bestScore && size > bestSize)) { + bestList = list; + bestTitleRows = config[0]; + bestHeadRows = config[1]; + bestScore = score; + bestSize = size; + } + } + + // Fallback scan: broaden the search space for messy source files (extra title rows, multi-row headers). + if (bestList == null) { + final int maxTitleRows = 10; + final int maxHeadRows = 6; + for (int titleRows = 0; titleRows <= maxTitleRows; titleRows++) { + for (int headRows = 1; headRows <= maxHeadRows; headRows++) { + List list; + try { + list = filterEmptyRows(importSheet(file, clazz, titleRows, headRows, sheetIndex), emptyRowPredicate); + anyImported = true; + } catch (Exception e) { + lastFailure = e; + continue; + } + if (CollectionUtils.isEmpty(list)) { + continue; + } + + int score = 0; + if (scoreRowPredicate != null) { + for (T row : list) { + if (scoreRowPredicate.test(row)) { + score++; + } + } + } + + int size = list.size(); + if (score > bestScore || (score == bestScore && size > bestSize)) { + bestList = list; + bestTitleRows = titleRows; + bestHeadRows = headRows; + bestScore = score; + bestSize = size; + } + } + } + } + + if (bestList != null) { + return new ImportResult<>(bestList, bestTitleRows, bestHeadRows, sheetIndex); + } + + if (!anyImported && lastFailure != null) { + throw lastFailure; + } + return read(file, clazz, emptyRowPredicate, sheetIndex); + } + + private static List importSheet(MultipartFile file, Class clazz, int titleRows, int headRows, int sheetIndex) throws Exception { + ImportParams importParams = new ImportParams(); + importParams.setTitleRows(titleRows); + importParams.setHeadRows(headRows); + importParams.setStartSheetIndex(sheetIndex); + importParams.setSheetNum(1); + + // Easypoi matches headers by exact string. Some upstream files contain extra spaces/tabs/newlines in header cells + // (e.g. "原告 / 上诉人" or "原告/上诉人\t"), which makes specific columns silently not mapped. + // Normalize header cells first to make imports robust. + try (InputStream is = file.getInputStream(); Workbook workbook = WorkbookFactory.create(is)) { + if (workbook.getNumberOfSheets() > sheetIndex) { + Sheet sheet = workbook.getSheetAt(sheetIndex); + if (sheet != null) { + normalizeHeaderCells(sheet, titleRows, headRows); + } + } + try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) { + workbook.write(bos); + try (ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray())) { + return ExcelImportUtil.importExcel(bis, clazz, importParams); + } + } + } + } + + private static void normalizeHeaderCells(Sheet sheet, int titleRows, int headRows) { + if (sheet == null || headRows <= 0) { + return; + } + int headerStart = Math.max(titleRows, 0); + int headerEnd = headerStart + headRows - 1; + for (int r = headerStart; r <= headerEnd; r++) { + Row row = sheet.getRow(r); + if (row == null) { + continue; + } + short last = row.getLastCellNum(); + for (int c = 0; c < last; c++) { + Cell cell = row.getCell(c); + if (cell == null) { + continue; + } + + String text = null; + CellType type = cell.getCellType(); + if (type == CellType.STRING) { + text = cell.getStringCellValue(); + } else if (type == CellType.FORMULA && cell.getCachedFormulaResultType() == CellType.STRING) { + text = cell.getStringCellValue(); + } else { + continue; + } + + String normalized = normalizeHeaderText(text); + if (normalized != null && !normalized.equals(text)) { + cell.setCellValue(normalized); + } + } + } + } + + private static String normalizeHeaderText(String text) { + if (text == null) { + return null; + } + // Remove common invisible whitespace characters, including full-width space. + return text + .replace("/", "/") + .replace(" ", "") + .replace("\t", "") + .replace("\r", "") + .replace("\n", "") + .replace("\u00A0", "") + .replace(" ", "") + .trim(); + } + + private static List filterEmptyRows(List rawList, Predicate emptyRowPredicate) { + if (CollectionUtils.isEmpty(rawList)) { + return rawList; + } + rawList.removeIf(emptyRowPredicate); + return rawList; + } + + private static int getSheetCount(MultipartFile file) throws Exception { + try (InputStream is = file.getInputStream(); Workbook workbook = WorkbookFactory.create(is)) { + return workbook.getNumberOfSheets(); + } + } + + /** + * 根据 sheet 名称查找下标(优先精确匹配,其次前缀匹配/包含匹配)。 + * + * @return 找不到返回 -1 + */ + public static int findSheetIndex(MultipartFile file, String sheetName) throws Exception { + if (file == null || sheetName == null || sheetName.trim().isEmpty()) { + return -1; + } + String target = normalizeSheetName(sheetName); + if (target.isEmpty()) { + return -1; + } + + try (InputStream is = file.getInputStream(); Workbook workbook = WorkbookFactory.create(is)) { + int sheetCount = workbook.getNumberOfSheets(); + for (int i = 0; i < sheetCount; i++) { + String candidate = normalizeSheetName(workbook.getSheetName(i)); + if (Objects.equals(candidate, target)) { + return i; + } + } + for (int i = 0; i < sheetCount; i++) { + String candidate = normalizeSheetName(workbook.getSheetName(i)); + if (candidate.startsWith(target) || candidate.contains(target) || target.startsWith(candidate)) { + return i; + } + } + return -1; + } + } + + public static int findSheetIndex(MultipartFile file, String sheetName, int defaultIndex) throws Exception { + int idx = findSheetIndex(file, sheetName); + return idx >= 0 ? idx : defaultIndex; + } + + private static String normalizeSheetName(String sheetName) { + if (sheetName == null) { + return ""; + } + return sheetName.replace(" ", "").replace(" ", "").trim(); + } + + /** + * 读取指定列(由表头名定位)的超链接,返回:单元格显示值 -> 超链接地址。 + * + *

适用于:导入对象没有 url 字段,但 Excel 把链接放在某个“名称/案号”等列的超链接里。

+ */ + public static Map readHyperlinksByHeaderKey(MultipartFile file, int sheetIndex, int titleRows, int headRows, String headerName) throws Exception { + if (file == null || headerName == null || headerName.trim().isEmpty()) { + return Collections.emptyMap(); + } + + try (InputStream is = file.getInputStream(); Workbook workbook = WorkbookFactory.create(is)) { + if (workbook.getNumberOfSheets() <= sheetIndex) { + return Collections.emptyMap(); + } + Sheet sheet = workbook.getSheetAt(sheetIndex); + if (sheet == null) { + return Collections.emptyMap(); + } + + int colIndex = findColumnIndexByHeader(sheet, titleRows, headRows, headerName); + if (colIndex < 0) { + return Collections.emptyMap(); + } + + Map result = new HashMap<>(); + DataFormatter formatter = new DataFormatter(); + int dataStartRow = titleRows + headRows; + for (int r = dataStartRow; r <= sheet.getLastRowNum(); r++) { + Row row = sheet.getRow(r); + if (row == null) { + continue; + } + Cell cell = row.getCell(colIndex); + if (cell == null) { + continue; + } + String address = extractHyperlinkAddress(cell); + if (address == null || address.isEmpty()) { + continue; + } + String key = formatter.formatCellValue(cell); + if (key == null || key.trim().isEmpty()) { + continue; + } + result.put(key.trim(), address); + } + return result; + } + } + + /** + * 读取两列(由表头名定位)的文本/超链接,返回:key列显示值 -> value列(优先超链接地址,其次单元格文本)。 + * + *

适用于:Excel 把 url 放在单独一列(可能是纯文本,也可能是超链接)。

+ */ + public static Map readKeyValueByHeaders(MultipartFile file, + int sheetIndex, + int titleRows, + int headRows, + String keyHeaderName, + String valueHeaderName) throws Exception { + if (file == null + || keyHeaderName == null || keyHeaderName.trim().isEmpty() + || valueHeaderName == null || valueHeaderName.trim().isEmpty()) { + return Collections.emptyMap(); + } + + try (InputStream is = file.getInputStream(); Workbook workbook = WorkbookFactory.create(is)) { + if (workbook.getNumberOfSheets() <= sheetIndex) { + return Collections.emptyMap(); + } + Sheet sheet = workbook.getSheetAt(sheetIndex); + if (sheet == null) { + return Collections.emptyMap(); + } + + int keyCol = findColumnIndexByHeader(sheet, titleRows, headRows, keyHeaderName); + int valCol = findColumnIndexByHeader(sheet, titleRows, headRows, valueHeaderName); + if (keyCol < 0 || valCol < 0) { + return Collections.emptyMap(); + } + + Map result = new HashMap<>(); + DataFormatter formatter = new DataFormatter(); + int dataStartRow = titleRows + headRows; + for (int r = dataStartRow; r <= sheet.getLastRowNum(); r++) { + Row row = sheet.getRow(r); + if (row == null) { + continue; + } + Cell keyCell = row.getCell(keyCol); + if (keyCell == null) { + continue; + } + String key = formatter.formatCellValue(keyCell); + if (key == null || key.trim().isEmpty()) { + continue; + } + + Cell valCell = row.getCell(valCol); + if (valCell == null) { + continue; + } + String value = extractHyperlinkAddress(valCell); + if (value == null || value.trim().isEmpty()) { + value = formatter.formatCellValue(valCell); + } + if (value == null || value.trim().isEmpty()) { + continue; + } + result.put(key.trim(), value.trim()); + } + return result; + } + } + + /** + * 读取“key列 -> url”的映射: + * - 优先读取 key 列自身的超链接(url 常挂在名称/案号等列的超链接里) + * - 如果源文件提供独立的 url/URL/网址/链接/链接地址 等列,则读取该列(支持文本或超链接) + */ + public static Map readUrlByKey(MultipartFile file, + int sheetIndex, + int titleRows, + int headRows, + String keyHeaderName) throws Exception { + if (file == null || keyHeaderName == null || keyHeaderName.trim().isEmpty()) { + return Collections.emptyMap(); + } + + Map result = new HashMap<>(); + + // 1) url 挂在 key 列超链接里(最常见) + Map fromKeyHyperlinks = readHyperlinksByHeaderKey(file, sheetIndex, titleRows, headRows, keyHeaderName); + if (!fromKeyHyperlinks.isEmpty()) { + result.putAll(fromKeyHyperlinks); + } + + // 2) url 作为单独一列(多种表头命名) + String[] urlHeaders = new String[]{"url", "URL", "网址", "链接", "链接地址"}; + for (String urlHeader : urlHeaders) { + Map fromUrlCol = readKeyValueByHeaders(file, sheetIndex, titleRows, headRows, keyHeaderName, urlHeader); + if (fromUrlCol.isEmpty()) { + continue; + } + for (Map.Entry entry : fromUrlCol.entrySet()) { + // 不覆盖已从 key 超链接读取到的地址 + result.putIfAbsent(entry.getKey(), entry.getValue()); + } + } + return result; + } + + private static int findColumnIndexByHeader(Sheet sheet, int titleRows, int headRows, String headerName) { + int firstHeaderRow = Math.max(0, titleRows); + int lastHeaderRow = Math.max(0, titleRows + headRows - 1); + for (int r = firstHeaderRow; r <= lastHeaderRow; r++) { + Row row = sheet.getRow(r); + if (row == null) { + continue; + } + for (int c = row.getFirstCellNum(); c < row.getLastCellNum(); c++) { + Cell cell = row.getCell(c); + if (cell == null) { + continue; + } + if (cell.getCellType() == CellType.STRING) { + String value = cell.getStringCellValue(); + if (headerName.equals(value != null ? value.trim() : null)) { + return c; + } + } else { + DataFormatter formatter = new DataFormatter(); + String value = formatter.formatCellValue(cell); + if (headerName.equals(value != null ? value.trim() : null)) { + return c; + } + } + } + } + return -1; + } + + private static String extractHyperlinkAddress(Cell cell) { + Hyperlink hyperlink = cell.getHyperlink(); + if (hyperlink != null && hyperlink.getAddress() != null && !hyperlink.getAddress().isEmpty()) { + return hyperlink.getAddress(); + } + if (cell.getCellType() == CellType.FORMULA) { + String formula = cell.getCellFormula(); + if (formula != null && formula.toUpperCase().startsWith("HYPERLINK(")) { + int firstQuote = formula.indexOf('\"'); + if (firstQuote >= 0) { + int secondQuote = formula.indexOf('\"', firstQuote + 1); + if (secondQuote > firstQuote) { + return formula.substring(firstQuote + 1, secondQuote); + } + } + } + } + return null; + } + + public static Workbook buildTemplate(String title, String sheetName, Class clazz, List examples) { + ExportParams exportParams = new ExportParams(title, sheetName); + return ExcelExportUtil.exportExcel(exportParams, clazz, examples); + } +} diff --git a/src/main/java/com/gxwebsoft/credit/controller/ImportHelper.java b/src/main/java/com/gxwebsoft/credit/controller/ImportHelper.java new file mode 100644 index 0000000..c3590be --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/controller/ImportHelper.java @@ -0,0 +1,39 @@ +package com.gxwebsoft.credit.controller; + +import java.math.BigDecimal; +import java.time.LocalDate; + +/** + * 导入解析辅助工具 + */ +public final class ImportHelper { + + private ImportHelper() { + } + + public static boolean isBlank(String value) { + return value == null || value.trim().isEmpty(); + } + + public static BigDecimal parseBigDecimal(String value, String fieldLabel) { + if (isBlank(value)) { + return null; + } + try { + return new BigDecimal(value.trim()); + } catch (Exception e) { + throw new IllegalArgumentException(fieldLabel + "格式不正确"); + } + } + + public static LocalDate parseLocalDate(String value, String fieldLabel) { + if (isBlank(value)) { + return null; + } + try { + return LocalDate.parse(value.trim()); + } catch (Exception e) { + throw new IllegalArgumentException(fieldLabel + "日期格式应为yyyy-MM-dd"); + } + } +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditAdministrativeLicense.java b/src/main/java/com/gxwebsoft/credit/entity/CreditAdministrativeLicense.java new file mode 100644 index 0000000..374408f --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditAdministrativeLicense.java @@ -0,0 +1,109 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 行政许可 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditAdministrativeLicense对象", description = "行政许可") +public class CreditAdministrativeLicense implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "决定文书/许可编号") + private String code; + + @Schema(description = "决定文书/许可证名称") + private String name; + + @Schema(description = "许可状态") + private String statusText; + + @Schema(description = "许可类别") + private String type; + + @Schema(description = "链接") + private String url; + + @Schema(description = "有效期自") + private String validityStart; + + @Schema(description = "有效期至") + private String validityEnd; + + @Schema(description = "许可机关") + private String licensingAuthority; + + @Schema(description = "许可内容") + @TableField("License_content") + private String licenseContent; + + @Schema(description = "数据来源单位") + private String dataSourceUnit; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "数据状态") + private String dataStatus; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "主体企业") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditBankruptcy.java b/src/main/java/com/gxwebsoft/credit/entity/CreditBankruptcy.java new file mode 100644 index 0000000..1b227a7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditBankruptcy.java @@ -0,0 +1,93 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 破产重整 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditBankruptcy对象", description = "破产重整") +public class CreditBankruptcy implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "案号") + private String code; + + @Schema(description = "案件类型") + private String type; + + @Schema(description = "当事人") + private String party; + + @Schema(description = "链接") + private String url; + + @Schema(description = "经办法院") + private String court; + + @Schema(description = "公开日期") + private String publicDate; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "主体企业") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditBranch.java b/src/main/java/com/gxwebsoft/credit/entity/CreditBranch.java new file mode 100644 index 0000000..8cf0447 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditBranch.java @@ -0,0 +1,93 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 分支机构 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditBranch对象", description = "分支机构") +public class CreditBranch implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "分支机构名称") + private String name; + + @Schema(description = "负责人") + private String curator; + + @Schema(description = "地区") + private String region; + + @Schema(description = "链接") + private String url; + + @Schema(description = "成立日期") + private String establishDate; + + @Schema(description = "状态") + private String statusText; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "主题企业") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditBreachOfTrust.java b/src/main/java/com/gxwebsoft/credit/entity/CreditBreachOfTrust.java new file mode 100644 index 0000000..befe849 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditBreachOfTrust.java @@ -0,0 +1,113 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 失信被执行人 + * + * @author 科技小王子 + * @since 2025-12-19 19:46:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditBreachOfTrust对象", description = "失信被执行人") +public class CreditBreachOfTrust implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "失信被执行人") + private String plaintiffAppellant; + + @Schema(description = "疑似申请执行人") + private String appellee; + + @Schema(description = "涉案金额(元)") + private String involvedAmount; + + @Schema(description = "执行法院") + private String courtName; + + @Schema(description = "立案日期") + private String occurrenceTime; + + @Schema(description = "发布日期") + private String releaseDate; + + @Schema(description = "数据类型") + private String dataType; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "其他当事人/第三人") + private String otherPartiesThirdParty; + + @Schema(description = "案由") + private String causeOfAction; + + @Schema(description = "数据状态") + private String dataStatus; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditCaseFiling.java b/src/main/java/com/gxwebsoft/credit/entity/CreditCaseFiling.java new file mode 100644 index 0000000..a0c340b --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditCaseFiling.java @@ -0,0 +1,110 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 司法大数据 + * + * @author 科技小王子 + * @since 2025-12-19 19:47:22 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditCaseFiling对象", description = "司法大数据") +public class CreditCaseFiling implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "数据类型") + private String dataType; + + @Schema(description = "原告/上诉人") + private String plaintiffAppellant; + + @Schema(description = "被告/被上诉人") + private String appellee; + + @Schema(description = "其他当事人/第三人") + private String otherPartiesThirdParty; + + @Schema(description = "立案日期") + private String occurrenceTime; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "项目网址") + private String url; + + @Schema(description = "案由") + private String causeOfAction; + + @Schema(description = "涉案金额") + private String involvedAmount; + + @Schema(description = "法院") + private String courtName; + + @Schema(description = "数据状态") + private String dataStatus; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditCompany.java b/src/main/java/com/gxwebsoft/credit/entity/CreditCompany.java new file mode 100644 index 0000000..5d70194 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditCompany.java @@ -0,0 +1,294 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 企业 + * + * @author 科技小王子 + * @since 2025-12-17 08:28:03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditCompany对象", description = "企业") +public class CreditCompany implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "原文件导入名称") + private String name; + + @Schema(description = "系统匹配企业名称") + private String matchName; + + @Schema(description = "登记状态") + private String registrationStatus; + + @Schema(description = "法定代表人") + private String legalPerson; + + @Schema(description = "注册资本") + private String registeredCapital; + + @Schema(description = "实缴资本") + private String paidinCapital; + + @Schema(description = "成立日期") + private String establishDate; + + @Schema(description = "统一社会信用代码") + private String code; + + @Schema(description = "企业地址") + private String address; + + @Schema(description = "所属省份") + private String province; + + @Schema(description = "所属城市") + private String city; + + @Schema(description = "所属区县") + private String region; + + @Schema(description = "电话") + private String tel; + + @Schema(description = "更多电话") + private String moreTel; + + @Schema(description = "邮箱") + private String email; + + @Schema(description = "更多邮箱") + private String moreEmail; + + @Schema(description = "企业(机构)类型") + private String institutionType; + + @Schema(description = "纳税人识别号") + private String taxpayerCode; + + @Schema(description = "注册号") + private String registrationNumber; + + @Schema(description = "组织机构代码") + private String organizationalCode; + + @Schema(description = "参保人数") + private String numberOfInsuredPersons; + + @Schema(description = "参保人数所属年报") + private String annualReport; + + @Schema(description = "营业期限") + private String businessTerm; + + @Schema(description = "国标行业门类") + private String nationalStandardIndustryCategories; + + @Schema(description = "国标行业大类") + private String nationalStandardIndustryCategories2; + + @Schema(description = "国标行业中类") + private String nationalStandardIndustryCategories3; + + @Schema(description = "国标行业小类") + private String nationalStandardIndustryCategories4; + + @Schema(description = "企查查行业门类") + private String nationalStandardIndustryCategories5; + + @Schema(description = "企查查行业大类") + private String nationalStandardIndustryCategories6; + + @Schema(description = "企查查行业中类") + private String nationalStandardIndustryCategories7; + + @Schema(description = "企查查行业小类") + private String nationalStandardIndustryCategories8; + + @Schema(description = "企业规模") + private String companySize; + + @Schema(description = "曾用名") + private String formerName; + + @Schema(description = "英文名") + private String englishName; + + @Schema(description = "官网") + private String domain; + + @Schema(description = "通信地址") + private String mailingAddress; + + @Schema(description = "企业简介") + private String companyProfile; + + @Schema(description = "经营范围") + private String natureOfBusiness; + + @Schema(description = "登记机关") + private String registrationAuthority; + + @Schema(description = "纳税人资质") + private String taxpayerQualification; + + @Schema(description = "最新年报年份") + private String latestAnnualReportYear; + + @Schema(description = "最新年报营业收入") + private String latestAnnualReportOnOperatingRevenue; + + @Schema(description = "企查分") + private String enterpriseScoreCheck; + + @Schema(description = "信用等级") + private String creditRating; + + @Schema(description = "科创分") + private String cechnologyScore; + + @Schema(description = "科创等级") + private String cechnologyLevel; + + @Schema(description = "是否小微企业") + private String smallEnterprise; + + + @Schema(description = "项目网址") + private String url; + + @Schema(description = "类型") + private Integer type; + + @Schema(description = "上级id, 0是顶级") + private Integer parentId; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "记录数") + private Integer creditAdministrativeLicense; + + @Schema(description = "记录数") + private Integer creditBankruptcy; + + @Schema(description = "记录数") + private Integer creditBranch; + + @Schema(description = "记录数") + private Integer creditBreachOfTrust; + + @Schema(description = "记录数") + private Integer creditCaseFiling; + + @Schema(description = "记录数") + private Integer creditCompetitor; + + @Schema(description = "记录数") + private Integer creditCourtAnnouncement; + + @Schema(description = "记录数") + private Integer creditCourtSession; + + @Schema(description = "记录数") + private Integer creditCustomer; + + @Schema(description = "记录数") + private Integer creditDeliveryNotice; + + @Schema(description = "记录数") + private Integer creditExternal; + + @Schema(description = "记录数") + private Integer creditFinalVersion; + + @Schema(description = "记录数") + private Integer creditGqdj; + + @Schema(description = "记录数") + private Integer creditHistoricalLegalPerson; + + @Schema(description = "记录数") + private Integer creditJudgmentDebtor; + + @Schema(description = "记录数") + private Integer creditJudicialDocument; + + @Schema(description = "记录数") + private Integer creditJudiciary; + + @Schema(description = "记录数") + private Integer creditMediation; + + @Schema(description = "记录数") + private Integer creditNearbyCompany; + + @Schema(description = "记录数") + private Integer creditPatent; + + @Schema(description = "记录数") + private Integer creditRiskRelation; + + @Schema(description = "记录数") + private Integer creditSupplier; + + @Schema(description = "记录数") + private Integer creditSuspectedRelationship; + + @Schema(description = "记录数") + private Integer creditUser; + + @Schema(description = "记录数") + private Integer creditXgxf; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditCompetitor.java b/src/main/java/com/gxwebsoft/credit/entity/CreditCompetitor.java new file mode 100644 index 0000000..c7a580c --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditCompetitor.java @@ -0,0 +1,105 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 竞争对手 + * + * @author 科技小王子 + * @since 2025-12-19 19:49:04 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditCompetitor对象", description = "竞争对手") +public class CreditCompetitor implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "序号") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "企业名称") + private String name; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "法定代表人") + private String legalRepresentative; + + @Schema(description = "注册资本") + private String registeredCapital; + + @Schema(description = "成立日期") + private String establishmentDate; + + @Schema(description = "登记状态") + private String registrationStatus; + + @Schema(description = "所属行业") + private String industry; + + @Schema(description = "所属省份") + private String province; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "所属企业名称") + @TableField(exist = false) + private String mainCompanyName; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditCourtAnnouncement.java b/src/main/java/com/gxwebsoft/credit/entity/CreditCourtAnnouncement.java new file mode 100644 index 0000000..1f42e78 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditCourtAnnouncement.java @@ -0,0 +1,110 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 法院公告司法大数据 + * + * @author 科技小王子 + * @since 2025-12-19 19:49:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditCourtAnnouncement对象", description = "法院公告司法大数据") +public class CreditCourtAnnouncement implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "案由") + private String causeOfAction; + + @Schema(description = "当事人") + private String otherPartiesThirdParty; + + @Schema(description = "公告类型") + private String dataType; + + @Schema(description = "公告人") + private String plaintiffAppellant; + + @Schema(description = "刊登日期") + private String occurrenceTime; + + @Schema(description = "被告/被上诉人") + private String appellee; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "涉案金额") + private String involvedAmount; + + @Schema(description = "法院") + private String courtName; + + @Schema(description = "数据状态") + private String dataStatus; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditCourtSession.java b/src/main/java/com/gxwebsoft/credit/entity/CreditCourtSession.java new file mode 100644 index 0000000..0784d41 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditCourtSession.java @@ -0,0 +1,110 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 开庭公告司法大数据 + * + * @author 科技小王子 + * @since 2025-12-19 19:49:32 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditCourtSession对象", description = "开庭公告司法大数据") +public class CreditCourtSession implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "数据类型") + private String dataType; + + @Schema(description = "原告/上诉人") + private String plaintiffAppellant; + + @Schema(description = "被告/被上诉人") + private String appellee; + + @Schema(description = "其他当事人/第三人") + private String otherPartiesThirdParty; + + @Schema(description = "发生时间") + private String occurrenceTime; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "案由") + private String causeOfAction; + + @Schema(description = "涉案金额") + private String involvedAmount; + + @Schema(description = "法院") + private String courtName; + + @Schema(description = "数据状态") + private String dataStatus; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditCustomer.java b/src/main/java/com/gxwebsoft/credit/entity/CreditCustomer.java new file mode 100644 index 0000000..522faa5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditCustomer.java @@ -0,0 +1,95 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 客户 + * + * @author 科技小王子 + * @since 2025-12-21 21:20:58 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditCustomer对象", description = "客户") +public class CreditCustomer implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "客户") + private String name; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "状态") + private String statusTxt; + + @Schema(description = "销售金额(万元)") + private String price; + + @Schema(description = "公开日期") + private String publicDate; + + @Schema(description = "数据来源") + private String dataSource; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditDeliveryNotice.java b/src/main/java/com/gxwebsoft/credit/entity/CreditDeliveryNotice.java new file mode 100644 index 0000000..e03a4a4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditDeliveryNotice.java @@ -0,0 +1,110 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 送达公告司法大数据 + * + * @author 科技小王子 + * @since 2025-12-19 19:49:51 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditDeliveryNotice对象", description = "送达公告司法大数据") +public class CreditDeliveryNotice implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "案由") + private String causeOfAction; + + @Schema(description = "当事人") + private String otherPartiesThirdParty; + + @Schema(description = "法院") + private String courtName; + + @Schema(description = "发布日期") + private String occurrenceTime; + + @Schema(description = "数据类型") + private String dataType; + + @Schema(description = "原告/上诉人") + private String plaintiffAppellant; + + @Schema(description = "被告/被上诉人") + private String appellee; + + @Schema(description = "涉案金额") + private String involvedAmount; + + @Schema(description = "数据状态") + private String dataStatus; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditExternal.java b/src/main/java/com/gxwebsoft/credit/entity/CreditExternal.java new file mode 100644 index 0000000..e95a42f --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditExternal.java @@ -0,0 +1,122 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 对外投资 + * + * @author 科技小王子 + * @since 2025-12-19 19:50:11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditExternal对象", description = "对外投资") +public class CreditExternal implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "被投资企业名称") + private String name; + + @Schema(description = "状态") + private String statusTxt; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "法定代表人") + private String legalRepresentative; + + @Schema(description = "注册资本(金额)") + private String registeredCapital; + + @Schema(description = "成立日期") + private String establishmentDate; + + @Schema(description = "持股比例") + private String shareholdingRatio; + + @Schema(description = "认缴出资额") + private String subscribedInvestmentAmount; + + @Schema(description = "认缴出资日期") + private String subscribedInvestmentDate; + + @Schema(description = "间接持股比例") + private String indirectShareholdingRatio; + + @Schema(description = "投资日期") + private String investmentDate; + + @Schema(description = "所属地区") + private String region; + + @Schema(description = "所属行业") + private String industry; + + @Schema(description = "投资数量") + private Integer investmentCount; + + @Schema(description = "关联产品/机构") + private String relatedProductsInstitutions; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditFinalVersion.java b/src/main/java/com/gxwebsoft/credit/entity/CreditFinalVersion.java new file mode 100644 index 0000000..868fb2c --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditFinalVersion.java @@ -0,0 +1,110 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 终本案件 + * + * @author 科技小王子 + * @since 2025-12-19 19:50:19 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditFinalVersion对象", description = "终本案件") +public class CreditFinalVersion implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "被执行人") + private String appellee; + + @Schema(description = "疑似申请执行人") + private String plaintiffAppellant; + + @Schema(description = "未履行金额(元)") + private String unfulfilledAmount; + + @Schema(description = "执行标的(元)") + private String involvedAmount; + + @Schema(description = "其他当事人/第三人") + private String otherPartiesThirdParty; + + @Schema(description = "执行法院") + private String courtName; + + @Schema(description = "立案日期") + private String occurrenceTime; + + @Schema(description = "终本日期") + private String finalDate; + + @Schema(description = "数据状态") + private String dataStatus; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditGqdj.java b/src/main/java/com/gxwebsoft/credit/entity/CreditGqdj.java new file mode 100644 index 0000000..9b3c7b9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditGqdj.java @@ -0,0 +1,110 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 股权冻结 + * + * @author 科技小王子 + * @since 2025-12-19 19:50:37 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditGqdj对象", description = "股权冻结") +public class CreditGqdj implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "执行通知文书号") + private String caseNumber;; + + @Schema(description = "被执行人") + private String appellee; + + @Schema(description = "冻结股权标的企业") + private String plaintiffAppellant; + + @Schema(description = "被执行人持有股权、其他投资权益数额") + private String involvedAmount; + + @Schema(description = "执行法院") + private String courtName; + + @Schema(description = "类型") + private String dataType; + + @Schema(description = "状态") + private String dataStatus; + + @Schema(description = "详情链接") + private String url; + + @Schema(description = "冻结日期自") + private String freezeDateStart; + + @Schema(description = "冻结日期至") + private String freezeDateEnd; + + @Schema(description = "公示日期") + private String publicDate; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditHistoricalLegalPerson.java b/src/main/java/com/gxwebsoft/credit/entity/CreditHistoricalLegalPerson.java new file mode 100644 index 0000000..f8557e2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditHistoricalLegalPerson.java @@ -0,0 +1,87 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 历史法定代表人 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditHistoricalLegalPerson对象", description = "历史法定代表人") +public class CreditHistoricalLegalPerson implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "名称") + private String name; + + @Schema(description = "任职日期") + private String registerDate; + + @Schema(description = "卸任日期") + private String publicDate; + + @Schema(description = "链接") + private String url; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "主体企业") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditJudgmentDebtor.java b/src/main/java/com/gxwebsoft/credit/entity/CreditJudgmentDebtor.java new file mode 100644 index 0000000..9e1e4fc --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditJudgmentDebtor.java @@ -0,0 +1,114 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +/** + * 被执行人 + * + * @author 科技小王子 + * @since 2025-12-19 19:50:55 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditJudgmentDebtor对象", description = "被执行人") +public class CreditJudgmentDebtor implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "被执行人名称") + private String name; + + @Schema(description = "被执行人") + private String name1; + + @Schema(description = "证件号/组织机构代码") + private String code; + + @Schema(description = "项目网址") + private String url; + + @Schema(description = "发生时间") + private String occurrenceTime; + + @Schema(description = "执行标的(元)") + private String amount; + + @Schema(description = "法院") + private String courtName; + + @Schema(description = "数据状态") + private String dataStatus; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "历史被执行人ID") + @TableField(exist = false) + private Integer historyId; + + @Schema(description = "历史被执行人名称") + @TableField(exist = false) + private String historyName; + + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditJudicialDocument.java b/src/main/java/com/gxwebsoft/credit/entity/CreditJudicialDocument.java new file mode 100644 index 0000000..0956b7e --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditJudicialDocument.java @@ -0,0 +1,116 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 裁判文书司法大数据 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:02 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditJudicialDocument对象", description = "裁判文书司法大数据") +public class CreditJudicialDocument implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "文书标题") + private String title; + + @Schema(description = "文书类型") + private String type; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "案由") + private String causeOfAction; + + @Schema(description = "当事人") + private String otherPartiesThirdParty; + + @Schema(description = "案件金额(元)") + private String involvedAmount; + + @Schema(description = "裁判结果") + private String defendantAppellee; + + @Schema(description = "裁判日期") + private String occurrenceTime; + + @Schema(description = "发布日期") + private String releaseDate; + + @Schema(description = "被告/被上诉人") + private String appellee; + + @Schema(description = "法院") + private String courtName; + + @Schema(description = "数据状态") + private String dataStatus; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditJudiciary.java b/src/main/java/com/gxwebsoft/credit/entity/CreditJudiciary.java new file mode 100644 index 0000000..7fcb938 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditJudiciary.java @@ -0,0 +1,130 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 司法案件 + * + * @author 科技小王子 + * @since 2025-12-16 15:23:58 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditJudiciary对象", description = "司法案件") +public class CreditJudiciary implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "案件名称") + private String name; + + @Schema(description = "案号") + private String code; + + @Schema(description = "详情链接") + private String url; + + @Schema(description = "类型, 0普通用户, 1招投标") + private Integer type; + + @Schema(description = "案由") + private String reason; + + @Schema(description = "上级id, 0是顶级") + private Integer parentId; + + @Schema(description = "案件类型") + private String infoType; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "案件进程") + private String caseProgress; + + @Schema(description = "案件身份") + private String caseIdentity; + + @Schema(description = "法院") + private String court; + + @Schema(description = "进程日期") + private String processDate; + + @Schema(description = "案件金额(元)") + private String caseAmount; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime expirationTime; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditMediation.java b/src/main/java/com/gxwebsoft/credit/entity/CreditMediation.java new file mode 100644 index 0000000..b7d2b42 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditMediation.java @@ -0,0 +1,114 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 诉前调解司法大数据 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditMediation对象", description = "诉前调解司法大数据") +public class CreditMediation implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "数据类型") + private String dataType; + + @Schema(description = "原告/上诉人") + private String plaintiffAppellant; + + @Schema(description = "被告/被上诉人") + private String appellee; + + @Schema(description = "其他当事人/第三人") + private String otherPartiesThirdParty; + + @Schema(description = "发生时间") + private String occurrenceTime; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "案由") + private String causeOfAction; + + @Schema(description = "涉案金额") + private String involvedAmount; + + @Schema(description = "法院") + private String courtName; + + @Schema(description = "数据状态") + private String dataStatus; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "发生时间") + @TableField(exist = false) + private String occurrenceTime2; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditNearbyCompany.java b/src/main/java/com/gxwebsoft/credit/entity/CreditNearbyCompany.java new file mode 100644 index 0000000..6c844eb --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditNearbyCompany.java @@ -0,0 +1,234 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 附近企业 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditNearbyCompany对象", description = "附近企业") +public class CreditNearbyCompany implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "企业名称") + private String name; + + @Schema(description = "登记状态") + private String registrationStatus; + + @Schema(description = "法定代表人") + private String legalPerson; + + @Schema(description = "注册资本") + private String registeredCapital; + + @Schema(description = "成立日期") + private String establishDate; + + @Schema(description = "统一社会信用代码") + private String code; + + @Schema(description = "注册地址") + private String address; + + @Schema(description = "注册地址邮编") + private String postalCode; + + @Schema(description = "有效手机号") + private String phone; + + @Schema(description = "更多电话") + private String moreTel; + + @Schema(description = "邮箱") + private String email; + + @Schema(description = "邮箱") + private String moreEmail; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所属省份") + private String province; + + @Schema(description = "所属城市") + private String city; + + @Schema(description = "所属区县") + private String region; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "主体企业") + @TableField(exist = false) + private String companyName; + + @Schema(description = "纳税人识别号") + private String taxpayerCode; + + @Schema(description = "注册号") + private String registrationNumber; + + @Schema(description = "组织机构代码") + private String organizationalCode; + + @Schema(description = "参保人数") + private String numberOfInsuredPersons; + + @Schema(description = "参保人数所属年报") + private String annualReport; + + @Schema(description = "企业(机构)类型") + private String institutionType; + + @Schema(description = "企业规模") + private String companySize; + + @Schema(description = "营业期限") + private String businessTerm; + + @Schema(description = "国标行业门类") + private String nationalStandardIndustryCategories; + + @Schema(description = "国标行业大类") + private String nationalStandardIndustryCategories2; + + @Schema(description = "国标行业中类") + private String nationalStandardIndustryCategories3; + + @Schema(description = "国标行业小类") + private String nationalStandardIndustryCategories4; + + @Schema(description = "曾用名") + private String formerName; + + @Schema(description = "英文名") + private String englishName; + + @Schema(description = "官网网址") + private String domain; + + @Schema(description = "通信地址") + private String mailingAddress; + + @Schema(description = "通信地址邮箱") + private String mailingEmail; + + @Schema(description = "企业简介") + private String companyProfile; + + @Schema(description = "经营范围") + private String natureOfBusiness; + + @Schema(description = "电话") + private String tel; + + @Schema(description = "企查查行业门类") + private String nationalStandardIndustryCategories5; + + @Schema(description = "企查查行业大类") + private String nationalStandardIndustryCategories6; + + @Schema(description = "企查查行业中类") + private String nationalStandardIndustryCategories7; + + @Schema(description = "企查查行业小类") + private String nationalStandardIndustryCategories8; + + @Schema(description = "链接") + private String url; + + @Schema(description = "类型") + private Integer type; + + @Schema(description = "上级id, 0是顶级") + private Integer parentId; + + @Schema(description = "实缴资本") + private String paidinCapital; + + @Schema(description = "登记机关") + private String registrationAuthority; + + @Schema(description = "纳税人资质") + private String taxpayerQualification; + + @Schema(description = "最新年报年份") + private String latestAnnualReportYear; + + @Schema(description = "最新年报营业收入") + private String latestAnnualReportOnOperatingRevenue; + + @Schema(description = "企查分") + private String enterpriseScoreCheck; + + @Schema(description = "信用等级") + private String creditRating; + + @Schema(description = "科创分") + private String cechnologyScore; + + @Schema(description = "科创等级") + private String cechnologyLevel; + + @Schema(description = "是否小微企业") + private String smallEnterprise; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditPatent.java b/src/main/java/com/gxwebsoft/credit/entity/CreditPatent.java new file mode 100644 index 0000000..a45177b --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditPatent.java @@ -0,0 +1,105 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 专利 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditPatent对象", description = "专利") +public class CreditPatent implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "发明名称") + private String name; + + @Schema(description = "专利类型") + private String type; + + @Schema(description = "法律状态") + private String statusText; + + @Schema(description = "申请号") + private String registerNo; + + @Schema(description = "申请日") + private String registerDate; + + @Schema(description = "公开(公告)号") + private String publicNo; + + @Schema(description = "公开(公告)日期") + private String publicDate; + + @Schema(description = "发明人") + private String inventor; + + @Schema(description = "申请(专利权)人") + private String patentApplicant; + + @Schema(description = "链接") + private String url; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "主体企业") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditRiskRelation.java b/src/main/java/com/gxwebsoft/credit/entity/CreditRiskRelation.java new file mode 100644 index 0000000..1d75ff2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditRiskRelation.java @@ -0,0 +1,94 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * 风险关系表 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:40 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditRiskRelation对象", description = "风险关系表") +public class CreditRiskRelation implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "序号") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "主体名称") + private String mainBodyName; + + @Schema(description = "登记状态") + private String registrationStatus; + + @Schema(description = "注册资本") + private String registeredCapital; + + @Schema(description = "省份地区") + private String provinceRegion; + + @Schema(description = "关联关系") + private String associatedRelation; + + @Schema(description = "风险关系") + private String riskRelation; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditSupplier.java b/src/main/java/com/gxwebsoft/credit/entity/CreditSupplier.java new file mode 100644 index 0000000..ceb4ff0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditSupplier.java @@ -0,0 +1,95 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 供应商 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:47 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditSupplier对象", description = "供应商") +public class CreditSupplier implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "供应商") + private String supplier; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "状态") + private String statusTxt; + + @Schema(description = "采购金额(万元)") + private String purchaseAmount; + + @Schema(description = "公开日期") + private String publicDate; + + @Schema(description = "数据来源") + private String dataSource; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditSuspectedRelationship.java b/src/main/java/com/gxwebsoft/credit/entity/CreditSuspectedRelationship.java new file mode 100644 index 0000000..41898c8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditSuspectedRelationship.java @@ -0,0 +1,102 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 疑似关系 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditSuspectedRelationship对象", description = "疑似关系") +public class CreditSuspectedRelationship implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "企业名称") + private String name; + + @Schema(description = "状态") + private String statusText; + + @Schema(description = "法定代表人") + private String legalPerson; + + @Schema(description = "注册资本") + private String registeredCapital; + + @Schema(description = "成立日期") + private String createDate; + + @Schema(description = "关联方") + private String relatedParty; + + @Schema(description = "疑似关系类型") + private String type; + + @Schema(description = "疑似关系详情") + private String detail; + + @Schema(description = "链接") + private String url; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "主体企业") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditUser.java b/src/main/java/com/gxwebsoft/credit/entity/CreditUser.java new file mode 100644 index 0000000..1407eb1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditUser.java @@ -0,0 +1,122 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 招投标信息表 + * + * @author 科技小王子 + * @since 2025-12-15 13:16:03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditUser对象", description = "招投标信息表") +public class CreditUser implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "项目名称") + private String name; + + @Schema(description = "项目网址") + private String url; + + @Schema(description = "唯一标识") + private String code; + + @Schema(description = "类型, 0普通用户, 1招投标") + private Integer type; + + @Schema(description = "企业角色") + private String role; + + @Schema(description = "上级id, 0是顶级") + private Integer parentId; + + @Schema(description = "信息类型") + private String infoType; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "招采单位") + private String procurementName; + + @Schema(description = "中标单位") + private String winningName; + + @Schema(description = "中标金额") + private String winningPrice; + + @Schema(description = "发布日期") + private String releaseDate; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/entity/CreditXgxf.java b/src/main/java/com/gxwebsoft/credit/entity/CreditXgxf.java new file mode 100644 index 0000000..4859bd8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/entity/CreditXgxf.java @@ -0,0 +1,122 @@ +package com.gxwebsoft.credit.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 限制高消费 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:55 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "CreditXgxf对象", description = "限制高消费") +public class CreditXgxf implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "数据类型") + private String type; + + @Schema(description = "限消令对象") + private String dataType; + + @Schema(description = "限制法定代表人") + private String plaintiffAppellant; + + @Schema(description = "申请人") + private String appellee; + + @Schema(description = "原告/上诉人") + private String plaintiffUser; + + @Schema(description = "被告/被上诉人") + private String defendantUser; + + @Schema(description = "涉案金额(元)") + private String involvedAmount; + + @Schema(description = "立案日期") + private String occurrenceTime; + + @Schema(description = "执行法院") + private String courtName; + + @Schema(description = "发布日期") + private String releaseDate; + + @Schema(description = "其他当事人/第三人") + private String otherPartiesThirdParty; + + @Schema(description = "案由") + private String causeOfAction; + + @Schema(description = "数据状态") + private String dataStatus; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "是否有数据") + private Boolean hasData; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditAdministrativeLicenseMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditAdministrativeLicenseMapper.java new file mode 100644 index 0000000..7f81ff0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditAdministrativeLicenseMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditAdministrativeLicense; +import com.gxwebsoft.credit.param.CreditAdministrativeLicenseParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 行政许可Mapper + * + * @author 科技小王子 + * @since 2026-01-07 13:52:13 + */ +public interface CreditAdministrativeLicenseMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditAdministrativeLicenseParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditAdministrativeLicenseParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditBankruptcyMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditBankruptcyMapper.java new file mode 100644 index 0000000..50ed5b5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditBankruptcyMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditBankruptcy; +import com.gxwebsoft.credit.param.CreditBankruptcyParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 破产重整Mapper + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +public interface CreditBankruptcyMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditBankruptcyParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditBankruptcyParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditBranchMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditBranchMapper.java new file mode 100644 index 0000000..3f4877c --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditBranchMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditBranch; +import com.gxwebsoft.credit.param.CreditBranchParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 分支机构Mapper + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +public interface CreditBranchMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditBranchParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditBranchParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditBreachOfTrustMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditBreachOfTrustMapper.java new file mode 100644 index 0000000..70da1c3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditBreachOfTrustMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditBreachOfTrust; +import com.gxwebsoft.credit.param.CreditBreachOfTrustParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 失信被执行人Mapper + * + * @author 科技小王子 + * @since 2025-12-19 19:46:14 + */ +public interface CreditBreachOfTrustMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditBreachOfTrustParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditBreachOfTrustParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditCaseFilingMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditCaseFilingMapper.java new file mode 100644 index 0000000..8bfd804 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditCaseFilingMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditCaseFiling; +import com.gxwebsoft.credit.param.CreditCaseFilingParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 司法大数据Mapper + * + * @author 科技小王子 + * @since 2025-12-19 19:47:22 + */ +public interface CreditCaseFilingMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditCaseFilingParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditCaseFilingParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditCompanyMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditCompanyMapper.java new file mode 100644 index 0000000..bbd7c01 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditCompanyMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditCompany; +import com.gxwebsoft.credit.param.CreditCompanyParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 企业Mapper + * + * @author 科技小王子 + * @since 2025-12-17 08:28:03 + */ +public interface CreditCompanyMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditCompanyParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditCompanyParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditCompetitorMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditCompetitorMapper.java new file mode 100644 index 0000000..fad9fa7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditCompetitorMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditCompetitor; +import com.gxwebsoft.credit.param.CreditCompetitorParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 竞争对手Mapper + * + * @author 科技小王子 + * @since 2025-12-19 19:49:04 + */ +public interface CreditCompetitorMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditCompetitorParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditCompetitorParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditCourtAnnouncementMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditCourtAnnouncementMapper.java new file mode 100644 index 0000000..5c6eb80 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditCourtAnnouncementMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditCourtAnnouncement; +import com.gxwebsoft.credit.param.CreditCourtAnnouncementParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 法院公告司法大数据Mapper + * + * @author 科技小王子 + * @since 2025-12-19 19:49:13 + */ +public interface CreditCourtAnnouncementMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditCourtAnnouncementParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditCourtAnnouncementParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditCourtSessionMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditCourtSessionMapper.java new file mode 100644 index 0000000..c9dd2e1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditCourtSessionMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditCourtSession; +import com.gxwebsoft.credit.param.CreditCourtSessionParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 开庭公告司法大数据Mapper + * + * @author 科技小王子 + * @since 2025-12-19 19:49:32 + */ +public interface CreditCourtSessionMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditCourtSessionParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditCourtSessionParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditCustomerMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditCustomerMapper.java new file mode 100644 index 0000000..6866565 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditCustomerMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditCustomer; +import com.gxwebsoft.credit.param.CreditCustomerParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 客户Mapper + * + * @author 科技小王子 + * @since 2025-12-21 21:20:58 + */ +public interface CreditCustomerMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditCustomerParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditCustomerParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditDeliveryNoticeMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditDeliveryNoticeMapper.java new file mode 100644 index 0000000..66ce505 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditDeliveryNoticeMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditDeliveryNotice; +import com.gxwebsoft.credit.param.CreditDeliveryNoticeParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 送达公告司法大数据Mapper + * + * @author 科技小王子 + * @since 2025-12-19 19:49:51 + */ +public interface CreditDeliveryNoticeMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditDeliveryNoticeParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditDeliveryNoticeParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditExternalMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditExternalMapper.java new file mode 100644 index 0000000..de61c9f --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditExternalMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditExternal; +import com.gxwebsoft.credit.param.CreditExternalParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 对外投资Mapper + * + * @author 科技小王子 + * @since 2025-12-19 19:50:11 + */ +public interface CreditExternalMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditExternalParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditExternalParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditFinalVersionMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditFinalVersionMapper.java new file mode 100644 index 0000000..dd4ef4a --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditFinalVersionMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditFinalVersion; +import com.gxwebsoft.credit.param.CreditFinalVersionParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 终本案件Mapper + * + * @author 科技小王子 + * @since 2025-12-19 19:50:19 + */ +public interface CreditFinalVersionMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditFinalVersionParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditFinalVersionParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditGqdjMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditGqdjMapper.java new file mode 100644 index 0000000..6cc6df7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditGqdjMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditGqdj; +import com.gxwebsoft.credit.param.CreditGqdjParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 股权冻结Mapper + * + * @author 科技小王子 + * @since 2025-12-19 19:50:37 + */ +public interface CreditGqdjMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditGqdjParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditGqdjParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditHistoricalLegalPersonMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditHistoricalLegalPersonMapper.java new file mode 100644 index 0000000..d13adee --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditHistoricalLegalPersonMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditHistoricalLegalPerson; +import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 历史法定代表人Mapper + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +public interface CreditHistoricalLegalPersonMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditHistoricalLegalPersonParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditHistoricalLegalPersonParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditJudgmentDebtorMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditJudgmentDebtorMapper.java new file mode 100644 index 0000000..13ef10f --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditJudgmentDebtorMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditJudgmentDebtor; +import com.gxwebsoft.credit.param.CreditJudgmentDebtorParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 被执行人Mapper + * + * @author 科技小王子 + * @since 2025-12-19 19:50:55 + */ +public interface CreditJudgmentDebtorMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditJudgmentDebtorParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditJudgmentDebtorParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditJudicialDocumentMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditJudicialDocumentMapper.java new file mode 100644 index 0000000..46356c6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditJudicialDocumentMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditJudicialDocument; +import com.gxwebsoft.credit.param.CreditJudicialDocumentParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 裁判文书司法大数据Mapper + * + * @author 科技小王子 + * @since 2025-12-19 19:51:02 + */ +public interface CreditJudicialDocumentMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditJudicialDocumentParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditJudicialDocumentParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditJudiciaryMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditJudiciaryMapper.java new file mode 100644 index 0000000..85c3efa --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditJudiciaryMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditJudiciary; +import com.gxwebsoft.credit.param.CreditJudiciaryParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 司法案件Mapper + * + * @author 科技小王子 + * @since 2025-12-16 15:23:58 + */ +public interface CreditJudiciaryMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditJudiciaryParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditJudiciaryParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditMediationMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditMediationMapper.java new file mode 100644 index 0000000..f46225b --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditMediationMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditMediation; +import com.gxwebsoft.credit.param.CreditMediationParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 诉前调解司法大数据Mapper + * + * @author 科技小王子 + * @since 2025-12-19 19:51:25 + */ +public interface CreditMediationMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditMediationParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditMediationParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditNearbyCompanyMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditNearbyCompanyMapper.java new file mode 100644 index 0000000..c557744 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditNearbyCompanyMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditNearbyCompany; +import com.gxwebsoft.credit.param.CreditNearbyCompanyParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 附近企业Mapper + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +public interface CreditNearbyCompanyMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditNearbyCompanyParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditNearbyCompanyParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditPatentMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditPatentMapper.java new file mode 100644 index 0000000..bb5628a --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditPatentMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditPatent; +import com.gxwebsoft.credit.param.CreditPatentParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 专利Mapper + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +public interface CreditPatentMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditPatentParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditPatentParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditRiskRelationMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditRiskRelationMapper.java new file mode 100644 index 0000000..077c758 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditRiskRelationMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditRiskRelation; +import com.gxwebsoft.credit.param.CreditRiskRelationParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 风险关系表Mapper + * + * @author 科技小王子 + * @since 2025-12-19 19:51:40 + */ +public interface CreditRiskRelationMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditRiskRelationParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditRiskRelationParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditSupplierMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditSupplierMapper.java new file mode 100644 index 0000000..fd6d687 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditSupplierMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditSupplier; +import com.gxwebsoft.credit.param.CreditSupplierParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 供应商Mapper + * + * @author 科技小王子 + * @since 2025-12-19 19:51:47 + */ +public interface CreditSupplierMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditSupplierParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditSupplierParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditSuspectedRelationshipMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditSuspectedRelationshipMapper.java new file mode 100644 index 0000000..4e05d9c --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditSuspectedRelationshipMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditSuspectedRelationship; +import com.gxwebsoft.credit.param.CreditSuspectedRelationshipParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 疑似关系Mapper + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +public interface CreditSuspectedRelationshipMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditSuspectedRelationshipParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditSuspectedRelationshipParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditUserMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditUserMapper.java new file mode 100644 index 0000000..dd1372c --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditUserMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditUser; +import com.gxwebsoft.credit.param.CreditUserParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 招投标信息表Mapper + * + * @author 科技小王子 + * @since 2025-12-15 13:16:03 + */ +public interface CreditUserMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditUserParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditUserParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/CreditXgxfMapper.java b/src/main/java/com/gxwebsoft/credit/mapper/CreditXgxfMapper.java new file mode 100644 index 0000000..c63d8f5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/CreditXgxfMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.credit.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.credit.entity.CreditXgxf; +import com.gxwebsoft.credit.param.CreditXgxfParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 限制高消费Mapper + * + * @author 科技小王子 + * @since 2025-12-19 19:51:55 + */ +public interface CreditXgxfMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") CreditXgxfParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") CreditXgxfParam param); + +} diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditAdministrativeLicenseMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditAdministrativeLicenseMapper.xml new file mode 100644 index 0000000..68cfa78 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditAdministrativeLicenseMapper.xml @@ -0,0 +1,94 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_administrative_license a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.status_text LIKE CONCAT('%', #{param.statusText}, '%') + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.url LIKE CONCAT('%', #{param.url}, '%') + + + AND a.validity_start LIKE CONCAT('%', #{param.validityStart}, '%') + + + AND a.validity_end LIKE CONCAT('%', #{param.validityEnd}, '%') + + + AND a.licensing_authority LIKE CONCAT('%', #{param.licensingAuthority}, '%') + + + AND a.License_content LIKE CONCAT('%', #{param.licenseContent}, '%') + + + AND a.data_source_unit LIKE CONCAT('%', #{param.dataSourceUnit}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.company_id = #{param.companyId} + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.code LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBankruptcyMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBankruptcyMapper.xml new file mode 100644 index 0000000..4015535 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBankruptcyMapper.xml @@ -0,0 +1,83 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_bankruptcy a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + + AND a.id = #{param.id} + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.party LIKE CONCAT('%', #{param.party}, '%') + + + AND a.url LIKE CONCAT('%', #{param.url}, '%') + + + AND a.court LIKE CONCAT('%', #{param.court}, '%') + + + AND a.public_date LIKE CONCAT('%', #{param.publicDate}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.company_id = #{param.companyId} + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.code LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBranchMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBranchMapper.xml new file mode 100644 index 0000000..d5e33ea --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBranchMapper.xml @@ -0,0 +1,83 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_branch a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.curator LIKE CONCAT('%', #{param.curator}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.url LIKE CONCAT('%', #{param.url}, '%') + + + AND a.establish_date LIKE CONCAT('%', #{param.establishDate}, '%') + + + AND a.status_text LIKE CONCAT('%', #{param.statusText}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.company_id = #{param.companyId} + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.curator LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBreachOfTrustMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBreachOfTrustMapper.xml new file mode 100644 index 0000000..e82aa24 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditBreachOfTrustMapper.xml @@ -0,0 +1,83 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_breach_of_trust a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.plaintiff_appellant LIKE CONCAT('%', #{param.plaintiffAppellant}, '%') + + + AND a.appellee LIKE CONCAT('%', #{param.appellee}, '%') + + + AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') + + + AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') + + + AND a.involved_amount = #{param.involvedAmount} + + + AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.case_number = #{param.keywords} + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.case_number LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCaseFilingMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCaseFilingMapper.xml new file mode 100644 index 0000000..b0e4a32 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCaseFilingMapper.xml @@ -0,0 +1,94 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_case_filing a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.data_type LIKE CONCAT('%', #{param.dataType}, '%') + + + AND a.plaintiff_appellant LIKE CONCAT('%', #{param.plaintiffAppellant}, '%') + + + AND a.appellee LIKE CONCAT('%', #{param.appellee}, '%') + + + AND a.other_parties_third_party LIKE CONCAT('%', #{param.otherPartiesThirdParty}, '%') + + + AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') + + + AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') + + + AND a.cause_of_action LIKE CONCAT('%', #{param.causeOfAction}, '%') + + + AND a.involved_amount = #{param.involvedAmount} + + + AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') + + + AND a.data_status LIKE CONCAT('%', #{param.dataStatus}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.case_number LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCompanyMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCompanyMapper.xml new file mode 100644 index 0000000..ef07f47 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCompanyMapper.xml @@ -0,0 +1,210 @@ + + + + + + + SELECT a.*, u.real_name AS realName + FROM credit_company a + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.match_name LIKE CONCAT('%', #{param.matchName}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.type = #{param.type} + + + AND a.parent_id = #{param.parentId} + + + AND a.registration_status LIKE CONCAT('%', #{param.registrationStatus}, '%') + + + AND a.legal_person LIKE CONCAT('%', #{param.legalPerson}, '%') + + + AND a.registered_capital LIKE CONCAT('%', #{param.registeredCapital}, '%') + + + AND a.paidin_capital LIKE CONCAT('%', #{param.paidinCapital}, '%') + + + AND a.establish_date LIKE CONCAT('%', #{param.establishDate}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.tel LIKE CONCAT('%', #{param.tel}, '%') + + + AND a.more_tel LIKE CONCAT('%', #{param.moreTel}, '%') + + + AND a.email LIKE CONCAT('%', #{param.email}, '%') + + + AND a.more_email LIKE CONCAT('%', #{param.moreEmail}, '%') + + + AND a.country LIKE CONCAT('%', #{param.country}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.institution_type LIKE CONCAT('%', #{param.institutionType}, '%') + + + AND a.taxpayer_code LIKE CONCAT('%', #{param.taxpayerCode}, '%') + + + AND a.registration_number LIKE CONCAT('%', #{param.registrationNumber}, '%') + + + AND a.organizational_code LIKE CONCAT('%', #{param.organizationalCode}, '%') + + + AND a.number_of_insured_persons LIKE CONCAT('%', #{param.numberOfInsuredPersons}, '%') + + + AND a.annual_report LIKE CONCAT('%', #{param.annualReport}, '%') + + + AND a.business_term LIKE CONCAT('%', #{param.businessTerm}, '%') + + + AND a.national_standard_industry_categories LIKE CONCAT('%', #{param.nationalStandardIndustryCategories}, '%') + + + AND a.national_standard_industry_categories2 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories2}, '%') + + + AND a.national_standard_industry_categories3 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories3}, '%') + + + AND a.national_standard_industry_categories4 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories4}, '%') + + + AND a.national_standard_industry_categories5 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories5}, '%') + + + AND a.national_standard_industry_categories6 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories6}, '%') + + + AND a.national_standard_industry_categories7 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories7}, '%') + + + AND a.national_standard_industry_categories8 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories8}, '%') + + + AND a.company_size LIKE CONCAT('%', #{param.companySize}, '%') + + + AND a.former_name LIKE CONCAT('%', #{param.formerName}, '%') + + + AND a.english_name LIKE CONCAT('%', #{param.englishName}, '%') + + + AND a.domain LIKE CONCAT('%', #{param.domain}, '%') + + + AND a.mailing_address LIKE CONCAT('%', #{param.mailingAddress}, '%') + + + AND a.company_profile LIKE CONCAT('%', #{param.companyProfile}, '%') + + + AND a.nature_of_business LIKE CONCAT('%', #{param.natureOfBusiness}, '%') + + + AND a.registration_authority LIKE CONCAT('%', #{param.registrationAuthority}, '%') + + + AND a.taxpayer_qualification LIKE CONCAT('%', #{param.taxpayerQualification}, '%') + + + AND a.latest_annual_report_year LIKE CONCAT('%', #{param.latestAnnualReportYear}, '%') + + + AND a.latest_annual_report_on_operating_revenue LIKE CONCAT('%', #{param.latestAnnualReportOnOperatingRevenue}, '%') + + + AND a.enterprise_score_check LIKE CONCAT('%', #{param.enterpriseScoreCheck}, '%') + + + AND a.credit_rating LIKE CONCAT('%', #{param.creditRating}, '%') + + + AND a.cechnology_score LIKE CONCAT('%', #{param.cechnologyScore}, '%') + + + AND a.cechnology_level LIKE CONCAT('%', #{param.cechnologyLevel}, '%') + + + AND a.small_enterprise LIKE CONCAT('%', #{param.smallEnterprise}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.match_name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.code = #{param.keywords} + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCompetitorMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCompetitorMapper.xml new file mode 100644 index 0000000..744416b --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCompetitorMapper.xml @@ -0,0 +1,85 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_competitor a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.legal_representative LIKE CONCAT('%', #{param.legalRepresentative}, '%') + + + AND a.registered_capital = #{param.registeredCapital} + + + AND a.establishment_date LIKE CONCAT('%', #{param.establishmentDate}, '%') + + + AND a.registration_status LIKE CONCAT('%', #{param.registrationStatus}, '%') + + + AND a.industry LIKE CONCAT('%', #{param.industry}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.name LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCourtAnnouncementMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCourtAnnouncementMapper.xml new file mode 100644 index 0000000..6877424 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCourtAnnouncementMapper.xml @@ -0,0 +1,94 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_court_announcement a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.data_type LIKE CONCAT('%', #{param.dataType}, '%') + + + AND a.plaintiff_appellant LIKE CONCAT('%', #{param.plaintiffAppellant}, '%') + + + AND a.appellee LIKE CONCAT('%', #{param.appellee}, '%') + + + AND a.other_parties_third_party LIKE CONCAT('%', #{param.otherPartiesThirdParty}, '%') + + + AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') + + + AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') + + + AND a.cause_of_action LIKE CONCAT('%', #{param.causeOfAction}, '%') + + + AND a.involved_amount = #{param.involvedAmount} + + + AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') + + + AND a.data_status LIKE CONCAT('%', #{param.dataStatus}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.case_number LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCourtSessionMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCourtSessionMapper.xml new file mode 100644 index 0000000..41c0cec --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCourtSessionMapper.xml @@ -0,0 +1,94 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_court_session a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.data_type LIKE CONCAT('%', #{param.dataType}, '%') + + + AND a.plaintiff_appellant LIKE CONCAT('%', #{param.plaintiffAppellant}, '%') + + + AND a.appellee LIKE CONCAT('%', #{param.appellee}, '%') + + + AND a.other_parties_third_party LIKE CONCAT('%', #{param.otherPartiesThirdParty}, '%') + + + AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') + + + AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') + + + AND a.cause_of_action LIKE CONCAT('%', #{param.causeOfAction}, '%') + + + AND a.involved_amount = #{param.involvedAmount} + + + AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') + + + AND a.data_status LIKE CONCAT('%', #{param.dataStatus}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.case_number LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCustomerMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCustomerMapper.xml new file mode 100644 index 0000000..cf00890 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditCustomerMapper.xml @@ -0,0 +1,79 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_customer a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.status_txt LIKE CONCAT('%', #{param.statusTxt}, '%') + + + AND a.price = #{param.price} + + + AND a.public_date LIKE CONCAT('%', #{param.publicDate}, '%') + + + AND a.data_source LIKE CONCAT('%', #{param.dataSource}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditDeliveryNoticeMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditDeliveryNoticeMapper.xml new file mode 100644 index 0000000..cb22c50 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditDeliveryNoticeMapper.xml @@ -0,0 +1,79 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_delivery_notice a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.other_parties_third_party LIKE CONCAT('%', #{param.otherPartiesThirdParty}, '%') + + + AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') + + + AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') + + + AND a.cause_of_action LIKE CONCAT('%', #{param.causeOfAction}, '%') + + + AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.case_number LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditExternalMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditExternalMapper.xml new file mode 100644 index 0000000..94e2362 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditExternalMapper.xml @@ -0,0 +1,106 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_external a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.status_txt LIKE CONCAT('%', #{param.statusTxt}, '%') + + + AND a.legal_representative LIKE CONCAT('%', #{param.legalRepresentative}, '%') + + + AND a.registered_capital = #{param.registeredCapital} + + + AND a.establishment_date LIKE CONCAT('%', #{param.establishmentDate}, '%') + + + AND a.shareholding_ratio = #{param.shareholdingRatio} + + + AND a.subscribed_investment_amount = #{param.subscribedInvestmentAmount} + + + AND a.subscribed_investment_date LIKE CONCAT('%', #{param.subscribedInvestmentDate}, '%') + + + AND a.indirect_shareholding_ratio = #{param.indirectShareholdingRatio} + + + AND a.investment_date LIKE CONCAT('%', #{param.investmentDate}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.industry LIKE CONCAT('%', #{param.industry}, '%') + + + AND a.investment_count = #{param.investmentCount} + + + AND a.related_products_institutions LIKE CONCAT('%', #{param.relatedProductsInstitutions}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.name LIKE CONCAT('%', #{param.name}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditFinalVersionMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditFinalVersionMapper.xml new file mode 100644 index 0000000..630e357 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditFinalVersionMapper.xml @@ -0,0 +1,82 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_final_version a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.plaintiff_appellant LIKE CONCAT('%', #{param.plaintiffAppellant}, '%') + + + AND a.appellee LIKE CONCAT('%', #{param.appellee}, '%') + + + AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') + + + AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') + + + AND a.involved_amount = #{param.involvedAmount} + + + AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.case_number = #{param.keywords} + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditGqdjMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditGqdjMapper.xml new file mode 100644 index 0000000..6c90a51 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditGqdjMapper.xml @@ -0,0 +1,85 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_gqdj a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.data_type LIKE CONCAT('%', #{param.dataType}, '%') + + + AND a.plaintiff_appellant LIKE CONCAT('%', #{param.plaintiffAppellant}, '%') + + + AND a.appellee LIKE CONCAT('%', #{param.appellee}, '%') + + + AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') + + + AND a.involved_amount = #{param.involvedAmount} + + + AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') + + + AND a.data_status LIKE CONCAT('%', #{param.dataStatus}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.case_number = #{param.keywords} + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditHistoricalLegalPersonMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditHistoricalLegalPersonMapper.xml new file mode 100644 index 0000000..2d25fd4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditHistoricalLegalPersonMapper.xml @@ -0,0 +1,76 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_historical_legal_person a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.register_date LIKE CONCAT('%', #{param.registerDate}, '%') + + + AND a.public_date LIKE CONCAT('%', #{param.publicDate}, '%') + + + AND a.url LIKE CONCAT('%', #{param.url}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.company_id = #{param.companyId} + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudgmentDebtorMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudgmentDebtorMapper.xml new file mode 100644 index 0000000..c03a9ee --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudgmentDebtorMapper.xml @@ -0,0 +1,86 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_judgment_debtor a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') + + + AND a.amount = #{param.amount} + + + AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') + + + AND a.data_status LIKE CONCAT('%', #{param.dataStatus}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.case_number = #{param.keywords} + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.case_number LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudicialDocumentMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudicialDocumentMapper.xml new file mode 100644 index 0000000..8f2521c --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudicialDocumentMapper.xml @@ -0,0 +1,82 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_judicial_document a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.other_parties_third_party LIKE CONCAT('%', #{param.otherPartiesThirdParty}, '%') + + + AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') + + + AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') + + + AND a.cause_of_action LIKE CONCAT('%', #{param.causeOfAction}, '%') + + + AND a.involved_amount = #{param.involvedAmount} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.case_number LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudiciaryMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudiciaryMapper.xml new file mode 100644 index 0000000..9b69e2f --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditJudiciaryMapper.xml @@ -0,0 +1,115 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_judiciary a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.type = #{param.type} + + + AND a.reason LIKE CONCAT('%', #{param.reason}, '%') + + + AND a.parent_id = #{param.parentId} + + + AND a.info_type LIKE CONCAT('%', #{param.infoType}, '%') + + + AND a.country LIKE CONCAT('%', #{param.country}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.case_progress LIKE CONCAT('%', #{param.caseProgress}, '%') + + + AND a.case_identity LIKE CONCAT('%', #{param.caseIdentity}, '%') + + + AND a.court LIKE CONCAT('%', #{param.court}, '%') + + + AND a.process_date LIKE CONCAT('%', #{param.processDate}, '%') + + + AND a.case_amount LIKE CONCAT('%', #{param.caseAmount}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.name LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.code LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditMediationMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditMediationMapper.xml new file mode 100644 index 0000000..b08bec6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditMediationMapper.xml @@ -0,0 +1,94 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_mediation a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.data_type LIKE CONCAT('%', #{param.dataType}, '%') + + + AND a.plaintiff_appellant LIKE CONCAT('%', #{param.plaintiffAppellant}, '%') + + + AND a.appellee LIKE CONCAT('%', #{param.appellee}, '%') + + + AND a.other_parties_third_party LIKE CONCAT('%', #{param.otherPartiesThirdParty}, '%') + + + AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') + + + AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') + + + AND a.cause_of_action LIKE CONCAT('%', #{param.causeOfAction}, '%') + + + AND a.involved_amount = #{param.involvedAmount} + + + AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') + + + AND a.data_status LIKE CONCAT('%', #{param.dataStatus}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.case_number LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditNearbyCompanyMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditNearbyCompanyMapper.xml new file mode 100644 index 0000000..c461f3e --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditNearbyCompanyMapper.xml @@ -0,0 +1,223 @@ + + + + + + + SELECT a.*,b.name AS companyName, u.real_name AS realName + FROM credit_nearby_company a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.company_id = #{param.companyId} + + + AND a.registration_status LIKE CONCAT('%', #{param.registrationStatus}, '%') + + + AND a.legal_person LIKE CONCAT('%', #{param.legalPerson}, '%') + + + AND a.registered_capital LIKE CONCAT('%', #{param.registeredCapital}, '%') + + + AND a.establish_date LIKE CONCAT('%', #{param.establishDate}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.postal_code LIKE CONCAT('%', #{param.postalCode}, '%') + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.more_tel LIKE CONCAT('%', #{param.moreTel}, '%') + + + AND a.email LIKE CONCAT('%', #{param.email}, '%') + + + AND a.more_email LIKE CONCAT('%', #{param.moreEmail}, '%') + + + AND a.country LIKE CONCAT('%', #{param.country}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + + + + AND a.registration_number LIKE CONCAT('%', #{param.registrationNumber}, '%') + + + AND a.organizational_code LIKE CONCAT('%', #{param.organizationalCode}, '%') + + + AND a.number_of_insured_persons LIKE CONCAT('%', #{param.numberOfInsuredPersons}, '%') + + + AND a.annual_report LIKE CONCAT('%', #{param.annualReport}, '%') + + + AND a.institution_type LIKE CONCAT('%', #{param.institutionType}, '%') + + + AND a.company_size LIKE CONCAT('%', #{param.companySize}, '%') + + + AND a.business_term LIKE CONCAT('%', #{param.businessTerm}, '%') + + + AND a.national_standard_industry_categories LIKE CONCAT('%', #{param.nationalStandardIndustryCategories}, '%') + + + AND a.national_standard_industry_categories2 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories2}, '%') + + + AND a.national_standard_industry_categories3 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories3}, '%') + + + AND a.national_standard_industry_categories4 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories4}, '%') + + + AND a.former_name LIKE CONCAT('%', #{param.formerName}, '%') + + + AND a.english_name LIKE CONCAT('%', #{param.englishName}, '%') + + + AND a.domain LIKE CONCAT('%', #{param.domain}, '%') + + + AND a.mailing_address LIKE CONCAT('%', #{param.mailingAddress}, '%') + + + AND a.mailing_email LIKE CONCAT('%', #{param.mailingEmail}, '%') + + + AND a.company_profile LIKE CONCAT('%', #{param.companyProfile}, '%') + + + AND a.nature_of_business LIKE CONCAT('%', #{param.natureOfBusiness}, '%') + + + AND a.tel LIKE CONCAT('%', #{param.tel}, '%') + + + AND a.national_standard_industry_categories5 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories5}, '%') + + + AND a.national_standard_industry_categories6 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories6}, '%') + + + AND a.national_standard_industry_categories7 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories7}, '%') + + + AND a.national_standard_industry_categories8 LIKE CONCAT('%', #{param.nationalStandardIndustryCategories8}, '%') + + + AND a.url LIKE CONCAT('%', #{param.url}, '%') + + + AND a.type = #{param.type} + + + AND a.parent_id = #{param.parentId} + + + AND a.paidin_capital LIKE CONCAT('%', #{param.paidinCapital}, '%') + + + AND a.registration_authority LIKE CONCAT('%', #{param.registrationAuthority}, '%') + + + AND a.taxpayer_qualification LIKE CONCAT('%', #{param.taxpayerQualification}, '%') + + + AND a.latest_annual_report_year LIKE CONCAT('%', #{param.latestAnnualReportYear}, '%') + + + AND a.latest_annual_report_on_operating_revenue LIKE CONCAT('%', #{param.latestAnnualReportOnOperatingRevenue}, '%') + + + AND a.enterprise_score_check LIKE CONCAT('%', #{param.enterpriseScoreCheck}, '%') + + + AND a.credit_rating LIKE CONCAT('%', #{param.creditRating}, '%') + + + AND a.cechnology_score LIKE CONCAT('%', #{param.cechnologyScore}, '%') + + + AND a.cechnology_level LIKE CONCAT('%', #{param.cechnologyLevel}, '%') + + + AND a.small_enterprise LIKE CONCAT('%', #{param.smallEnterprise}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.name = #{param.keywords} + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditPatentMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditPatentMapper.xml new file mode 100644 index 0000000..091c212 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditPatentMapper.xml @@ -0,0 +1,95 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_patent a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.status_text LIKE CONCAT('%', #{param.statusText}, '%') + + + AND a.register_no LIKE CONCAT('%', #{param.registerNo}, '%') + + + AND a.register_date LIKE CONCAT('%', #{param.registerDate}, '%') + + + AND a.public_no LIKE CONCAT('%', #{param.publicNo}, '%') + + + AND a.public_date LIKE CONCAT('%', #{param.publicDate}, '%') + + + AND a.inventor LIKE CONCAT('%', #{param.inventor}, '%') + + + AND a.patent_applicant LIKE CONCAT('%', #{param.patentApplicant}, '%') + + + AND a.url LIKE CONCAT('%', #{param.url}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.company_id = #{param.companyId} + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.public_no LIKE CONCAT('%', #{param.keywords}, '%') + OR a.register_no LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditRiskRelationMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditRiskRelationMapper.xml new file mode 100644 index 0000000..9683d91 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditRiskRelationMapper.xml @@ -0,0 +1,82 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_risk_relation a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.main_body_name LIKE CONCAT('%', #{param.mainBodyName}, '%') + + + AND a.registration_status LIKE CONCAT('%', #{param.registrationStatus}, '%') + + + AND a.registered_capital = #{param.registeredCapital} + + + AND a.province_region LIKE CONCAT('%', #{param.provinceRegion}, '%') + + + AND a.associated_relation LIKE CONCAT('%', #{param.associatedRelation}, '%') + + + AND a.risk_relation LIKE CONCAT('%', #{param.riskRelation}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name = #{param.keywords} + OR b.main_body_name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditSupplierMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditSupplierMapper.xml new file mode 100644 index 0000000..c5d3cdd --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditSupplierMapper.xml @@ -0,0 +1,78 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_supplier a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.supplier LIKE CONCAT('%', #{param.supplier}, '%') + + + AND a.status_txt LIKE CONCAT('%', #{param.statusTxt}, '%') + + + AND a.purchase_amount = #{param.purchaseAmount} + + + AND a.public_date LIKE CONCAT('%', #{param.publicDate}, '%') + + + AND a.data_source LIKE CONCAT('%', #{param.dataSource}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditSuspectedRelationshipMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditSuspectedRelationshipMapper.xml new file mode 100644 index 0000000..28c2722 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditSuspectedRelationshipMapper.xml @@ -0,0 +1,91 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_suspected_relationship a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.status_text LIKE CONCAT('%', #{param.statusText}, '%') + + + AND a.legal_person LIKE CONCAT('%', #{param.legalPerson}, '%') + + + AND a.registered_capital LIKE CONCAT('%', #{param.registeredCapital}, '%') + + + AND a.create_date LIKE CONCAT('%', #{param.createDate}, '%') + + + AND a.related_party LIKE CONCAT('%', #{param.relatedParty}, '%') + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.detail LIKE CONCAT('%', #{param.detail}, '%') + + + AND a.url LIKE CONCAT('%', #{param.url}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.company_id = #{param.companyId} + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditUserMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditUserMapper.xml new file mode 100644 index 0000000..345e12d --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditUserMapper.xml @@ -0,0 +1,110 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_user a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.type = #{param.type} + + + AND a.role LIKE CONCAT('%', #{param.role}, '%') + + + AND a.parent_id = #{param.parentId} + + + AND a.info_type LIKE CONCAT('%', #{param.infoType}, '%') + + + AND a.country LIKE CONCAT('%', #{param.country}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.procurement_name LIKE CONCAT('%', #{param.procurementName}, '%') + + + AND a.winning_name LIKE CONCAT('%', #{param.winningName}, '%') + + + AND a.winning_price LIKE CONCAT('%', #{param.winningPrice}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.procurement_name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.winning_name LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditXgxfMapper.xml b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditXgxfMapper.xml new file mode 100644 index 0000000..afba995 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/mapper/xml/CreditXgxfMapper.xml @@ -0,0 +1,94 @@ + + + + + + + SELECT a.*, b.name AS companyName, u.real_name AS realName + FROM credit_xgxf a + LEFT JOIN credit_company b ON a.company_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.data_type LIKE CONCAT('%', #{param.dataType}, '%') + + + AND a.plaintiff_appellant LIKE CONCAT('%', #{param.plaintiffAppellant}, '%') + + + AND a.appellee LIKE CONCAT('%', #{param.appellee}, '%') + + + AND a.other_parties_third_party LIKE CONCAT('%', #{param.otherPartiesThirdParty}, '%') + + + AND a.occurrence_time LIKE CONCAT('%', #{param.occurrenceTime}, '%') + + + AND a.case_number LIKE CONCAT('%', #{param.caseNumber}, '%') + + + AND a.cause_of_action LIKE CONCAT('%', #{param.causeOfAction}, '%') + + + AND a.involved_amount = #{param.involvedAmount} + + + AND a.court_name LIKE CONCAT('%', #{param.courtName}, '%') + + + AND a.data_status LIKE CONCAT('%', #{param.dataStatus}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR b.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.case_number = #{param.keywords} + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditAdministrativeLicenseImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditAdministrativeLicenseImportParam.java new file mode 100644 index 0000000..91bf7f0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditAdministrativeLicenseImportParam.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 行政许可导入参数 + */ +@Data +public class CreditAdministrativeLicenseImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "决定文书/许可编号") + private String code; + + @Excel(name = "决定文书/许可证名称") + private String name; + + @Excel(name = "许可状态") + private String statusText; + + @Excel(name = "许可类别") + private String type; + + @Excel(name = "有效期自") + private String validityStart; + + @Excel(name = "有效期至") + private String validityEnd; + + @Excel(name = "许可机关") + private String licensingAuthority; + + @Excel(name = "许可内容") + private String licenseContent; + + @Excel(name = "数据来源单位") + private String dataSourceUnit; + + @Excel(name = "备注") + private String comments; +} + diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditAdministrativeLicenseParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditAdministrativeLicenseParam.java new file mode 100644 index 0000000..13b537b --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditAdministrativeLicenseParam.java @@ -0,0 +1,85 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 行政许可查询参数 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditAdministrativeLicenseParam对象", description = "行政许可查询参数") +public class CreditAdministrativeLicenseParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "决定文书/许可编号") + private String code; + + @Schema(description = "决定文书/许可证名称") + private String name; + + @Schema(description = "许可状态") + private String statusText; + + @Schema(description = "许可类别") + private String type; + + @Schema(description = "链接") + private String url; + + @Schema(description = "有效期自") + private String validityStart; + + @Schema(description = "有效期至") + private String validityEnd; + + @Schema(description = "许可机关") + private String licensingAuthority; + + @Schema(description = "许可内容") + private String licenseContent; + + @Schema(description = "数据来源单位") + private String dataSourceUnit; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditBankruptcyImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditBankruptcyImportParam.java new file mode 100644 index 0000000..b1c83b9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditBankruptcyImportParam.java @@ -0,0 +1,33 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 破产重整导入参数 + */ +@Data +public class CreditBankruptcyImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "案号") + private String code; + + @Excel(name = "案件类型") + private String type; + + @Excel(name = "当事人") + private String party; + + @Excel(name = "经办法院") + private String court; + + @Excel(name = "公开日期") + private String publicDate; + + @Excel(name = "备注") + private String comments; +} + diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditBankruptcyParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditBankruptcyParam.java new file mode 100644 index 0000000..1be91f0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditBankruptcyParam.java @@ -0,0 +1,73 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 破产重整查询参数 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditBankruptcyParam对象", description = "破产重整查询参数") +public class CreditBankruptcyParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "案号") + private String code; + + @Schema(description = "案件类型") + private String type; + + @Schema(description = "当事人") + private String party; + + @Schema(description = "链接") + private String url; + + @Schema(description = "经办法院") + private String court; + + @Schema(description = "公开日期") + private String publicDate; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditBranchImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditBranchImportParam.java new file mode 100644 index 0000000..01c72c3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditBranchImportParam.java @@ -0,0 +1,33 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 分支机构导入参数 + */ +@Data +public class CreditBranchImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "分支机构名称") + private String name; + + @Excel(name = "负责人") + private String curator; + + @Excel(name = "地区") + private String region; + + @Excel(name = "成立日期") + private String establishDate; + + @Excel(name = "状态") + private String statusText; + + @Excel(name = "备注") + private String comments; +} + diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditBranchParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditBranchParam.java new file mode 100644 index 0000000..3e24a08 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditBranchParam.java @@ -0,0 +1,73 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分支机构查询参数 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditBranchParam对象", description = "分支机构查询参数") +public class CreditBranchParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "分支机构名称") + private String name; + + @Schema(description = "负责人") + private String curator; + + @Schema(description = "地区") + private String region; + + @Schema(description = "链接") + private String url; + + @Schema(description = "成立日期") + private String establishDate; + + @Schema(description = "状态") + private String statusText; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditBreachOfTrustImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditBreachOfTrustImportParam.java new file mode 100644 index 0000000..e90f364 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditBreachOfTrustImportParam.java @@ -0,0 +1,63 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 司法通用导入参数 + */ +@Data +public class CreditBreachOfTrustImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "数据类型") + private String dataType; + + @Excel(name = "案号") + private String caseNumber; + + @Excel(name = "失信被执行人") + private String plaintiffAppellant; + + @Excel(name = "原告/上诉人") + private String plaintiffAppellant2; + + @Excel(name = "疑似申请执行人") + private String appellee; + + @Excel(name = "被告/被上诉人") + private String appellee2; + + @Excel(name = "其他当事人/第三人") + private String otherPartiesThirdParty; + + @Excel(name = "数据状态") + private String dataStatus; + + @Excel(name = "涉案金额(元)") + private String involvedAmount; + + @Excel(name = "涉案金额") + private String involvedAmount2; + + @Excel(name = "执行法院") + private String courtName; + + @Excel(name = "法院") + private String courtName2; + + @Excel(name = "立案日期") + private String occurrenceTime; + + @Excel(name = "发生时间") + private String occurrenceTime2; + + @Excel(name = "发布日期") + private String releaseDate; + + @Excel(name = "备注") + private String comments; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditBreachOfTrustParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditBreachOfTrustParam.java new file mode 100644 index 0000000..57b340f --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditBreachOfTrustParam.java @@ -0,0 +1,78 @@ +package com.gxwebsoft.credit.param; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 失信被执行人查询参数 + * + * @author 科技小王子 + * @since 2025-12-19 19:46:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditBreachOfTrustParam对象", description = "失信被执行人查询参数") +public class CreditBreachOfTrustParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "失信被执行人") + private String plaintiffAppellant; + + @Schema(description = "疑似申请执行人") + private String appellee; + + @Schema(description = "涉案金额(元)") + private String involvedAmount; + + @Schema(description = "执行法院") + private String courtName; + + @Schema(description = "立案日期") + private String occurrenceTime; + + @Schema(description = "发布日期") + private String releaseDate; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCaseFilingImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCaseFilingImportParam.java new file mode 100644 index 0000000..517f455 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditCaseFilingImportParam.java @@ -0,0 +1,60 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 司法通用导入参数 + */ +@Data +public class CreditCaseFilingImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "数据类型") + private String dataType; + + @Excel(name = "原告/上诉人") + private String plaintiffAppellant; + + @Excel(name = "被告/被上诉人") + private String appellee; + + @Excel(name = "数据状态") + private String dataStatus; + + @Excel(name = "案号") + private String caseNumber; + + @Excel(name = "案由") + private String causeOfAction; + + @Excel(name = "当事人") + private String otherPartiesThirdParty; + + @Excel(name = "其他当事人/第三人") + private String otherPartiesThirdParty2; + + @Excel(name = "法院") + private String courtName; + + @Excel(name = "执行法院") + private String courtName2; + + @Excel(name = "立案日期") + private String occurrenceTime; + + @Excel(name = "发生时间") + private String occurrenceTime2; + + @Excel(name = "涉案金额") + private String involvedAmount; + + @Excel(name = "涉案金额(元)") + private String involvedAmount2; + + @Excel(name = "备注") + private String comments; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCaseFilingParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCaseFilingParam.java new file mode 100644 index 0000000..d9b8c60 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditCaseFilingParam.java @@ -0,0 +1,89 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 司法大数据查询参数 + * + * @author 科技小王子 + * @since 2025-12-19 19:47:22 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditCaseFilingParam对象", description = "司法大数据查询参数") +public class CreditCaseFilingParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "数据类型") + private String dataType; + + @Schema(description = "原告/上诉人") + private String plaintiffAppellant; + + @Schema(description = "被告/被上诉人") + private String appellee; + + @Schema(description = "其他当事人/第三人") + private String otherPartiesThirdParty; + + @Schema(description = "发生时间") + private String occurrenceTime; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "项目网址") + private String url; + + @Schema(description = "案由") + private String causeOfAction; + + @Schema(description = "涉案金额") + private String involvedAmount; + + @Schema(description = "法院") + private String courtName; + + @Schema(description = "数据状态") + private String dataStatus; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCompanyImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCompanyImportParam.java new file mode 100644 index 0000000..9db4d95 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditCompanyImportParam.java @@ -0,0 +1,163 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** + * 企业导入参数 + * + * @author 科技小王子 + * @since 2025-12-15 + */ +@Data +public class CreditCompanyImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "原文件导入名称") + private String name; + + @Excel(name = "系统匹配企业名称") + private String matchName; + + @Excel(name = "统一社会信用代码") + private String code; + + @Excel(name = "登记状态") + private String registrationStatus; + + @Excel(name = "法定代表人") + private String legalPerson; + + @Excel(name = "注册资本") + private String registeredCapital; + + @Excel(name = "实缴资本") + private String paidinCapital; + + @Excel(name = "成立日期") + private String establishDate; + + @Excel(name = "企业地址") + private String address; + + @Excel(name = "电话") + private String tel; + + @Excel(name = "更多电话") + private String moreTel; + + @Excel(name = "邮箱") + private String email; + + @Excel(name = "更多邮箱") + private String moreEmail; + + @Excel(name = "所在国家") + private String country; + + @Excel(name = "所属省份") + private String province; + + @Excel(name = "所属城市") + private String city; + + @Excel(name = "所属区县") + private String region; + + @Excel(name = "企业(机构)类型") + private String institutionType; + + @Excel(name = "纳税人识别号") + private String taxpayerCode; + + @Excel(name = "注册号") + private String registrationNumber; + + @Excel(name = "组织机构代码") + private String organizationalCode; + + @Excel(name = "参保人数") + private String numberOfInsuredPersons; + + @Excel(name = "参保人数所属年报") + private String annualReport; + + @Excel(name = "营业期限") + private String businessTerm; + + @Excel(name = "国标行业门类") + private String nationalStandardIndustryCategories; + + @Excel(name = "国标行业大类") + private String nationalStandardIndustryCategories2; + + @Excel(name = "国标行业中类") + private String nationalStandardIndustryCategories3; + + @Excel(name = "国标行业小类") + private String nationalStandardIndustryCategories4; + + @Excel(name = "企查查行业门类") + private String nationalStandardIndustryCategories5; + + @Excel(name = "企查查行业大类") + private String nationalStandardIndustryCategories6; + + @Excel(name = "企查查行业中类") + private String nationalStandardIndustryCategories7; + + @Excel(name = "企查查行业小类") + private String nationalStandardIndustryCategories8; + + @Excel(name = "企业规模") + private String companySize; + + @Excel(name = "曾用名") + private String formerName; + + @Excel(name = "英文名") + private String englishName; + + @Excel(name = "官网") + private String domain; + + @Excel(name = "通信地址") + private String mailingAddress; + + @Excel(name = "企业简介") + private String companyProfile; + + @Excel(name = "经营范围") + private String natureOfBusiness; + + @Excel(name = "登记机关") + private String registrationAuthority; + + @Excel(name = "纳税人资质") + private String taxpayerQualification; + + @Excel(name = "最新年报年份") + private String latestAnnualReportYear; + + @Excel(name = "最新年报营业收入") + private String latestAnnualReportOnOperatingRevenue; + + @Excel(name = "企查分") + private String enterpriseScoreCheck; + + @Excel(name = "信用等级") + private String creditRating; + + @Excel(name = "科创分") + private String cechnologyScore; + + @Excel(name = "科创等级") + private String cechnologyLevel; + + @Excel(name = "是否小微企业") + private String smallEnterprise; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCompanyParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCompanyParam.java new file mode 100644 index 0000000..e1db229 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditCompanyParam.java @@ -0,0 +1,203 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 企业查询参数 + * + * @author 科技小王子 + * @since 2025-12-17 08:28:02 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditCompanyParam对象", description = "企业查询参数") +public class CreditCompanyParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "原文件导入名称") + private String name; + + @Schema(description = "系统匹配企业名称") + private String matchName; + + @Schema(description = "统一社会信用代码") + private String code; + + @Schema(description = "类型") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "上级id, 0是顶级") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "登记状态") + private String registrationStatus; + + @Schema(description = "法定代表人") + private String legalPerson; + + @Schema(description = "注册资本") + private String registeredCapital; + + @Schema(description = "实缴资本") + private String paidinCapital; + + @Schema(description = "成立日期") + private String establishDate; + + @Schema(description = "企业地址") + private String address; + + @Schema(description = "电话") + private String tel; + + @Schema(description = "更多电话") + private String moreTel; + + @Schema(description = "邮箱") + private String email; + + @Schema(description = "更多邮箱") + private String moreEmail; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所属省份") + private String province; + + @Schema(description = "所属城市") + private String city; + + @Schema(description = "所属区县") + private String region; + + @Schema(description = "企业(机构)类型") + private String institutionType; + + @Schema(description = "纳税人识别号") + private String taxpayerCode; + + @Schema(description = "注册号") + private String registrationNumber; + + @Schema(description = "组织机构代码") + private String organizationalCode; + + @Schema(description = "参保人数") + private String numberOfInsuredPersons; + + @Schema(description = "参保人数所属年报") + private String annualReport; + + @Schema(description = "营业期限") + private String businessTerm; + + @Schema(description = "国标行业门类") + private String nationalStandardIndustryCategories; + + @Schema(description = "国标行业大类") + private String nationalStandardIndustryCategories2; + + @Schema(description = "国标行业中类") + private String nationalStandardIndustryCategories3; + + @Schema(description = "国标行业小类") + private String nationalStandardIndustryCategories4; + + @Schema(description = "企查查行业门类") + private String nationalStandardIndustryCategories5; + + @Schema(description = "企查查行业大类") + private String nationalStandardIndustryCategories6; + + @Schema(description = "企查查行业中类") + private String nationalStandardIndustryCategories7; + + @Schema(description = "企查查行业小类") + private String nationalStandardIndustryCategories8; + + @Schema(description = "企业规模") + private String companySize; + + @Schema(description = "曾用名") + private String formerName; + + @Schema(description = "英文名") + private String englishName; + + @Schema(description = "官网") + private String domain; + + @Schema(description = "通信地址") + private String mailingAddress; + + @Schema(description = "企业简介") + private String companyProfile; + + @Schema(description = "经营范围") + private String natureOfBusiness; + + @Schema(description = "登记机关") + private String registrationAuthority; + + @Schema(description = "纳税人资质") + private String taxpayerQualification; + + @Schema(description = "最新年报年份") + private String latestAnnualReportYear; + + @Schema(description = "最新年报营业收入") + private String latestAnnualReportOnOperatingRevenue; + + @Schema(description = "企查分") + private String enterpriseScoreCheck; + + @Schema(description = "信用等级") + private String creditRating; + + @Schema(description = "科创分") + private String cechnologyScore; + + @Schema(description = "科创等级") + private String cechnologyLevel; + + @Schema(description = "是否小微企业") + private String smallEnterprise; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCompetitorImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCompetitorImportParam.java new file mode 100644 index 0000000..33a4066 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditCompetitorImportParam.java @@ -0,0 +1,38 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 竞争对手导入参数 + */ +@Data +public class CreditCompetitorImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "企业名称") + private String name; + + @Excel(name = "法定代表人") + private String legalRepresentative; + + @Excel(name = "注册资本") + private String registeredCapital; + + @Excel(name = "成立日期") + private String establishmentDate; + + @Excel(name = "登记状态") + private String registrationStatus; + + @Excel(name = "所属行业") + private String industry; + + @Excel(name = "所属省份") + private String province; + + @Excel(name = "备注") + private String comments; +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCompetitorParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCompetitorParam.java new file mode 100644 index 0000000..d265914 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditCompetitorParam.java @@ -0,0 +1,77 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 竞争对手查询参数 + * + * @author 科技小王子 + * @since 2025-12-19 19:49:04 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditCompetitorParam对象", description = "竞争对手查询参数") +public class CreditCompetitorParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "序号") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "企业名称") + private String name; + + @Schema(description = "法定代表人") + private String legalRepresentative; + + @Schema(description = "注册资本") + private String registeredCapital; + + @Schema(description = "成立日期") + private String establishmentDate; + + @Schema(description = "登记状态") + private String registrationStatus; + + @Schema(description = "所属行业") + private String industry; + + @Schema(description = "所属省份") + private String province; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCourtAnnouncementImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCourtAnnouncementImportParam.java new file mode 100644 index 0000000..ffb47fc --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditCourtAnnouncementImportParam.java @@ -0,0 +1,63 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 司法通用导入参数 + */ +@Data +public class CreditCourtAnnouncementImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "案号") + private String caseNumber; + + @Excel(name = "案由") + private String causeOfAction; + + @Excel(name = "当事人") + private String otherPartiesThirdParty; + + @Excel(name = "其他当事人/第三人") + private String otherPartiesThirdParty2; + + @Excel(name = "公告类型") + private String dataType; + + @Excel(name = "数据类型") + private String dataType2; + + @Excel(name = "公告人") + private String plaintiffAppellant; + + @Excel(name = "原告/上诉人") + private String plaintiffAppellant2; + + @Excel(name = "被告/被上诉人") + private String appellee; + + @Excel(name = "涉案金额") + private String involvedAmount; + + @Excel(name = "涉案金额(元)") + private String involvedAmount2; + + @Excel(name = "法院") + private String courtName; + + @Excel(name = "数据状态") + private String dataStatus; + + @Excel(name = "刊登日期") + private String occurrenceTime; + + @Excel(name = "发生时间") + private String occurrenceTime2; + + @Excel(name = "备注") + private String comments; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCourtAnnouncementParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCourtAnnouncementParam.java new file mode 100644 index 0000000..177a51b --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditCourtAnnouncementParam.java @@ -0,0 +1,86 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 法院公告司法大数据查询参数 + * + * @author 科技小王子 + * @since 2025-12-19 19:49:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditCourtAnnouncementParam对象", description = "法院公告司法大数据查询参数") +public class CreditCourtAnnouncementParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "数据类型") + private String dataType; + + @Schema(description = "原告/上诉人") + private String plaintiffAppellant; + + @Schema(description = "被告/被上诉人") + private String appellee; + + @Schema(description = "其他当事人/第三人") + private String otherPartiesThirdParty; + + @Schema(description = "发生时间") + private String occurrenceTime; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "案由") + private String causeOfAction; + + @Schema(description = "涉案金额") + private String involvedAmount; + + @Schema(description = "法院") + private String courtName; + + @Schema(description = "数据状态") + private String dataStatus; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCourtSessionImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCourtSessionImportParam.java new file mode 100644 index 0000000..d4007d9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditCourtSessionImportParam.java @@ -0,0 +1,57 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 司法通用导入参数 + */ +@Data +public class CreditCourtSessionImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "数据类型") + private String dataType; + + @Excel(name = "案号") + private String caseNumber; + + @Excel(name = "案由") + private String causeOfAction; + + @Excel(name = "当事人") + private String otherPartiesThirdParty; + + @Excel(name = "其他当事人/第三人") + private String otherPartiesThirdParty2; + + @Excel(name = "原告/上诉人") + private String plaintiffAppellant; + + @Excel(name = "被告/被上诉人") + private String appellee; + + @Excel(name = "涉案金额") + private String involvedAmount; + + @Excel(name = "涉案金额(元)") + private String involvedAmount2; + + @Excel(name = "数据状态") + private String dataStatus; + + @Excel(name = "法院") + private String courtName; + + @Excel(name = "开庭时间") + private String occurrenceTime; + + @Excel(name = "发生时间") + private String occurrenceTime2; + + @Excel(name = "备注") + private String comments; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCourtSessionParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCourtSessionParam.java new file mode 100644 index 0000000..cf8a5f9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditCourtSessionParam.java @@ -0,0 +1,86 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 开庭公告司法大数据查询参数 + * + * @author 科技小王子 + * @since 2025-12-19 19:49:32 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditCourtSessionParam对象", description = "开庭公告司法大数据查询参数") +public class CreditCourtSessionParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "数据类型") + private String dataType; + + @Schema(description = "原告/上诉人") + private String plaintiffAppellant; + + @Schema(description = "被告/被上诉人") + private String appellee; + + @Schema(description = "其他当事人/第三人") + private String otherPartiesThirdParty; + + @Schema(description = "发生时间") + private String occurrenceTime; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "案由") + private String causeOfAction; + + @Schema(description = "涉案金额") + private String involvedAmount; + + @Schema(description = "法院") + private String courtName; + + @Schema(description = "数据状态") + private String dataStatus; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCustomerImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCustomerImportParam.java new file mode 100644 index 0000000..1a06637 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditCustomerImportParam.java @@ -0,0 +1,32 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 客户导入参数 + */ +@Data +public class CreditCustomerImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "客户") + private String name; + + @Excel(name = "状态") + private String statusTxt; + + @Excel(name = "销售金额(万元)") + private String price; + + @Excel(name = "公开日期") + private String publicDate; + + @Excel(name = "数据来源") + private String dataSource; + + @Excel(name = "备注") + private String comments; +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditCustomerParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditCustomerParam.java new file mode 100644 index 0000000..1046bba --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditCustomerParam.java @@ -0,0 +1,72 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 客户查询参数 + * + * @author 科技小王子 + * @since 2025-12-21 21:20:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditCustomerParam对象", description = "客户查询参数") +public class CreditCustomerParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "客户") + private String name; + + @Schema(description = "状态") + private String statusTxt; + + @Schema(description = "销售金额(万元)") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "公开日期") + private String publicDate; + + @Schema(description = "数据来源") + private String dataSource; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditDeliveryNoticeImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditDeliveryNoticeImportParam.java new file mode 100644 index 0000000..214e1a7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditDeliveryNoticeImportParam.java @@ -0,0 +1,60 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 司法通用导入参数 + */ +@Data +public class CreditDeliveryNoticeImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "数据类型") + private String dataType; + + @Excel(name = "原告/上诉人") + private String plaintiffAppellant; + + @Excel(name = "被告/被上诉人") + private String appellee; + + @Excel(name = "数据状态") + private String dataStatus; + + @Excel(name = "涉案金额") + private String involvedAmount; + + @Excel(name = "涉案金额(元)") + private String involvedAmount2; + + @Excel(name = "案号") + private String caseNumber; + + @Excel(name = "案由") + private String causeOfAction; + + @Excel(name = "当事人") + private String otherPartiesThirdParty; + + @Excel(name = "其他当事人/第三人") + private String otherPartiesThirdParty2; + + @Excel(name = "法院") + private String courtName; + + @Excel(name = "执行法院") + private String courtName2; + + @Excel(name = "发布日期") + private String occurrenceTime; + + @Excel(name = "发生时间") + private String occurrenceTime2; + + @Excel(name = "备注") + private String comments; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditDeliveryNoticeParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditDeliveryNoticeParam.java new file mode 100644 index 0000000..161d039 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditDeliveryNoticeParam.java @@ -0,0 +1,72 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 送达公告司法大数据查询参数 + * + * @author 科技小王子 + * @since 2025-12-19 19:49:51 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditDeliveryNoticeParam对象", description = "送达公告司法大数据查询参数") +public class CreditDeliveryNoticeParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "案由") + private String causeOfAction; + + @Schema(description = "当事人") + private String otherPartiesThirdParty; + + @Schema(description = "法院") + private String courtName; + + @Schema(description = "发布日期") + private String occurrenceTime; + + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditExternalImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditExternalImportParam.java new file mode 100644 index 0000000..68cd0d4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditExternalImportParam.java @@ -0,0 +1,59 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 对外投资导入参数 + */ +@Data +public class CreditExternalImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "被投资企业名称") + private String name; + + @Excel(name = "状态") + private String statusTxt; + + @Excel(name = "法定代表人") + private String legalRepresentative; + + @Excel(name = "注册资本") + private String registeredCapital; + + @Excel(name = "成立日期") + private String establishmentDate; + + @Excel(name = "持股比例") + private String shareholdingRatio; + + @Excel(name = "认缴出资额") + private String subscribedInvestmentAmount; + + @Excel(name = "认缴出资日期") + private String subscribedInvestmentDate; + + @Excel(name = "间接持股比例") + private String indirectShareholdingRatio; + + @Excel(name = "投资日期") + private String investmentDate; + + @Excel(name = "所属地区") + private String region; + + @Excel(name = "所属行业") + private String industry; + + @Excel(name = "投资数量") + private Integer investmentCount; + + @Excel(name = "关联产品/机构") + private String relatedProductsInstitutions; + + @Excel(name = "备注") + private String comments; +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditExternalParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditExternalParam.java new file mode 100644 index 0000000..4a12707 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditExternalParam.java @@ -0,0 +1,99 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 对外投资查询参数 + * + * @author 科技小王子 + * @since 2025-12-19 19:50:11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditExternalParam对象", description = "对外投资查询参数") +public class CreditExternalParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "被投资企业名称") + private String name; + + @Schema(description = "企业状态(如存续、注销等)") + private String statusTxt; + + @Schema(description = "法定代表人姓名") + private String legalRepresentative; + + @Schema(description = "注册资本(金额)") + private String registeredCapital; + + @Schema(description = "成立日期") + private String establishmentDate; + + @Schema(description = "持股比例") + private String shareholdingRatio; + + @Schema(description = "认缴出资额") + private String subscribedInvestmentAmount; + + @Schema(description = "认缴出资日期") + private String subscribedInvestmentDate; + + @Schema(description = "间接持股比例") + private String indirectShareholdingRatio; + + @Schema(description = "投资日期") + private String investmentDate; + + @Schema(description = "所属地区") + private String region; + + @Schema(description = "所属行业") + private String industry; + + @Schema(description = "投资数量") + @QueryField(type = QueryType.EQ) + private Integer investmentCount; + + @Schema(description = "关联产品/机构") + private String relatedProductsInstitutions; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditFinalVersionImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditFinalVersionImportParam.java new file mode 100644 index 0000000..4aea1d7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditFinalVersionImportParam.java @@ -0,0 +1,66 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 司法通用导入参数 + */ +@Data +public class CreditFinalVersionImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "案号") + private String caseNumber; + + @Excel(name = "被执行人") + private String appellee; + + @Excel(name = "被告/被上诉人") + private String appellee2; + + @Excel(name = "疑似申请执行人") + private String plaintiffAppellant; + + @Excel(name = "原告/上诉人") + private String plaintiffAppellant2; + + @Excel(name = "其他当事人/第三人") + private String otherPartiesThirdParty; + + @Excel(name = "当事人") + private String otherPartiesThirdParty2; + + @Excel(name = "数据状态") + private String dataStatus; + + @Excel(name = "未履行金额(元)") + private String unfulfilledAmount; + + @Excel(name = "执行标的(元)") + private String involvedAmount; + + @Excel(name = "涉案金额") + private String involvedAmount2; + + @Excel(name = "执行法院") + private String courtName; + + @Excel(name = "法院") + private String courtName2; + + @Excel(name = "立案日期") + private String occurrenceTime; + + @Excel(name = "发生时间") + private String occurrenceTime2; + + @Excel(name = "终本日期") + private String finalDate; + + @Excel(name = "备注") + private String comments; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditFinalVersionParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditFinalVersionParam.java new file mode 100644 index 0000000..a184197 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditFinalVersionParam.java @@ -0,0 +1,80 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 终本案件查询参数 + * + * @author 科技小王子 + * @since 2025-12-19 19:50:19 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditFinalVersionParam对象", description = "终本案件查询参数") +public class CreditFinalVersionParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "被告/被上诉人") + private String appellee; + + @Schema(description = "疑似申请执行人") + private String plaintiffAppellant; + + @Schema(description = "未履行金额(元)") + private String unfulfilledAmount; + + @Schema(description = "执行标的(元)") + private String involvedAmount; + + @Schema(description = "执行法院") + private String courtName; + + @Schema(description = "立案日期") + private String occurrenceTime; + + @Schema(description = "终本日期") + private String finalDate; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditGqdjImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditGqdjImportParam.java new file mode 100644 index 0000000..60e0c9a --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditGqdjImportParam.java @@ -0,0 +1,67 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** + * 股权冻结导入参数 + */ +@Data +public class CreditGqdjImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "执行通知文书号") + private String caseNumber; + + // Some upstream sources use "案号" instead of "执行通知文书号". + @Excel(name = "案号") + private String caseNumber2; + + @Excel(name = "被执行人") + private String appellee; + + // Some upstream sources use "被执行人名称" as the executed person column. + @Excel(name = "被执行人名称") + private String appellee2; + + @Excel(name = "冻结股权标的企业") + private String plaintiffAppellant; + + // Some upstream sources use "冻结股权标的企业名称" as the target company column. + @Excel(name = "冻结股权标的企业名称") + private String plaintiffAppellant2; + + @Excel(name = "被执行人持有股权、其他投资权益数额") + private String involvedAmount; + + @Excel(name = "执行法院") + private String courtName; + + @Excel(name = "类型") + private String dataType; + + @Excel(name = "状态") + private String dataStatus; + + // Some upstream sources use "数据状态" as the status column. + @Excel(name = "数据状态") + private String dataStatus2; + + @Excel(name = "冻结日期自") + private String freezeDateStart; + + @Excel(name = "冻结日期至") + private String freezeDateEnd; + + @Excel(name = "冻结开始日期") + private String freezeDateStart2; + + @Excel(name = "冻结结束日期") + private String freezeDateEnd2; + + @Excel(name = "公示日期") + private String publicDate; +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditGqdjParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditGqdjParam.java new file mode 100644 index 0000000..1641a42 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditGqdjParam.java @@ -0,0 +1,86 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 股权冻结查询参数 + * + * @author 科技小王子 + * @since 2025-12-19 19:50:37 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditGqdjParam对象", description = "股权冻结查询参数") +public class CreditGqdjParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "执行通知文书号") + private String caseNumber; + + @Schema(description = "被执行人") + private String appellee; + + @Schema(description = "冻结股权标的企业") + private String plaintiffAppellant; + + @Schema(description = "被执行人持有股权、其他投资权益数额") + private String involvedAmount; + + @Schema(description = "执行法院") + private String courtName; + + @Schema(description = "类型") + private String dataType; + + @Schema(description = "状态") + private String dataStatus; + + @Schema(description = "冻结日期自") + private String freezeDateStart; + + @Schema(description = "冻结日期至") + private String freezeDateEnd; + + @Schema(description = "公示日期") + private String publicDate; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditHistoricalLegalPersonImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditHistoricalLegalPersonImportParam.java new file mode 100644 index 0000000..19182f5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditHistoricalLegalPersonImportParam.java @@ -0,0 +1,27 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 历史法定代表人导入参数 + */ +@Data +public class CreditHistoricalLegalPersonImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "名称") + private String name; + + @Excel(name = "任职日期") + private String registerDate; + + @Excel(name = "卸任日期") + private String publicDate; + + @Excel(name = "备注") + private String comments; +} + diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditHistoricalLegalPersonParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditHistoricalLegalPersonParam.java new file mode 100644 index 0000000..8c94edc --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditHistoricalLegalPersonParam.java @@ -0,0 +1,67 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 历史法定代表人查询参数 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditHistoricalLegalPersonParam对象", description = "历史法定代表人查询参数") +public class CreditHistoricalLegalPersonParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "名称") + private String name; + + @Schema(description = "任职日期") + private String registerDate; + + @Schema(description = "卸任日期") + private String publicDate; + + @Schema(description = "链接") + private String url; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditJudgmentDebtorImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditJudgmentDebtorImportParam.java new file mode 100644 index 0000000..41b6708 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditJudgmentDebtorImportParam.java @@ -0,0 +1,41 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 被执行人导入参数 + */ +@Data +public class CreditJudgmentDebtorImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "案号") + private String caseNumber; + + @Excel(name = "被执行人名称") + private String name; + + @Excel(name = "被执行人") + private String name1; + + @Excel(name = "证件号/组织机构代码") + private String code; + + @Excel(name = "立案日期") + private String occurrenceTime; + + @Excel(name = "执行标的(元)") + private String amount; + + @Excel(name = "法院") + private String courtName; + + @Excel(name = "数据状态") + private String dataStatus; + + @Excel(name = "备注") + private String comments; +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditJudgmentDebtorParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditJudgmentDebtorParam.java new file mode 100644 index 0000000..6480ced --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditJudgmentDebtorParam.java @@ -0,0 +1,78 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 被执行人查询参数 + * + * @author 科技小王子 + * @since 2025-12-19 19:50:54 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditJudgmentDebtorParam对象", description = "被执行人查询参数") +public class CreditJudgmentDebtorParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "被执行人名称") + private String name; + + @Schema(description = "证件号/组织机构代码") + private String code; + + @Schema(description = "立案日期") + private String occurrenceTime; + + @Schema(description = "执行标的(元)") + @QueryField(type = QueryType.EQ) + private String amount; + + @Schema(description = "法院") + private String courtName; + + @Schema(description = "数据状态") + private String dataStatus; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditJudicialDocumentImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditJudicialDocumentImportParam.java new file mode 100644 index 0000000..c063b6c --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditJudicialDocumentImportParam.java @@ -0,0 +1,55 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** + * 司法通用导入参数 + */ +@Data +public class CreditJudicialDocumentImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "文书标题") + private String title; + + @Excel(name = "文书类型") + private String type; + + @Excel(name = "案号") + private String caseNumber; + + @Excel(name = "案由") + private String causeOfAction; + + @Excel(name = "当事人") + private String otherPartiesThirdParty; + + @Excel(name = "案件金额(元)") + private String involvedAmount; + + @Excel(name = "涉案金额") + private String involvedAmount2; + + @Excel(name = "裁判结果") + private String defendantAppellee; + + @Excel(name = "裁判日期") + private String occurrenceTime; + + @Excel(name = "发布日期") + private String releaseDate; + + @Excel(name = "法院") + private String courtName; + + @Excel(name = "数据状态") + private String dataStatus; + + @Excel(name = "备注") + private String comments; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditJudicialDocumentParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditJudicialDocumentParam.java new file mode 100644 index 0000000..6415b53 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditJudicialDocumentParam.java @@ -0,0 +1,81 @@ +package com.gxwebsoft.credit.param; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 裁判文书司法大数据查询参数 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:02 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditJudicialDocumentParam对象", description = "裁判文书司法大数据查询参数") +public class CreditJudicialDocumentParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "文书标题") + private String title; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "案由") + private String causeOfAction; + + @Schema(description = "当事人") + private String otherPartiesThirdParty; + + @Schema(description = "案件金额(元)") + private String involvedAmount; + + @Schema(description = "裁判结果") + private String defendantAppellee; + + @Schema(description = "裁判日期") + private String occurrenceTime; + + @Schema(description = "发布日期") + private String releaseDate; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditJudicialImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditJudicialImportParam.java new file mode 100644 index 0000000..35436f7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditJudicialImportParam.java @@ -0,0 +1,49 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** + * 司法通用导入参数 + */ +@Data +public class CreditJudicialImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "数据类型") + private String dataType; + + @Excel(name = "原告/上诉人") + private String plaintiffAppellant; + + @Excel(name = "被告/被上诉人") + private String appellee; + + @Excel(name = "其他当事人/第三人") + private String otherPartiesThirdParty; + + @Excel(name = "发生时间") + private String occurrenceTime; + + @Excel(name = "案号") + private String caseNumber; + + @Excel(name = "案由") + private String causeOfAction; + + @Excel(name = "涉案金额") + private String involvedAmount; + + @Excel(name = "法院") + private String courtName; + + @Excel(name = "数据状态") + private String dataStatus; + + @Excel(name = "备注") + private String comments; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditJudiciaryImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditJudiciaryImportParam.java new file mode 100644 index 0000000..4c08656 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditJudiciaryImportParam.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 招投标信息导入参数 + * + * @author 科技小王子 + * @since 2025-12-15 + */ +@Data +public class CreditJudiciaryImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "案件名称") + private String name; + + @Excel(name = "案件类型") + private String infoType; + + @Excel(name = "案由") + private String reason; + + @Excel(name = "进程日期") + private String processDate; + + @Excel(name = "案件进程") + private String caseProgress; + + @Excel(name = "案件身份") + private String caseIdentity; + + @Excel(name = "案号") + private String code; + + @Excel(name = "法院") + private String court; + + @Excel(name = "案件金额(元)") + private String caseAmount; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditJudiciaryParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditJudiciaryParam.java new file mode 100644 index 0000000..295cc75 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditJudiciaryParam.java @@ -0,0 +1,107 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 司法案件查询参数 + * + * @author 科技小王子 + * @since 2025-12-16 15:23:57 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditJudiciaryParam对象", description = "司法案件查询参数") +public class CreditJudiciaryParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "案件名称") + private String name; + + @Schema(description = "案号") + private String code; + + @Schema(description = "类型, 0普通用户, 1招投标") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "案由") + private String reason; + + @Schema(description = "上级id, 0是顶级") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "案件类型") + private String infoType; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "案件进程") + private String caseProgress; + + @Schema(description = "案件身份") + private String caseIdentity; + + @Schema(description = "法院") + private String court; + + @Schema(description = "进程日期") + private String processDate; + + @Schema(description = "案件金额(元)") + private String caseAmount; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "到期时间") + private String expirationTime; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditMediationImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditMediationImportParam.java new file mode 100644 index 0000000..0799e5e --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditMediationImportParam.java @@ -0,0 +1,51 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** + * 司法通用导入参数 + */ +@Data +public class CreditMediationImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "案号") + private String caseNumber; + + @Excel(name = "案由") + private String causeOfAction; + + @Excel(name = "当事人") + private String otherPartiesThirdParty; + + @Excel(name = "法院") + private String courtName; + + @Excel(name = "立案日期") + private String occurrenceTime; + + @Excel(name = "备注") + private String comments; + + @Excel(name = "原告/上诉人") + private String plaintiffAppellant; + + @Excel(name = "被告/被上诉人") + private String appellee; + + @Excel(name = "数据状态") + private String dataStatus; + + @Excel(name = "涉案金额") + private String involvedAmount; + + @Excel(name = "发生时间") + private String occurrenceTime2; + + @Excel(name = "其他当事人/第三人") + private String otherPartiesThirdParty2; +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditMediationParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditMediationParam.java new file mode 100644 index 0000000..4561edd --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditMediationParam.java @@ -0,0 +1,86 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 诉前调解司法大数据查询参数 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:24 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditMediationParam对象", description = "诉前调解司法大数据查询参数") +public class CreditMediationParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "数据类型") + private String dataType; + + @Schema(description = "原告/上诉人") + private String plaintiffAppellant; + + @Schema(description = "被告/被上诉人") + private String appellee; + + @Schema(description = "其他当事人/第三人") + private String otherPartiesThirdParty; + + @Schema(description = "发生时间") + private String occurrenceTime; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "案由") + private String causeOfAction; + + @Schema(description = "涉案金额") + private String involvedAmount; + + @Schema(description = "法院") + private String courtName; + + @Schema(description = "数据状态") + private String dataStatus; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditNearbyCompanyImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditNearbyCompanyImportParam.java new file mode 100644 index 0000000..e592f93 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditNearbyCompanyImportParam.java @@ -0,0 +1,99 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 附近企业导入参数 + */ +@Data +public class CreditNearbyCompanyImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "企业名称") + private String name; + + @Excel(name = "登记状态") + private String registrationStatus; + + @Excel(name = "法定代表人") + private String legalPerson; + + @Excel(name = "注册资本") + private String registeredCapital; + + @Excel(name = "实缴资本") + private String paidinCapital; + + @Excel(name = "成立日期") + private String establishDate; + + @Excel(name = "统一社会信用代码") + private String code; + + @Excel(name = "注册地址") + private String address; + + @Excel(name = "有效手机号") + private String phone; + + @Excel(name = "邮箱") + private String email; + + @Excel(name = "所属省份") + private String province; + + @Excel(name = "所属城市") + private String city; + + @Excel(name = "所属区县") + private String region; + + @Excel(name = "官网网址") + private String domain; + + @Excel(name = "企业(机构)类型") + private String institutionType; + + @Excel(name = "企业规模") + private String companySize; + + @Excel(name = "登记机关") + private String registrationAuthority; + + @Excel(name = "纳税人资质") + private String taxpayerQualification; + + @Excel(name = "最新年报年份") + private String latestAnnualReportYear; + + @Excel(name = "最新年报营业收入") + private String latestAnnualReportOnOperatingRevenue; + + @Excel(name = "企查分") + private String enterpriseScoreCheck; + + @Excel(name = "信用等级") + private String creditRating; + + @Excel(name = "科创分") + private String cechnologyScore; + + @Excel(name = "科创等级") + private String cechnologyLevel; + + @Excel(name = "是否小微企业") + private String smallEnterprise; + + @Excel(name = "企业简介") + private String companyProfile; + + @Excel(name = "经营范围") + private String natureOfBusiness; + + @Excel(name = "备注") + private String comments; +} + diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditNearbyCompanyParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditNearbyCompanyParam.java new file mode 100644 index 0000000..f2ba839 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditNearbyCompanyParam.java @@ -0,0 +1,216 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 附近企业查询参数 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditNearbyCompanyParam对象", description = "附近企业查询参数") +public class CreditNearbyCompanyParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "企业名称") + private String name; + + @Schema(description = "登记状态") + private String registrationStatus; + + @Schema(description = "法定代表人") + private String legalPerson; + + @Schema(description = "注册资本") + private String registeredCapital; + + @Schema(description = "成立日期") + private String establishDate; + + @Schema(description = "统一社会信用代码") + private String code; + + @Schema(description = "注册地址") + private String address; + + @Schema(description = "注册地址邮编") + private String postalCode; + + @Schema(description = "有效手机号") + private String phone; + + @Schema(description = "更多电话") + private String moreTel; + + @Schema(description = "邮箱") + private String email; + + @Schema(description = "邮箱") + private String moreEmail; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所属省份") + private String province; + + @Schema(description = "所属城市") + private String city; + + @Schema(description = "所属区县") + private String region; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private String companyId; + + @Schema(description = "纳税人识别号") + private String taxpayerCode; + + @Schema(description = "注册号") + private String registrationNumber; + + @Schema(description = "组织机构代码") + private String organizationalCode; + + @Schema(description = "参保人数") + private String numberOfInsuredPersons; + + @Schema(description = "参保人数所属年报") + private String annualReport; + + @Schema(description = "企业(机构)类型") + private String institutionType; + + @Schema(description = "企业规模") + private String companySize; + + @Schema(description = "营业期限") + private String businessTerm; + + @Schema(description = "国标行业门类") + private String nationalStandardIndustryCategories; + + @Schema(description = "国标行业大类") + private String nationalStandardIndustryCategories2; + + @Schema(description = "国标行业中类") + private String nationalStandardIndustryCategories3; + + @Schema(description = "国标行业小类") + private String nationalStandardIndustryCategories4; + + @Schema(description = "曾用名") + private String formerName; + + @Schema(description = "英文名") + private String englishName; + + @Schema(description = "官网网址") + private String domain; + + @Schema(description = "通信地址") + private String mailingAddress; + + @Schema(description = "通信地址邮箱") + private String mailingEmail; + + @Schema(description = "企业简介") + private String companyProfile; + + @Schema(description = "经营范围") + private String natureOfBusiness; + + @Schema(description = "电话") + private String tel; + + @Schema(description = "企查查行业门类") + private String nationalStandardIndustryCategories5; + + @Schema(description = "企查查行业大类") + private String nationalStandardIndustryCategories6; + + @Schema(description = "企查查行业中类") + private String nationalStandardIndustryCategories7; + + @Schema(description = "企查查行业小类") + private String nationalStandardIndustryCategories8; + + @Schema(description = "链接") + private String url; + + @Schema(description = "类型") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "上级id, 0是顶级") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "实缴资本") + private String paidinCapital; + + @Schema(description = "登记机关") + private String registrationAuthority; + + @Schema(description = "纳税人资质") + private String taxpayerQualification; + + @Schema(description = "最新年报年份") + private String latestAnnualReportYear; + + @Schema(description = "最新年报营业收入") + private String latestAnnualReportOnOperatingRevenue; + + @Schema(description = "企查分") + private String enterpriseScoreCheck; + + @Schema(description = "信用等级") + private String creditRating; + + @Schema(description = "科创分") + private String cechnologyScore; + + @Schema(description = "科创等级") + private String cechnologyLevel; + + @Schema(description = "是否小微企业") + private String smallEnterprise; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditPatentImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditPatentImportParam.java new file mode 100644 index 0000000..34e2777 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditPatentImportParam.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 专利导入参数 + */ +@Data +public class CreditPatentImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "发明名称") + private String name; + + @Excel(name = "专利类型") + private String type; + + @Excel(name = "法律状态") + private String statusText; + + @Excel(name = "申请号") + private String registerNo; + + @Excel(name = "申请日") + private String registerDate; + + @Excel(name = "公开(公告)号") + private String publicNo; + + @Excel(name = "公开(公告)日期") + private String publicDate; + + @Excel(name = "发明人") + private String inventor; + + @Excel(name = "申请(专利权)人") + private String patentApplicant; + + @Excel(name = "备注") + private String comments; +} + diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditPatentParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditPatentParam.java new file mode 100644 index 0000000..ae3cd27 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditPatentParam.java @@ -0,0 +1,85 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 专利查询参数 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditPatentParam对象", description = "专利查询参数") +public class CreditPatentParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "发明名称") + private String name; + + @Schema(description = "专利类型") + private String type; + + @Schema(description = "法律状态") + private String statusText; + + @Schema(description = "申请号") + private String registerNo; + + @Schema(description = "申请日") + private String registerDate; + + @Schema(description = "公开(公告)号") + private String publicNo; + + @Schema(description = "公开(公告)日期") + private String publicDate; + + @Schema(description = "发明人") + private String inventor; + + @Schema(description = "申请(专利权)人") + private String patentApplicant; + + @Schema(description = "链接") + private String url; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditRiskRelationImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditRiskRelationImportParam.java new file mode 100644 index 0000000..b2a8ff3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditRiskRelationImportParam.java @@ -0,0 +1,35 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 风险关系导入参数 + */ +@Data +public class CreditRiskRelationImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "主体名称") + private String mainBodyName; + + @Excel(name = "登记状态") + private String registrationStatus; + + @Excel(name = "注册资本") + private String registeredCapital; + + @Excel(name = "省份地区") + private String provinceRegion; + + @Excel(name = "关联关系") + private String associatedRelation; + + @Excel(name = "风险关系") + private String riskRelation; + + @Excel(name = "备注") + private String comments; +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditRiskRelationParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditRiskRelationParam.java new file mode 100644 index 0000000..6ff4f44 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditRiskRelationParam.java @@ -0,0 +1,74 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 风险关系表查询参数 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:40 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditRiskRelationParam对象", description = "风险关系表查询参数") +public class CreditRiskRelationParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "序号") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "主体名称") + private String mainBodyName; + + @Schema(description = "登记状态") + private String registrationStatus; + + @Schema(description = "注册资本") + private String registeredCapital; + + @Schema(description = "省份地区") + private String provinceRegion; + + @Schema(description = "关联关系") + private String associatedRelation; + + @Schema(description = "风险关系") + private String riskRelation; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditSupplierImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditSupplierImportParam.java new file mode 100644 index 0000000..45ff9c0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditSupplierImportParam.java @@ -0,0 +1,32 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 供应商导入参数 + */ +@Data +public class CreditSupplierImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "供应商") + private String supplier; + + @Excel(name = "状态") + private String statusTxt; + + @Excel(name = "采购金额(万元)") + private String purchaseAmount; + + @Excel(name = "公开日期") + private String publicDate; + + @Excel(name = "数据来源") + private String dataSource; + + @Excel(name = "备注") + private String comments; +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditSupplierParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditSupplierParam.java new file mode 100644 index 0000000..a2f646d --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditSupplierParam.java @@ -0,0 +1,71 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 供应商查询参数 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:47 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditSupplierParam对象", description = "供应商查询参数") +public class CreditSupplierParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "供应商") + private String supplier; + + @Schema(description = "状态") + private String statusTxt; + + @Schema(description = "采购金额(万元)") + private String purchaseAmount; + + @Schema(description = "公开日期") + private String publicDate; + + @Schema(description = "数据来源") + private String dataSource; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditSuspectedRelationshipImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditSuspectedRelationshipImportParam.java new file mode 100644 index 0000000..575e6fd --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditSuspectedRelationshipImportParam.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 疑似关系导入参数 + */ +@Data +public class CreditSuspectedRelationshipImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "企业名称") + private String name; + + @Excel(name = "状态") + private String statusText; + + @Excel(name = "法定代表人") + private String legalPerson; + + @Excel(name = "注册资本") + private String registeredCapital; + + @Excel(name = "成立日期") + private String createDate; + + @Excel(name = "关联方") + private String relatedParty; + + @Excel(name = "疑似关系类型") + private String type; + + @Excel(name = "疑似关系详情") + private String detail; + + @Excel(name = "备注") + private String comments; +} + diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditSuspectedRelationshipParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditSuspectedRelationshipParam.java new file mode 100644 index 0000000..ee87cef --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditSuspectedRelationshipParam.java @@ -0,0 +1,82 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 疑似关系查询参数 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditSuspectedRelationshipParam对象", description = "疑似关系查询参数") +public class CreditSuspectedRelationshipParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "企业名称") + private String name; + + @Schema(description = "状态") + private String statusText; + + @Schema(description = "法定代表人") + private String legalPerson; + + @Schema(description = "注册资本") + private String registeredCapital; + + @Schema(description = "成立日期") + private String createDate; + + @Schema(description = "关联方") + private String relatedParty; + + @Schema(description = "疑似关系类型") + private String type; + + @Schema(description = "疑似关系详情") + private String detail; + + @Schema(description = "链接") + private String url; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditUserImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditUserImportParam.java new file mode 100644 index 0000000..0420439 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditUserImportParam.java @@ -0,0 +1,84 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** + * 招投标信息导入参数 + * + * @author 科技小王子 + * @since 2025-12-15 + */ +@Data +public class CreditUserImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "项目名称") + private String name; + + @Excel(name = "发布日期") + private String releaseDate; + + @Excel(name = "序号") + private String code; + + @Excel(name = "类型", replace = {"普通用户_0", "招投标_1"}) + private Integer type; + + @Excel(name = "企业角色") + private String role; + + @Excel(name = "上级ID") + private Integer parentId; + + @Excel(name = "信息类型") + private String infoType; + +// @Excel(name = "所在国家") +// private String country; + +// @Excel(name = "所在省份") +// private String province; + +// @Excel(name = "所在城市") +// private String city; + +// @Excel(name = "所在辖区") +// private String region; + + @Excel(name = "省份地区") + private String address; + + @Excel(name = "招采单位") + private String procurementName; + + @Excel(name = "中标单位") + private String winningName; + + @Excel(name = "中标金额") + private String winningPrice; + +// @Excel(name = "备注") +// private String comments; +// +// @Excel(name = "是否推荐", replace = {"否_0", "是_1"}) +// private Integer recommend; + +// @Excel(name = "到期时间", format = "yyyy-MM-dd HH:mm:ss") +// private String expirationTime; + +// @Excel(name = "排序") +// private Integer sortNumber; +// +// @Excel(name = "状态", replace = {"正常_0", "冻结_1"}) +// private Integer status; + +// @Excel(name = "用户ID") +// private Integer userId; +// +// @Excel(name = "租户ID") +// private Integer tenantId; +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditUserParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditUserParam.java new file mode 100644 index 0000000..2a74eb7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditUserParam.java @@ -0,0 +1,105 @@ +package com.gxwebsoft.credit.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 招投标信息表查询参数 + * + * @author 科技小王子 + * @since 2025-12-15 13:16:03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditUserParam对象", description = "招投标信息表查询参数") +public class CreditUserParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "项目名称") + private String name; + + @Schema(description = "唯一标识") + private String code; + + @Schema(description = "类型, 0普通用户, 1招投标") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "企业角色") + private String role; + + @Schema(description = "上级id, 0是顶级") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "信息类型") + private String infoType; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "招采单位名称") + private String procurementName; + + @Schema(description = "中标单位名称") + private String winningName; + + @Schema(description = "中标单位名称") + private String winningPrice; + + @Schema(description = "发布日期") + private String releaseDate; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "到期时间") + private String expirationTime; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditXgxfImportParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditXgxfImportParam.java new file mode 100644 index 0000000..d0eb97d --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditXgxfImportParam.java @@ -0,0 +1,67 @@ +package com.gxwebsoft.credit.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** + * 司法通用导入参数 + */ +@Data +public class CreditXgxfImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "案号") + private String caseNumber; + + @Excel(name = "数据类型") + private String type; + + @Excel(name = "限消令对象") + private String dataType; + + @Excel(name = "限制法定代表人") + private String plaintiffAppellant; + + @Excel(name = "申请人") + private String appellee; + + @Excel(name = "涉案金额(元)") + private String involvedAmount; + + @Excel(name = "涉案金额") + private String involvedAmount2; + + @Excel(name = "立案日期") + private String occurrenceTime; + + @Excel(name = "发生时间") + private String occurrenceTime2; + + @Excel(name = "执行法院") + private String courtName; + + @Excel(name = "发布日期") + private String releaseDate; + + @Excel(name = "备注") + private String comments; + + @Excel(name = "原告/上诉人") + private String plaintiffUser; + + @Excel(name = "被告/被上诉人") + private String defendantUser; + + @Excel(name = "其他当事人/第三人") + private String otherPartiesThirdParty; + + @Excel(name = "数据状态") + private String dataStatus; + + @Excel(name = "法院") + private String courtName2; + +} diff --git a/src/main/java/com/gxwebsoft/credit/param/CreditXgxfParam.java b/src/main/java/com/gxwebsoft/credit/param/CreditXgxfParam.java new file mode 100644 index 0000000..3934489 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/param/CreditXgxfParam.java @@ -0,0 +1,92 @@ +package com.gxwebsoft.credit.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 限制高消费查询参数 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:54 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "CreditXgxfParam对象", description = "限制高消费查询参数") +public class CreditXgxfParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "案号") + private String caseNumber; + + @Schema(description = "数据类型") + private String type; + + @Schema(description = "限消令对象") + private String dataType; + + @Schema(description = "限制法定代表人") + private String plaintiffAppellant; + + @Schema(description = "申请人") + private String appellee; + + @Schema(description = "涉案金额(元)") + private String involvedAmount; + + @Schema(description = "立案日期") + private String occurrenceTime; + + @Schema(description = "执行法院") + private String courtName; + + @Schema(description = "发布日期") + private String releaseDate; + + @Schema(description = "其他当事人/第三人") + private String otherPartiesThirdParty; + + @Schema(description = "案由") + private String causeOfAction; + + @Schema(description = "数据状态") + private String dataStatus; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditAdministrativeLicenseService.java b/src/main/java/com/gxwebsoft/credit/service/CreditAdministrativeLicenseService.java new file mode 100644 index 0000000..d2253e5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditAdministrativeLicenseService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditAdministrativeLicense; +import com.gxwebsoft.credit.param.CreditAdministrativeLicenseParam; + +import java.util.List; + +/** + * 行政许可Service + * + * @author 科技小王子 + * @since 2026-01-07 13:52:13 + */ +public interface CreditAdministrativeLicenseService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditAdministrativeLicenseParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditAdministrativeLicenseParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditAdministrativeLicense + */ + CreditAdministrativeLicense getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditBankruptcyService.java b/src/main/java/com/gxwebsoft/credit/service/CreditBankruptcyService.java new file mode 100644 index 0000000..3a23584 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditBankruptcyService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditBankruptcy; +import com.gxwebsoft.credit.param.CreditBankruptcyParam; + +import java.util.List; + +/** + * 破产重整Service + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +public interface CreditBankruptcyService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditBankruptcyParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditBankruptcyParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditBankruptcy + */ + CreditBankruptcy getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditBranchService.java b/src/main/java/com/gxwebsoft/credit/service/CreditBranchService.java new file mode 100644 index 0000000..5cdb363 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditBranchService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditBranch; +import com.gxwebsoft.credit.param.CreditBranchParam; + +import java.util.List; + +/** + * 分支机构Service + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +public interface CreditBranchService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditBranchParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditBranchParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditBranch + */ + CreditBranch getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditBreachOfTrustService.java b/src/main/java/com/gxwebsoft/credit/service/CreditBreachOfTrustService.java new file mode 100644 index 0000000..57d40dc --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditBreachOfTrustService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditBreachOfTrust; +import com.gxwebsoft.credit.param.CreditBreachOfTrustParam; + +import java.util.List; + +/** + * 失信被执行人Service + * + * @author 科技小王子 + * @since 2025-12-19 19:46:14 + */ +public interface CreditBreachOfTrustService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditBreachOfTrustParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditBreachOfTrustParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditBreachOfTrust + */ + CreditBreachOfTrust getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditCaseFilingService.java b/src/main/java/com/gxwebsoft/credit/service/CreditCaseFilingService.java new file mode 100644 index 0000000..23bb227 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditCaseFilingService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditCaseFiling; +import com.gxwebsoft.credit.param.CreditCaseFilingParam; + +import java.util.List; + +/** + * 司法大数据Service + * + * @author 科技小王子 + * @since 2025-12-19 19:47:22 + */ +public interface CreditCaseFilingService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditCaseFilingParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditCaseFilingParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditCaseFiling + */ + CreditCaseFiling getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditCompanyRecordCountService.java b/src/main/java/com/gxwebsoft/credit/service/CreditCompanyRecordCountService.java new file mode 100644 index 0000000..0326a22 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditCompanyRecordCountService.java @@ -0,0 +1,122 @@ +package com.gxwebsoft.credit.service; + +import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +/** + * 刷新 credit_company 表内的“关联记录数”字段。 + * + *

这些字段是通过统计:credit_company.id = 关联表.company_id(且 deleted=0) 得到。

+ */ +@Service +public class CreditCompanyRecordCountService { + + public enum CountType { + ADMINISTRATIVE_LICENSE("credit_administrative_license", "credit_administrative_license"), + BANKRUPTCY("credit_bankruptcy", "credit_bankruptcy"), + BRANCH("credit_branch", "credit_branch"), + BREACH_OF_TRUST("credit_breach_of_trust", "credit_breach_of_trust"), + CASE_FILING("credit_case_filing", "credit_case_filing"), + COMPETITOR("credit_competitor", "credit_competitor"), + COURT_ANNOUNCEMENT("credit_court_announcement", "credit_court_announcement"), + COURT_SESSION("credit_court_session", "credit_court_session"), + CUSTOMER("credit_customer", "credit_customer"), + DELIVERY_NOTICE("credit_delivery_notice", "credit_delivery_notice"), + EXTERNAL("credit_external", "credit_external"), + FINAL_VERSION("credit_final_version", "credit_final_version"), + GQDJ("credit_gqdj", "credit_gqdj"), + HISTORICAL_LEGAL_PERSON("credit_historical_legal_person", "credit_historical_legal_person"), + JUDGMENT_DEBTOR("credit_judgment_debtor", "credit_judgment_debtor"), + JUDICIAL_DOCUMENT("credit_judicial_document", "credit_judicial_document"), + JUDICIARY("credit_judiciary", "credit_judiciary"), + MEDIATION("credit_mediation", "credit_mediation"), + NEARBY_COMPANY("credit_nearby_company", "credit_nearby_company"), + PATENT("credit_patent", "credit_patent"), + RISK_RELATION("credit_risk_relation", "credit_risk_relation"), + SUPPLIER("credit_supplier", "credit_supplier"), + SUSPECTED_RELATIONSHIP("credit_suspected_relationship", "credit_suspected_relationship"), + USER("credit_user", "credit_user"), + XGXF("credit_xgxf", "credit_xgxf"); + + private final String companyColumn; + private final String sourceTable; + + CountType(String companyColumn, String sourceTable) { + this.companyColumn = companyColumn; + this.sourceTable = sourceTable; + } + + public String getCompanyColumn() { + return companyColumn; + } + + public String getSourceTable() { + return sourceTable; + } + } + + private final NamedParameterJdbcTemplate namedJdbc; + + public CreditCompanyRecordCountService(NamedParameterJdbcTemplate namedJdbc) { + this.namedJdbc = namedJdbc; + } + + /** + * 刷新某个“记录数”字段(只更新传入 companyIds)。 + */ + public void refresh(CountType type, Collection companyIds) { + if (type == null || CollectionUtils.isEmpty(companyIds)) { + return; + } + List ids = normalizeCompanyIds(companyIds); + if (ids.isEmpty()) { + return; + } + + // 表/字段名来自固定枚举,不允许外部传入,避免 SQL 注入。 + String sql = "" + + "UPDATE credit_company c " + + "SET " + type.getCompanyColumn() + " = (" + + " SELECT COUNT(1) " + + " FROM " + type.getSourceTable() + " t " + + " WHERE t.company_id = c.id AND t.deleted = 0" + + ") " + + "WHERE c.id IN (:ids)"; + + final int inChunkSize = 1000; + for (int i = 0; i < ids.size(); i += inChunkSize) { + List chunk = ids.subList(i, Math.min(ids.size(), i + inChunkSize)); + namedJdbc.update(sql, new MapSqlParameterSource("ids", chunk)); + } + } + + /** + * 刷新全部“记录数”字段(只更新传入 companyIds)。 + */ + public void refreshAll(Collection companyIds) { + if (CollectionUtils.isEmpty(companyIds)) { + return; + } + for (CountType type : CountType.values()) { + refresh(type, companyIds); + } + } + + private static List normalizeCompanyIds(Collection companyIds) { + Set unique = new LinkedHashSet<>(); + for (Integer id : companyIds) { + if (id != null && id > 0) { + unique.add(id); + } + } + return new ArrayList<>(unique); + } +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditCompanyService.java b/src/main/java/com/gxwebsoft/credit/service/CreditCompanyService.java new file mode 100644 index 0000000..e96c34e --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditCompanyService.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditCompany; +import com.gxwebsoft.credit.param.CreditCompanyParam; + +import java.util.List; + +/** + * 企业Service + * + * @author 科技小王子 + * @since 2025-12-17 08:28:03 + */ +public interface CreditCompanyService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditCompanyParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditCompanyParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditCompany + */ + CreditCompany getByIdRel(Integer id); + + CreditCompany getByName(String name); + + CreditCompany getByMatchName(String name); +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditCompetitorService.java b/src/main/java/com/gxwebsoft/credit/service/CreditCompetitorService.java new file mode 100644 index 0000000..b7612a6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditCompetitorService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditCompetitor; +import com.gxwebsoft.credit.param.CreditCompetitorParam; + +import java.util.List; + +/** + * 竞争对手Service + * + * @author 科技小王子 + * @since 2025-12-19 19:49:05 + */ +public interface CreditCompetitorService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditCompetitorParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditCompetitorParam param); + + /** + * 根据id查询 + * + * @param id 序号 + * @return CreditCompetitor + */ + CreditCompetitor getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditCourtAnnouncementService.java b/src/main/java/com/gxwebsoft/credit/service/CreditCourtAnnouncementService.java new file mode 100644 index 0000000..a693994 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditCourtAnnouncementService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditCourtAnnouncement; +import com.gxwebsoft.credit.param.CreditCourtAnnouncementParam; + +import java.util.List; + +/** + * 法院公告司法大数据Service + * + * @author 科技小王子 + * @since 2025-12-19 19:49:13 + */ +public interface CreditCourtAnnouncementService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditCourtAnnouncementParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditCourtAnnouncementParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditCourtAnnouncement + */ + CreditCourtAnnouncement getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditCourtSessionService.java b/src/main/java/com/gxwebsoft/credit/service/CreditCourtSessionService.java new file mode 100644 index 0000000..6df519f --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditCourtSessionService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditCourtSession; +import com.gxwebsoft.credit.param.CreditCourtSessionParam; + +import java.util.List; + +/** + * 开庭公告司法大数据Service + * + * @author 科技小王子 + * @since 2025-12-19 19:49:32 + */ +public interface CreditCourtSessionService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditCourtSessionParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditCourtSessionParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditCourtSession + */ + CreditCourtSession getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditCustomerService.java b/src/main/java/com/gxwebsoft/credit/service/CreditCustomerService.java new file mode 100644 index 0000000..afcafb1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditCustomerService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditCustomer; +import com.gxwebsoft.credit.param.CreditCustomerParam; + +import java.util.List; + +/** + * 客户Service + * + * @author 科技小王子 + * @since 2025-12-21 21:20:58 + */ +public interface CreditCustomerService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditCustomerParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditCustomerParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditCustomer + */ + CreditCustomer getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditDeliveryNoticeService.java b/src/main/java/com/gxwebsoft/credit/service/CreditDeliveryNoticeService.java new file mode 100644 index 0000000..2398954 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditDeliveryNoticeService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditDeliveryNotice; +import com.gxwebsoft.credit.param.CreditDeliveryNoticeParam; + +import java.util.List; + +/** + * 送达公告司法大数据Service + * + * @author 科技小王子 + * @since 2025-12-19 19:49:51 + */ +public interface CreditDeliveryNoticeService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditDeliveryNoticeParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditDeliveryNoticeParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditDeliveryNotice + */ + CreditDeliveryNotice getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditExternalService.java b/src/main/java/com/gxwebsoft/credit/service/CreditExternalService.java new file mode 100644 index 0000000..c78c895 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditExternalService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditExternal; +import com.gxwebsoft.credit.param.CreditExternalParam; + +import java.util.List; + +/** + * 对外投资Service + * + * @author 科技小王子 + * @since 2025-12-19 19:50:11 + */ +public interface CreditExternalService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditExternalParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditExternalParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditExternal + */ + CreditExternal getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditFinalVersionService.java b/src/main/java/com/gxwebsoft/credit/service/CreditFinalVersionService.java new file mode 100644 index 0000000..b68bb42 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditFinalVersionService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditFinalVersion; +import com.gxwebsoft.credit.param.CreditFinalVersionParam; + +import java.util.List; + +/** + * 终本案件Service + * + * @author 科技小王子 + * @since 2025-12-19 19:50:19 + */ +public interface CreditFinalVersionService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditFinalVersionParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditFinalVersionParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditFinalVersion + */ + CreditFinalVersion getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditGqdjService.java b/src/main/java/com/gxwebsoft/credit/service/CreditGqdjService.java new file mode 100644 index 0000000..18c7f15 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditGqdjService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditGqdj; +import com.gxwebsoft.credit.param.CreditGqdjParam; + +import java.util.List; + +/** + * 股权冻结Service + * + * @author 科技小王子 + * @since 2025-12-19 19:50:37 + */ +public interface CreditGqdjService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditGqdjParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditGqdjParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditGqdj + */ + CreditGqdj getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditHistoricalLegalPersonService.java b/src/main/java/com/gxwebsoft/credit/service/CreditHistoricalLegalPersonService.java new file mode 100644 index 0000000..0a309a6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditHistoricalLegalPersonService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditHistoricalLegalPerson; +import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonParam; + +import java.util.List; + +/** + * 历史法定代表人Service + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +public interface CreditHistoricalLegalPersonService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditHistoricalLegalPersonParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditHistoricalLegalPersonParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditHistoricalLegalPerson + */ + CreditHistoricalLegalPerson getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditJudgmentDebtorService.java b/src/main/java/com/gxwebsoft/credit/service/CreditJudgmentDebtorService.java new file mode 100644 index 0000000..f46a36d --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditJudgmentDebtorService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditJudgmentDebtor; +import com.gxwebsoft.credit.param.CreditJudgmentDebtorParam; + +import java.util.List; + +/** + * 被执行人Service + * + * @author 科技小王子 + * @since 2025-12-19 19:50:55 + */ +public interface CreditJudgmentDebtorService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditJudgmentDebtorParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditJudgmentDebtorParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditJudgmentDebtor + */ + CreditJudgmentDebtor getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditJudicialDocumentService.java b/src/main/java/com/gxwebsoft/credit/service/CreditJudicialDocumentService.java new file mode 100644 index 0000000..56ce04d --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditJudicialDocumentService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditJudicialDocument; +import com.gxwebsoft.credit.param.CreditJudicialDocumentParam; + +import java.util.List; + +/** + * 裁判文书司法大数据Service + * + * @author 科技小王子 + * @since 2025-12-19 19:51:02 + */ +public interface CreditJudicialDocumentService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditJudicialDocumentParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditJudicialDocumentParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditJudicialDocument + */ + CreditJudicialDocument getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditJudiciaryService.java b/src/main/java/com/gxwebsoft/credit/service/CreditJudiciaryService.java new file mode 100644 index 0000000..122b303 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditJudiciaryService.java @@ -0,0 +1,50 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditJudiciary; +import com.gxwebsoft.credit.param.CreditJudiciaryParam; + +import java.util.List; + +/** + * 司法案件Service + * + * @author 科技小王子 + * @since 2025-12-16 15:23:58 + */ +public interface CreditJudiciaryService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditJudiciaryParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditJudiciaryParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditJudiciary + */ + CreditJudiciary getByIdRel(Integer id); + + /** + * 根据名称查询 + * + * @param name 名称 + * @return CreditJudiciary + */ + CreditJudiciary getByName(String name); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditMediationService.java b/src/main/java/com/gxwebsoft/credit/service/CreditMediationService.java new file mode 100644 index 0000000..4870dd8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditMediationService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditMediation; +import com.gxwebsoft.credit.param.CreditMediationParam; + +import java.util.List; + +/** + * 诉前调解司法大数据Service + * + * @author 科技小王子 + * @since 2025-12-19 19:51:25 + */ +public interface CreditMediationService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditMediationParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditMediationParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditMediation + */ + CreditMediation getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditNearbyCompanyService.java b/src/main/java/com/gxwebsoft/credit/service/CreditNearbyCompanyService.java new file mode 100644 index 0000000..7622af9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditNearbyCompanyService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditNearbyCompany; +import com.gxwebsoft.credit.param.CreditNearbyCompanyParam; + +import java.util.List; + +/** + * 附近企业Service + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +public interface CreditNearbyCompanyService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditNearbyCompanyParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditNearbyCompanyParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditNearbyCompany + */ + CreditNearbyCompany getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditPatentService.java b/src/main/java/com/gxwebsoft/credit/service/CreditPatentService.java new file mode 100644 index 0000000..44d0e99 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditPatentService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditPatent; +import com.gxwebsoft.credit.param.CreditPatentParam; + +import java.util.List; + +/** + * 专利Service + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +public interface CreditPatentService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditPatentParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditPatentParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditPatent + */ + CreditPatent getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditRiskRelationService.java b/src/main/java/com/gxwebsoft/credit/service/CreditRiskRelationService.java new file mode 100644 index 0000000..141ff83 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditRiskRelationService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditRiskRelation; +import com.gxwebsoft.credit.param.CreditRiskRelationParam; + +import java.util.List; + +/** + * 风险关系表Service + * + * @author 科技小王子 + * @since 2025-12-19 19:51:40 + */ +public interface CreditRiskRelationService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditRiskRelationParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditRiskRelationParam param); + + /** + * 根据id查询 + * + * @param id 序号 + * @return CreditRiskRelation + */ + CreditRiskRelation getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditSupplierService.java b/src/main/java/com/gxwebsoft/credit/service/CreditSupplierService.java new file mode 100644 index 0000000..469fd34 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditSupplierService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditSupplier; +import com.gxwebsoft.credit.param.CreditSupplierParam; + +import java.util.List; + +/** + * 供应商Service + * + * @author 科技小王子 + * @since 2025-12-19 19:51:47 + */ +public interface CreditSupplierService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditSupplierParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditSupplierParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditSupplier + */ + CreditSupplier getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditSuspectedRelationshipService.java b/src/main/java/com/gxwebsoft/credit/service/CreditSuspectedRelationshipService.java new file mode 100644 index 0000000..f44913d --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditSuspectedRelationshipService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditSuspectedRelationship; +import com.gxwebsoft.credit.param.CreditSuspectedRelationshipParam; + +import java.util.List; + +/** + * 疑似关系Service + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +public interface CreditSuspectedRelationshipService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditSuspectedRelationshipParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditSuspectedRelationshipParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditSuspectedRelationship + */ + CreditSuspectedRelationship getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditUserService.java b/src/main/java/com/gxwebsoft/credit/service/CreditUserService.java new file mode 100644 index 0000000..e833256 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditUserService.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditUser; +import com.gxwebsoft.credit.param.CreditUserParam; + +import java.util.List; + +/** + * 招投标信息表Service + * + * @author 科技小王子 + * @since 2025-12-15 13:16:03 + */ +public interface CreditUserService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditUserParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditUserParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditUser + */ + CreditUser getByIdRel(Integer id); + + CreditUser getByName(String name); +} diff --git a/src/main/java/com/gxwebsoft/credit/service/CreditXgxfService.java b/src/main/java/com/gxwebsoft/credit/service/CreditXgxfService.java new file mode 100644 index 0000000..7871e79 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/CreditXgxfService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.credit.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditXgxf; +import com.gxwebsoft.credit.param.CreditXgxfParam; + +import java.util.List; + +/** + * 限制高消费Service + * + * @author 科技小王子 + * @since 2025-12-19 19:51:55 + */ +public interface CreditXgxfService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(CreditXgxfParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(CreditXgxfParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return CreditXgxf + */ + CreditXgxf getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditAdministrativeLicenseServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditAdministrativeLicenseServiceImpl.java new file mode 100644 index 0000000..8df16b6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditAdministrativeLicenseServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditAdministrativeLicense; +import com.gxwebsoft.credit.mapper.CreditAdministrativeLicenseMapper; +import com.gxwebsoft.credit.param.CreditAdministrativeLicenseParam; +import com.gxwebsoft.credit.service.CreditAdministrativeLicenseService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 行政许可Service实现 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:13 + */ +@Service +public class CreditAdministrativeLicenseServiceImpl extends ServiceImpl implements CreditAdministrativeLicenseService { + + @Override + public PageResult pageRel(CreditAdministrativeLicenseParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditAdministrativeLicenseParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditAdministrativeLicense getByIdRel(Integer id) { + CreditAdministrativeLicenseParam param = new CreditAdministrativeLicenseParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditBankruptcyServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditBankruptcyServiceImpl.java new file mode 100644 index 0000000..7ce7d70 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditBankruptcyServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditBankruptcy; +import com.gxwebsoft.credit.mapper.CreditBankruptcyMapper; +import com.gxwebsoft.credit.param.CreditBankruptcyParam; +import com.gxwebsoft.credit.service.CreditBankruptcyService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 破产重整Service实现 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Service +public class CreditBankruptcyServiceImpl extends ServiceImpl implements CreditBankruptcyService { + + @Override + public PageResult pageRel(CreditBankruptcyParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditBankruptcyParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditBankruptcy getByIdRel(Integer id) { + CreditBankruptcyParam param = new CreditBankruptcyParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditBranchServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditBranchServiceImpl.java new file mode 100644 index 0000000..dcf4bec --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditBranchServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditBranch; +import com.gxwebsoft.credit.mapper.CreditBranchMapper; +import com.gxwebsoft.credit.param.CreditBranchParam; +import com.gxwebsoft.credit.service.CreditBranchService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 分支机构Service实现 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Service +public class CreditBranchServiceImpl extends ServiceImpl implements CreditBranchService { + + @Override + public PageResult pageRel(CreditBranchParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditBranchParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditBranch getByIdRel(Integer id) { + CreditBranchParam param = new CreditBranchParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditBreachOfTrustServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditBreachOfTrustServiceImpl.java new file mode 100644 index 0000000..0398416 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditBreachOfTrustServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditBreachOfTrust; +import com.gxwebsoft.credit.mapper.CreditBreachOfTrustMapper; +import com.gxwebsoft.credit.param.CreditBreachOfTrustParam; +import com.gxwebsoft.credit.service.CreditBreachOfTrustService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 失信被执行人Service实现 + * + * @author 科技小王子 + * @since 2025-12-19 19:46:14 + */ +@Service +public class CreditBreachOfTrustServiceImpl extends ServiceImpl implements CreditBreachOfTrustService { + + @Override + public PageResult pageRel(CreditBreachOfTrustParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditBreachOfTrustParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditBreachOfTrust getByIdRel(Integer id) { + CreditBreachOfTrustParam param = new CreditBreachOfTrustParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCaseFilingServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCaseFilingServiceImpl.java new file mode 100644 index 0000000..3f1f4e4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCaseFilingServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditCaseFiling; +import com.gxwebsoft.credit.mapper.CreditCaseFilingMapper; +import com.gxwebsoft.credit.param.CreditCaseFilingParam; +import com.gxwebsoft.credit.service.CreditCaseFilingService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 司法大数据Service实现 + * + * @author 科技小王子 + * @since 2025-12-19 19:47:22 + */ +@Service +public class CreditCaseFilingServiceImpl extends ServiceImpl implements CreditCaseFilingService { + + @Override + public PageResult pageRel(CreditCaseFilingParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditCaseFilingParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditCaseFiling getByIdRel(Integer id) { + CreditCaseFilingParam param = new CreditCaseFilingParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCompanyServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCompanyServiceImpl.java new file mode 100644 index 0000000..ab591b3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCompanyServiceImpl.java @@ -0,0 +1,61 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditCompany; +import com.gxwebsoft.credit.mapper.CreditCompanyMapper; +import com.gxwebsoft.credit.param.CreditCompanyParam; +import com.gxwebsoft.credit.service.CreditCompanyService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 企业Service实现 + * + * @author 科技小王子 + * @since 2025-12-17 08:28:03 + */ +@Service +public class CreditCompanyServiceImpl extends ServiceImpl implements CreditCompanyService { + + @Override + public PageResult pageRel(CreditCompanyParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditCompanyParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditCompany getByIdRel(Integer id) { + CreditCompanyParam param = new CreditCompanyParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public CreditCompany getByName(String name) { + CreditCompanyParam param = new CreditCompanyParam(); + param.setName(name); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public CreditCompany getByMatchName(String name) { + CreditCompanyParam param = new CreditCompanyParam(); + param.setMatchName(name); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCompetitorServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCompetitorServiceImpl.java new file mode 100644 index 0000000..4204d3e --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCompetitorServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditCompetitor; +import com.gxwebsoft.credit.mapper.CreditCompetitorMapper; +import com.gxwebsoft.credit.param.CreditCompetitorParam; +import com.gxwebsoft.credit.service.CreditCompetitorService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 竞争对手Service实现 + * + * @author 科技小王子 + * @since 2025-12-19 19:49:05 + */ +@Service +public class CreditCompetitorServiceImpl extends ServiceImpl implements CreditCompetitorService { + + @Override + public PageResult pageRel(CreditCompetitorParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditCompetitorParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditCompetitor getByIdRel(Integer id) { + CreditCompetitorParam param = new CreditCompetitorParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCourtAnnouncementServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCourtAnnouncementServiceImpl.java new file mode 100644 index 0000000..d9e6ecf --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCourtAnnouncementServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditCourtAnnouncement; +import com.gxwebsoft.credit.mapper.CreditCourtAnnouncementMapper; +import com.gxwebsoft.credit.param.CreditCourtAnnouncementParam; +import com.gxwebsoft.credit.service.CreditCourtAnnouncementService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 法院公告司法大数据Service实现 + * + * @author 科技小王子 + * @since 2025-12-19 19:49:13 + */ +@Service +public class CreditCourtAnnouncementServiceImpl extends ServiceImpl implements CreditCourtAnnouncementService { + + @Override + public PageResult pageRel(CreditCourtAnnouncementParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditCourtAnnouncementParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditCourtAnnouncement getByIdRel(Integer id) { + CreditCourtAnnouncementParam param = new CreditCourtAnnouncementParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCourtSessionServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCourtSessionServiceImpl.java new file mode 100644 index 0000000..c875735 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCourtSessionServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditCourtSession; +import com.gxwebsoft.credit.mapper.CreditCourtSessionMapper; +import com.gxwebsoft.credit.param.CreditCourtSessionParam; +import com.gxwebsoft.credit.service.CreditCourtSessionService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 开庭公告司法大数据Service实现 + * + * @author 科技小王子 + * @since 2025-12-19 19:49:33 + */ +@Service +public class CreditCourtSessionServiceImpl extends ServiceImpl implements CreditCourtSessionService { + + @Override + public PageResult pageRel(CreditCourtSessionParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditCourtSessionParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditCourtSession getByIdRel(Integer id) { + CreditCourtSessionParam param = new CreditCourtSessionParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditCustomerServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCustomerServiceImpl.java new file mode 100644 index 0000000..edfbfc8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditCustomerServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditCustomer; +import com.gxwebsoft.credit.mapper.CreditCustomerMapper; +import com.gxwebsoft.credit.param.CreditCustomerParam; +import com.gxwebsoft.credit.service.CreditCustomerService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 客户Service实现 + * + * @author 科技小王子 + * @since 2025-12-21 21:20:58 + */ +@Service +public class CreditCustomerServiceImpl extends ServiceImpl implements CreditCustomerService { + + @Override + public PageResult pageRel(CreditCustomerParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditCustomerParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditCustomer getByIdRel(Integer id) { + CreditCustomerParam param = new CreditCustomerParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditDeliveryNoticeServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditDeliveryNoticeServiceImpl.java new file mode 100644 index 0000000..becedc3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditDeliveryNoticeServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditDeliveryNotice; +import com.gxwebsoft.credit.mapper.CreditDeliveryNoticeMapper; +import com.gxwebsoft.credit.param.CreditDeliveryNoticeParam; +import com.gxwebsoft.credit.service.CreditDeliveryNoticeService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 送达公告司法大数据Service实现 + * + * @author 科技小王子 + * @since 2025-12-19 19:49:51 + */ +@Service +public class CreditDeliveryNoticeServiceImpl extends ServiceImpl implements CreditDeliveryNoticeService { + + @Override + public PageResult pageRel(CreditDeliveryNoticeParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditDeliveryNoticeParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditDeliveryNotice getByIdRel(Integer id) { + CreditDeliveryNoticeParam param = new CreditDeliveryNoticeParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditExternalServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditExternalServiceImpl.java new file mode 100644 index 0000000..2b45a20 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditExternalServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditExternal; +import com.gxwebsoft.credit.mapper.CreditExternalMapper; +import com.gxwebsoft.credit.param.CreditExternalParam; +import com.gxwebsoft.credit.service.CreditExternalService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 对外投资Service实现 + * + * @author 科技小王子 + * @since 2025-12-19 19:50:11 + */ +@Service +public class CreditExternalServiceImpl extends ServiceImpl implements CreditExternalService { + + @Override + public PageResult pageRel(CreditExternalParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditExternalParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditExternal getByIdRel(Integer id) { + CreditExternalParam param = new CreditExternalParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditFinalVersionServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditFinalVersionServiceImpl.java new file mode 100644 index 0000000..c40ec14 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditFinalVersionServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditFinalVersion; +import com.gxwebsoft.credit.mapper.CreditFinalVersionMapper; +import com.gxwebsoft.credit.param.CreditFinalVersionParam; +import com.gxwebsoft.credit.service.CreditFinalVersionService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 终本案件Service实现 + * + * @author 科技小王子 + * @since 2025-12-19 19:50:19 + */ +@Service +public class CreditFinalVersionServiceImpl extends ServiceImpl implements CreditFinalVersionService { + + @Override + public PageResult pageRel(CreditFinalVersionParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditFinalVersionParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditFinalVersion getByIdRel(Integer id) { + CreditFinalVersionParam param = new CreditFinalVersionParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditGqdjServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditGqdjServiceImpl.java new file mode 100644 index 0000000..acc1353 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditGqdjServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditGqdj; +import com.gxwebsoft.credit.mapper.CreditGqdjMapper; +import com.gxwebsoft.credit.param.CreditGqdjParam; +import com.gxwebsoft.credit.service.CreditGqdjService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 股权冻结Service实现 + * + * @author 科技小王子 + * @since 2025-12-19 19:50:37 + */ +@Service +public class CreditGqdjServiceImpl extends ServiceImpl implements CreditGqdjService { + + @Override + public PageResult pageRel(CreditGqdjParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditGqdjParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditGqdj getByIdRel(Integer id) { + CreditGqdjParam param = new CreditGqdjParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditHistoricalLegalPersonServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditHistoricalLegalPersonServiceImpl.java new file mode 100644 index 0000000..ffd3d1f --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditHistoricalLegalPersonServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditHistoricalLegalPerson; +import com.gxwebsoft.credit.mapper.CreditHistoricalLegalPersonMapper; +import com.gxwebsoft.credit.param.CreditHistoricalLegalPersonParam; +import com.gxwebsoft.credit.service.CreditHistoricalLegalPersonService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 历史法定代表人Service实现 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Service +public class CreditHistoricalLegalPersonServiceImpl extends ServiceImpl implements CreditHistoricalLegalPersonService { + + @Override + public PageResult pageRel(CreditHistoricalLegalPersonParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditHistoricalLegalPersonParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditHistoricalLegalPerson getByIdRel(Integer id) { + CreditHistoricalLegalPersonParam param = new CreditHistoricalLegalPersonParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditJudgmentDebtorServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditJudgmentDebtorServiceImpl.java new file mode 100644 index 0000000..9291270 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditJudgmentDebtorServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditJudgmentDebtor; +import com.gxwebsoft.credit.mapper.CreditJudgmentDebtorMapper; +import com.gxwebsoft.credit.param.CreditJudgmentDebtorParam; +import com.gxwebsoft.credit.service.CreditJudgmentDebtorService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 被执行人Service实现 + * + * @author 科技小王子 + * @since 2025-12-19 19:50:55 + */ +@Service +public class CreditJudgmentDebtorServiceImpl extends ServiceImpl implements CreditJudgmentDebtorService { + + @Override + public PageResult pageRel(CreditJudgmentDebtorParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditJudgmentDebtorParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditJudgmentDebtor getByIdRel(Integer id) { + CreditJudgmentDebtorParam param = new CreditJudgmentDebtorParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditJudicialDocumentServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditJudicialDocumentServiceImpl.java new file mode 100644 index 0000000..a83095a --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditJudicialDocumentServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditJudicialDocument; +import com.gxwebsoft.credit.mapper.CreditJudicialDocumentMapper; +import com.gxwebsoft.credit.param.CreditJudicialDocumentParam; +import com.gxwebsoft.credit.service.CreditJudicialDocumentService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 裁判文书司法大数据Service实现 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:02 + */ +@Service +public class CreditJudicialDocumentServiceImpl extends ServiceImpl implements CreditJudicialDocumentService { + + @Override + public PageResult pageRel(CreditJudicialDocumentParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditJudicialDocumentParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditJudicialDocument getByIdRel(Integer id) { + CreditJudicialDocumentParam param = new CreditJudicialDocumentParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditJudiciaryServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditJudiciaryServiceImpl.java new file mode 100644 index 0000000..6b31fbe --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditJudiciaryServiceImpl.java @@ -0,0 +1,54 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditJudiciary; +import com.gxwebsoft.credit.mapper.CreditJudiciaryMapper; +import com.gxwebsoft.credit.param.CreditJudiciaryParam; +import com.gxwebsoft.credit.service.CreditJudiciaryService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 司法案件Service实现 + * + * @author 科技小王子 + * @since 2025-12-16 15:23:58 + */ +@Service +public class CreditJudiciaryServiceImpl extends ServiceImpl implements CreditJudiciaryService { + + @Override + public PageResult pageRel(CreditJudiciaryParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditJudiciaryParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditJudiciary getByIdRel(Integer id) { + CreditJudiciaryParam param = new CreditJudiciaryParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public CreditJudiciary getByName(String name) { + CreditJudiciaryParam param = new CreditJudiciaryParam(); + param.setName(name); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditMediationServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditMediationServiceImpl.java new file mode 100644 index 0000000..9ec551a --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditMediationServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditMediation; +import com.gxwebsoft.credit.mapper.CreditMediationMapper; +import com.gxwebsoft.credit.param.CreditMediationParam; +import com.gxwebsoft.credit.service.CreditMediationService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 诉前调解司法大数据Service实现 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:25 + */ +@Service +public class CreditMediationServiceImpl extends ServiceImpl implements CreditMediationService { + + @Override + public PageResult pageRel(CreditMediationParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditMediationParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditMediation getByIdRel(Integer id) { + CreditMediationParam param = new CreditMediationParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditNearbyCompanyServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditNearbyCompanyServiceImpl.java new file mode 100644 index 0000000..5083b95 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditNearbyCompanyServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditNearbyCompany; +import com.gxwebsoft.credit.mapper.CreditNearbyCompanyMapper; +import com.gxwebsoft.credit.param.CreditNearbyCompanyParam; +import com.gxwebsoft.credit.service.CreditNearbyCompanyService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 附近企业Service实现 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Service +public class CreditNearbyCompanyServiceImpl extends ServiceImpl implements CreditNearbyCompanyService { + + @Override + public PageResult pageRel(CreditNearbyCompanyParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditNearbyCompanyParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditNearbyCompany getByIdRel(Integer id) { + CreditNearbyCompanyParam param = new CreditNearbyCompanyParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditPatentServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditPatentServiceImpl.java new file mode 100644 index 0000000..3bb975d --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditPatentServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditPatent; +import com.gxwebsoft.credit.mapper.CreditPatentMapper; +import com.gxwebsoft.credit.param.CreditPatentParam; +import com.gxwebsoft.credit.service.CreditPatentService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 专利Service实现 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Service +public class CreditPatentServiceImpl extends ServiceImpl implements CreditPatentService { + + @Override + public PageResult pageRel(CreditPatentParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditPatentParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditPatent getByIdRel(Integer id) { + CreditPatentParam param = new CreditPatentParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditRiskRelationServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditRiskRelationServiceImpl.java new file mode 100644 index 0000000..f000de1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditRiskRelationServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditRiskRelation; +import com.gxwebsoft.credit.mapper.CreditRiskRelationMapper; +import com.gxwebsoft.credit.param.CreditRiskRelationParam; +import com.gxwebsoft.credit.service.CreditRiskRelationService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 风险关系表Service实现 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:40 + */ +@Service +public class CreditRiskRelationServiceImpl extends ServiceImpl implements CreditRiskRelationService { + + @Override + public PageResult pageRel(CreditRiskRelationParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditRiskRelationParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditRiskRelation getByIdRel(Integer id) { + CreditRiskRelationParam param = new CreditRiskRelationParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditSupplierServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditSupplierServiceImpl.java new file mode 100644 index 0000000..56a9c06 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditSupplierServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditSupplier; +import com.gxwebsoft.credit.mapper.CreditSupplierMapper; +import com.gxwebsoft.credit.param.CreditSupplierParam; +import com.gxwebsoft.credit.service.CreditSupplierService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 供应商Service实现 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:47 + */ +@Service +public class CreditSupplierServiceImpl extends ServiceImpl implements CreditSupplierService { + + @Override + public PageResult pageRel(CreditSupplierParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditSupplierParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditSupplier getByIdRel(Integer id) { + CreditSupplierParam param = new CreditSupplierParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditSuspectedRelationshipServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditSuspectedRelationshipServiceImpl.java new file mode 100644 index 0000000..4907758 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditSuspectedRelationshipServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditSuspectedRelationship; +import com.gxwebsoft.credit.mapper.CreditSuspectedRelationshipMapper; +import com.gxwebsoft.credit.param.CreditSuspectedRelationshipParam; +import com.gxwebsoft.credit.service.CreditSuspectedRelationshipService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 疑似关系Service实现 + * + * @author 科技小王子 + * @since 2026-01-07 13:52:14 + */ +@Service +public class CreditSuspectedRelationshipServiceImpl extends ServiceImpl implements CreditSuspectedRelationshipService { + + @Override + public PageResult pageRel(CreditSuspectedRelationshipParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditSuspectedRelationshipParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditSuspectedRelationship getByIdRel(Integer id) { + CreditSuspectedRelationshipParam param = new CreditSuspectedRelationshipParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditUserServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditUserServiceImpl.java new file mode 100644 index 0000000..9bd5a00 --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditUserServiceImpl.java @@ -0,0 +1,54 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.credit.mapper.CreditUserMapper; +import com.gxwebsoft.credit.service.CreditUserService; +import com.gxwebsoft.credit.entity.CreditUser; +import com.gxwebsoft.credit.param.CreditUserParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 招投标信息表Service实现 + * + * @author 科技小王子 + * @since 2025-12-15 13:16:03 + */ +@Service +public class CreditUserServiceImpl extends ServiceImpl implements CreditUserService { + + @Override + public PageResult pageRel(CreditUserParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditUserParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditUser getByIdRel(Integer id) { + CreditUserParam param = new CreditUserParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public CreditUser getByName(String name) { + CreditUserParam param = new CreditUserParam(); + param.setName(name); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/credit/service/impl/CreditXgxfServiceImpl.java b/src/main/java/com/gxwebsoft/credit/service/impl/CreditXgxfServiceImpl.java new file mode 100644 index 0000000..d8ffa3a --- /dev/null +++ b/src/main/java/com/gxwebsoft/credit/service/impl/CreditXgxfServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.credit.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.credit.entity.CreditXgxf; +import com.gxwebsoft.credit.mapper.CreditXgxfMapper; +import com.gxwebsoft.credit.param.CreditXgxfParam; +import com.gxwebsoft.credit.service.CreditXgxfService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 限制高消费Service实现 + * + * @author 科技小王子 + * @since 2025-12-19 19:51:55 + */ +@Service +public class CreditXgxfServiceImpl extends ServiceImpl implements CreditXgxfService { + + @Override + public PageResult pageRel(CreditXgxfParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(CreditXgxfParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public CreditXgxf getByIdRel(Integer id) { + CreditXgxfParam param = new CreditXgxfParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/controller/DormitoryApplyController.java b/src/main/java/com/gxwebsoft/dormitory/controller/DormitoryApplyController.java new file mode 100644 index 0000000..b34af63 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/controller/DormitoryApplyController.java @@ -0,0 +1,128 @@ +package com.gxwebsoft.dormitory.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.dormitory.entity.DormitoryApply; +import com.gxwebsoft.dormitory.param.DormitoryApplyParam; +import com.gxwebsoft.dormitory.service.DormitoryApplyService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 审批管理控制器 + * + * @author 科技小王子 + * @since 2025-10-03 15:54:30 + */ +@Tag(name = "审批管理管理") +@RestController +@RequestMapping("/api/dormitory/dormitory-apply") +public class DormitoryApplyController extends BaseController { + @Resource + private DormitoryApplyService dormitoryApplyService; + + @PreAuthorize("hasAuthority('dormitory:dormitoryApply:list')") + @Operation(summary = "分页查询审批管理") + @GetMapping("/page") + public ApiResult> page(DormitoryApplyParam param) { + // 使用关联查询 + return success(dormitoryApplyService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryApply:list')") + @Operation(summary = "查询全部审批管理") + @GetMapping() + public ApiResult> list(DormitoryApplyParam param) { + // 使用关联查询 + return success(dormitoryApplyService.listRel(param)); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryApply:list')") + @Operation(summary = "根据id查询审批管理") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(dormitoryApplyService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryApply:save')") + @OperationLog + @Operation(summary = "添加审批管理") + @PostMapping() + public ApiResult save(@RequestBody DormitoryApply dormitoryApply) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + dormitoryApply.setUserId(loginUser.getUserId()); + } + if (dormitoryApplyService.save(dormitoryApply)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryApply:update')") + @OperationLog + @Operation(summary = "修改审批管理") + @PutMapping() + public ApiResult update(@RequestBody DormitoryApply dormitoryApply) { + if (dormitoryApplyService.updateById(dormitoryApply)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryApply:remove')") + @OperationLog + @Operation(summary = "删除审批管理") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (dormitoryApplyService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryApply:save')") + @OperationLog + @Operation(summary = "批量添加审批管理") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (dormitoryApplyService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryApply:update')") + @OperationLog + @Operation(summary = "批量修改审批管理") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(dormitoryApplyService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryApply:remove')") + @OperationLog + @Operation(summary = "批量删除审批管理") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (dormitoryApplyService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} \ No newline at end of file diff --git a/src/main/java/com/gxwebsoft/dormitory/controller/DormitoryBedController.java b/src/main/java/com/gxwebsoft/dormitory/controller/DormitoryBedController.java new file mode 100644 index 0000000..c90f412 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/controller/DormitoryBedController.java @@ -0,0 +1,126 @@ +package com.gxwebsoft.dormitory.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.dormitory.service.DormitoryBedService; +import com.gxwebsoft.dormitory.entity.DormitoryBed; +import com.gxwebsoft.dormitory.param.DormitoryBedParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 宿舍床位控制器 + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +@Tag(name = "宿舍床位管理") +@RestController +@RequestMapping("/api/dormitory/dormitory-bed") +public class DormitoryBedController extends BaseController { + @Resource + private DormitoryBedService dormitoryBedService; + + @Operation(summary = "分页查询宿舍床位") + @GetMapping("/page") + public ApiResult> page(DormitoryBedParam param) { + // 使用关联查询 + return success(dormitoryBedService.pageRel(param)); + } + + @Operation(summary = "查询全部宿舍床位") + @GetMapping() + public ApiResult> list(DormitoryBedParam param) { + // 使用关联查询 + return success(dormitoryBedService.listRel(param)); + } + + @Operation(summary = "根据id查询宿舍床位") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(dormitoryBedService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryBed:save')") + @OperationLog + @Operation(summary = "添加宿舍床位") + @PostMapping() + public ApiResult save(@RequestBody DormitoryBed dormitoryBed) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + // dormitoryBed实体类没有userId字段,所以不设置 + } + if (dormitoryBedService.save(dormitoryBed)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryBed:update')") + @OperationLog + @Operation(summary = "修改宿舍床位") + @PutMapping() + public ApiResult update(@RequestBody DormitoryBed dormitoryBed) { + if (dormitoryBedService.updateById(dormitoryBed)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryBed:remove')") + @OperationLog + @Operation(summary = "删除宿舍床位") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (dormitoryBedService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryBed:save')") + @OperationLog + @Operation(summary = "批量添加宿舍床位") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (dormitoryBedService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryBed:update')") + @OperationLog + @Operation(summary = "批量修改宿舍床位") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(dormitoryBedService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryBed:remove')") + @OperationLog + @Operation(summary = "批量删除宿舍床位") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (dormitoryBedService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/controller/DormitoryBuildingController.java b/src/main/java/com/gxwebsoft/dormitory/controller/DormitoryBuildingController.java new file mode 100644 index 0000000..ab84fbf --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/controller/DormitoryBuildingController.java @@ -0,0 +1,126 @@ +package com.gxwebsoft.dormitory.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.dormitory.service.DormitoryBuildingService; +import com.gxwebsoft.dormitory.entity.DormitoryBuilding; +import com.gxwebsoft.dormitory.param.DormitoryBuildingParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 宿舍楼栋控制器 + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +@Tag(name = "宿舍楼栋管理") +@RestController +@RequestMapping("/api/dormitory/dormitory-building") +public class DormitoryBuildingController extends BaseController { + @Resource + private DormitoryBuildingService dormitoryBuildingService; + + @Operation(summary = "分页查询宿舍楼栋") + @GetMapping("/page") + public ApiResult> page(DormitoryBuildingParam param) { + // 使用关联查询 + return success(dormitoryBuildingService.pageRel(param)); + } + + @Operation(summary = "查询全部宿舍楼栋") + @GetMapping() + public ApiResult> list(DormitoryBuildingParam param) { + // 使用关联查询 + return success(dormitoryBuildingService.listRel(param)); + } + + @Operation(summary = "根据id查询宿舍楼栋") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(dormitoryBuildingService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryBuilding:save')") + @OperationLog + @Operation(summary = "添加宿舍楼栋") + @PostMapping() + public ApiResult save(@RequestBody DormitoryBuilding dormitoryBuilding) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + // dormitoryBuilding实体类没有userId字段,所以不设置 + } + if (dormitoryBuildingService.save(dormitoryBuilding)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryBuilding:update')") + @OperationLog + @Operation(summary = "修改宿舍楼栋") + @PutMapping() + public ApiResult update(@RequestBody DormitoryBuilding dormitoryBuilding) { + if (dormitoryBuildingService.updateById(dormitoryBuilding)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryBuilding:remove')") + @OperationLog + @Operation(summary = "删除宿舍楼栋") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (dormitoryBuildingService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryBuilding:save')") + @OperationLog + @Operation(summary = "批量添加宿舍楼栋") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (dormitoryBuildingService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryBuilding:update')") + @OperationLog + @Operation(summary = "批量修改宿舍楼栋") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(dormitoryBuildingService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryBuilding:remove')") + @OperationLog + @Operation(summary = "批量删除宿舍楼栋") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (dormitoryBuildingService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/controller/DormitoryFloorController.java b/src/main/java/com/gxwebsoft/dormitory/controller/DormitoryFloorController.java new file mode 100644 index 0000000..2d16bda --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/controller/DormitoryFloorController.java @@ -0,0 +1,126 @@ +package com.gxwebsoft.dormitory.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.dormitory.service.DormitoryFloorService; +import com.gxwebsoft.dormitory.entity.DormitoryFloor; +import com.gxwebsoft.dormitory.param.DormitoryFloorParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 宿舍楼层控制器 + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +@Tag(name = "宿舍楼层管理") +@RestController +@RequestMapping("/api/dormitory/dormitory-floor") +public class DormitoryFloorController extends BaseController { + @Resource + private DormitoryFloorService dormitoryFloorService; + + @Operation(summary = "分页查询宿舍楼层") + @GetMapping("/page") + public ApiResult> page(DormitoryFloorParam param) { + // 使用关联查询 + return success(dormitoryFloorService.pageRel(param)); + } + + @Operation(summary = "查询全部宿舍楼层") + @GetMapping() + public ApiResult> list(DormitoryFloorParam param) { + // 使用关联查询 + return success(dormitoryFloorService.listRel(param)); + } + + @Operation(summary = "根据id查询宿舍楼层") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(dormitoryFloorService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryFloor:save')") + @OperationLog + @Operation(summary = "添加宿舍楼层") + @PostMapping() + public ApiResult save(@RequestBody DormitoryFloor dormitoryFloor) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + // dormitoryFloor实体类没有userId字段,所以不设置 + } + if (dormitoryFloorService.save(dormitoryFloor)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryFloor:update')") + @OperationLog + @Operation(summary = "修改宿舍楼层") + @PutMapping() + public ApiResult update(@RequestBody DormitoryFloor dormitoryFloor) { + if (dormitoryFloorService.updateById(dormitoryFloor)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryFloor:remove')") + @OperationLog + @Operation(summary = "删除宿舍楼层") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (dormitoryFloorService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryFloor:save')") + @OperationLog + @Operation(summary = "批量添加宿舍楼层") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (dormitoryFloorService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryFloor:update')") + @OperationLog + @Operation(summary = "批量修改宿舍楼层") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(dormitoryFloorService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryFloor:remove')") + @OperationLog + @Operation(summary = "批量删除宿舍楼层") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (dormitoryFloorService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/controller/DormitoryRecordController.java b/src/main/java/com/gxwebsoft/dormitory/controller/DormitoryRecordController.java new file mode 100644 index 0000000..7a6cc15 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/controller/DormitoryRecordController.java @@ -0,0 +1,126 @@ +package com.gxwebsoft.dormitory.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.dormitory.service.DormitoryRecordService; +import com.gxwebsoft.dormitory.entity.DormitoryRecord; +import com.gxwebsoft.dormitory.param.DormitoryRecordParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 宿舍记录控制器 + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +@Tag(name = "宿舍记录管理") +@RestController +@RequestMapping("/api/dormitory/dormitory-record") +public class DormitoryRecordController extends BaseController { + @Resource + private DormitoryRecordService dormitoryRecordService; + + @Operation(summary = "分页查询宿舍记录") + @GetMapping("/page") + public ApiResult> page(DormitoryRecordParam param) { + // 使用关联查询 + return success(dormitoryRecordService.pageRel(param)); + } + + @Operation(summary = "查询全部宿舍记录") + @GetMapping() + public ApiResult> list(DormitoryRecordParam param) { + // 使用关联查询 + return success(dormitoryRecordService.listRel(param)); + } + + @Operation(summary = "根据id查询宿舍记录") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(dormitoryRecordService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryRecord:save')") + @OperationLog + @Operation(summary = "添加宿舍记录") + @PostMapping() + public ApiResult save(@RequestBody DormitoryRecord dormitoryRecord) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + // dormitoryRecord实体类没有userId字段,所以不设置 + } + if (dormitoryRecordService.save(dormitoryRecord)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryRecord:update')") + @OperationLog + @Operation(summary = "修改宿舍记录") + @PutMapping() + public ApiResult update(@RequestBody DormitoryRecord dormitoryRecord) { + if (dormitoryRecordService.updateById(dormitoryRecord)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryRecord:remove')") + @OperationLog + @Operation(summary = "删除宿舍记录") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (dormitoryRecordService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryRecord:save')") + @OperationLog + @Operation(summary = "批量添加宿舍记录") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (dormitoryRecordService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryRecord:update')") + @OperationLog + @Operation(summary = "批量修改宿舍记录") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(dormitoryRecordService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('dormitory:dormitoryRecord:remove')") + @OperationLog + @Operation(summary = "批量删除宿舍记录") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (dormitoryRecordService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/entity/DormitoryApply.java b/src/main/java/com/gxwebsoft/dormitory/entity/DormitoryApply.java new file mode 100644 index 0000000..0b82350 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/entity/DormitoryApply.java @@ -0,0 +1,89 @@ +package com.gxwebsoft.dormitory.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * 审批管理 + * + * @author 科技小王子 + * @since 2025-10-03 15:54:30 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(description = "审批管理") +public class DormitoryApply implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "类型") + private Integer type; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "姓名") + private String realName; + + @Schema(description = "手机号") + private String mobile; + + @Schema(description = "客户名称") + private String dealerName; + + @Schema(description = "客户编号") + private String dealerCode; + + @Schema(description = "详细地址") + private String address; + + @Schema(description = "签约价格") + private BigDecimal money; + + @Schema(description = "推荐人用户ID") + private Integer refereeId; + + @Schema(description = "申请方式(10需后台审核 20无需审核)") + private Integer applyType; + + @Schema(description = "审核状态 (10待审核 20审核通过 30驳回)") + private Integer applyStatus; + + @Schema(description = "申请时间") + private LocalDateTime applyTime; + + @Schema(description = "审核时间") + private LocalDateTime auditTime; + + @Schema(description = "合同时间") + private LocalDateTime contractTime; + + @Schema(description = "过期时间") + private LocalDateTime expirationTime; + + @Schema(description = "驳回原因") + private String rejectReason; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "商城ID") + private Integer tenantId; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + private LocalDateTime updateTime; + +} \ No newline at end of file diff --git a/src/main/java/com/gxwebsoft/dormitory/entity/DormitoryBed.java b/src/main/java/com/gxwebsoft/dormitory/entity/DormitoryBed.java new file mode 100644 index 0000000..7302543 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/entity/DormitoryBed.java @@ -0,0 +1,91 @@ +package com.gxwebsoft.dormitory.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 宿舍床位 + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(description = "宿舍床位") +public class DormitoryBed implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "宿舍名称") + private String name; + + @Schema(description = "编号") + private String code; + + @Schema(description = "楼栋ID") + private Integer buildingId; + + @Schema(description = "楼栋名称") + @TableField(exist = false) + private String buildingName; + + @Schema(description = "楼层ID") + private Integer floorId; + + @Schema(description = "楼层名称") + @TableField(exist = false) + private String floorName; + + @Schema(description = "宿舍ID") + private Integer recordId; + + @Schema(description = "宿舍名称") + @TableField(exist = false) + private String recordName; + + @Schema(description = "学生ID") + private Integer userId; + + @Schema(description = "学生昵称") + @TableField(exist = false) + private String realName; + + @Schema(description = "手机号码") + @TableField(exist = false) + private String phone; + + @Schema(description = "头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "上下铺 1下铺 2上铺 0无") + private Boolean bunk; + + @Schema(description = "充电口") + private Boolean chargingPort; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1报修") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/entity/DormitoryBuilding.java b/src/main/java/com/gxwebsoft/dormitory/entity/DormitoryBuilding.java new file mode 100644 index 0000000..f79d4fb --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/entity/DormitoryBuilding.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.dormitory.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 宿舍楼栋 + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(description = "宿舍楼栋") +public class DormitoryBuilding implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "楼栋名称") + private String name; + + @Schema(description = "楼栋编号") + private String code; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/src/main/java/com/gxwebsoft/dormitory/entity/DormitoryFloor.java b/src/main/java/com/gxwebsoft/dormitory/entity/DormitoryFloor.java new file mode 100644 index 0000000..e72b2e0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/entity/DormitoryFloor.java @@ -0,0 +1,56 @@ +package com.gxwebsoft.dormitory.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 宿舍楼层 + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(description = "宿舍楼层") +public class DormitoryFloor implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "楼层") + private String name; + + @Schema(description = "编号") + private String code; + + @Schema(description = "楼栋") + @TableField(exist = false) + private String buildingName; + + @Schema(description = "楼栋ID") + private Integer buildingId; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/entity/DormitoryRecord.java b/src/main/java/com/gxwebsoft/dormitory/entity/DormitoryRecord.java new file mode 100644 index 0000000..d2aac03 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/entity/DormitoryRecord.java @@ -0,0 +1,69 @@ +package com.gxwebsoft.dormitory.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 宿舍记录 + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(description = "宿舍记录") +public class DormitoryRecord implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "宿舍名称") + private String name; + + @Schema(description = "编号") + private String code; + + @Schema(description = "楼栋ID") + private Integer buildingId; + + @Schema(description = "楼栋名称") + @TableField(exist = false) + private String buildingName; + + @Schema(description = "楼层ID") + private Integer floorId; + + @Schema(description = "楼层名称") + @TableField(exist = false) + private String floorName; + + @Schema(description = "床位数") + private Integer beds; + + @Schema(description = "独立卫生间") + private Boolean toilet; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/mapper/DormitoryApplyMapper.java b/src/main/java/com/gxwebsoft/dormitory/mapper/DormitoryApplyMapper.java new file mode 100644 index 0000000..b7e5ea5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/mapper/DormitoryApplyMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.dormitory.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.dormitory.entity.DormitoryApply; +import com.gxwebsoft.dormitory.param.DormitoryApplyParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 审批管理Mapper + * + * @author 科技小王子 + * @since 2025-10-03 15:54:30 + */ +public interface DormitoryApplyMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") DormitoryApplyParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") DormitoryApplyParam param); + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/mapper/DormitoryBedMapper.java b/src/main/java/com/gxwebsoft/dormitory/mapper/DormitoryBedMapper.java new file mode 100644 index 0000000..484bf2b --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/mapper/DormitoryBedMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.dormitory.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.dormitory.entity.DormitoryBed; +import com.gxwebsoft.dormitory.param.DormitoryBedParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 宿舍床位Mapper + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +public interface DormitoryBedMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") DormitoryBedParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") DormitoryBedParam param); + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/mapper/DormitoryBuildingMapper.java b/src/main/java/com/gxwebsoft/dormitory/mapper/DormitoryBuildingMapper.java new file mode 100644 index 0000000..3bfc4ca --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/mapper/DormitoryBuildingMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.dormitory.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.dormitory.entity.DormitoryBuilding; +import com.gxwebsoft.dormitory.param.DormitoryBuildingParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 宿舍楼栋Mapper + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +public interface DormitoryBuildingMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") DormitoryBuildingParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") DormitoryBuildingParam param); + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/mapper/DormitoryFloorMapper.java b/src/main/java/com/gxwebsoft/dormitory/mapper/DormitoryFloorMapper.java new file mode 100644 index 0000000..84f7e9b --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/mapper/DormitoryFloorMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.dormitory.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.dormitory.entity.DormitoryFloor; +import com.gxwebsoft.dormitory.param.DormitoryFloorParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 宿舍楼层Mapper + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +public interface DormitoryFloorMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") DormitoryFloorParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") DormitoryFloorParam param); + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/mapper/DormitoryRecordMapper.java b/src/main/java/com/gxwebsoft/dormitory/mapper/DormitoryRecordMapper.java new file mode 100644 index 0000000..9d64316 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/mapper/DormitoryRecordMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.dormitory.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.dormitory.entity.DormitoryRecord; +import com.gxwebsoft.dormitory.param.DormitoryRecordParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 宿舍记录Mapper + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +public interface DormitoryRecordMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") DormitoryRecordParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") DormitoryRecordParam param); + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/mapper/xml/DormitoryApplyMapper.xml b/src/main/java/com/gxwebsoft/dormitory/mapper/xml/DormitoryApplyMapper.xml new file mode 100644 index 0000000..a42aa41 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/mapper/xml/DormitoryApplyMapper.xml @@ -0,0 +1,87 @@ + + + + + + + SELECT a.* + FROM dormitory_apply a + + + AND a.id = #{param.id} + + + AND a.type = #{param.type} + + + AND a.user_id = #{param.userId} + + + AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') + + + AND a.mobile LIKE CONCAT('%', #{param.mobile}, '%') + + + AND a.dealer_name LIKE CONCAT('%', #{param.dealerName}, '%') + + + AND a.dealer_code LIKE CONCAT('%', #{param.dealerCode}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.money = #{param.money} + + + AND a.referee_id = #{param.refereeId} + + + AND a.apply_type = #{param.applyType} + + + AND a.apply_status = #{param.applyStatus} + + + AND a.apply_time LIKE CONCAT('%', #{param.applyTime}, '%') + + + AND a.audit_time LIKE CONCAT('%', #{param.auditTime}, '%') + + + AND a.contract_time LIKE CONCAT('%', #{param.contractTime}, '%') + + + AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') + + + AND a.reject_reason LIKE CONCAT('%', #{param.rejectReason}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/dormitory/mapper/xml/DormitoryBedMapper.xml b/src/main/java/com/gxwebsoft/dormitory/mapper/xml/DormitoryBedMapper.xml new file mode 100644 index 0000000..351e144 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/mapper/xml/DormitoryBedMapper.xml @@ -0,0 +1,73 @@ + + + + + + + SELECT a.*, b.name AS buildingName, c.name AS floorName, d.name AS recordName, e.real_name AS realName, e.phone AS phone, e.avatar + FROM dormitory_bed a + LEFT JOIN dormitory_building b ON a.building_id = b.id + LEFT JOIN dormitory_floor c ON a.floor_id = c.id + LEFT JOIN dormitory_record d ON a.record_id = d.id + LEFT JOIN shop_user e ON a.user_id = e.user_id + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.building_id = #{param.buildingId} + + + AND a.floor_id = #{param.floorId} + + + AND a.record_id = #{param.recordId} + + + AND a.user_id = #{param.userId} + + + AND a.bunk = #{param.bunk} + + + AND a.charging_port = #{param.chargingPort} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/dormitory/mapper/xml/DormitoryBuildingMapper.xml b/src/main/java/com/gxwebsoft/dormitory/mapper/xml/DormitoryBuildingMapper.xml new file mode 100644 index 0000000..b7a6e30 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/mapper/xml/DormitoryBuildingMapper.xml @@ -0,0 +1,51 @@ + + + + + + + SELECT a.* + FROM dormitory_building a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/dormitory/mapper/xml/DormitoryFloorMapper.xml b/src/main/java/com/gxwebsoft/dormitory/mapper/xml/DormitoryFloorMapper.xml new file mode 100644 index 0000000..9cafffe --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/mapper/xml/DormitoryFloorMapper.xml @@ -0,0 +1,55 @@ + + + + + + + SELECT a.*, b.name AS buildingName + FROM dormitory_floor a + LEFT JOIN dormitory_building b ON a.building_id = b.id + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.building_id = #{param.buildingId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/dormitory/mapper/xml/DormitoryRecordMapper.xml b/src/main/java/com/gxwebsoft/dormitory/mapper/xml/DormitoryRecordMapper.xml new file mode 100644 index 0000000..95755c9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/mapper/xml/DormitoryRecordMapper.xml @@ -0,0 +1,65 @@ + + + + + + + SELECT a.*, b.name AS buildingName, c.name AS floorName + FROM dormitory_record a + LEFT JOIN dormitory_building b ON a.building_id = b.id + LEFT JOIN dormitory_floor c ON a.floor_id = c.id + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.building_id = #{param.buildingId} + + + AND a.floor_id = #{param.floorId} + + + AND a.beds = #{param.beds} + + + AND a.toilet = #{param.toilet} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/dormitory/param/DormitoryApplyParam.java b/src/main/java/com/gxwebsoft/dormitory/param/DormitoryApplyParam.java new file mode 100644 index 0000000..474cb02 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/param/DormitoryApplyParam.java @@ -0,0 +1,87 @@ +package com.gxwebsoft.dormitory.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 审批管理查询参数 + * + * @author 科技小王子 + * @since 2025-10-03 15:54:30 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "审批管理查询参数") +public class DormitoryApplyParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "类型") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "姓名") + private String realName; + + @Schema(description = "手机号") + private String mobile; + + @Schema(description = "客户名称") + private String dealerName; + + @Schema(description = "客户编号") + private String dealerCode; + + @Schema(description = "详细地址") + private String address; + + @Schema(description = "签约价格") + @QueryField(type = QueryType.EQ) + private BigDecimal money; + + @Schema(description = "推荐人用户ID") + @QueryField(type = QueryType.EQ) + private Integer refereeId; + + @Schema(description = "申请方式(10需后台审核 20无需审核)") + @QueryField(type = QueryType.EQ) + private Integer applyType; + + @Schema(description = "审核状态 (10待审核 20审核通过 30驳回)") + @QueryField(type = QueryType.EQ) + private Integer applyStatus; + + @Schema(description = "申请时间") + private String applyTime; + + @Schema(description = "审核时间") + private String auditTime; + + @Schema(description = "合同时间") + private String contractTime; + + @Schema(description = "过期时间") + private String expirationTime; + + @Schema(description = "驳回原因") + private String rejectReason; + + @Schema(description = "备注") + private String comments; + +} \ No newline at end of file diff --git a/src/main/java/com/gxwebsoft/dormitory/param/DormitoryBedParam.java b/src/main/java/com/gxwebsoft/dormitory/param/DormitoryBedParam.java new file mode 100644 index 0000000..2b99a10 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/param/DormitoryBedParam.java @@ -0,0 +1,69 @@ +package com.gxwebsoft.dormitory.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 宿舍床位查询参数 + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "宿舍床位查询参数") +public class DormitoryBedParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "宿舍名称") + private String name; + + @Schema(description = "编号") + private String code; + + @Schema(description = "楼栋ID") + @QueryField(type = QueryType.EQ) + private Integer buildingId; + + @Schema(description = "楼层ID") + @QueryField(type = QueryType.EQ) + private Integer floorId; + + @Schema(description = "宿舍ID") + @QueryField(type = QueryType.EQ) + private Integer recordId; + + @Schema(description = "学生ID") + private Integer userId; + + @Schema(description = "上下铺 1下铺 2上铺 0无") + @QueryField(type = QueryType.EQ) + private Boolean bunk; + + @Schema(description = "充电口") + @QueryField(type = QueryType.EQ) + private Boolean chargingPort; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1报修") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/param/DormitoryBuildingParam.java b/src/main/java/com/gxwebsoft/dormitory/param/DormitoryBuildingParam.java new file mode 100644 index 0000000..1c02691 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/param/DormitoryBuildingParam.java @@ -0,0 +1,46 @@ +package com.gxwebsoft.dormitory.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 宿舍楼栋查询参数 + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "宿舍楼栋查询参数") +public class DormitoryBuildingParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "楼栋名称") + private String name; + + @Schema(description = "楼栋编号") + private String code; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + +} \ No newline at end of file diff --git a/src/main/java/com/gxwebsoft/dormitory/param/DormitoryFloorParam.java b/src/main/java/com/gxwebsoft/dormitory/param/DormitoryFloorParam.java new file mode 100644 index 0000000..d699dbc --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/param/DormitoryFloorParam.java @@ -0,0 +1,50 @@ +package com.gxwebsoft.dormitory.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 宿舍楼层查询参数 + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "宿舍楼层查询参数") +public class DormitoryFloorParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "楼层") + private String name; + + @Schema(description = "编号") + private String code; + + @Schema(description = "楼栋ID") + @QueryField(type = QueryType.EQ) + private Integer buildingId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + +} \ No newline at end of file diff --git a/src/main/java/com/gxwebsoft/dormitory/param/DormitoryRecordParam.java b/src/main/java/com/gxwebsoft/dormitory/param/DormitoryRecordParam.java new file mode 100644 index 0000000..2843d1d --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/param/DormitoryRecordParam.java @@ -0,0 +1,62 @@ +package com.gxwebsoft.dormitory.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 宿舍记录查询参数 + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "宿舍记录查询参数") +public class DormitoryRecordParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "宿舍名称") + private String name; + + @Schema(description = "编号") + private String code; + + @Schema(description = "楼栋ID") + @QueryField(type = QueryType.EQ) + private Integer buildingId; + + @Schema(description = "楼层ID") + @QueryField(type = QueryType.EQ) + private Integer floorId; + + @Schema(description = "床位数") + @QueryField(type = QueryType.EQ) + private Integer beds; + + @Schema(description = "独立卫生间") + @QueryField(type = QueryType.EQ) + private Boolean toilet; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + +} \ No newline at end of file diff --git a/src/main/java/com/gxwebsoft/dormitory/service/DormitoryApplyService.java b/src/main/java/com/gxwebsoft/dormitory/service/DormitoryApplyService.java new file mode 100644 index 0000000..3456e75 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/service/DormitoryApplyService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.dormitory.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.dormitory.entity.DormitoryApply; +import com.gxwebsoft.dormitory.param.DormitoryApplyParam; + +import java.util.List; + +/** + * 审批管理Service + * + * @author 科技小王子 + * @since 2025-10-03 15:54:30 + */ +public interface DormitoryApplyService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(DormitoryApplyParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(DormitoryApplyParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return DormitoryApply + */ + DormitoryApply getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/service/DormitoryBedService.java b/src/main/java/com/gxwebsoft/dormitory/service/DormitoryBedService.java new file mode 100644 index 0000000..3f80f7b --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/service/DormitoryBedService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.dormitory.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.dormitory.entity.DormitoryBed; +import com.gxwebsoft.dormitory.param.DormitoryBedParam; + +import java.util.List; + +/** + * 宿舍床位Service + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +public interface DormitoryBedService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(DormitoryBedParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(DormitoryBedParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return DormitoryBed + */ + DormitoryBed getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/service/DormitoryBuildingService.java b/src/main/java/com/gxwebsoft/dormitory/service/DormitoryBuildingService.java new file mode 100644 index 0000000..c5b015f --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/service/DormitoryBuildingService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.dormitory.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.dormitory.entity.DormitoryBuilding; +import com.gxwebsoft.dormitory.param.DormitoryBuildingParam; + +import java.util.List; + +/** + * 宿舍楼栋Service + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +public interface DormitoryBuildingService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(DormitoryBuildingParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(DormitoryBuildingParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return DormitoryBuilding + */ + DormitoryBuilding getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/service/DormitoryFloorService.java b/src/main/java/com/gxwebsoft/dormitory/service/DormitoryFloorService.java new file mode 100644 index 0000000..0e64087 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/service/DormitoryFloorService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.dormitory.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.dormitory.entity.DormitoryFloor; +import com.gxwebsoft.dormitory.param.DormitoryFloorParam; + +import java.util.List; + +/** + * 宿舍楼层Service + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +public interface DormitoryFloorService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(DormitoryFloorParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(DormitoryFloorParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return DormitoryFloor + */ + DormitoryFloor getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/service/DormitoryRecordService.java b/src/main/java/com/gxwebsoft/dormitory/service/DormitoryRecordService.java new file mode 100644 index 0000000..13fe03d --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/service/DormitoryRecordService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.dormitory.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.dormitory.entity.DormitoryRecord; +import com.gxwebsoft.dormitory.param.DormitoryRecordParam; + +import java.util.List; + +/** + * 宿舍记录Service + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +public interface DormitoryRecordService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(DormitoryRecordParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(DormitoryRecordParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return DormitoryRecord + */ + DormitoryRecord getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/service/impl/DormitoryApplyServiceImpl.java b/src/main/java/com/gxwebsoft/dormitory/service/impl/DormitoryApplyServiceImpl.java new file mode 100644 index 0000000..003fa9a --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/service/impl/DormitoryApplyServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.dormitory.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.dormitory.entity.DormitoryApply; +import com.gxwebsoft.dormitory.mapper.DormitoryApplyMapper; +import com.gxwebsoft.dormitory.param.DormitoryApplyParam; +import com.gxwebsoft.dormitory.service.DormitoryApplyService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 审批管理Service实现 + * + * @author 科技小王子 + * @since 2025-10-03 15:54:30 + */ +@Service +public class DormitoryApplyServiceImpl extends ServiceImpl implements DormitoryApplyService { + + @Override + public PageResult pageRel(DormitoryApplyParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(DormitoryApplyParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public DormitoryApply getByIdRel(Integer id) { + DormitoryApplyParam param = new DormitoryApplyParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/service/impl/DormitoryBedServiceImpl.java b/src/main/java/com/gxwebsoft/dormitory/service/impl/DormitoryBedServiceImpl.java new file mode 100644 index 0000000..0014b17 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/service/impl/DormitoryBedServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.dormitory.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.dormitory.mapper.DormitoryBedMapper; +import com.gxwebsoft.dormitory.service.DormitoryBedService; +import com.gxwebsoft.dormitory.entity.DormitoryBed; +import com.gxwebsoft.dormitory.param.DormitoryBedParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 宿舍床位Service实现 + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +@Service +public class DormitoryBedServiceImpl extends ServiceImpl implements DormitoryBedService { + + @Override + public PageResult pageRel(DormitoryBedParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(DormitoryBedParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public DormitoryBed getByIdRel(Integer id) { + DormitoryBedParam param = new DormitoryBedParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/service/impl/DormitoryBuildingServiceImpl.java b/src/main/java/com/gxwebsoft/dormitory/service/impl/DormitoryBuildingServiceImpl.java new file mode 100644 index 0000000..e15e01e --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/service/impl/DormitoryBuildingServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.dormitory.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.dormitory.mapper.DormitoryBuildingMapper; +import com.gxwebsoft.dormitory.service.DormitoryBuildingService; +import com.gxwebsoft.dormitory.entity.DormitoryBuilding; +import com.gxwebsoft.dormitory.param.DormitoryBuildingParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 宿舍楼栋Service实现 + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +@Service +public class DormitoryBuildingServiceImpl extends ServiceImpl implements DormitoryBuildingService { + + @Override + public PageResult pageRel(DormitoryBuildingParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(DormitoryBuildingParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public DormitoryBuilding getByIdRel(Integer id) { + DormitoryBuildingParam param = new DormitoryBuildingParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/service/impl/DormitoryFloorServiceImpl.java b/src/main/java/com/gxwebsoft/dormitory/service/impl/DormitoryFloorServiceImpl.java new file mode 100644 index 0000000..6ddd3c5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/service/impl/DormitoryFloorServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.dormitory.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.dormitory.mapper.DormitoryFloorMapper; +import com.gxwebsoft.dormitory.service.DormitoryFloorService; +import com.gxwebsoft.dormitory.entity.DormitoryFloor; +import com.gxwebsoft.dormitory.param.DormitoryFloorParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 宿舍楼层Service实现 + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +@Service +public class DormitoryFloorServiceImpl extends ServiceImpl implements DormitoryFloorService { + + @Override + public PageResult pageRel(DormitoryFloorParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(DormitoryFloorParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public DormitoryFloor getByIdRel(Integer id) { + DormitoryFloorParam param = new DormitoryFloorParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/dormitory/service/impl/DormitoryRecordServiceImpl.java b/src/main/java/com/gxwebsoft/dormitory/service/impl/DormitoryRecordServiceImpl.java new file mode 100644 index 0000000..a7f218b --- /dev/null +++ b/src/main/java/com/gxwebsoft/dormitory/service/impl/DormitoryRecordServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.dormitory.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.dormitory.mapper.DormitoryRecordMapper; +import com.gxwebsoft.dormitory.service.DormitoryRecordService; +import com.gxwebsoft.dormitory.entity.DormitoryRecord; +import com.gxwebsoft.dormitory.param.DormitoryRecordParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 宿舍记录Service实现 + * + * @author 科技小王子 + * @since 2025-10-03 10:49:27 + */ +@Service +public class DormitoryRecordServiceImpl extends ServiceImpl implements DormitoryRecordService { + + @Override + public PageResult pageRel(DormitoryRecordParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(DormitoryRecordParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public DormitoryRecord getByIdRel(Integer id) { + DormitoryRecordParam param = new DormitoryRecordParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/enterprise/controller/EnterpriseController.java b/src/main/java/com/gxwebsoft/enterprise/controller/EnterpriseController.java new file mode 100644 index 0000000..819568a --- /dev/null +++ b/src/main/java/com/gxwebsoft/enterprise/controller/EnterpriseController.java @@ -0,0 +1,147 @@ +package com.gxwebsoft.enterprise.controller; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.enterprise.entity.Enterprise; +import com.gxwebsoft.enterprise.service.EnterpriseService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * + * @author GIIT-YC + * + */ +@Tag(name = "企业信息管理") +@RestController +@RequestMapping("/api/enterprise/enterprise") +public class EnterpriseController extends BaseController { + + @Resource + private EnterpriseService enterpriseService; + +// @PreAuthorize("hasAuthority('enterprise:enterprise:list')") + @Operation(summary = "分页查询企业信息") + @GetMapping("/page") + public ApiResult> page(Enterprise enterprise) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(StrUtil.isNotBlank(enterprise.getName()), Enterprise::getName, enterprise.getName()); + wrapper.like(StrUtil.isNotBlank(enterprise.getCreditCode()), Enterprise::getCreditCode, enterprise.getCreditCode()); + wrapper.orderByAsc(Enterprise::getName); + + final Page page = new Page<>(enterprise.getPage(), enterprise.getLimit()); + final IPage p = enterpriseService.page(page, wrapper); + + return success(new PageResult(p.getRecords(), p.getTotal())); + } + +// @PreAuthorize("hasAuthority('enterprise:enterprise:list')") + @Operation(summary = "查询全部企业信息") + @GetMapping("/list") + public ApiResult> list(Enterprise enterprise) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.like(StrUtil.isNotBlank(enterprise.getName()), Enterprise::getName, enterprise.getName()); + wrapper.like(StrUtil.isNotBlank(enterprise.getCreditCode()), Enterprise::getCreditCode, enterprise.getCreditCode()); + return success(enterpriseService.list(wrapper)); + } + +// @PreAuthorize("hasAuthority('enterprise:enterprise:list')") + @Operation(summary = "根据id查询企业信息") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(enterpriseService.getById(id)); + } + +// @PreAuthorize("hasAuthority('enterprise:enterprise:list')") + @Operation(summary = "根据CreditCode查询企业信息") + @GetMapping("/creditCode/{creditCode}") + public ApiResult getByCreditCode(@PathVariable("creditCode") String creditCode) { + Enterprise enterprise = enterpriseService.getOne(new LambdaQueryWrapper().eq(Enterprise::getCreditCode, creditCode)); + return success(enterprise); + } + +// @PreAuthorize("hasAuthority('enterprise:enterprise:save')") + @OperationLog + @Operation(summary = "添加企业信息") + @PostMapping() + public ApiResult save(@RequestBody Enterprise enterprise) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + enterprise.setUserId(loginUser.getUserId()); + final Enterprise one = enterpriseService.getOne(new LambdaQueryWrapper().eq(Enterprise::getCreditCode, enterprise.getCreditCode())); + if (!ObjectUtil.isEmpty(one)) { + return fail("企业统一信用代码已存在"); + } + if (enterpriseService.save(enterprise)) { + //TODO 查询知识库(kb_name=enterprise.getCreditCode) + + //TODO 新建知识库 + String kbId = "pggi9mpair"; + + //绑定知识库 + enterprise.setKbId(kbId); + enterpriseService.updateById(enterprise); + return success("添加成功"); + } + } + return fail("添加失败"); + } + +// @PreAuthorize("hasAuthority('enterprise:enterprise:update')") + @OperationLog + @Operation(summary = "修改企业信息") + @PutMapping() + public ApiResult update(@RequestBody Enterprise enterprise) { + if(StrUtil.isEmpty(enterprise.getKbId())) { + //TODO 查询知识库 + + //TODO 新建知识库 + String kbId = "pggi9mpair"; + + //绑定知识库 + enterprise.setKbId(kbId); + } + if (enterpriseService.updateById(enterprise)) { + return success("修改成功"); + } + return fail("修改失败"); + } + +// @PreAuthorize("hasAuthority('enterprise:enterprise:remove')") + @OperationLog + @Operation(summary = "删除企业信息") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (enterpriseService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +// @PreAuthorize("hasAuthority('enterprise:enterprise:remove')") + @OperationLog + @Operation(summary = "批量删除企业信息") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (enterpriseService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/enterprise/entity/Enterprise.java b/src/main/java/com/gxwebsoft/enterprise/entity/Enterprise.java new file mode 100644 index 0000000..9e99efd --- /dev/null +++ b/src/main/java/com/gxwebsoft/enterprise/entity/Enterprise.java @@ -0,0 +1,67 @@ +package com.gxwebsoft.enterprise.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.gxwebsoft.common.core.web.BaseParam; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 企业信息 + * @author GIIT-YC + */ +@Data +@TableName("enterprise") +@EqualsAndHashCode(callSuper = false) +@Schema(name = "Enterprise对象", description = "企业信息表") +public class Enterprise extends BaseParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "企业名称") + private String name; + + @Schema(description = "统一代码") + private String creditCode; + + @Schema(description = "企业性质(国企、行政事业单位、民间非营利组织)") + private String enterpriseType; + + @Schema(description = "所属行业(使用插件)") + private String industry; + + @Schema(description = "知识库ID") + private String kbId; + + @Schema(description = "客户ID") + private Integer userId; + + @Schema(description = "租户ID") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; +} \ No newline at end of file diff --git a/src/main/java/com/gxwebsoft/enterprise/mapper/EnterpriseMapper.java b/src/main/java/com/gxwebsoft/enterprise/mapper/EnterpriseMapper.java new file mode 100644 index 0000000..33ca945 --- /dev/null +++ b/src/main/java/com/gxwebsoft/enterprise/mapper/EnterpriseMapper.java @@ -0,0 +1,13 @@ +package com.gxwebsoft.enterprise.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gxwebsoft.enterprise.entity.Enterprise; + +/** + * + * @author GIIT-YC + * + */ +public interface EnterpriseMapper extends BaseMapper { + +} diff --git a/src/main/java/com/gxwebsoft/enterprise/mapper/xml/EnterpriseMapper.xml b/src/main/java/com/gxwebsoft/enterprise/mapper/xml/EnterpriseMapper.xml new file mode 100644 index 0000000..b543162 --- /dev/null +++ b/src/main/java/com/gxwebsoft/enterprise/mapper/xml/EnterpriseMapper.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/main/java/com/gxwebsoft/enterprise/service/EnterpriseService.java b/src/main/java/com/gxwebsoft/enterprise/service/EnterpriseService.java new file mode 100644 index 0000000..daf3ff8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/enterprise/service/EnterpriseService.java @@ -0,0 +1,13 @@ +package com.gxwebsoft.enterprise.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.enterprise.entity.Enterprise; + +/** + * + * @author GIIT-YC + * + */ +public interface EnterpriseService extends IService { + +} diff --git a/src/main/java/com/gxwebsoft/enterprise/service/impl/EnterpriseServiceImpl.java b/src/main/java/com/gxwebsoft/enterprise/service/impl/EnterpriseServiceImpl.java new file mode 100644 index 0000000..a6eedda --- /dev/null +++ b/src/main/java/com/gxwebsoft/enterprise/service/impl/EnterpriseServiceImpl.java @@ -0,0 +1,17 @@ +package com.gxwebsoft.enterprise.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.enterprise.entity.Enterprise; +import com.gxwebsoft.enterprise.mapper.EnterpriseMapper; +import com.gxwebsoft.enterprise.service.EnterpriseService; +import org.springframework.stereotype.Service; + +/** + * + * @author GIIT-YC + * + */ +@Service +public class EnterpriseServiceImpl extends ServiceImpl implements EnterpriseService { + +} diff --git a/src/main/java/com/gxwebsoft/glt/controller/GltTicketTemplateController.java b/src/main/java/com/gxwebsoft/glt/controller/GltTicketTemplateController.java new file mode 100644 index 0000000..2158b56 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/controller/GltTicketTemplateController.java @@ -0,0 +1,128 @@ +package com.gxwebsoft.glt.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.glt.service.GltTicketTemplateService; +import com.gxwebsoft.glt.entity.GltTicketTemplate; +import com.gxwebsoft.glt.param.GltTicketTemplateParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 水票控制器 + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +@Tag(name = "水票管理") +@RestController +@RequestMapping("/api/glt/glt-ticket-template") +public class GltTicketTemplateController extends BaseController { + @Resource + private GltTicketTemplateService gltTicketTemplateService; + + @Operation(summary = "分页查询水票") + @GetMapping("/page") + public ApiResult> page(GltTicketTemplateParam param) { + // 使用关联查询 + return success(gltTicketTemplateService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('glt:gltTicketTemplate:list')") + @Operation(summary = "查询全部水票") + @GetMapping() + public ApiResult> list(GltTicketTemplateParam param) { + // 使用关联查询 + return success(gltTicketTemplateService.listRel(param)); + } + + @PreAuthorize("hasAuthority('glt:gltTicketTemplate:list')") + @Operation(summary = "根据id查询水票") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(gltTicketTemplateService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('glt:gltTicketTemplate:save')") + @OperationLog + @Operation(summary = "添加水票") + @PostMapping() + public ApiResult save(@RequestBody GltTicketTemplate gltTicketTemplate) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + gltTicketTemplate.setUserId(loginUser.getUserId()); + } + if (gltTicketTemplateService.save(gltTicketTemplate)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('glt:gltTicketTemplate:update')") + @OperationLog + @Operation(summary = "修改水票") + @PutMapping() + public ApiResult update(@RequestBody GltTicketTemplate gltTicketTemplate) { + if (gltTicketTemplateService.updateById(gltTicketTemplate)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('glt:gltTicketTemplate:remove')") + @OperationLog + @Operation(summary = "删除水票") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (gltTicketTemplateService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('glt:gltTicketTemplate:save')") + @OperationLog + @Operation(summary = "批量添加水票") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (gltTicketTemplateService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('glt:gltTicketTemplate:update')") + @OperationLog + @Operation(summary = "批量修改水票") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(gltTicketTemplateService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('glt:gltTicketTemplate:remove')") + @OperationLog + @Operation(summary = "批量删除水票") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (gltTicketTemplateService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/glt/controller/GltUserTicketController.java b/src/main/java/com/gxwebsoft/glt/controller/GltUserTicketController.java new file mode 100644 index 0000000..15848a1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/controller/GltUserTicketController.java @@ -0,0 +1,137 @@ +package com.gxwebsoft.glt.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.glt.service.GltUserTicketService; +import com.gxwebsoft.glt.entity.GltUserTicket; +import com.gxwebsoft.glt.param.GltUserTicketParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 我的水票控制器 + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +@Tag(name = "我的水票管理") +@RestController +@RequestMapping("/api/glt/glt-user-ticket") +public class GltUserTicketController extends BaseController { + @Resource + private GltUserTicketService gltUserTicketService; + + @Operation(summary = "分页查询我的水票") + @GetMapping("/page") + public ApiResult> page(GltUserTicketParam param) { + // 使用关联查询 + return success(gltUserTicketService.pageRel(param)); + } + + @Operation(summary = "我的水票总数") + @GetMapping("/my-total") + public ApiResult myTotal() { + Integer userId = getLoginUserId(); + if (userId == null) { + return fail("未登录"); + } + Integer totalQty = gltUserTicketService.sumTotalQtyByUserId(userId); + Map data = new HashMap<>(); + data.put("userId", userId); + data.put("totalQty", totalQty); + return success(data); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicket:list')") + @Operation(summary = "查询全部我的水票") + @GetMapping() + public ApiResult> list(GltUserTicketParam param) { + // 使用关联查询 + return success(gltUserTicketService.listRel(param)); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicket:list')") + @Operation(summary = "根据id查询我的水票") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(gltUserTicketService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicket:save')") + @OperationLog + @Operation(summary = "添加我的水票") + @PostMapping() + public ApiResult save(@RequestBody GltUserTicket gltUserTicket) { + if (gltUserTicketService.save(gltUserTicket)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicket:update')") + @OperationLog + @Operation(summary = "修改我的水票") + @PutMapping() + public ApiResult update(@RequestBody GltUserTicket gltUserTicket) { + if (gltUserTicketService.updateById(gltUserTicket)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicket:remove')") + @OperationLog + @Operation(summary = "删除我的水票") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (gltUserTicketService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicket:save')") + @OperationLog + @Operation(summary = "批量添加我的水票") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (gltUserTicketService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicket:update')") + @OperationLog + @Operation(summary = "批量修改我的水票") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(gltUserTicketService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicket:remove')") + @OperationLog + @Operation(summary = "批量删除我的水票") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (gltUserTicketService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/glt/controller/GltUserTicketLogController.java b/src/main/java/com/gxwebsoft/glt/controller/GltUserTicketLogController.java new file mode 100644 index 0000000..19ab463 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/controller/GltUserTicketLogController.java @@ -0,0 +1,129 @@ +package com.gxwebsoft.glt.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.glt.service.GltUserTicketLogService; +import com.gxwebsoft.glt.entity.GltUserTicketLog; +import com.gxwebsoft.glt.param.GltUserTicketLogParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 消费日志控制器 + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +@Tag(name = "消费日志管理") +@RestController +@RequestMapping("/api/glt/glt-user-ticket-log") +public class GltUserTicketLogController extends BaseController { + @Resource + private GltUserTicketLogService gltUserTicketLogService; + + @PreAuthorize("hasAuthority('glt:gltUserTicketLog:list')") + @Operation(summary = "分页查询消费日志") + @GetMapping("/page") + public ApiResult> page(GltUserTicketLogParam param) { + // 使用关联查询 + return success(gltUserTicketLogService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicketLog:list')") + @Operation(summary = "查询全部消费日志") + @GetMapping() + public ApiResult> list(GltUserTicketLogParam param) { + // 使用关联查询 + return success(gltUserTicketLogService.listRel(param)); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicketLog:list')") + @Operation(summary = "根据id查询消费日志") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(gltUserTicketLogService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicketLog:save')") + @OperationLog + @Operation(summary = "添加消费日志") + @PostMapping() + public ApiResult save(@RequestBody GltUserTicketLog gltUserTicketLog) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + gltUserTicketLog.setUserId(loginUser.getUserId()); + } + if (gltUserTicketLogService.save(gltUserTicketLog)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicketLog:update')") + @OperationLog + @Operation(summary = "修改消费日志") + @PutMapping() + public ApiResult update(@RequestBody GltUserTicketLog gltUserTicketLog) { + if (gltUserTicketLogService.updateById(gltUserTicketLog)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicketLog:remove')") + @OperationLog + @Operation(summary = "删除消费日志") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (gltUserTicketLogService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicketLog:save')") + @OperationLog + @Operation(summary = "批量添加消费日志") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (gltUserTicketLogService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicketLog:update')") + @OperationLog + @Operation(summary = "批量修改消费日志") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(gltUserTicketLogService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicketLog:remove')") + @OperationLog + @Operation(summary = "批量删除消费日志") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (gltUserTicketLogService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/glt/controller/GltUserTicketReleaseController.java b/src/main/java/com/gxwebsoft/glt/controller/GltUserTicketReleaseController.java new file mode 100644 index 0000000..44198ba --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/controller/GltUserTicketReleaseController.java @@ -0,0 +1,129 @@ +package com.gxwebsoft.glt.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.glt.service.GltUserTicketReleaseService; +import com.gxwebsoft.glt.entity.GltUserTicketRelease; +import com.gxwebsoft.glt.param.GltUserTicketReleaseParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 水票释放控制器 + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +@Tag(name = "水票释放管理") +@RestController +@RequestMapping("/api/glt/glt-user-ticket-release") +public class GltUserTicketReleaseController extends BaseController { + @Resource + private GltUserTicketReleaseService gltUserTicketReleaseService; + + @PreAuthorize("hasAuthority('glt:gltUserTicketRelease:list')") + @Operation(summary = "分页查询水票释放") + @GetMapping("/page") + public ApiResult> page(GltUserTicketReleaseParam param) { + // 使用关联查询 + return success(gltUserTicketReleaseService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicketRelease:list')") + @Operation(summary = "查询全部水票释放") + @GetMapping() + public ApiResult> list(GltUserTicketReleaseParam param) { + // 使用关联查询 + return success(gltUserTicketReleaseService.listRel(param)); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicketRelease:list')") + @Operation(summary = "根据id查询水票释放") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(gltUserTicketReleaseService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicketRelease:save')") + @OperationLog + @Operation(summary = "添加水票释放") + @PostMapping() + public ApiResult save(@RequestBody GltUserTicketRelease gltUserTicketRelease) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + gltUserTicketRelease.setUserId(loginUser.getUserId()); + } + if (gltUserTicketReleaseService.save(gltUserTicketRelease)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicketRelease:update')") + @OperationLog + @Operation(summary = "修改水票释放") + @PutMapping() + public ApiResult update(@RequestBody GltUserTicketRelease gltUserTicketRelease) { + if (gltUserTicketReleaseService.updateById(gltUserTicketRelease)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicketRelease:remove')") + @OperationLog + @Operation(summary = "删除水票释放") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (gltUserTicketReleaseService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicketRelease:save')") + @OperationLog + @Operation(summary = "批量添加水票释放") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (gltUserTicketReleaseService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicketRelease:update')") + @OperationLog + @Operation(summary = "批量修改水票释放") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(gltUserTicketReleaseService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('glt:gltUserTicketRelease:remove')") + @OperationLog + @Operation(summary = "批量删除水票释放") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (gltUserTicketReleaseService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/glt/entity/GltTicketTemplate.java b/src/main/java/com/gxwebsoft/glt/entity/GltTicketTemplate.java new file mode 100644 index 0000000..4e4f941 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/entity/GltTicketTemplate.java @@ -0,0 +1,88 @@ +package com.gxwebsoft.glt.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 水票 + * + * @author 科技小王子 + * @since 2026-02-03 18:55:54 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "GltTicketTemplate对象", description = "水票") +public class GltTicketTemplate implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "关联商品ID") + private Integer goodsId; + + @Schema(description = "名称") + private String name; + + @Schema(description = "启用") + private Boolean enabled; + + @Schema(description = "单位名称") + private String unitName; + + @Schema(description = "最小购买数量") + private Integer minBuyQty; + + @Schema(description = "起始发送数量") + private Integer startSendQty; + + @Schema(description = "买赠:买1送4 => gift_multiplier=4") + private Integer giftMultiplier; + + @Schema(description = "是否把购买量也计入套票总量(默认仅计入赠送量)") + private Boolean includeBuyQty; + + @Schema(description = "每期释放数量(默认每月释放10)") + private Integer monthlyReleaseQty; + + @Schema(description = "总共释放多少期(若配置>0,则按期数平均分摊)") + private Integer releasePeriods; + + @Schema(description = "首期释放时机:0=支付成功当刻;1=下个月同日") + private Integer firstReleaseMode; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/glt/entity/GltUserTicket.java b/src/main/java/com/gxwebsoft/glt/entity/GltUserTicket.java new file mode 100644 index 0000000..ecae32a --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/entity/GltUserTicket.java @@ -0,0 +1,112 @@ +package com.gxwebsoft.glt.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 我的水票 + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "GltUserTicket对象", description = "我的水票") +public class GltUserTicket implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "模板ID") + private Integer templateId; + + @Schema(description = "模板名称") + @TableField(exist = false) + private String templateName; + + @Schema(description = "商品ID") + private Integer goodsId; + + @Schema(description = "购买价格") + @TableField(exist = false) + private BigDecimal payPrice; + + @Schema(description = "商品名称") + @TableField(exist = false) + private String goodsName; + + @Schema(description = "订单ID") + private Integer orderId; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "订单商品ID") + private Integer orderGoodsId; + + @Schema(description = "总数量") + private Integer totalQty; + + @Schema(description = "可用数量") + private Integer availableQty; + + @Schema(description = "冻结数量") + private Integer frozenQty; + + @Schema(description = "已使用数量") + private Integer usedQty; + + @Schema(description = "已释放数量") + private Integer releasedQty; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "用户昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "用户头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "用户手机号") + @TableField(exist = false) + private String phone; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/glt/entity/GltUserTicketLog.java b/src/main/java/com/gxwebsoft/glt/entity/GltUserTicketLog.java new file mode 100644 index 0000000..4c83b91 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/entity/GltUserTicketLog.java @@ -0,0 +1,98 @@ +package com.gxwebsoft.glt.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 消费日志 + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "GltUserTicketLog对象", description = "消费日志") +public class GltUserTicketLog implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "用户水票ID") + private Integer userTicketId; + + @Schema(description = "变更类型") + private Integer changeType; + + @Schema(description = "可更改") + private Integer changeAvailable; + + @Schema(description = "更改冻结状态") + private Integer changeFrozen; + + @Schema(description = "已使用更改") + private Integer changeUsed; + + @Schema(description = "可用后") + private Integer availableAfter; + + @Schema(description = "冻结后") + private Integer frozenAfter; + + @Schema(description = "使用后") + private Integer usedAfter; + + @Schema(description = "订单ID") + private Integer orderId; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "用户昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "用户头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "用户手机号") + @TableField(exist = false) + private String phone; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/glt/entity/GltUserTicketRelease.java b/src/main/java/com/gxwebsoft/glt/entity/GltUserTicketRelease.java new file mode 100644 index 0000000..26131d9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/entity/GltUserTicketRelease.java @@ -0,0 +1,75 @@ +package com.gxwebsoft.glt.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 水票释放 + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "GltUserTicketRelease对象", description = "水票释放") +public class GltUserTicketRelease implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @Schema(description = "水票ID") + private Long userTicketId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "用户昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "用户头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "用户手机号") + @TableField(exist = false) + private String phone; + + @Schema(description = "周期编号") + private Integer periodNo; + + @Schema(description = "释放数量") + private Integer releaseQty; + + @Schema(description = "释放时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime releaseTime; + + @Schema(description = "状态") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/glt/mapper/GltTicketTemplateMapper.java b/src/main/java/com/gxwebsoft/glt/mapper/GltTicketTemplateMapper.java new file mode 100644 index 0000000..c293a30 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/mapper/GltTicketTemplateMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.glt.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.glt.entity.GltTicketTemplate; +import com.gxwebsoft.glt.param.GltTicketTemplateParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 水票Mapper + * + * @author 科技小王子 + * @since 2026-02-03 18:55:54 + */ +public interface GltTicketTemplateMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") GltTicketTemplateParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") GltTicketTemplateParam param); + +} diff --git a/src/main/java/com/gxwebsoft/glt/mapper/GltUserTicketLogMapper.java b/src/main/java/com/gxwebsoft/glt/mapper/GltUserTicketLogMapper.java new file mode 100644 index 0000000..b635ade --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/mapper/GltUserTicketLogMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.glt.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.glt.entity.GltUserTicketLog; +import com.gxwebsoft.glt.param.GltUserTicketLogParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 消费日志Mapper + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +public interface GltUserTicketLogMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") GltUserTicketLogParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") GltUserTicketLogParam param); + +} diff --git a/src/main/java/com/gxwebsoft/glt/mapper/GltUserTicketMapper.java b/src/main/java/com/gxwebsoft/glt/mapper/GltUserTicketMapper.java new file mode 100644 index 0000000..d46a767 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/mapper/GltUserTicketMapper.java @@ -0,0 +1,92 @@ +package com.gxwebsoft.glt.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.glt.entity.GltUserTicket; +import com.gxwebsoft.glt.param.GltUserTicketParam; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * 我的水票Mapper + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +public interface GltUserTicketMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") GltUserTicketParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") GltUserTicketParam param); + + /** + * 统计用户可用水票总数(sum(available_qty)) + * + * @param userId 用户ID + * @param tenantId 租户ID + * @return 可用总数 + */ + Integer sumAvailableQtyByUserId(@Param("userId") Integer userId, + @Param("tenantId") Integer tenantId); + + /** + * 按当前用户锁定水票记录(用于扣减/核销的事务场景) + */ + @Select(""" + SELECT * + FROM glt_user_ticket + WHERE id = #{id} + AND user_id = #{userId} + AND tenant_id = #{tenantId} + AND status = 0 + AND deleted = 0 + LIMIT 1 + FOR UPDATE + """) + GltUserTicket selectByIdForUpdate(@Param("id") Integer id, + @Param("userId") Integer userId, + @Param("tenantId") Integer tenantId); + + /** + * 释放冻结水票(冻结 -> 可用;并累加已释放数量) + *

+ * 返回值为受影响行数:1 表示释放成功;0 表示记录不存在/状态不符/冻结不足。 + */ + @Update(""" + UPDATE glt_user_ticket + SET available_qty = COALESCE(available_qty, 0) + #{qty}, + frozen_qty = COALESCE(frozen_qty, 0) - #{qty}, + released_qty = COALESCE(released_qty, 0) + #{qty}, + update_time = #{now} + WHERE id = #{id} + AND user_id = #{userId} + AND tenant_id = #{tenantId} + AND status = 0 + AND deleted = 0 + AND COALESCE(frozen_qty, 0) >= #{qty} + """) + int releaseFrozenQty(@Param("id") Integer id, + @Param("userId") Integer userId, + @Param("tenantId") Integer tenantId, + @Param("qty") Integer qty, + @Param("now") LocalDateTime now); + +} diff --git a/src/main/java/com/gxwebsoft/glt/mapper/GltUserTicketReleaseMapper.java b/src/main/java/com/gxwebsoft/glt/mapper/GltUserTicketReleaseMapper.java new file mode 100644 index 0000000..baf5639 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/mapper/GltUserTicketReleaseMapper.java @@ -0,0 +1,73 @@ +package com.gxwebsoft.glt.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.glt.entity.GltUserTicketRelease; +import com.gxwebsoft.glt.param.GltUserTicketReleaseParam; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; +import org.apache.ibatis.annotations.Param; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * 水票释放Mapper + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +public interface GltUserTicketReleaseMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") GltUserTicketReleaseParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") GltUserTicketReleaseParam param); + + /** + * 查询待释放且到期的记录(加行锁,防止多实例重复处理) + * + * status: 0=待释放, 1=已释放, 2=释放失败(数据异常) + */ + @Select(""" + SELECT * + FROM glt_user_ticket_release + WHERE status = 0 + AND deleted = 0 + AND release_time <= #{now} + ORDER BY release_time ASC, id ASC + LIMIT #{limit} + FOR UPDATE + """) + List selectDueForUpdate(@Param("now") LocalDateTime now, + @Param("limit") int limit); + + /** + * 更新释放记录状态 + */ + @Update(""" + UPDATE glt_user_ticket_release + SET status = #{status}, + update_time = #{now} + WHERE id = #{id} + AND deleted = 0 + AND status = 0 + """) + int updateStatus(@Param("id") Long id, + @Param("status") Integer status, + @Param("now") LocalDateTime now); + +} diff --git a/src/main/java/com/gxwebsoft/glt/mapper/xml/GltTicketTemplateMapper.xml b/src/main/java/com/gxwebsoft/glt/mapper/xml/GltTicketTemplateMapper.xml new file mode 100644 index 0000000..aaa9af3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/mapper/xml/GltTicketTemplateMapper.xml @@ -0,0 +1,87 @@ + + + + + + + SELECT a.* + FROM glt_ticket_template a + + + AND a.id = #{param.id} + + + AND a.goods_id = #{param.goodsId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.enabled = #{param.enabled} + + + AND a.unit_name LIKE CONCAT('%', #{param.unitName}, '%') + + + AND a.min_buy_qty = #{param.minBuyQty} + + + AND a.start_send_qty = #{param.startSendQty} + + + AND a.gift_multiplier = #{param.giftMultiplier} + + + AND a.include_buy_qty = #{param.includeBuyQty} + + + AND a.monthly_release_qty = #{param.monthlyReleaseQty} + + + AND a.release_periods = #{param.releasePeriods} + + + AND a.first_release_mode = #{param.firstReleaseMode} + + + AND a.user_id = #{param.userId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/glt/mapper/xml/GltUserTicketLogMapper.xml b/src/main/java/com/gxwebsoft/glt/mapper/xml/GltUserTicketLogMapper.xml new file mode 100644 index 0000000..695b9d1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/mapper/xml/GltUserTicketLogMapper.xml @@ -0,0 +1,88 @@ + + + + + + + SELECT a.*, u.nickname, u.avatar, u.phone + FROM glt_user_ticket_log a + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.user_ticket_id = #{param.userTicketId} + + + AND a.change_type = #{param.changeType} + + + AND a.change_available = #{param.changeAvailable} + + + AND a.change_frozen = #{param.changeFrozen} + + + AND a.change_used = #{param.changeUsed} + + + AND a.available_after = #{param.availableAfter} + + + AND a.frozen_after = #{param.frozenAfter} + + + AND a.used_after = #{param.usedAfter} + + + AND a.order_id = #{param.orderId} + + + AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.user_id = #{param.keywords} + OR a.user_ticket_id = #{param.keywords} + OR a.order_no = #{param.keywords} + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/glt/mapper/xml/GltUserTicketMapper.xml b/src/main/java/com/gxwebsoft/glt/mapper/xml/GltUserTicketMapper.xml new file mode 100644 index 0000000..c0f6ef0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/mapper/xml/GltUserTicketMapper.xml @@ -0,0 +1,100 @@ + + + + + + + SELECT a.*, u.nickname, u.avatar, u.phone, m.name AS templateName, o.pay_price AS payPrice + FROM glt_user_ticket a + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + LEFT JOIN glt_ticket_template m ON a.template_id = m.id + + LEFT JOIN shop_order o ON a.order_id = o.order_id AND a.tenant_id = o.tenant_id AND o.deleted = 0 + + + AND a.id = #{param.id} + + + AND a.template_id = #{param.templateId} + + + AND a.goods_id = #{param.goodsId} + + + AND a.order_id = #{param.orderId} + + + AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%') + + + AND a.order_goods_id = #{param.orderGoodsId} + + + AND a.total_qty = #{param.totalQty} + + + AND a.available_qty = #{param.availableQty} + + + AND a.frozen_qty = #{param.frozenQty} + + + AND a.used_qty = #{param.usedQty} + + + AND a.released_qty = #{param.releasedQty} + + + AND a.user_id = #{param.userId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.user_id = #{param.keywords} + OR a.order_no = #{param.keywords} + ) + + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/glt/mapper/xml/GltUserTicketReleaseMapper.xml b/src/main/java/com/gxwebsoft/glt/mapper/xml/GltUserTicketReleaseMapper.xml new file mode 100644 index 0000000..a8364a9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/mapper/xml/GltUserTicketReleaseMapper.xml @@ -0,0 +1,62 @@ + + + + + + + SELECT a.*, u.nickname, u.avatar, u.phone + FROM glt_user_ticket_release a + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.user_ticket_id LIKE CONCAT('%', #{param.userTicketId}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.period_no = #{param.periodNo} + + + AND a.release_qty = #{param.releaseQty} + + + AND a.release_time LIKE CONCAT('%', #{param.releaseTime}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.user_ticket_id = #{param.keywords} + OR u.user_id = #{param.keywords} + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/glt/param/GltTicketTemplateParam.java b/src/main/java/com/gxwebsoft/glt/param/GltTicketTemplateParam.java new file mode 100644 index 0000000..aa0cb74 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/param/GltTicketTemplateParam.java @@ -0,0 +1,89 @@ +package com.gxwebsoft.glt.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 水票查询参数 + * + * @author 科技小王子 + * @since 2026-02-03 18:55:54 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "GltTicketTemplateParam对象", description = "水票查询参数") +public class GltTicketTemplateParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "关联商品ID") + @QueryField(type = QueryType.EQ) + private Integer goodsId; + + @Schema(description = "名称") + private String name; + + @Schema(description = "启用") + @QueryField(type = QueryType.EQ) + private Boolean enabled; + + @Schema(description = "单位名称") + private String unitName; + + @Schema(description = "最小购买数量") + @QueryField(type = QueryType.EQ) + private Integer minBuyQty; + + @Schema(description = "起始发送数量") + @QueryField(type = QueryType.EQ) + private Integer startSendQty; + + @Schema(description = "买赠:买1送4 => gift_multiplier=4") + @QueryField(type = QueryType.EQ) + private Integer giftMultiplier; + + @Schema(description = "是否把购买量也计入套票总量(默认仅计入赠送量)") + @QueryField(type = QueryType.EQ) + private Boolean includeBuyQty; + + @Schema(description = "每期释放数量(默认每月释放10)") + @QueryField(type = QueryType.EQ) + private Integer monthlyReleaseQty; + + @Schema(description = "总共释放多少期(若配置>0,则按期数平均分摊)") + @QueryField(type = QueryType.EQ) + private Integer releasePeriods; + + @Schema(description = "首期释放时机:0=支付成功当刻;1=下个月同日") + @QueryField(type = QueryType.EQ) + private Integer firstReleaseMode; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/glt/param/GltUserTicketLogParam.java b/src/main/java/com/gxwebsoft/glt/param/GltUserTicketLogParam.java new file mode 100644 index 0000000..d0cc687 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/param/GltUserTicketLogParam.java @@ -0,0 +1,86 @@ +package com.gxwebsoft.glt.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 消费日志查询参数 + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "GltUserTicketLogParam对象", description = "消费日志查询参数") +public class GltUserTicketLogParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "用户水票ID") + @QueryField(type = QueryType.EQ) + private Integer userTicketId; + + @Schema(description = "变更类型") + @QueryField(type = QueryType.EQ) + private Integer changeType; + + @Schema(description = "可更改") + @QueryField(type = QueryType.EQ) + private Integer changeAvailable; + + @Schema(description = "更改冻结状态") + @QueryField(type = QueryType.EQ) + private Integer changeFrozen; + + @Schema(description = "已使用更改") + @QueryField(type = QueryType.EQ) + private Integer changeUsed; + + @Schema(description = "可用后") + @QueryField(type = QueryType.EQ) + private Integer availableAfter; + + @Schema(description = "冻结后") + @QueryField(type = QueryType.EQ) + private Integer frozenAfter; + + @Schema(description = "使用后") + @QueryField(type = QueryType.EQ) + private Integer usedAfter; + + @Schema(description = "订单ID") + @QueryField(type = QueryType.EQ) + private Integer orderId; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/glt/param/GltUserTicketParam.java b/src/main/java/com/gxwebsoft/glt/param/GltUserTicketParam.java new file mode 100644 index 0000000..fa448a7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/param/GltUserTicketParam.java @@ -0,0 +1,86 @@ +package com.gxwebsoft.glt.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 我的水票查询参数 + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "GltUserTicketParam对象", description = "我的水票查询参数") +public class GltUserTicketParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "模板ID") + @QueryField(type = QueryType.EQ) + private Integer templateId; + + @Schema(description = "商品ID") + @QueryField(type = QueryType.EQ) + private Integer goodsId; + + @Schema(description = "订单ID") + @QueryField(type = QueryType.EQ) + private Integer orderId; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "订单商品ID") + @QueryField(type = QueryType.EQ) + private Integer orderGoodsId; + + @Schema(description = "总数量") + @QueryField(type = QueryType.EQ) + private Integer totalQty; + + @Schema(description = "可用数量") + @QueryField(type = QueryType.EQ) + private Integer availableQty; + + @Schema(description = "冻结数量") + @QueryField(type = QueryType.EQ) + private Integer frozenQty; + + @Schema(description = "已使用数量") + @QueryField(type = QueryType.EQ) + private Integer usedQty; + + @Schema(description = "已释放数量") + @QueryField(type = QueryType.EQ) + private Integer releasedQty; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/glt/param/GltUserTicketReleaseParam.java b/src/main/java/com/gxwebsoft/glt/param/GltUserTicketReleaseParam.java new file mode 100644 index 0000000..3ce4bff --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/param/GltUserTicketReleaseParam.java @@ -0,0 +1,54 @@ +package com.gxwebsoft.glt.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 水票释放查询参数 + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "GltUserTicketReleaseParam对象", description = "水票释放查询参数") +public class GltUserTicketReleaseParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "水票ID") + private Integer userTicketId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "周期编号") + @QueryField(type = QueryType.EQ) + private Integer periodNo; + + @Schema(description = "释放数量") + @QueryField(type = QueryType.EQ) + private Integer releaseQty; + + @Schema(description = "释放时间") + private String releaseTime; + + @Schema(description = "状态") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/glt/service/GltTicketIssueService.java b/src/main/java/com/gxwebsoft/glt/service/GltTicketIssueService.java new file mode 100644 index 0000000..6ac9261 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/service/GltTicketIssueService.java @@ -0,0 +1,362 @@ +package com.gxwebsoft.glt.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.gxwebsoft.glt.entity.GltTicketTemplate; +import com.gxwebsoft.glt.entity.GltUserTicket; +import com.gxwebsoft.glt.entity.GltUserTicketLog; +import com.gxwebsoft.glt.entity.GltUserTicketRelease; +import com.gxwebsoft.shop.entity.ShopOrder; +import com.gxwebsoft.shop.entity.ShopOrderGoods; +import com.gxwebsoft.shop.service.ShopOrderGoodsService; +import com.gxwebsoft.shop.service.ShopOrderService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.support.TransactionTemplate; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * 套票发放(从订单生成用户套票 + 释放计划)的业务逻辑。 + * + * 说明: + * - 定时任务无登录态时,MyBatis-Plus 多租户插件可能拿不到 tenantId; + * 外层任务方法会通过 @IgnoreTenant 禁用租户拦截,本服务内部强制用 tenantId 过滤。 + * - 幂等:以 (tenantId, templateId, orderNo, orderGoodsId) 判断是否已发放。 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class GltTicketIssueService { + + public static final int CHANGE_TYPE_ISSUE = 10; + + private enum IssueOutcome { + ISSUED, + ALREADY_ISSUED, + SKIPPED, + NO_TEMPLATE + } + + private final ShopOrderService shopOrderService; + private final ShopOrderGoodsService shopOrderGoodsService; + + private final GltTicketTemplateService gltTicketTemplateService; + private final GltUserTicketService gltUserTicketService; + private final GltUserTicketReleaseService gltUserTicketReleaseService; + private final GltUserTicketLogService gltUserTicketLogService; + private final TransactionTemplate transactionTemplate; + + /** + * 扫描“今日订单”,执行套票发放。 + */ + public void issueTodayOrders(Integer tenantId, Integer formId) { + LocalDateTime todayStart = LocalDate.now().atStartOfDay(); + LocalDateTime tomorrowStart = todayStart.plusDays(1); + + List orders = shopOrderService.list( + new LambdaQueryWrapper() + .eq(ShopOrder::getTenantId, tenantId) + .eq(ShopOrder::getFormId, formId) + .eq(ShopOrder::getPayStatus, true) + .eq(ShopOrder::getOrderStatus, 0) + // 今日订单(兼容:以 create_time 或 pay_time 任一落在今日即可) + .and(w -> w + .ge(ShopOrder::getCreateTime, todayStart).lt(ShopOrder::getCreateTime, tomorrowStart) + .or() + .ge(ShopOrder::getPayTime, todayStart).lt(ShopOrder::getPayTime, tomorrowStart) + ) + .orderByAsc(ShopOrder::getPayTime) + .orderByAsc(ShopOrder::getOrderId) + ); + + if (orders.isEmpty()) { + log.debug("套票发放扫描:今日无符合条件的订单 tenantId={}, formId={}", tenantId, formId); + return; + } + + int success = 0; + int skipped = 0; + int failed = 0; + + for (ShopOrder order : orders) { + try { + int issuedCount = issueForOrder(tenantId, formId, order); + if (issuedCount > 0) { + success += issuedCount; + } else { + skipped++; + } + } catch (Exception e) { + failed++; + log.error("套票发放失败 - tenantId={}, orderNo={}, orderId={}", + tenantId, order.getOrderNo(), order.getOrderId(), e); + } + } + + log.info("套票发放扫描完成 - tenantId={}, formId={}, 订单数={}, 发放成功={}, 跳过={}, 失败={}", + tenantId, formId, orders.size(), success, skipped, failed); + } + + private int issueForOrder(Integer tenantId, Integer formId, ShopOrder order) { + List goodsList = shopOrderGoodsService.getListByOrderIdIgnoreTenant(order.getOrderId()); + if (goodsList == null || goodsList.isEmpty()) { + return 0; + } + + int issuedCount = 0; // 本轮新增发放数量(用于统计) + boolean shouldCompleteOrder = false; + + for (ShopOrderGoods og : goodsList) { + if (!Objects.equals(og.getGoodsId(), formId)) { + continue; + } + + IssueOutcome outcome = transactionTemplate.execute(status -> doIssueOne(tenantId, order, og)); + if (outcome == IssueOutcome.ISSUED) { + issuedCount++; + shouldCompleteOrder = true; + } else if (outcome == IssueOutcome.ALREADY_ISSUED) { + // 幂等:已处理过也应视为完成,避免重复扫描 + shouldCompleteOrder = true; + } + } + + if (shouldCompleteOrder) { + LocalDateTime now = LocalDateTime.now(); + // 任务执行完后将订单置为“已完成”:order_status=1 + shopOrderService.update( + new LambdaUpdateWrapper() + .eq(ShopOrder::getOrderId, order.getOrderId()) + .eq(ShopOrder::getTenantId, tenantId) + .set(ShopOrder::getOrderStatus, 1) + // 同步更新发货状态为“已发货” + .set(ShopOrder::getDeliveryStatus, 20) + .set(ShopOrder::getHasTakeGift, true) + .set(ShopOrder::getUpdateTime, now) + ); + } + + return issuedCount; + } + + private IssueOutcome doIssueOne(Integer tenantId, ShopOrder order, ShopOrderGoods og) { + if (order.getUserId() == null) { + log.warn("套票发放跳过:订单缺少 userId - tenantId={}, orderNo={}", tenantId, order.getOrderNo()); + return IssueOutcome.SKIPPED; + } + if (og.getId() == null) { + log.warn("套票发放跳过:订单商品缺少 id - tenantId={}, orderNo={}", tenantId, order.getOrderNo()); + return IssueOutcome.SKIPPED; + } + + GltTicketTemplate template = gltTicketTemplateService.getOne( + new LambdaQueryWrapper() + .eq(GltTicketTemplate::getTenantId, tenantId) + .eq(GltTicketTemplate::getGoodsId, og.getGoodsId()) + .eq(GltTicketTemplate::getDeleted, 0) + .last("limit 1") + ); + + if (template == null) { + log.warn("套票发放跳过:未配置套票模板 - tenantId={}, goodsId={}, orderNo={}", + tenantId, og.getGoodsId(), order.getOrderNo()); + return IssueOutcome.NO_TEMPLATE; + } + if (!Boolean.TRUE.equals(template.getEnabled())) { + log.info("套票发放跳过:套票模板未启用 - tenantId={}, templateId={}, goodsId={}", + tenantId, template.getId(), template.getGoodsId()); + return IssueOutcome.SKIPPED; + } + + // 幂等:同一 orderNo + orderGoodsId 只发放一次 + GltUserTicket existing = gltUserTicketService.getOne( + new LambdaQueryWrapper() + .eq(GltUserTicket::getTenantId, tenantId) + .eq(GltUserTicket::getTemplateId, template.getId()) + .eq(GltUserTicket::getOrderNo, order.getOrderNo()) + .eq(GltUserTicket::getOrderGoodsId, og.getId()) + .eq(GltUserTicket::getDeleted, 0) + .last("limit 1") + ); + if (existing != null) { + log.debug("套票已发放,跳过 - tenantId={}, orderNo={}, orderGoodsId={}, userTicketId={}", + tenantId, order.getOrderNo(), og.getId(), existing.getId()); + return IssueOutcome.ALREADY_ISSUED; + } + + int buyQty = og.getTotalNum() != null ? og.getTotalNum() : 0; + if (buyQty <= 0) { + log.warn("套票发放跳过:购买数量无效 - tenantId={}, orderNo={}, orderGoodsId={}, totalNum={}", + tenantId, order.getOrderNo(), og.getId(), og.getTotalNum()); + return IssueOutcome.SKIPPED; + } + + Integer minBuyQty = template.getMinBuyQty(); + if (minBuyQty != null && minBuyQty > 0 && buyQty < minBuyQty) { + log.info("套票发放跳过:未达到最小购买数量 - tenantId={}, orderNo={}, buyQty={}, minBuyQty={}", + tenantId, order.getOrderNo(), buyQty, minBuyQty); + return IssueOutcome.SKIPPED; + } + + int giftMultiplier = template.getGiftMultiplier() != null ? template.getGiftMultiplier() : 0; + int giftQty = buyQty * Math.max(giftMultiplier, 0); + + // 购买量(buyQty)应立即可用;赠送量(giftQty)进入冻结并按计划释放。 + int totalQty = buyQty + giftQty; + + if (totalQty <= 0) { + log.info("套票发放跳过:计算结果为0 - tenantId={}, orderNo={}, buyQty={}, giftMultiplier={}, includeBuyQty={}", + tenantId, order.getOrderNo(), buyQty, giftMultiplier, template.getIncludeBuyQty()); + return IssueOutcome.SKIPPED; + } + + LocalDateTime now = LocalDateTime.now(); + + GltUserTicket userTicket = new GltUserTicket(); + userTicket.setTemplateId(template.getId()); + userTicket.setGoodsId(og.getGoodsId()); + userTicket.setOrderId(order.getOrderId()); + userTicket.setOrderNo(order.getOrderNo()); + userTicket.setOrderGoodsId(og.getId()); + userTicket.setTotalQty(totalQty); + userTicket.setAvailableQty(buyQty); + userTicket.setFrozenQty(giftQty); + userTicket.setUsedQty(0); + // 初始可用量来自“购买量”,视为已释放 + userTicket.setReleasedQty(buyQty); + userTicket.setUserId(order.getUserId()); + userTicket.setSortNumber(0); + userTicket.setComments("订单发放套票"); + userTicket.setStatus(0); + userTicket.setDeleted(0); + userTicket.setTenantId(tenantId); + userTicket.setCreateTime(now); + userTicket.setUpdateTime(now); + + gltUserTicketService.save(userTicket); + + // 生成释放计划(按月) + LocalDateTime baseTime = order.getPayTime() != null ? order.getPayTime() : order.getCreateTime(); + if (baseTime == null) { + baseTime = now; + } + List releases = buildReleasePlan(template, userTicket, baseTime, giftQty, now); + if (!releases.isEmpty()) { + gltUserTicketReleaseService.saveBatch(releases); + } + + // 发放流水 + GltUserTicketLog issueLog = new GltUserTicketLog(); + issueLog.setUserTicketId(userTicket.getId()); + issueLog.setChangeType(CHANGE_TYPE_ISSUE); + issueLog.setChangeAvailable(buyQty); + issueLog.setChangeFrozen(giftQty); + issueLog.setChangeUsed(0); + issueLog.setAvailableAfter(buyQty); + issueLog.setFrozenAfter(giftQty); + issueLog.setUsedAfter(0); + issueLog.setOrderId(order.getOrderId()); + issueLog.setOrderNo(order.getOrderNo()); + issueLog.setUserId(order.getUserId()); + issueLog.setSortNumber(0); + issueLog.setComments("套票发放"); + issueLog.setStatus(0); + issueLog.setDeleted(0); + issueLog.setTenantId(tenantId); + issueLog.setCreateTime(now); + issueLog.setUpdateTime(now); + gltUserTicketLogService.save(issueLog); + + log.info("套票发放成功 - tenantId={}, orderNo={}, orderGoodsId={}, templateId={}, userTicketId={}, totalQty={}", + tenantId, order.getOrderNo(), og.getId(), template.getId(), userTicket.getId(), totalQty); + + return IssueOutcome.ISSUED; + } + + private List buildReleasePlan(GltTicketTemplate template, + GltUserTicket userTicket, + LocalDateTime baseTime, + int totalQty, + LocalDateTime now) { + List list = new ArrayList<>(); + + if (totalQty <= 0) { + return list; + } + + // 首期释放时间 + LocalDateTime firstReleaseTime; + if (Objects.equals(template.getFirstReleaseMode(), 1)) { + firstReleaseTime = nextMonthSameDay(baseTime); + } else { + firstReleaseTime = baseTime; + } + + // 每期释放数量计算 + Integer releasePeriods = template.getReleasePeriods(); + if (releasePeriods != null && releasePeriods > 0) { + int base = totalQty / releasePeriods; + int remainder = totalQty % releasePeriods; + for (int i = 1; i <= releasePeriods; i++) { + int qty = base + (i <= remainder ? 1 : 0); + if (qty <= 0) { + continue; + } + list.add(buildRelease(userTicket, i, qty, firstReleaseTime.plusMonths(i - 1), now)); + } + return list; + } + + int monthlyReleaseQty = template.getMonthlyReleaseQty() != null && template.getMonthlyReleaseQty() > 0 + ? template.getMonthlyReleaseQty() + : 10; + int periods = (totalQty + monthlyReleaseQty - 1) / monthlyReleaseQty; + int remaining = totalQty; + for (int i = 1; i <= periods; i++) { + int qty = Math.min(monthlyReleaseQty, remaining); + if (qty <= 0) { + break; + } + remaining -= qty; + list.add(buildRelease(userTicket, i, qty, firstReleaseTime.plusMonths(i - 1), now)); + } + + return list; + } + + private GltUserTicketRelease buildRelease(GltUserTicket userTicket, + int periodNo, + int releaseQty, + LocalDateTime releaseTime, + LocalDateTime now) { + GltUserTicketRelease r = new GltUserTicketRelease(); + r.setUserTicketId(userTicket.getId() != null ? userTicket.getId().longValue() : null); + r.setUserId(userTicket.getUserId()); + r.setPeriodNo(periodNo); + r.setReleaseQty(releaseQty); + r.setReleaseTime(releaseTime); + r.setStatus(0); + r.setDeleted(0); + r.setTenantId(userTicket.getTenantId()); + r.setCreateTime(now); + r.setUpdateTime(now); + return r; + } + + private static LocalDateTime nextMonthSameDay(LocalDateTime baseTime) { + LocalDate baseDate = baseTime.toLocalDate(); + LocalTime time = baseTime.toLocalTime(); + + LocalDate nextMonth = baseDate.plusMonths(1); + int day = Math.min(baseDate.getDayOfMonth(), nextMonth.lengthOfMonth()); + LocalDate adjusted = nextMonth.withDayOfMonth(day); + return LocalDateTime.of(adjusted, time); + } +} diff --git a/src/main/java/com/gxwebsoft/glt/service/GltTicketTemplateService.java b/src/main/java/com/gxwebsoft/glt/service/GltTicketTemplateService.java new file mode 100644 index 0000000..8ebb330 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/service/GltTicketTemplateService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.glt.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.glt.entity.GltTicketTemplate; +import com.gxwebsoft.glt.param.GltTicketTemplateParam; + +import java.util.List; + +/** + * 水票Service + * + * @author 科技小王子 + * @since 2026-02-03 18:55:54 + */ +public interface GltTicketTemplateService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(GltTicketTemplateParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(GltTicketTemplateParam param); + + /** + * 根据id查询 + * + * @param id + * @return GltTicketTemplate + */ + GltTicketTemplate getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/glt/service/GltUserTicketLogService.java b/src/main/java/com/gxwebsoft/glt/service/GltUserTicketLogService.java new file mode 100644 index 0000000..7bdda87 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/service/GltUserTicketLogService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.glt.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.glt.entity.GltUserTicketLog; +import com.gxwebsoft.glt.param.GltUserTicketLogParam; + +import java.util.List; + +/** + * 消费日志Service + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +public interface GltUserTicketLogService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(GltUserTicketLogParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(GltUserTicketLogParam param); + + /** + * 根据id查询 + * + * @param id + * @return GltUserTicketLog + */ + GltUserTicketLog getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/glt/service/GltUserTicketReleaseService.java b/src/main/java/com/gxwebsoft/glt/service/GltUserTicketReleaseService.java new file mode 100644 index 0000000..f023cf8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/service/GltUserTicketReleaseService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.glt.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.glt.entity.GltUserTicketRelease; +import com.gxwebsoft.glt.param.GltUserTicketReleaseParam; + +import java.util.List; + +/** + * 水票释放Service + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +public interface GltUserTicketReleaseService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(GltUserTicketReleaseParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(GltUserTicketReleaseParam param); + + /** + * 根据id查询 + * + * @param id + * @return GltUserTicketRelease + */ + GltUserTicketRelease getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/glt/service/GltUserTicketService.java b/src/main/java/com/gxwebsoft/glt/service/GltUserTicketService.java new file mode 100644 index 0000000..1c292e9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/service/GltUserTicketService.java @@ -0,0 +1,50 @@ +package com.gxwebsoft.glt.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.glt.entity.GltUserTicket; +import com.gxwebsoft.glt.param.GltUserTicketParam; + +import java.util.List; + +/** + * 我的水票Service + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +public interface GltUserTicketService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(GltUserTicketParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(GltUserTicketParam param); + + /** + * 根据id查询 + * + * @param id + * @return GltUserTicket + */ + GltUserTicket getByIdRel(Integer id); + + /** + * 统计指定用户水票总数量(sum(total_qty)) + * + * @param userId 用户ID + * @return 总数量(无记录返回0) + */ + Integer sumTotalQtyByUserId(Integer userId); + +} diff --git a/src/main/java/com/gxwebsoft/glt/service/impl/GltTicketTemplateServiceImpl.java b/src/main/java/com/gxwebsoft/glt/service/impl/GltTicketTemplateServiceImpl.java new file mode 100644 index 0000000..082acb8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/service/impl/GltTicketTemplateServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.glt.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.glt.mapper.GltTicketTemplateMapper; +import com.gxwebsoft.glt.service.GltTicketTemplateService; +import com.gxwebsoft.glt.entity.GltTicketTemplate; +import com.gxwebsoft.glt.param.GltTicketTemplateParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 水票Service实现 + * + * @author 科技小王子 + * @since 2026-02-03 18:55:54 + */ +@Service +public class GltTicketTemplateServiceImpl extends ServiceImpl implements GltTicketTemplateService { + + @Override + public PageResult pageRel(GltTicketTemplateParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(GltTicketTemplateParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public GltTicketTemplate getByIdRel(Integer id) { + GltTicketTemplateParam param = new GltTicketTemplateParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketLogServiceImpl.java b/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketLogServiceImpl.java new file mode 100644 index 0000000..a0d6acc --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketLogServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.glt.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.glt.mapper.GltUserTicketLogMapper; +import com.gxwebsoft.glt.service.GltUserTicketLogService; +import com.gxwebsoft.glt.entity.GltUserTicketLog; +import com.gxwebsoft.glt.param.GltUserTicketLogParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 消费日志Service实现 + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +@Service +public class GltUserTicketLogServiceImpl extends ServiceImpl implements GltUserTicketLogService { + + @Override + public PageResult pageRel(GltUserTicketLogParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(GltUserTicketLogParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public GltUserTicketLog getByIdRel(Integer id) { + GltUserTicketLogParam param = new GltUserTicketLogParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketReleaseServiceImpl.java b/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketReleaseServiceImpl.java new file mode 100644 index 0000000..e85881b --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketReleaseServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.glt.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.glt.mapper.GltUserTicketReleaseMapper; +import com.gxwebsoft.glt.service.GltUserTicketReleaseService; +import com.gxwebsoft.glt.entity.GltUserTicketRelease; +import com.gxwebsoft.glt.param.GltUserTicketReleaseParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 水票释放Service实现 + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +@Service +public class GltUserTicketReleaseServiceImpl extends ServiceImpl implements GltUserTicketReleaseService { + + @Override + public PageResult pageRel(GltUserTicketReleaseParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(GltUserTicketReleaseParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public GltUserTicketRelease getByIdRel(Integer id) { + GltUserTicketReleaseParam param = new GltUserTicketReleaseParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketServiceImpl.java b/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketServiceImpl.java new file mode 100644 index 0000000..d5547a9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/service/impl/GltUserTicketServiceImpl.java @@ -0,0 +1,53 @@ +package com.gxwebsoft.glt.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.glt.mapper.GltUserTicketMapper; +import com.gxwebsoft.glt.service.GltUserTicketService; +import com.gxwebsoft.glt.entity.GltUserTicket; +import com.gxwebsoft.glt.param.GltUserTicketParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 我的水票Service实现 + * + * @author 科技小王子 + * @since 2026-02-03 18:55:55 + */ +@Service +public class GltUserTicketServiceImpl extends ServiceImpl implements GltUserTicketService { + + @Override + public PageResult pageRel(GltUserTicketParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(GltUserTicketParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public GltUserTicket getByIdRel(Integer id) { + GltUserTicketParam param = new GltUserTicketParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public Integer sumAvailableQtyByUserId(Integer userId, Integer tenantId) { + Integer availableQty = baseMapper.sumAvailableQtyByUserId(userId, tenantId); + return availableQty == null ? 0 : availableQty; + } + +} diff --git a/src/main/java/com/gxwebsoft/glt/task/DealerOrderSettlement10584Task.java b/src/main/java/com/gxwebsoft/glt/task/DealerOrderSettlement10584Task.java new file mode 100644 index 0000000..d74f4c1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/task/DealerOrderSettlement10584Task.java @@ -0,0 +1,956 @@ +package com.gxwebsoft.glt.task; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.gxwebsoft.common.core.annotation.IgnoreTenant; +import com.gxwebsoft.shop.entity.ShopDealerCapital; +import com.gxwebsoft.shop.entity.ShopDealerOrder; +import com.gxwebsoft.shop.entity.ShopDealerReferee; +import com.gxwebsoft.shop.entity.ShopDealerSetting; +import com.gxwebsoft.shop.entity.ShopDealerUser; +import com.gxwebsoft.shop.entity.ShopGoods; +import com.gxwebsoft.shop.entity.ShopOrder; +import com.gxwebsoft.shop.entity.ShopOrderGoods; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.mapper.UserMapper; +import com.gxwebsoft.shop.service.ShopDealerCapitalService; +import com.gxwebsoft.shop.service.ShopDealerOrderService; +import com.gxwebsoft.shop.service.ShopDealerRefereeService; +import com.gxwebsoft.shop.service.ShopDealerSettingService; +import com.gxwebsoft.shop.service.ShopDealerUserService; +import com.gxwebsoft.shop.service.ShopGoodsService; +import com.gxwebsoft.shop.service.ShopOrderService; +import com.gxwebsoft.shop.service.ShopOrderGoodsService; +import com.gxwebsoft.shop.util.UpstreamUserFinder; +import com.alibaba.fastjson.JSONObject; +import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.springframework.transaction.support.TransactionTemplate; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.*; + +/** + * 租户10584:分销订单结算任务 + *

+ * 每10秒执行一次,查询“已付款且未结算”的订单,按指定规则计算佣金并先计入分销商冻结金额(freezeMoney),并将订单置为已结算。 + */ +@Slf4j +@Component +public class DealerOrderSettlement10584Task { + + private static final Integer TENANT_ID = 10584; + + private static final BigDecimal RATE_0_10 = new BigDecimal("0.10"); + private static final BigDecimal RATE_0_05 = new BigDecimal("0.05"); + private static final BigDecimal RATE_0_03 = new BigDecimal("0.03"); + private static final BigDecimal RATE_0_02 = new BigDecimal("0.02"); + private static final BigDecimal RATE_0_01 = new BigDecimal("0.01"); + private static final BigDecimal TOTAL_DEALER_DIVIDEND_RATE = RATE_0_01; + + private static final int MAX_ORDERS_PER_RUN = 50; + private static final int MAX_REFEREE_CHAIN_DEPTH = 20; + private static final int DIVIDEND_SCALE = 3; + + @Resource + private TransactionTemplate transactionTemplate; + + @Resource + private ShopOrderService shopOrderService; + + @Resource + private ShopDealerRefereeService shopDealerRefereeService; + + @Resource + private ShopDealerUserService shopDealerUserService; + + @Resource + private ShopDealerCapitalService shopDealerCapitalService; + + @Resource + private ShopDealerOrderService shopDealerOrderService; + + @Resource + private ShopDealerSettingService shopDealerSettingService; + + @Resource + private ShopGoodsService shopGoodsService; + + @Resource + private ShopOrderGoodsService shopOrderGoodsService; + + @Resource + private UserMapper userMapper; + + /** + * 每10秒执行一次。 + */ + @Scheduled(cron = "0/10 * * * * ?") + @IgnoreTenant("该定时任务仅处理租户10584,但需要显式按tenantId过滤,避免定时任务线程无租户上下文导致查询异常") + public void settleTenant10584Orders() { + try { + List orders = findUnsettledPaidOrders(); + if (orders.isEmpty()) { + return; + } + + // Per-run caches to reduce DB chatter across orders. + Map level1ParentCache = new HashMap<>(); + Map shopRoleCache = new HashMap<>(); + DealerBasicSetting dealerBasicSetting = findDealerBasicSetting(); + ShopDealerUser totalDealerUser = findTotalDealerUser(); + if (totalDealerUser == null || totalDealerUser.getUserId() == null) { + log.warn("未找到总经销商账号,订单仍可结算但不会发放总经销商分润 - tenantId={}", TENANT_ID); + } + log.debug("租户{}分销设置 - level={}", TENANT_ID, dealerBasicSetting.level); + + log.info("租户{}待结算订单数: {}, orderNos(sample)={}", + TENANT_ID, + orders.size(), + orders.stream().limit(10).map(ShopOrder::getOrderNo).toList()); + + for (ShopOrder order : orders) { + try { + transactionTemplate.executeWithoutResult(status -> { + // 先“认领”订单:并发/多实例下避免重复结算(update=0 表示被其他线程/实例处理) + if (!claimOrderToSettle(order.getOrderId())) { + return; + } + settleOneOrder(order, level1ParentCache, shopRoleCache, totalDealerUser, dealerBasicSetting.level); + }); + } catch (Exception e) { + log.error("订单结算失败,将回滚本订单并在下次任务重试 - orderId={}, orderNo={}", order.getOrderId(), order.getOrderNo(), e); + } + } + } catch (Exception e) { + log.error("租户{}分销订单结算任务执行失败", TENANT_ID, e); + } + } + + private List findUnsettledPaidOrders() { + // 以确认收货为准:仅结算 deliveryStatus=20 的订单(租户10584约定)。 + return shopOrderService.list( + new LambdaQueryWrapper() + .eq(ShopOrder::getTenantId, TENANT_ID) + .eq(ShopOrder::getDeleted, 0) + .eq(ShopOrder::getPayStatus, true) + .eq(ShopOrder::getDeliveryStatus, 20) + .eq(ShopOrder::getIsSettled, 0) + .orderByAsc(ShopOrder::getOrderId) + .last("limit " + MAX_ORDERS_PER_RUN) + ); + } + + private boolean claimOrderToSettle(Integer orderId) { + return shopOrderService.update( + new LambdaUpdateWrapper() + .eq(ShopOrder::getOrderId, orderId) + .eq(ShopOrder::getTenantId, TENANT_ID) + .eq(ShopOrder::getIsSettled, 0) + .set(ShopOrder::getIsSettled, 1) + ); + } + + private void settleOneOrder( + ShopOrder order, + Map level1ParentCache, + Map shopRoleCache, + ShopDealerUser totalDealerUser, + int dealerLevel + ) { + if (order.getUserId() == null || order.getOrderNo() == null) { + throw new IllegalStateException("订单关键信息缺失,无法结算 - orderId=" + order.getOrderId()); + } + + BigDecimal baseAmount = getOrderBaseAmount(order); + if (baseAmount == null || baseAmount.signum() <= 0) { + throw new IllegalStateException("订单金额为空或<=0,无法结算 - orderId=" + order.getOrderId() + ", orderNo=" + order.getOrderNo()); + } + + OrderGoodsInfo goodsInfo = findOrderSingleGoodsInfo(order); + ShopGoods goods = goodsInfo.goods; + int goodsQty = goodsInfo.quantity; + + if (goods != null && goods.getIsOpenCommission() != null && goods.getIsOpenCommission() != 1) { + log.info("商品未开启分销,跳过订单结算 - orderId={}, orderNo={}, buyerUserId={}, goodsId={}, isOpenCommission={}", + order.getOrderId(), order.getOrderNo(), order.getUserId(), goods.getGoodsId(), goods.getIsOpenCommission()); + return; + } + + CommissionConfig commissionConfig = resolveCommissionConfig(goods); + + log.info("开始结算订单 - orderId={}, orderNo={}, buyerUserId={}, payPrice={}, goodsId={}, goodsQty={}, commissionType={}, cfg[dealer1={}, dealer2={}, dealer3={}, div1={}, div2={}]", + order.getOrderId(), + order.getOrderNo(), + order.getUserId(), + baseAmount, + goods != null ? goods.getGoodsId() : null, + goodsQty, + commissionConfig.commissionType, + commissionConfig.dealerDirectValue, + commissionConfig.dealerSimpleValue, + commissionConfig.dealerThirdValue, + commissionConfig.storeDirectValue, + commissionConfig.storeSimpleValue); + + // 1) 直推/间推(shop_dealer_referee) + DealerRefereeCommission dealerRefereeCommission = settleDealerRefereeCommission(order, baseAmount, goodsQty, commissionConfig, dealerLevel); + + // 2) 门店分红上级:从下单用户开始逐级向上找,命中 ShopDealerUser.type=1 的最近两级(直推门店/间推门店)。 + ShopRoleCommission shopRoleCommission = settleShopRoleRefereeCommission(order, baseAmount, goodsQty, commissionConfig, level1ParentCache, shopRoleCache); + + // 3) 总经销商分润:固定比率,每个订单都分。 + TotalDealerCommission totalDealerCommission = settleTotalDealerCommission(order, baseAmount, goodsQty, totalDealerUser); + + // 4) 写入分销订单记录(用于排查/统计;详细分佣以 ShopDealerCapital 为准) + createDealerOrderRecord(order, baseAmount, dealerRefereeCommission, shopRoleCommission, totalDealerCommission); + + log.info("订单结算完成 - orderId={}, orderNo={}, baseAmount={}", order.getOrderId(), order.getOrderNo(), baseAmount); + } + + private DealerRefereeCommission settleDealerRefereeCommission( + ShopOrder order, + BigDecimal baseAmount, + int goodsQty, + CommissionConfig commissionConfig, + int dealerLevel + ) { + // 兼容两种数据形态: + // 1) 同一 userId 下有 level=1/2/3 的多级关系(直接按 level 取); + // 2) 仅维护 level=1(用“查两次”回退获取上级)。 + // + // 严格按“分销设置 level”决定发放到第几级,避免 level=2 时仍触发第3级发放逻辑。 + int normalizedLevel = normalizeDealerLevel(dealerLevel); + + Integer directDealerId = null; + Integer simpleDealerId = null; + Integer thirdDealerId = null; + + if (normalizedLevel >= 1) { + directDealerId = getDealerRefereeId(order.getUserId(), 1); + } + if (normalizedLevel >= 2) { + simpleDealerId = getDealerRefereeId(order.getUserId(), 2); + if (simpleDealerId == null && directDealerId != null) { + simpleDealerId = getDealerRefereeId(directDealerId, 1); + } + } + if (normalizedLevel >= 3) { + thirdDealerId = getDealerRefereeId(order.getUserId(), 3); + if (thirdDealerId == null && simpleDealerId != null) { + thirdDealerId = getDealerRefereeId(simpleDealerId, 1); + } + } + + BigDecimal directMoney = + directDealerId != null ? calcMoneyByCommissionType(baseAmount, commissionConfig.dealerDirectValue, goodsQty, 2, commissionConfig.commissionType) : BigDecimal.ZERO; + // 允许同一条线内同一个人同时拿到“直推 + 间推”(即使 directDealerId == simpleDealerId 也照常发放两笔) + BigDecimal simpleMoney = + simpleDealerId != null ? calcMoneyByCommissionType(baseAmount, commissionConfig.dealerSimpleValue, goodsQty, 2, commissionConfig.commissionType) : BigDecimal.ZERO; + BigDecimal thirdMoney = + thirdDealerId != null ? calcMoneyByCommissionType(baseAmount, commissionConfig.dealerThirdValue, goodsQty, 2, commissionConfig.commissionType) : BigDecimal.ZERO; + + log.info("分销直推/间推/第3级查询结果 - orderNo={}, buyerUserId={}, directDealerId={}, directMoney={}, simpleDealerId={}, simpleMoney={}, thirdDealerId={}, thirdMoney={}", + order.getOrderNo(), order.getUserId(), directDealerId, directMoney, simpleDealerId, simpleMoney, thirdDealerId, thirdMoney); + + // 直推:对方=买家;推荐奖(5%):对方=直推分销商(便于在资金明细中看出“来自哪个下级分销商/团队订单”) + if (normalizedLevel >= 1) { + creditDealerCommission( + directDealerId, + directMoney, + order, + order.getUserId(), + buildCommissionComment("直推佣金", commissionConfig.commissionType, commissionConfig.dealerDirectValue, goodsQty) + ); + } + if (normalizedLevel >= 2) { + creditDealerCommission( + simpleDealerId, + simpleMoney, + order, + directDealerId, + buildCommissionComment("推荐奖", commissionConfig.commissionType, commissionConfig.dealerSimpleValue, goodsQty) + ); + } + if (normalizedLevel >= 3) { + creditDealerCommission( + thirdDealerId, + thirdMoney, + order, + simpleDealerId, + buildCommissionComment("分润收入", commissionConfig.commissionType, commissionConfig.dealerThirdValue, goodsQty) + ); + } + + return new DealerRefereeCommission(directDealerId, directMoney, simpleDealerId, simpleMoney, thirdDealerId, thirdMoney); + } + + private Integer getDealerRefereeId(Integer userId) { + return getDealerRefereeId(userId, 1); + } + + private Integer getDealerRefereeId(Integer userId, int level) { + if (userId == null) { + return null; + } + ShopDealerReferee rel = shopDealerRefereeService.getOne( + new LambdaQueryWrapper() + .eq(ShopDealerReferee::getTenantId, TENANT_ID) + .eq(ShopDealerReferee::getUserId, userId) + .eq(ShopDealerReferee::getLevel, level) + .orderByDesc(ShopDealerReferee::getId) + .last("limit 1") + ); + log.debug("shop_dealer_referee(level={}) 查询 - tenantId={}, userId={}, dealerId={}", + level, TENANT_ID, userId, rel != null ? rel.getDealerId() : null); + return rel != null ? rel.getDealerId() : null; + } + + private ShopRoleCommission settleShopRoleRefereeCommission( + ShopOrder order, + BigDecimal baseAmount, + int goodsQty, + CommissionConfig commissionConfig, + Map level1ParentCache, + Map shopRoleCache + ) { + List shopRoleReferees = findFirstTwoShopRoleReferees(order.getUserId(), level1ParentCache, shopRoleCache); + log.info("门店分红命中结果(type=1门店角色取前两级) - orderNo={}, buyerUserId={}, shopRoleReferees={}", + order.getOrderNo(), order.getUserId(), shopRoleReferees); + if (shopRoleReferees.isEmpty()) { + return ShopRoleCommission.empty(); + } + + if (shopRoleReferees.size() == 1) { + // 仅找到一个门店:按(直推+间推)汇总发放 + BigDecimal singleStoreValue = safeValue(commissionConfig.storeDirectValue).add(safeValue(commissionConfig.storeSimpleValue)); + BigDecimal money = calcMoneyByCommissionType(baseAmount, singleStoreValue, goodsQty, DIVIDEND_SCALE, commissionConfig.commissionType); + log.info("分红发放(仅1门店) - orderNo={}, firstDividendUserId={}, commissionType={}, value={}, money={}", + order.getOrderNo(), shopRoleReferees.get(0), commissionConfig.commissionType, singleStoreValue, money); + creditDealerCommission( + shopRoleReferees.get(0), + money, + order, + order.getUserId(), + buildCommissionComment("门店直推佣金(仅1门店)", commissionConfig.commissionType, singleStoreValue, goodsQty) + ); + return new ShopRoleCommission(shopRoleReferees.get(0), money, null, BigDecimal.ZERO); + } + + // 两个或以上:按配置分别发放 + BigDecimal storeDirectMoney = + calcMoneyByCommissionType(baseAmount, commissionConfig.storeDirectValue, goodsQty, DIVIDEND_SCALE, commissionConfig.commissionType); + BigDecimal storeSimpleMoney = + calcMoneyByCommissionType(baseAmount, commissionConfig.storeSimpleValue, goodsQty, DIVIDEND_SCALE, commissionConfig.commissionType); + log.info("分红发放(2人) - orderNo={}, firstDividendUserId={}, commissionType={}, firstValue={}, firstMoney={}, secondDividendUserId={}, secondValue={}, secondMoney={}", + order.getOrderNo(), + shopRoleReferees.get(0), + commissionConfig.commissionType, + commissionConfig.storeDirectValue, + storeDirectMoney, + shopRoleReferees.get(1), + commissionConfig.storeSimpleValue, + storeSimpleMoney); + creditDealerCommission( + shopRoleReferees.get(0), + storeDirectMoney, + order, + order.getUserId(), + buildCommissionComment("门店直推佣金", commissionConfig.commissionType, commissionConfig.storeDirectValue, goodsQty) + ); + creditDealerCommission( + shopRoleReferees.get(1), + storeSimpleMoney, + order, + order.getUserId(), + buildCommissionComment("门店间推佣金", commissionConfig.commissionType, commissionConfig.storeSimpleValue, goodsQty) + ); + return new ShopRoleCommission(shopRoleReferees.get(0), storeDirectMoney, shopRoleReferees.get(1), storeSimpleMoney); + } + + private TotalDealerCommission settleTotalDealerCommission( + ShopOrder order, + BigDecimal baseAmount, + int goodsQty, + ShopDealerUser totalDealerUser + ) { + if (totalDealerUser == null || totalDealerUser.getUserId() == null) { + return TotalDealerCommission.empty(); + } + BigDecimal rate = safePositive(totalDealerUser.getRate()); + if (rate.signum() <= 0) { + rate = TOTAL_DEALER_DIVIDEND_RATE; + } + BigDecimal money = calcMoneyByCommissionType(baseAmount, rate, goodsQty, DIVIDEND_SCALE, 20); + log.info("总经销商分润发放 - orderNo={}, totalDealerUserId={}, rate={}, money={}", + order.getOrderNo(), totalDealerUser.getUserId(), rate, money); + creditDealerCommission( + totalDealerUser.getUserId(), + money, + order, + order.getUserId(), + buildCommissionComment("总经销商分润", 20, rate, goodsQty) + ); + return new TotalDealerCommission(totalDealerUser.getUserId(), money); + } + + private ShopDealerUser findTotalDealerUser() { + return shopDealerUserService.getOne( + new LambdaQueryWrapper() + .eq(ShopDealerUser::getTenantId, TENANT_ID) + .eq(ShopDealerUser::getType, 2) + .and(w -> w.eq(ShopDealerUser::getIsDelete, 0).or().isNull(ShopDealerUser::getIsDelete)) + .orderByAsc(ShopDealerUser::getId) + .last("limit 1") + ); + } + + private DealerBasicSetting findDealerBasicSetting() { + int level = 2; + ShopDealerSetting setting = shopDealerSettingService.getOne( + new LambdaQueryWrapper() + .eq(ShopDealerSetting::getTenantId, TENANT_ID) + .eq(ShopDealerSetting::getKey, "basic") + .last("limit 1") + ); + if (setting != null && setting.getValues() != null && !setting.getValues().isBlank()) { + try { + JSONObject json = JSONObject.parseObject(setting.getValues()); + Integer levelVal = json.getInteger("level"); + if (levelVal != null && levelVal > 0) { + level = Math.min(levelVal, 3); + } + } catch (Exception e) { + log.warn("解析分销设置失败,将使用默认等级 - tenantId={}, values={}", TENANT_ID, setting.getValues(), e); + } + } + return new DealerBasicSetting(level); + } + + private int normalizeDealerLevel(int dealerLevel) { + if (dealerLevel <= 0) { + return 2; + } + return Math.min(dealerLevel, 3); + } + + /** + * shop_dealer_setting(key=basic) 的关键配置(仅取结算任务需要的字段)。 + */ + private static class DealerBasicSetting { + private final int level; + + private DealerBasicSetting(int level) { + this.level = level; + } + } + + /** + * 门店分红规则: + * - 门店角色为 ShopDealerUser.type=1; + * - 从下单用户开始,沿 shop_dealer_referee(level=1) 链路逐级向上找; + * - 遇到第一个 type=1 用户命中为“直推门店用户”,继续向上找到第二个 type=1 用户命中为“间推门店用户”。 + */ + private List findFirstTwoShopRoleReferees( + Integer buyerUserId, + Map level1ParentCache, + Map shopRoleCache + ) { + if (buyerUserId == null) { + return Collections.emptyList(); + } + + return UpstreamUserFinder.findFirstNMatchingUpstreamUsers( + buyerUserId, + 2, + MAX_REFEREE_CHAIN_DEPTH, + childId -> getLevel1ParentCached(childId, level1ParentCache), + userId -> isShopRoleUserCached(userId, shopRoleCache) + ); + } + + private Integer getLevel1ParentCached(Integer userId, Map cache) { + if (userId == null) { + return null; + } + if (cache != null) { + if (cache.containsKey(userId)) { + return cache.get(userId); + } + Integer parent = getDealerRefereeId(userId, 1); + cache.put(userId, parent); + return parent; + } + return getDealerRefereeId(userId, 1); + } + + private boolean isShopRoleUserCached(Integer userId, Map cache) { + if (userId == null) { + return false; + } + if (cache != null) { + Boolean cached = cache.get(userId); + if (cached != null) { + return cached; + } + if (cache.containsKey(userId)) { + return false; + } + boolean val = isShopRoleUser(userId); + cache.put(userId, val); + return val; + } + return isShopRoleUser(userId); + } + + private boolean isShopRoleUser(Integer userId) { + return shopDealerUserService.count( + new LambdaQueryWrapper() + .eq(ShopDealerUser::getTenantId, TENANT_ID) + .eq(ShopDealerUser::getUserId, userId) + .eq(ShopDealerUser::getType, 1) + .and(w -> w.eq(ShopDealerUser::getIsDelete, 0).or().isNull(ShopDealerUser::getIsDelete)) + ) > 0; + } + + private void creditDealerCommission(Integer dealerUserId, BigDecimal money, ShopOrder order, Integer toUserId, String comments) { + if (dealerUserId == null || money == null || money.signum() <= 0) { + return; + } + + // 幂等:同一订单同一类型佣金,避免重复发放(用于任务重跑/补发场景) + LambdaQueryWrapper idempotentQw = new LambdaQueryWrapper() + .eq(ShopDealerCapital::getTenantId, TENANT_ID) + .eq(ShopDealerCapital::getOrderNo, order.getOrderNo()) + .eq(ShopDealerCapital::getUserId, dealerUserId); + if (comments != null) { + // 以“佣金类型前缀”做幂等键,避免 comments 细节文案调整导致重复发放。 + String commentPrefix = comments; + int idx = comments.indexOf('('); + if (idx > 0) { + commentPrefix = comments.substring(0, idx) + "("; + } + idempotentQw.likeRight(ShopDealerCapital::getComments, commentPrefix); + } else { + idempotentQw.isNull(ShopDealerCapital::getComments); + } + boolean alreadyCredited = shopDealerCapitalService.count(idempotentQw) > 0; + if (alreadyCredited) { + log.info("佣金已处理(已入冻结/已落明细),跳过 - orderNo={}, toDealerUserId={}, money={}, comments={}", order.getOrderNo(), dealerUserId, money, comments); + return; + } + + log.info("佣金入冻结 - orderNo={}, toDealerUserId={}, money={}, comments={}", order.getOrderNo(), dealerUserId, money, comments); + + // 订单付款成功:佣金先进入冻结金额(freeze_money),避免后续退款/撤销时已可提现导致对账困难。 + // 并发下避免丢失更新,用SQL自增。 + boolean updated = shopDealerUserService.update( + new LambdaUpdateWrapper() + .eq(ShopDealerUser::getTenantId, TENANT_ID) + .eq(ShopDealerUser::getUserId, dealerUserId) + .setSql("freeze_money = IFNULL(freeze_money,0) + " + money.toPlainString()) + .setSql("total_money = IFNULL(total_money,0) + " + money.toPlainString()) + ); + + if (!updated) { + // 门店角色用户可能未开通分销账户:此时门店直推/间推会“找到了人但入不了账”,收益与明细都不会写入。 + // 这里补偿创建账户后再尝试入账一次。 + ShopDealerUser existed = shopDealerUserService.getOne( + new LambdaQueryWrapper() + .eq(ShopDealerUser::getTenantId, TENANT_ID) + .eq(ShopDealerUser::getUserId, dealerUserId) + .last("limit 1") + ); + if (existed == null) { + ShopDealerUser newDealerUser = new ShopDealerUser(); + newDealerUser.setTenantId(TENANT_ID); + newDealerUser.setUserId(dealerUserId); + newDealerUser.setType(0); + newDealerUser.setIsDelete(0); + newDealerUser.setSortNumber(0); + newDealerUser.setFirstNum(0); + newDealerUser.setSecondNum(0); + newDealerUser.setThirdNum(0); + newDealerUser.setMoney(BigDecimal.ZERO); + newDealerUser.setFreezeMoney(BigDecimal.ZERO); + newDealerUser.setTotalMoney(BigDecimal.ZERO); + // 尽量补齐基础信息,避免表字段 NOT NULL 导致插入失败(插入失败会让门店分佣“找到了人但入不了账”)。 + try { + User sysUser = userMapper.selectByIdIgnoreTenant(dealerUserId); + if (sysUser != null) { + newDealerUser.setRealName(sysUser.getRealName() != null ? sysUser.getRealName() : sysUser.getNickname()); + newDealerUser.setMobile(sysUser.getPhone()); + } + } catch (Exception e) { + // 拉取基础信息失败不应阻断结算;后续 update 若失败会有 warn 日志。 + log.warn("创建分销商账户时读取sys_user失败 - tenantId={}, dealerUserId={}", TENANT_ID, dealerUserId, e); + } + newDealerUser.setCreateTime(java.time.LocalDateTime.now()); + newDealerUser.setUpdateTime(java.time.LocalDateTime.now()); + try { + shopDealerUserService.save(newDealerUser); + } catch (Exception e) { + // 并发下可能已被其他线程/实例创建;也可能是字段约束导致插入失败。 + // 继续重试 update,若仍失败会输出 warn,便于定位原因。 + log.warn("创建分销商账户失败 - tenantId={}, dealerUserId={}, orderNo={}", TENANT_ID, dealerUserId, order.getOrderNo(), e); + } + } + + updated = shopDealerUserService.update( + new LambdaUpdateWrapper() + .eq(ShopDealerUser::getTenantId, TENANT_ID) + .eq(ShopDealerUser::getUserId, dealerUserId) + .setSql("freeze_money = IFNULL(freeze_money,0) + " + money.toPlainString()) + .setSql("total_money = IFNULL(total_money,0) + " + money.toPlainString()) + ); + if (!updated) { + log.warn("发放佣金失败:未找到/创建分销商账户 - tenantId={}, dealerUserId={}, orderNo={}", TENANT_ID, dealerUserId, order.getOrderNo()); + return; + } + } + + ShopDealerCapital cap = new ShopDealerCapital(); + cap.setUserId(dealerUserId); + cap.setOrderNo(order.getOrderNo()); + cap.setFlowType(10); + cap.setMoney(money); + cap.setComments(comments); + cap.setToUserId(toUserId); + cap.setMonth(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"))); + cap.setTenantId(TENANT_ID); + shopDealerCapitalService.save(cap); + } + + private void createDealerOrderRecord( + ShopOrder order, + BigDecimal baseAmount, + DealerRefereeCommission dealerRefereeCommission, + ShopRoleCommission shopRoleCommission, + TotalDealerCommission totalDealerCommission + ) { + // 幂等:同一订单只写一条(依赖 order_no + tenant_id 作为业务唯一) + ShopDealerOrder existed = shopDealerOrderService.getOne( + new LambdaQueryWrapper() + .eq(ShopDealerOrder::getTenantId, TENANT_ID) + .eq(ShopDealerOrder::getOrderNo, order.getOrderNo()) + .last("limit 1") + ); + if (existed != null) { + // 允许“补发”门店分佣时回填分红字段,避免订单已结算但分红字段一直为空,影响排查/对账。 + LambdaUpdateWrapper uw = new LambdaUpdateWrapper() + .eq(ShopDealerOrder::getTenantId, TENANT_ID) + .eq(ShopDealerOrder::getOrderNo, order.getOrderNo()); + boolean needUpdate = false; + if (shopRoleCommission.storeDirectUserId != null) { + Integer existedUser = existed.getFirstDividendUser(); + boolean needSetUser = existedUser == null; + boolean needSetMoney = existed.getFirstDividend() == null || existed.getFirstDividend().signum() == 0; + if (needSetUser) { + uw.set(ShopDealerOrder::getFirstDividendUser, shopRoleCommission.storeDirectUserId); + needUpdate = true; + } + boolean sameUser = existedUser == null || Objects.equals(existedUser, shopRoleCommission.storeDirectUserId); + if (sameUser && needSetMoney && shopRoleCommission.storeDirectMoney != null && shopRoleCommission.storeDirectMoney.signum() > 0) { + uw.set(ShopDealerOrder::getFirstDividend, shopRoleCommission.storeDirectMoney); + needUpdate = true; + } + } + if (shopRoleCommission.storeSimpleUserId != null) { + Integer existedUser = existed.getSecondDividendUser(); + boolean needSetUser = existedUser == null; + boolean needSetMoney = existed.getSecondDividend() == null || existed.getSecondDividend().signum() == 0; + if (needSetUser) { + uw.set(ShopDealerOrder::getSecondDividendUser, shopRoleCommission.storeSimpleUserId); + needUpdate = true; + } + boolean sameUser = existedUser == null || Objects.equals(existedUser, shopRoleCommission.storeSimpleUserId); + if (sameUser && needSetMoney && shopRoleCommission.storeSimpleMoney != null && shopRoleCommission.storeSimpleMoney.signum() > 0) { + uw.set(ShopDealerOrder::getSecondDividend, shopRoleCommission.storeSimpleMoney); + needUpdate = true; + } + } + if (needUpdate) { + shopDealerOrderService.update(uw); + log.info("ShopDealerOrder已存在,回填门店分红字段 - orderNo={}, firstDividendUser={}, secondDividendUser={}", + order.getOrderNo(), shopRoleCommission.storeDirectUserId, shopRoleCommission.storeSimpleUserId); + } else { + log.info("ShopDealerOrder已存在,跳过写入 - orderNo={}", order.getOrderNo()); + } + return; + } + + ShopDealerOrder dealerOrder = new ShopDealerOrder(); + dealerOrder.setUserId(order.getUserId()); // 买家用户ID + dealerOrder.setOrderNo(order.getOrderNo()); + dealerOrder.setOrderPrice(baseAmount); + dealerOrder.setPayPrice(baseAmount); + + dealerOrder.setFirstUserId(dealerRefereeCommission.directDealerId); + dealerOrder.setFirstMoney(dealerRefereeCommission.directMoney); + dealerOrder.setSecondUserId(dealerRefereeCommission.simpleDealerId); + dealerOrder.setSecondMoney(dealerRefereeCommission.simpleMoney); + dealerOrder.setThirdUserId(dealerRefereeCommission.thirdDealerId); + dealerOrder.setThirdMoney(dealerRefereeCommission.thirdMoney); + + // 门店(角色shop)两级分红单独落字段(详细以 ShopDealerCapital 为准) + dealerOrder.setFirstDividendUser(shopRoleCommission.storeDirectUserId); + dealerOrder.setFirstDividend(shopRoleCommission.storeDirectMoney); + dealerOrder.setSecondDividendUser(shopRoleCommission.storeSimpleUserId); + dealerOrder.setSecondDividend(shopRoleCommission.storeSimpleMoney); + + dealerOrder.setIsSettled(1); + dealerOrder.setSettleTime(java.time.LocalDateTime.now()); + // ShopDealerCapital 关联查询会拿 shop_dealer_order.month(覆盖 a.month),这里需要同步填充。 + dealerOrder.setMonth(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"))); + dealerOrder.setTenantId(TENANT_ID); + + dealerOrder.setComments(buildCommissionTraceComment(dealerRefereeCommission, shopRoleCommission, totalDealerCommission)); + + shopDealerOrderService.save(dealerOrder); + log.info("写入ShopDealerOrder完成 - orderNo={}, firstUserId={}, secondUserId={}, firstDividendUser={}, secondDividendUser={}", + order.getOrderNo(), dealerOrder.getFirstUserId(), dealerOrder.getSecondUserId(), dealerOrder.getFirstDividendUser(), dealerOrder.getSecondDividendUser()); + } + + private String buildCommissionTraceComment( + DealerRefereeCommission dealerRefereeCommission, + ShopRoleCommission shopRoleCommission, + TotalDealerCommission totalDealerCommission + ) { + // 轻量“过程”留痕,方便排查;详细分佣以 ShopDealerCapital 为准。 + return "direct=" + dealerRefereeCommission.directDealerId + ":" + dealerRefereeCommission.directMoney + + ",simple=" + dealerRefereeCommission.simpleDealerId + ":" + dealerRefereeCommission.simpleMoney + + ",third=" + dealerRefereeCommission.thirdDealerId + ":" + dealerRefereeCommission.thirdMoney + + ",dividend1=" + shopRoleCommission.storeDirectUserId + ":" + shopRoleCommission.storeDirectMoney + + ",dividend2=" + shopRoleCommission.storeSimpleUserId + ":" + shopRoleCommission.storeSimpleMoney + + ",totalDealer=" + totalDealerCommission.userId + ":" + totalDealerCommission.money; + } + + private BigDecimal getOrderBaseAmount(ShopOrder order) { + if (order == null) { + return null; + } + return order.getPayPrice(); + } + + private BigDecimal calcMoneyByCommissionType(BigDecimal baseAmount, BigDecimal value, int goodsQty, int scale, Integer commissionType) { + if (value == null || value.signum() <= 0) { + return BigDecimal.ZERO; + } + int qty = Math.max(1, goodsQty); + + // 10: 固定金额(按件);20: 百分比(按订单金额) + if (commissionType != null && commissionType == 10) { + return value.multiply(BigDecimal.valueOf(qty)).setScale(scale, RoundingMode.HALF_UP); + } + return baseAmount != null ? baseAmount.multiply(value).setScale(scale, RoundingMode.HALF_UP) : BigDecimal.ZERO; + } + + private String buildCommissionComment(String label, Integer commissionType, BigDecimal value, int goodsQty) { + if (commissionType != null && commissionType == 10) { + return label + "(type=amount,amount=" + value + ",qty=" + Math.max(1, goodsQty) + ")"; + } + return label + "(type=rate,rate=" + value + ")"; + } + + private OrderGoodsInfo findOrderSingleGoodsInfo(ShopOrder order) { + if (order == null) { + return new OrderGoodsInfo(null, 1); + } + + Integer goodsId = order.getFormId(); + Integer totalNum = order.getTotalNum(); + + if (goodsId == null) { + ShopOrderGoods orderGoods = shopOrderGoodsService.getOne( + new LambdaQueryWrapper() + .eq(ShopOrderGoods::getTenantId, TENANT_ID) + .eq(ShopOrderGoods::getOrderId, order.getOrderId()) + .orderByDesc(ShopOrderGoods::getId) + .last("limit 1") + ); + goodsId = orderGoods != null ? orderGoods.getGoodsId() : null; + if (totalNum == null && orderGoods != null) { + totalNum = orderGoods.getTotalNum(); + } + } + + int qty = totalNum != null && totalNum > 0 ? totalNum : 1; + if (goodsId == null) { + return new OrderGoodsInfo(null, qty); + } + + ShopGoods goods = shopGoodsService.getOne( + new LambdaQueryWrapper() + .eq(ShopGoods::getTenantId, TENANT_ID) + .eq(ShopGoods::getGoodsId, goodsId) + .last("limit 1") + ); + return new OrderGoodsInfo(goods, qty); + } + + private CommissionConfig resolveCommissionConfig(ShopGoods goods) { + // commissionType:10固定金额;20百分比(默认/兼容历史) + Integer commissionType = goods != null && goods.getCommissionType() != null ? goods.getCommissionType() : 20; + if (commissionType != 10 && commissionType != 20) { + commissionType = 20; + } + + if (goods == null) { + // 无商品信息:回退旧逻辑(按比率) + return CommissionConfig.defaultRate(); + } + + if (commissionType == 10) { + // 固定金额模式:字段值>0按金额结算(按件),未配置则视为0。 + return new CommissionConfig( + commissionType, + safePositive(goods.getFirstMoney()), + safePositive(goods.getSecondMoney()), + safePositive(goods.getThirdMoney()), + safePositive(goods.getFirstDividend()), + safePositive(goods.getSecondDividend()) + ); + } + + // 比率模式:默认用旧规则;商品字段值>0则覆盖默认比率。 + BigDecimal dealerDirectValue = RATE_0_10; + BigDecimal dealerSimpleValue = RATE_0_05; + BigDecimal dealerThirdValue = BigDecimal.ZERO; + BigDecimal storeDirectValue = RATE_0_02; + BigDecimal storeSimpleValue = RATE_0_01; + + if (safePositive(goods.getFirstMoney()).signum() > 0) { + dealerDirectValue = goods.getFirstMoney(); + } + if (safePositive(goods.getSecondMoney()).signum() > 0) { + dealerSimpleValue = goods.getSecondMoney(); + } + if (safePositive(goods.getThirdMoney()).signum() > 0) { + dealerThirdValue = goods.getThirdMoney(); + } + if (safePositive(goods.getFirstDividend()).signum() > 0) { + storeDirectValue = goods.getFirstDividend(); + } + if (safePositive(goods.getSecondDividend()).signum() > 0) { + storeSimpleValue = goods.getSecondDividend(); + } + + return new CommissionConfig( + commissionType, + dealerDirectValue, + dealerSimpleValue, + dealerThirdValue, + storeDirectValue, + storeSimpleValue + ); + } + + private BigDecimal safeValue(BigDecimal v) { + return v != null ? v : BigDecimal.ZERO; + } + + private BigDecimal safePositive(BigDecimal v) { + return v != null && v.signum() > 0 ? v : BigDecimal.ZERO; + } + + private static class OrderGoodsInfo { + private final ShopGoods goods; + private final int quantity; + + private OrderGoodsInfo(ShopGoods goods, int quantity) { + this.goods = goods; + this.quantity = Math.max(1, quantity); + } + } + + private static class CommissionConfig { + private final Integer commissionType; + private final BigDecimal dealerDirectValue; + private final BigDecimal dealerSimpleValue; + private final BigDecimal dealerThirdValue; + private final BigDecimal storeDirectValue; + private final BigDecimal storeSimpleValue; + + private static CommissionConfig defaultRate() { + return new CommissionConfig(20, RATE_0_10, RATE_0_05, BigDecimal.ZERO, RATE_0_02, RATE_0_01); + } + + private CommissionConfig( + Integer commissionType, + BigDecimal dealerDirectValue, + BigDecimal dealerSimpleValue, + BigDecimal dealerThirdValue, + BigDecimal storeDirectValue, + BigDecimal storeSimpleValue + ) { + this.commissionType = commissionType != null ? commissionType : 20; + this.dealerDirectValue = dealerDirectValue != null ? dealerDirectValue : BigDecimal.ZERO; + this.dealerSimpleValue = dealerSimpleValue != null ? dealerSimpleValue : BigDecimal.ZERO; + this.dealerThirdValue = dealerThirdValue != null ? dealerThirdValue : BigDecimal.ZERO; + this.storeDirectValue = storeDirectValue != null ? storeDirectValue : BigDecimal.ZERO; + this.storeSimpleValue = storeSimpleValue != null ? storeSimpleValue : BigDecimal.ZERO; + } + } + + private static class DealerRefereeCommission { + private final Integer directDealerId; + private final BigDecimal directMoney; + private final Integer simpleDealerId; + private final BigDecimal simpleMoney; + private final Integer thirdDealerId; + private final BigDecimal thirdMoney; + + private DealerRefereeCommission( + Integer directDealerId, + BigDecimal directMoney, + Integer simpleDealerId, + BigDecimal simpleMoney, + Integer thirdDealerId, + BigDecimal thirdMoney + ) { + this.directDealerId = directDealerId; + this.directMoney = directMoney != null ? directMoney : BigDecimal.ZERO; + this.simpleDealerId = simpleDealerId; + this.simpleMoney = simpleMoney != null ? simpleMoney : BigDecimal.ZERO; + this.thirdDealerId = thirdDealerId; + this.thirdMoney = thirdMoney != null ? thirdMoney : BigDecimal.ZERO; + } + } + + private static class ShopRoleCommission { + private final Integer storeDirectUserId; + private final BigDecimal storeDirectMoney; + private final Integer storeSimpleUserId; + private final BigDecimal storeSimpleMoney; + + private static ShopRoleCommission empty() { + return new ShopRoleCommission(null, BigDecimal.ZERO, null, BigDecimal.ZERO); + } + + private ShopRoleCommission(Integer storeDirectUserId, BigDecimal storeDirectMoney, Integer storeSimpleUserId, BigDecimal storeSimpleMoney) { + this.storeDirectUserId = storeDirectUserId; + this.storeDirectMoney = storeDirectMoney != null ? storeDirectMoney : BigDecimal.ZERO; + this.storeSimpleUserId = storeSimpleUserId; + this.storeSimpleMoney = storeSimpleMoney != null ? storeSimpleMoney : BigDecimal.ZERO; + } + } + + private static class TotalDealerCommission { + private final Integer userId; + private final BigDecimal money; + + private static TotalDealerCommission empty() { + return new TotalDealerCommission(null, BigDecimal.ZERO); + } + + private TotalDealerCommission(Integer userId, BigDecimal money) { + this.userId = userId; + this.money = money != null ? money : BigDecimal.ZERO; + } + } +} diff --git a/src/main/java/com/gxwebsoft/glt/task/GltTicketIssue10584Task.java b/src/main/java/com/gxwebsoft/glt/task/GltTicketIssue10584Task.java new file mode 100644 index 0000000..8dd9f28 --- /dev/null +++ b/src/main/java/com/gxwebsoft/glt/task/GltTicketIssue10584Task.java @@ -0,0 +1,66 @@ +package com.gxwebsoft.glt.task; + +import com.gxwebsoft.common.core.annotation.IgnoreTenant; +import com.gxwebsoft.glt.entity.GltTicketTemplate; +import com.gxwebsoft.glt.service.GltTicketIssueService; +import com.gxwebsoft.glt.service.GltTicketTemplateService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; + +/** + * GLT 套票发放任务: + * - 每30秒扫描一次今日订单(tenantId=10584, formId in 套票模板 goodsId, payStatus=1, orderStatus=0) + * - 为订单生成用户套票账户 + 释放计划(幂等) + * - 若模板配置了 startSendQty,则发放时自动核销对应数量(用于“第一次送水”场景) + */ +@Slf4j +@Component +@RequiredArgsConstructor +@ConditionalOnProperty(prefix = "glt.ticket.issue10584", name = "enabled", havingValue = "true", matchIfMissing = true) +public class GltTicketIssue10584Task { + + private static final int TENANT_ID = 10584; + + private final GltTicketIssueService gltTicketIssueService; + private final GltTicketTemplateService gltTicketTemplateService; + + private final AtomicBoolean running = new AtomicBoolean(false); + + @Scheduled(cron = "${glt.ticket.issue10584.cron:0/15 * * * * ?}") + @IgnoreTenant("定时任务无登录态,需忽略租户隔离;内部使用 tenantId=10584 精确过滤") + public void run() { + if (!running.compareAndSet(false, true)) { + log.warn("套票发放任务仍在执行中,本轮跳过 - tenantId={}", TENANT_ID); + return; + } + + try { + List goodsIds = gltTicketTemplateService.list( + new LambdaQueryWrapper() + .eq(GltTicketTemplate::getTenantId, TENANT_ID) + .eq(GltTicketTemplate::getDeleted, 0) + .eq(GltTicketTemplate::getEnabled, true) + .isNotNull(GltTicketTemplate::getGoodsId) + ).stream() + .map(GltTicketTemplate::getGoodsId) + .distinct() + .toList(); + + if (goodsIds.isEmpty()) { + log.warn("套票发放任务跳过:未配置/未启用套票模板 - tenantId={}", TENANT_ID); + return; + } + + gltTicketIssueService.issueTodayOrders(TENANT_ID, goodsIds); + } finally { + running.set(false); + } + } +} diff --git a/src/main/java/com/gxwebsoft/hjm/controller/HjmBxLogController.java b/src/main/java/com/gxwebsoft/hjm/controller/HjmBxLogController.java new file mode 100644 index 0000000..8d8b8a8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/controller/HjmBxLogController.java @@ -0,0 +1,170 @@ +package com.gxwebsoft.hjm.controller; + +import cn.hutool.core.util.StrUtil; +import com.gxwebsoft.common.core.config.ConfigProperties; +import com.gxwebsoft.common.core.utils.FileServerUtil; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.FileRecord; +import com.gxwebsoft.hjm.service.HjmBxLogService; +import com.gxwebsoft.hjm.entity.HjmBxLog; +import com.gxwebsoft.hjm.param.HjmBxLogParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.io.File; +import java.util.List; + +/** + * 黄家明_报险记录控制器 + * + * @author 科技小王子 + * @since 2025-06-06 13:08:29 + */ +@Tag(name = "黄家明_报险记录管理") +@RestController +@RequestMapping("/api/hjm/hjm-bx-log") +public class HjmBxLogController extends BaseController { + @Resource + private ConfigProperties config; + @Resource + private HjmBxLogService hjmBxLogService; + + @Operation(summary = "分页查询黄家明_报险记录") + @GetMapping("/page") + public ApiResult> page(HjmBxLogParam param) { + // 使用关联查询 + return success(hjmBxLogService.pageRel(param)); + } + + @Operation(summary = "查询全部黄家明_报险记录") + @GetMapping() + public ApiResult> list(HjmBxLogParam param) { + // 使用关联查询 + return success(hjmBxLogService.listRel(param)); + } + + @Operation(summary = "根据id查询黄家明_报险记录") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(hjmBxLogService.getByIdRel(id)); + } + + @Operation(summary = "添加黄家明_报险记录") + @PostMapping() + public ApiResult save(@RequestBody HjmBxLog hjmBxLog) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + hjmBxLog.setUserId(loginUser.getUserId()); + } + if (hjmBxLogService.save(hjmBxLog)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmBxLog:update')") + @OperationLog + @Operation(summary = "修改黄家明_报险记录") + @PutMapping() + public ApiResult update(@RequestBody HjmBxLog hjmBxLog) { + if (hjmBxLogService.updateById(hjmBxLog)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmBxLog:remove')") + @OperationLog + @Operation(summary = "删除黄家明_报险记录") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (hjmBxLogService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmBxLog:save')") + @OperationLog + @Operation(summary = "批量添加黄家明_报险记录") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (hjmBxLogService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmBxLog:update')") + @OperationLog + @Operation(summary = "批量修改黄家明_报险记录") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(hjmBxLogService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmBxLog:remove')") + @OperationLog + @Operation(summary = "批量删除黄家明_报险记录") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (hjmBxLogService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "上传文件") + @PostMapping("/upload") + public ApiResult upload(@RequestParam MultipartFile file, HttpServletRequest request) { + FileRecord result = null; + try { + String dir = getUploadDir(); + File upload = FileServerUtil.upload(file, dir, config.getUploadUuidName()); + String path = upload.getAbsolutePath().replace("\\", "/").substring(dir.length() - 1); + // String requestURL = StrUtil.removeSuffix(request.getRequestURL(), "/upload"); + String requestURL = config.getFileServer() + "/api/file"; + String originalName = file.getOriginalFilename(); + result = new FileRecord(); + result.setCreateUserId(getLoginUserId()); + result.setName(StrUtil.isBlank(originalName) ? upload.getName() : originalName); + result.setLength(upload.length()); + result.setPath(path); + result.setUrl(requestURL + path); + String contentType = FileServerUtil.getContentType(upload); + result.setContentType(contentType); + if (FileServerUtil.isImage(contentType)) { + result.setThumbnail(requestURL + "/thumbnail" + path); + } + result.setUrl(path); + System.out.println("result = " + result); + return success(result); + } catch (Exception e) { + e.printStackTrace(); + return fail("上传失败", result).setError(e.toString()); + } + } + + /** + * 文件上传位置(服务器) + */ + private String getUploadDir() { + return config.getUploadPath(); + } + +} diff --git a/src/main/java/com/gxwebsoft/hjm/controller/HjmCarController.java b/src/main/java/com/gxwebsoft/hjm/controller/HjmCarController.java new file mode 100644 index 0000000..eb9838a --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/controller/HjmCarController.java @@ -0,0 +1,416 @@ +package com.gxwebsoft.hjm.controller; + +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSONObject; + +import java.util.ArrayList; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.DictData; +import com.gxwebsoft.common.system.param.DictDataParam; +import com.gxwebsoft.common.system.service.DictDataService; +import com.gxwebsoft.hjm.service.HjmCarService; +import com.gxwebsoft.hjm.entity.HjmCar; +import com.gxwebsoft.hjm.param.HjmCarParam; +import com.gxwebsoft.hjm.param.HjmCarImportParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.hjm.service.GpsDiagnosticService; +import com.gxwebsoft.hjm.service.HjmFenceService; +import com.gxwebsoft.hjm.service.HjmGpsLogService; +import com.gxwebsoft.hjm.service.MqttService; +import com.gxwebsoft.hjm.service.impl.HjmCarServiceImpl; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.apache.poi.ss.usermodel.Workbook; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + + +/** + * 黄家明_车辆管理控制器 + * + * @author 科技小王子 + * @since 2025-04-14 16:43:26 + */ +@Tag(name = "黄家明_车辆管理管理") +@RestController +@RequestMapping("/api/hjm/hjm-car") +public class HjmCarController extends BaseController { + private static final Logger logger = LoggerFactory.getLogger(PushCallback.class); + @Resource + private HjmCarService hjmCarService; + @Resource + private HjmFenceService hjmFenceService; + @Resource + private DictDataService dictDataService; + @Resource + private HjmGpsLogService hjmGpsLogService; + @Resource + private HjmCarServiceImpl hjmCarServiceImpl; + @Resource + private MqttService mqttService; + @Resource + private GpsDiagnosticService gpsDiagnosticService; + + @Operation(summary = "分页查询黄家明_车辆管理") + @GetMapping("/page") + public ApiResult> page(HjmCarParam param) { + return success(hjmCarService.pageRel(param)); + } + + @Operation(summary = "查询全部黄家明_车辆管理") + @GetMapping() + public ApiResult> list(HjmCarParam param) { + // 使用关联查询 + return success(hjmCarService.listRel(param)); + } + + @Operation(summary = "根据id查询黄家明_车辆管理") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(hjmCarService.getByIdRel(id)); + } + + @Operation(summary = "根据code查询车辆") + @GetMapping("/getByCode/{code}") + public ApiResult getByCode(@PathVariable("code") String code) { + return success(hjmCarService.getByCode(code)); + } + + @PreAuthorize("hasAuthority('hjm:hjmCar:save')") + @OperationLog + @Operation(summary = "添加黄家明_车辆管理") + @PostMapping() + public ApiResult save(@RequestBody HjmCar hjmCar) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + hjmCar.setUserId(loginUser.getUserId()); + } + if (hjmCarService.save(hjmCar)) { + // 重新生成编号 + hjmCar.setCode(hjmCar.getCode().concat(hjmCar.getId().toString())); + hjmCarService.updateById(hjmCar); + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改黄家明_车辆管理") + @PutMapping() + public ApiResult update(@RequestBody HjmCar hjmCar) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + // 判断GPS设备是否被绑定 + final HjmCar byGpsNo = hjmCarService.getByGpsNo(hjmCar.getGpsNo()); + if(byGpsNo != null && byGpsNo.getInstallerId().equals(1)){ + return fail("该GPS设备已被绑定"); + } + hjmCar.setDriverName(loginUser.getRealName()); + hjmCar.setUserId(loginUser.getUserId()); + hjmCar.setCode(null); + if (hjmCarService.updateById(hjmCar)) { + return success("绑定成功"); + } + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmCar:remove')") + @OperationLog + @Operation(summary = "删除黄家明_车辆管理") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + // 硬删除(物理删除),不走 @TableLogic 逻辑删除 + if (hjmCarService.hardRemoveById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmCar:save')") + @OperationLog + @Operation(summary = "批量添加黄家明_车辆管理") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (hjmCarService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmCar:update')") + @OperationLog + @Operation(summary = "批量修改黄家明_车辆管理") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(hjmCarService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmCar:remove')") + @OperationLog + @Operation(summary = "批量删除黄家明_车辆管理") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + // 硬删除(物理删除),不走 @TableLogic 逻辑删除 + if (hjmCarService.hardRemoveByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + + /** + * excel批量导入车辆 + * Excel表头格式:车辆名称、车辆图片、类型、管理负责人、车辆编号、司机ID、保险状态、GPS设备编号、电子围栏ID、电子围栏名称、位置、纬度、经度、区域、地址、组织ID、父级组织ID、微信小程序码、用户ID、排序、备注、状态 + */ + @PreAuthorize("hasAuthority('hjm:hjmCar:save')") + @Transactional(rollbackFor = {Exception.class}) + @Operation(summary = "批量导入车辆") + @PostMapping("/import") + public ApiResult> importBatch(MultipartFile file) { + ImportParams importParams = new ImportParams(); + List errorMessages = new ArrayList<>(); + int successCount = 0; + + try { + List list = ExcelImportUtil.importExcel(file.getInputStream(), HjmCarImportParam.class, importParams); + + // 获取当前登录用户 + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + + for (int i = 0; i < list.size(); i++) { + HjmCarImportParam param = list.get(i); + try { + // 手动转换对象,避免JSON序列化问题 + HjmCar item = convertImportParamToEntity(param); + + // 设置必填字段的默认值 + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getStatus() == null) { + item.setStatus(0); // 默认状态为正常 + } + if (item.getDeleted() == null) { + item.setDeleted(0); // 默认未删除 + } + if (item.getType() == null) { + item.setType(0); // 默认类型为汽车 + } + + // 验证必填字段 + if (item.getCode() == null) { + errorMessages.add("第" + (i + 1) + "行:车辆编号不能为空"); + continue; + } + // 保存数据 + if (hjmCarService.save(item)) { + successCount++; + } else { + errorMessages.add("第" + (i + 1) + "行:保存失败"); + } + + } catch (Exception e) { + errorMessages.add("第" + (i + 1) + "行:" + e.getMessage()); + System.err.println("导入第" + (i + 1) + "行数据失败: " + e.getMessage()); + e.printStackTrace(); + } + } + + // 返回结果 + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + + } catch (Exception e) { + System.err.println("批量导入车辆失败: " + e.getMessage()); + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载车辆导入模板 + */ + @Operation(summary = "下载车辆导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + // 创建空的导入参数列表作为模板 + List templateList = new ArrayList<>(); + + // 添加一行示例数据 + HjmCarImportParam example = new HjmCarImportParam(); + example.setName("示例车辆"); + example.setType(0); + example.setKuaidiAdmin("管理员"); + example.setCode("CAR"); + example.setInsuranceStatus("正常"); + example.setGpsNo("GPS001"); + example.setDistrict("示例区域"); + example.setStatus(0); + example.setComments("这是示例数据,请删除后填入真实数据"); + templateList.add(example); + + // 设置导出参数 + ExportParams exportParams = new ExportParams("车辆导入模板", "车辆信息"); + + // 生成Excel + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, HjmCarImportParam.class, templateList); + + // 设置响应头 + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=car_import_template.xlsx"); + + // 输出到响应流 + workbook.write(response.getOutputStream()); + workbook.close(); + } + + /** + * 将HjmCarImportParam转换为HjmCar实体 + */ + private HjmCar convertImportParamToEntity(HjmCarImportParam param) { + HjmCar entity = new HjmCar(); + + // 基本字段转换 + entity.setName(param.getName()); + entity.setImage(param.getImage()); + entity.setType(param.getType()); + entity.setKuaidiAdmin(param.getKuaidiAdmin()); + entity.setCode(param.getCode()); + entity.setDriverId(param.getDriverId()); + entity.setInsuranceStatus(param.getInsuranceStatus()); + entity.setGpsNo(param.getGpsNo()); + entity.setFenceId(param.getFenceId()); + entity.setFenceName(param.getFenceName()); + entity.setLocation(param.getLocation()); + entity.setLatitude(param.getLatitude()); + entity.setLongitude(param.getLongitude()); + entity.setDistrict(param.getDistrict()); + entity.setAddress(param.getAddress()); + entity.setOrganizationId(param.getOrganizationId()); + entity.setOrganizationParentId(param.getOrganizationParentId()); + entity.setMpCode(param.getMpCode()); + entity.setUserId(param.getUserId()); + entity.setSortNumber(param.getSortNumber()); + entity.setComments(param.getComments()); + entity.setStatus(param.getStatus()); + + return entity; + } + + @Operation(summary = "根据坐标解析地址(腾讯地图)") + @GetMapping("/pageByQQMap") + public ApiResult> pageByQQMap(HjmCarParam param) { + // 检查必要的坐标参数 + if (param.getLatitude() == null || param.getLatitude().isEmpty() || + param.getLongitude() == null || param.getLongitude().isEmpty()) { + // 如果坐标为空,直接返回分页结果 + param.setLimit(100L); + return success(hjmCarService.pageRel(param)); + } + + final DictDataParam dictDataParam = new DictDataParam(); + dictDataParam.setDictCode("QQMapKey"); +// final List dictDataList = dictDataService.listRel(dictDataParam); +// if (!CollectionUtils.isEmpty(dictDataList)) { +// final DictData dictData = dictDataList.get(0); + final String API_KEY = "RDABZ-IF7AB-L4AUO-JHMX3-GBSGE-KIF53"; + String url = "https://apis.map.qq.com/ws/geocoder/v1/?location=".concat(param.getLatitude()).concat(",").concat(param.getLongitude()).concat("&key=").concat(API_KEY); + final String string = HttpUtil.get(url); + if (string.contains("\"result\":")) { + JSONObject jsonObject = JSONObject.parseObject(string); + JSONObject result = jsonObject.getJSONObject("result"); + JSONObject address_component = result.getJSONObject("address_component"); + String district = address_component.getString("district"); + System.out.println("district = " + district); + param.setDistrict(district); + return success(hjmCarService.pageRel(param)); + } +// } + param.setLimit(100L); + return success(hjmCarService.pageRel(param)); + } + + @Operation(summary = "获取MQTT连接状态") + @GetMapping("/mqtt/status") + public ApiResult getMqttStatus() { + boolean connected = mqttService.isConnected(); + String clientInfo = mqttService.getClientInfo(); + return success("MQTT状态查询成功", Map.of( + "connected", connected, + "clientInfo", clientInfo, + "status", connected ? "已连接" : "未连接" + )); + } + + @Operation(summary = "重新连接MQTT") + @PostMapping("/mqtt/reconnect") + public ApiResult reconnectMqtt() { + try { + mqttService.reconnect(); + return success("MQTT重连请求已发送"); + } catch (Exception e) { + logger.error("MQTT重连失败", e); + return fail("MQTT重连失败: " + e.getMessage()); + } + } + + @Operation(summary = "GPS数据诊断") + @GetMapping("/gps/diagnose") + public ApiResult diagnoseGpsData() { + try { + Map report = gpsDiagnosticService.diagnoseGpsDataIssues(); + return success("GPS数据诊断完成", report); + } catch (Exception e) { + logger.error("GPS数据诊断失败", e); + return fail("GPS数据诊断失败: " + e.getMessage()); + } + } + + @Operation(summary = "检查特定GPS设备") + @GetMapping("/gps/check/{gpsNo}") + public ApiResult checkSpecificGpsDevice(@PathVariable String gpsNo) { + try { + Map deviceInfo = gpsDiagnosticService.checkSpecificGpsDevice(gpsNo); + return success("GPS设备检查完成", deviceInfo); + } catch (Exception e) { + logger.error("检查GPS设备失败: {}", gpsNo, e); + return fail("检查GPS设备失败: " + e.getMessage()); + } + } + + + + +} diff --git a/src/main/java/com/gxwebsoft/hjm/controller/HjmChoicesController.java b/src/main/java/com/gxwebsoft/hjm/controller/HjmChoicesController.java new file mode 100644 index 0000000..eef4ee8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/controller/HjmChoicesController.java @@ -0,0 +1,122 @@ +package com.gxwebsoft.hjm.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.hjm.service.HjmChoicesService; +import com.gxwebsoft.hjm.entity.HjmChoices; +import com.gxwebsoft.hjm.param.HjmChoicesParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 黄家明_选择题选项控制器 + * + * @author 科技小王子 + * @since 2025-06-02 12:59:49 + */ +@Tag(name = "黄家明_选择题选项管理") +@RestController +@RequestMapping("/api/hjm/hjm-choices") +public class HjmChoicesController extends BaseController { + @Resource + private HjmChoicesService hjmChoicesService; + + @Operation(summary = "分页查询黄家明_选择题选项") + @GetMapping("/page") + public ApiResult> page(HjmChoicesParam param) { + // 使用关联查询 + return success(hjmChoicesService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('hjm:hjmChoices:list')") + @Operation(summary = "查询全部黄家明_选择题选项") + @GetMapping() + public ApiResult> list(HjmChoicesParam param) { + // 使用关联查询 + return success(hjmChoicesService.listRel(param)); + } + + @Operation(summary = "根据id查询黄家明_选择题选项") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(hjmChoicesService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('hjm:hjmChoices:save')") + @OperationLog + @Operation(summary = "添加黄家明_选择题选项") + @PostMapping() + public ApiResult save(@RequestBody HjmChoices hjmChoices) { + if (hjmChoicesService.save(hjmChoices)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmChoices:update')") + @OperationLog + @Operation(summary = "修改黄家明_选择题选项") + @PutMapping() + public ApiResult update(@RequestBody HjmChoices hjmChoices) { + if (hjmChoicesService.updateById(hjmChoices)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmChoices:remove')") + @OperationLog + @Operation(summary = "删除黄家明_选择题选项") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (hjmChoicesService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmChoices:save')") + @OperationLog + @Operation(summary = "批量添加黄家明_选择题选项") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (hjmChoicesService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmChoices:update')") + @OperationLog + @Operation(summary = "批量修改黄家明_选择题选项") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(hjmChoicesService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmChoices:remove')") + @OperationLog + @Operation(summary = "批量删除黄家明_选择题选项") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (hjmChoicesService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/hjm/controller/HjmCoursesController.java b/src/main/java/com/gxwebsoft/hjm/controller/HjmCoursesController.java new file mode 100644 index 0000000..d3f3beb --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/controller/HjmCoursesController.java @@ -0,0 +1,127 @@ +package com.gxwebsoft.hjm.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.hjm.service.HjmCoursesService; +import com.gxwebsoft.hjm.entity.HjmCourses; +import com.gxwebsoft.hjm.param.HjmCoursesParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 黄家明_课程控制器 + * + * @author 科技小王子 + * @since 2025-06-02 12:59:49 + */ +@Tag(name = "黄家明_课程管理") +@RestController +@RequestMapping("/api/hjm/hjm-courses") +public class HjmCoursesController extends BaseController { + @Resource + private HjmCoursesService hjmCoursesService; + + @Operation(summary = "分页查询黄家明_课程") + @GetMapping("/page") + public ApiResult> page(HjmCoursesParam param) { + // 使用关联查询 + return success(hjmCoursesService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('hjm:hjmCourses:list')") + @Operation(summary = "查询全部黄家明_课程") + @GetMapping() + public ApiResult> list(HjmCoursesParam param) { + // 使用关联查询 + return success(hjmCoursesService.listRel(param)); + } + + @Operation(summary = "根据id查询黄家明_课程") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(hjmCoursesService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('hjm:hjmCourses:save')") + @OperationLog + @Operation(summary = "添加黄家明_课程") + @PostMapping() + public ApiResult save(@RequestBody HjmCourses hjmCourses) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + hjmCourses.setUserId(loginUser.getUserId()); + } + if (hjmCoursesService.save(hjmCourses)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmCourses:update')") + @OperationLog + @Operation(summary = "修改黄家明_课程") + @PutMapping() + public ApiResult update(@RequestBody HjmCourses hjmCourses) { + if (hjmCoursesService.updateById(hjmCourses)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmCourses:remove')") + @OperationLog + @Operation(summary = "删除黄家明_课程") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (hjmCoursesService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmCourses:save')") + @OperationLog + @Operation(summary = "批量添加黄家明_课程") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (hjmCoursesService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmCourses:update')") + @OperationLog + @Operation(summary = "批量修改黄家明_课程") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(hjmCoursesService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmCourses:remove')") + @OperationLog + @Operation(summary = "批量删除黄家明_课程") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (hjmCoursesService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/hjm/controller/HjmExamLogController.java b/src/main/java/com/gxwebsoft/hjm/controller/HjmExamLogController.java new file mode 100644 index 0000000..7202eec --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/controller/HjmExamLogController.java @@ -0,0 +1,162 @@ +package com.gxwebsoft.hjm.controller; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.hjm.service.HjmExamLogService; +import com.gxwebsoft.hjm.entity.HjmExamLog; +import com.gxwebsoft.hjm.param.HjmExamLogParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 黄家明_学习记录控制器 + * + * @author 科技小王子 + * @since 2025-06-05 14:32:03 + */ +@Tag(name = "黄家明_学习记录管理") +@RestController +@RequestMapping("/api/hjm/hjm-exam-log") +public class HjmExamLogController extends BaseController { + @Resource + private HjmExamLogService hjmExamLogService; + + @Operation(summary = "分页查询黄家明_学习记录") + @GetMapping("/page") + public ApiResult> page(HjmExamLogParam param) { + // 使用关联查询 + return success(hjmExamLogService.pageRel(param)); + } + + @Operation(summary = "查询全部黄家明_学习记录") + @GetMapping() + public ApiResult> list(HjmExamLogParam param) { + // 使用关联查询 + return success(hjmExamLogService.listRel(param)); + } + + @Operation(summary = "根据id查询黄家明_学习记录") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(hjmExamLogService.getByIdRel(id)); + } + + @Operation(summary = "添加黄家明_学习记录") + @PostMapping() + public ApiResult save(@RequestBody HjmExamLog hjmExamLog) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + hjmExamLog.setUserId(loginUser.getUserId()); + } + if (hjmExamLogService.save(hjmExamLog)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmExamLog:update')") + @OperationLog + @Operation(summary = "修改黄家明_学习记录") + @PutMapping() + public ApiResult update(@RequestBody HjmExamLog hjmExamLog) { + if (hjmExamLogService.updateById(hjmExamLog)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmExamLog:remove')") + @OperationLog + @Operation(summary = "删除黄家明_学习记录") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (hjmExamLogService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmExamLog:save')") + @OperationLog + @Operation(summary = "批量添加黄家明_学习记录") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (hjmExamLogService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmExamLog:update')") + @OperationLog + @Operation(summary = "批量修改黄家明_学习记录") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(hjmExamLogService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmExamLog:remove')") + @OperationLog + @Operation(summary = "批量删除黄家明_学习记录") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (hjmExamLogService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "查询本月是否已完成学习任务") + @GetMapping("/getMyMonthExamLog") + public ApiResult> getMyMonthExamLog() { + User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("请先登录",null); + } + + // 查询当前月份的记录 + List list = hjmExamLogService.list(new LambdaQueryWrapper() + .eq(HjmExamLog::getStatus, 1) + .eq(HjmExamLog::getUserId, loginUser.getUserId()) + .ge(HjmExamLog::getCreateTime, DateUtil.beginOfMonth(DateUtil.date())) + .le(HjmExamLog::getCreateTime, DateUtil.endOfMonth(DateUtil.date()))); + + return success("查询成功", list); + } + + @Operation(summary = "检查本月是否已完成学习任务") + @GetMapping("/checkMonthTaskCompleted") + public ApiResult checkMonthTaskCompleted() { + User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("请先登录",null); + } + + // 查询本月是否有完成的学习记录 + long count = hjmExamLogService.count(new LambdaQueryWrapper() + .eq(HjmExamLog::getStatus, 1) + .eq(HjmExamLog::getUserId, loginUser.getUserId()) + .ge(HjmExamLog::getCreateTime, DateUtil.beginOfMonth(DateUtil.date())) + .le(HjmExamLog::getCreateTime, DateUtil.endOfMonth(DateUtil.date()))); + + boolean isCompleted = count > 0; + return success(isCompleted ? "本月已完成学习任务" : "本月尚未完成学习任务", isCompleted); + } + +} diff --git a/src/main/java/com/gxwebsoft/hjm/controller/HjmFenceController.java b/src/main/java/com/gxwebsoft/hjm/controller/HjmFenceController.java new file mode 100644 index 0000000..956a7e3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/controller/HjmFenceController.java @@ -0,0 +1,121 @@ +package com.gxwebsoft.hjm.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.hjm.service.HjmFenceService; +import com.gxwebsoft.hjm.entity.HjmFence; +import com.gxwebsoft.hjm.param.HjmFenceParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 黄家明_电子围栏控制器 + * + * @author 科技小王子 + * @since 2025-06-03 02:08:03 + */ +@Tag(name = "黄家明_电子围栏管理") +@RestController +@RequestMapping("/api/hjm/hjm-fence") +public class HjmFenceController extends BaseController { + @Resource + private HjmFenceService hjmFenceService; + + @Operation(summary = "分页查询黄家明_电子围栏") + @GetMapping("/page") + public ApiResult> page(HjmFenceParam param) { + // 使用关联查询 + return success(hjmFenceService.pageRel(param)); + } + + @Operation(summary = "查询全部黄家明_电子围栏") + @GetMapping() + public ApiResult> list(HjmFenceParam param) { + // 使用关联查询 + return success(hjmFenceService.listRel(param)); + } + + @Operation(summary = "根据id查询黄家明_电子围栏") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(hjmFenceService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('hjm:hjmFence:save')") + @OperationLog + @Operation(summary = "添加黄家明_电子围栏") + @PostMapping() + public ApiResult save(@RequestBody HjmFence hjmFence) { + if (hjmFenceService.save(hjmFence)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmFence:update')") + @OperationLog + @Operation(summary = "修改黄家明_电子围栏") + @PutMapping() + public ApiResult update(@RequestBody HjmFence hjmFence) { + if (hjmFenceService.updateById(hjmFence)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmFence:remove')") + @OperationLog + @Operation(summary = "删除黄家明_电子围栏") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (hjmFenceService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmFence:save')") + @OperationLog + @Operation(summary = "批量添加黄家明_电子围栏") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (hjmFenceService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmFence:update')") + @OperationLog + @Operation(summary = "批量修改黄家明_电子围栏") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(hjmFenceService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmFence:remove')") + @OperationLog + @Operation(summary = "批量删除黄家明_电子围栏") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (hjmFenceService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/hjm/controller/HjmGpsLogController.java b/src/main/java/com/gxwebsoft/hjm/controller/HjmGpsLogController.java new file mode 100644 index 0000000..f176e86 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/controller/HjmGpsLogController.java @@ -0,0 +1,121 @@ +package com.gxwebsoft.hjm.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.hjm.service.HjmGpsLogService; +import com.gxwebsoft.hjm.entity.HjmGpsLog; +import com.gxwebsoft.hjm.param.HjmGpsLogParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 黄家明_gps轨迹控制器 + * + * @author 科技小王子 + * @since 2025-06-11 12:03:50 + */ +@Tag(name = "黄家明_gps轨迹管理") +@RestController +@RequestMapping("/api/hjm/hjm-gps-log") +public class HjmGpsLogController extends BaseController { + @Resource + private HjmGpsLogService hjmGpsLogService; + + @Operation(summary = "分页查询黄家明_gps轨迹") + @GetMapping("/page") + public ApiResult> page(HjmGpsLogParam param) { + // 使用关联查询 + return success(hjmGpsLogService.pageRel(param)); + } + + @Operation(summary = "查询全部黄家明_gps轨迹") + @GetMapping() + public ApiResult> list(HjmGpsLogParam param) { + // 使用关联查询 + return success(hjmGpsLogService.listRel(param)); + } + + @Operation(summary = "根据id查询黄家明_gps轨迹") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(hjmGpsLogService.getByIdRel(id)); + } + + @Operation(summary = "添加黄家明_gps轨迹") + @PostMapping() + public ApiResult save(@RequestBody HjmGpsLog hjmGpsLog) { + if (hjmGpsLogService.save(hjmGpsLog)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmGpsLog:update')") + @OperationLog + @Operation(summary = "修改黄家明_gps轨迹") + @PutMapping() + public ApiResult update(@RequestBody HjmGpsLog hjmGpsLog) { + if (hjmGpsLogService.updateById(hjmGpsLog)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmGpsLog:remove')") + @OperationLog + @Operation(summary = "删除黄家明_gps轨迹") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (hjmGpsLogService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmGpsLog:save')") + @OperationLog + @Operation(summary = "批量添加黄家明_gps轨迹") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (hjmGpsLogService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmGpsLog:update')") + @OperationLog + @Operation(summary = "批量修改黄家明_gps轨迹") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(hjmGpsLogService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmGpsLog:remove')") + @OperationLog + @Operation(summary = "批量删除黄家明_gps轨迹") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (hjmGpsLogService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + // 分析车辆是否逆行 + +} diff --git a/src/main/java/com/gxwebsoft/hjm/controller/HjmQuestionsController.java b/src/main/java/com/gxwebsoft/hjm/controller/HjmQuestionsController.java new file mode 100644 index 0000000..0a55323 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/controller/HjmQuestionsController.java @@ -0,0 +1,143 @@ +package com.gxwebsoft.hjm.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.hjm.entity.HjmChoices; +import com.gxwebsoft.hjm.service.HjmChoicesService; +import com.gxwebsoft.hjm.service.HjmQuestionsService; +import com.gxwebsoft.hjm.entity.HjmQuestions; +import com.gxwebsoft.hjm.param.HjmQuestionsParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 黄家明_题目控制器 + * + * @author 科技小王子 + * @since 2025-06-02 12:59:49 + */ +@Tag(name = "黄家明_题目管理") +@RestController +@RequestMapping("/api/hjm/hjm-questions") +public class HjmQuestionsController extends BaseController { + @Resource + private HjmQuestionsService hjmQuestionsService; + @Resource + private HjmChoicesService hjmChoicesService; + + @Operation(summary = "分页查询黄家明_题目") + @GetMapping("/page") + public ApiResult> page(HjmQuestionsParam param) { + // 使用关联查询 + return success(hjmQuestionsService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('hjm:hjmQuestions:list')") + @Operation(summary = "查询全部黄家明_题目") + @GetMapping() + public ApiResult> list(HjmQuestionsParam param) { + // 使用关联查询 + return success(hjmQuestionsService.listRel(param)); + } + + @Operation(summary = "根据id查询黄家明_题目") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(hjmQuestionsService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('hjm:hjmQuestions:save')") + @OperationLog + @Operation(summary = "添加黄家明_题目") + @PostMapping() + public ApiResult save(@RequestBody HjmQuestions hjmQuestions) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + hjmQuestions.setUserId(loginUser.getUserId()); + } + if (hjmQuestionsService.save(hjmQuestions)) { + final List choicesList = hjmQuestions.getChoicesList(); + if (!CollectionUtils.isEmpty(choicesList)) { + choicesList.forEach(choice -> { + choice.setQuestionId(hjmQuestions.getId()); + }); + hjmChoicesService.saveBatch(choicesList); + } + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmQuestions:update')") + @OperationLog + @Operation(summary = "修改黄家明_题目") + @PutMapping() + public ApiResult update(@RequestBody HjmQuestions hjmQuestions) { + if (hjmQuestionsService.updateById(hjmQuestions)) { + if (!CollectionUtils.isEmpty(hjmQuestions.getChoicesList())) { + hjmChoicesService.updateBatchById(hjmQuestions.getChoicesList()); + } + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmQuestions:remove')") + @OperationLog + @Operation(summary = "删除黄家明_题目") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (hjmQuestionsService.removeById(id)) { + hjmChoicesService.remove(new LambdaQueryWrapper().eq(HjmChoices::getQuestionId, id)); + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmQuestions:save')") + @OperationLog + @Operation(summary = "批量添加黄家明_题目") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (hjmQuestionsService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmQuestions:update')") + @OperationLog + @Operation(summary = "批量修改黄家明_题目") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(hjmQuestionsService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmQuestions:remove')") + @OperationLog + @Operation(summary = "批量删除黄家明_题目") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (hjmQuestionsService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/hjm/controller/HjmViolationController.java b/src/main/java/com/gxwebsoft/hjm/controller/HjmViolationController.java new file mode 100644 index 0000000..acede29 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/controller/HjmViolationController.java @@ -0,0 +1,140 @@ +package com.gxwebsoft.hjm.controller; + +import cn.hutool.core.util.ObjUtil; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.hjm.entity.HjmCar; +import com.gxwebsoft.hjm.service.HjmCarService; +import com.gxwebsoft.hjm.service.HjmViolationService; +import com.gxwebsoft.hjm.entity.HjmViolation; +import com.gxwebsoft.hjm.param.HjmViolationParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.List; + +/** + * 黄家明_违章记录控制器 + * + * @author 科技小王子 + * @since 2025-06-20 13:48:43 + */ +@Tag(name = "黄家明_违章记录管理") +@RestController +@RequestMapping("/api/hjm/hjm-violation") +public class HjmViolationController extends BaseController { + @Resource + private HjmViolationService hjmViolationService; + @Resource + private HjmCarService hjmCarService; + + @PreAuthorize("hasAuthority('hjm:hjmViolation:list')") + @Operation(summary = "分页查询黄家明_违章记录") + @GetMapping("/page") + public ApiResult> page(HjmViolationParam param) { + // 使用关联查询 + return success(hjmViolationService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('hjm:hjmViolation:list')") + @Operation(summary = "查询全部黄家明_违章记录") + @GetMapping() + public ApiResult> list(HjmViolationParam param) { + // 使用关联查询 + return success(hjmViolationService.listRel(param)); + } + + @PreAuthorize("hasAuthority('hjm:hjmViolation:list')") + @Operation(summary = "根据id查询黄家明_违章记录") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(hjmViolationService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('hjm:hjmViolation:save')") + @OperationLog + @Operation(summary = "添加黄家明_违章记录") + @PostMapping() + public ApiResult save(@RequestBody HjmViolation hjmViolation) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + hjmViolation.setUserId(loginUser.getUserId()); + final HjmCar car = hjmCarService.getByCode(hjmViolation.getCode()); + if (ObjUtil.isEmpty(car)) { + return fail("车辆编号不存在"); + } + if (hjmViolationService.save(hjmViolation)) { + hjmViolationService.send(hjmViolation); + return success("添加成功"); + } + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmViolation:update')") + @OperationLog + @Operation(summary = "修改黄家明_违章记录") + @PutMapping() + public ApiResult update(@RequestBody HjmViolation hjmViolation) { + if (hjmViolationService.updateById(hjmViolation)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmViolation:remove')") + @OperationLog + @Operation(summary = "删除黄家明_违章记录") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (hjmViolationService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmViolation:save')") + @OperationLog + @Operation(summary = "批量添加黄家明_违章记录") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (hjmViolationService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmViolation:update')") + @OperationLog + @Operation(summary = "批量修改黄家明_违章记录") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(hjmViolationService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('hjm:hjmViolation:remove')") + @OperationLog + @Operation(summary = "批量删除黄家明_违章记录") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (hjmViolationService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/hjm/controller/MQTTClientDemo.java b/src/main/java/com/gxwebsoft/hjm/controller/MQTTClientDemo.java new file mode 100644 index 0000000..585cafd --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/controller/MQTTClientDemo.java @@ -0,0 +1,150 @@ +package com.gxwebsoft.hjm.controller; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.eclipse.paho.client.mqttv3.*; +import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; + +/** +* @Description: + * maven 依赖: + * + * org.eclipse.paho + * org.eclipse.paho.client.mqttv3 + * 1.2.1 + * + * +* @Author: lx +* @Version: 1.0.0 +* @Date: 2025/7/2 +*/ +public class MQTTClientDemo { + + private static final Log log = LogFactory.getLog(MQTTClientDemo.class); + + private MqttClient client; + + private String HOST = "TCP://127.0.0.1:1883"; + private String userName = ""; + private String passWord = ""; + private String mqttClientId=""; + private MqttCallback callback; + + + public MQTTClientDemo(MqttCallback callback, String host,String clientId,String usrname,String password) throws MqttException { + this.callback = callback; + HOST = host; + mqttClientId = clientId; + userName = usrname; + passWord = password; + + client = new MqttClient(HOST, mqttClientId, new MemoryPersistence()); + connect(); + } + + /** + * 用来连接服务器 + */ + public void connect() { + MqttConnectOptions options = new MqttConnectOptions(); + options.setCleanSession(false); + options.setUserName(userName); + options.setPassword(passWord.toCharArray()); + // 设置超时时间 + options.setConnectionTimeout(10); + // 设置会话心跳时间 + options.setKeepAliveInterval(20); + //设置自动重连 + options.setAutomaticReconnect(true); + try { + System.out.println("DC MQTT Host="+HOST); + System.out.println("DC MQTT ClientId="+mqttClientId); + System.out.println("DC MQTT userName="+userName); + System.out.println("DC MQTT passWord="+passWord); + client.setCallback(this.callback); + client.connect(options); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public MqttTopic getTopic(String topic) { + return client.getTopic(topic); + } + + public void subscribe(String topic) throws MqttException { + client.subscribe(topic); + } + + public void subscribe(String[] topics) throws MqttException { + client.subscribe(topics); + } + + //qos 0:最多一次 、1:最少一次 、2:只有一次 + public void subscribe(String topic,int qos) throws MqttException { + client.subscribe(topic,qos); + } + + public void subscribe(String[] topics,int[] qosArr) throws MqttException { + client.subscribe(topics,qosArr); + } + + /** + * + * @param topic + * @param message + * @throws MqttPersistenceException + * @throws MqttException + */ + public void publish(MqttTopic topic , MqttMessage message) throws MqttPersistenceException, + MqttException { + MqttDeliveryToken token = topic.publish(message); + /* + //原地等待发送结果 + token.waitForCompletion(); + if(token.isComplete()) { + log.info("message is published completely! "); + }else { + log.info("message is published failed! "); + } + */ + } + + public void publish(MqttTopic topic,String payload,int qos,boolean retained) throws MqttPersistenceException, MqttException { + MqttMessage msg = new MqttMessage(); + msg.setQos(qos); + msg.setRetained(retained); + msg.setPayload(payload.getBytes()); + publish(topic,msg); + } + + public boolean isConnected() { + return client.isConnected(); + } + + + public static void main(String[] args) throws MqttException { + MQTTClientDemo mqttClient = new MQTTClientDemo(new MqttCallback() { + @Override + public void connectionLost(Throwable throwable) { + log.error("connectionLost..."); + } + @Override + public void messageArrived(String topic, MqttMessage message) throws Exception { + if (topic.equals("xxxxx")){ + /*是指定topic*/ + } + log.debug("DC 接收消息主题 : " + topic); + log.debug("DC 接收消息Qos : " + message.getQos()); + log.debug("DC 接收消息内容 : " + new String(message.getPayload())); + } + @Override + public void deliveryComplete(IMqttDeliveryToken token) { + log.error("deliveryComplete..." + token.isComplete()); + } + },"HOST", "SERVER_" + System.currentTimeMillis(), "userName", "passWord"); + /*订阅一个*/ + mqttClient.subscribe("TOPIC"); +// mqttClient.subscribe(new String[] {"TOPIC"}); + } +} diff --git a/src/main/java/com/gxwebsoft/hjm/controller/PushCallback.java b/src/main/java/com/gxwebsoft/hjm/controller/PushCallback.java new file mode 100644 index 0000000..6e59c83 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/controller/PushCallback.java @@ -0,0 +1,31 @@ +package com.gxwebsoft.hjm.controller; + +import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; +import org.eclipse.paho.client.mqttv3.MqttCallback; +import org.eclipse.paho.client.mqttv3.MqttMessage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 推送消息的回调类 + */ +public class PushCallback implements MqttCallback { + private static final Logger logger = LoggerFactory.getLogger(PushCallback.class); + @Override + public void connectionLost(Throwable throwable) { + logger.info("连接丢失............."); + } + + @Override + public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception { + logger.info("接收消息主题 : " + topic); + logger.info("接收消息Qos : " + mqttMessage.getQos()); + logger.info("接收消息内容 : " + new String(mqttMessage.getPayload())); + + } + + @Override + public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) { + logger.info("deliveryComplete............."); + } +} diff --git a/src/main/java/com/gxwebsoft/hjm/controller/SendSubscriptionMessages.java b/src/main/java/com/gxwebsoft/hjm/controller/SendSubscriptionMessages.java new file mode 100644 index 0000000..7ca5d11 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/controller/SendSubscriptionMessages.java @@ -0,0 +1,136 @@ +package com.gxwebsoft.hjm.controller; + +import com.alibaba.fastjson.JSONObject; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.hjm.dto.BatchTemplateMessageRequest; +import com.gxwebsoft.hjm.dto.SubscribeMessageRequest; +import com.gxwebsoft.hjm.dto.TemplateMessageRequest; +import com.gxwebsoft.hjm.service.WxNotificationService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +/** + * 微信公众号订阅通知控制器 + * + * @author 科技小王子 + * @since 2025-06-15 + */ +@Slf4j +@Tag(name = "微信公众号订阅通知") +@RestController +@RequestMapping("/api/hjm/wx-subscription") +public class SendSubscriptionMessages extends BaseController { + + @Resource + private WxNotificationService wxNotificationService; + + /** + * 发送模板消息 + */ + @Operation(summary = "发送模板消息") + @OperationLog("发送模板消息") + @PostMapping("/send-template") + public ApiResult sendTemplateMessage(@RequestBody TemplateMessageRequest request) { + try { + User loginUser = getLoginUser(); + Integer tenantId = loginUser != null ? loginUser.getTenantId() : 0; + + // 发送模板消息 + boolean success = wxNotificationService.sendTemplateMessage(tenantId, request); + + if (success) { + return success("模板消息发送成功"); + } else { + return fail("模板消息发送失败"); + } + + } catch (Exception e) { + log.error("发送模板消息失败", e); + return fail("发送失败:" + e.getMessage()); + } + } + + + + + + /** + * 发送订阅消息(小程序订阅消息) + */ + @Operation(summary = "发送订阅消息") + @OperationLog("发送订阅消息") + @PostMapping("/send-subscribe") + public ApiResult sendSubscribeMessage(@RequestBody SubscribeMessageRequest request) { + try { + User loginUser = getLoginUser(); + Integer tenantId = loginUser != null ? loginUser.getTenantId() : 0; + + // 发送订阅消息 + boolean success = wxNotificationService.sendSubscribeMessage(tenantId, request); + + if (success) { + return success("订阅消息发送成功"); + } else { + return fail("订阅消息发送失败"); + } + + } catch (Exception e) { + log.error("发送订阅消息失败", e); + return fail("发送失败:" + e.getMessage()); + } + } + + + + /** + * 批量发送模板消息 + */ + @Operation(summary = "批量发送模板消息") + @OperationLog("批量发送模板消息") + @PostMapping("/batch-send-template") + public ApiResult batchSendTemplateMessage(@RequestBody BatchTemplateMessageRequest request) { + try { + User loginUser = getLoginUser(); + Integer tenantId = loginUser != null ? loginUser.getTenantId() : 0; + + WxNotificationService.BatchSendResult result = wxNotificationService.batchSendTemplateMessage(tenantId, request.getMessages()); + + return success("批量发送完成," + result.toString()); + + } catch (Exception e) { + log.error("批量发送模板消息失败", e); + return fail("批量发送失败:" + e.getMessage()); + } + } + + /** + * 获取模板列表 + */ + @Operation(summary = "获取模板列表") + @GetMapping("/templates") + public ApiResult getTemplateList() { + try { + User loginUser = getLoginUser(); + Integer tenantId = loginUser != null ? loginUser.getTenantId() : 0; + + String response = wxNotificationService.getTemplateList(tenantId); + if (response != null) { + JSONObject result = JSONObject.parseObject(response); + return success("获取成功", result); + } else { + return fail("获取失败"); + } + + } catch (Exception e) { + log.error("获取模板列表失败", e); + return fail("获取失败:" + e.getMessage()); + } + } +} diff --git a/src/main/java/com/gxwebsoft/hjm/controller/WxNotificationTestController.java b/src/main/java/com/gxwebsoft/hjm/controller/WxNotificationTestController.java new file mode 100644 index 0000000..1d7aac4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/controller/WxNotificationTestController.java @@ -0,0 +1,222 @@ +package com.gxwebsoft.hjm.controller; + +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.hjm.dto.SubscribeMessageRequest; +import com.gxwebsoft.hjm.dto.TemplateMessageRequest; +import com.gxwebsoft.hjm.service.WxNotificationService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.Map; + +/** + * 微信通知测试控制器 + * + * @author 科技小王子 + * @since 2025-06-15 + */ +@Slf4j +@Tag(name = "微信通知测试") +@RestController +@RequestMapping("/api/hjm/wx-notification-test") +public class WxNotificationTestController extends BaseController { + + @Resource + private WxNotificationService wxNotificationService; + + /** + * 测试发送订单确认通知 + */ + @Operation(summary = "测试发送订单确认通知") + @PostMapping("/test-order-notification") + public ApiResult testOrderNotification(@RequestParam String openId, + @RequestParam String orderNo, + @RequestParam(required = false) String templateId) { + try { + User loginUser = getLoginUser(); + Integer tenantId = loginUser != null ? loginUser.getTenantId() : 0; + + // 构建模板消息请求 + TemplateMessageRequest request = new TemplateMessageRequest(); + request.setToUser(openId); + request.setTemplateId(templateId != null ? templateId : "your_order_template_id"); + request.setUrl("https://your-domain.com/order/" + orderNo); + request.setTopColor("#173177"); + + // 构建模板数据 + Map data = new HashMap<>(); + data.put("first", new TemplateMessageRequest.TemplateDataItem("您的订单已确认", "#173177")); + data.put("keyword1", new TemplateMessageRequest.TemplateDataItem(orderNo, "#173177")); + data.put("keyword2", new TemplateMessageRequest.TemplateDataItem( + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now()), "#173177")); + data.put("remark", new TemplateMessageRequest.TemplateDataItem("感谢您的使用,如有疑问请联系客服!", "#173177")); + + request.setData(data); + + // 发送消息 + boolean success = wxNotificationService.sendTemplateMessage(tenantId, request); + + if (success) { + return success("订单确认通知发送成功"); + } else { + return fail("订单确认通知发送失败"); + } + + } catch (Exception e) { + log.error("测试发送订单确认通知失败", e); + return fail("发送失败:" + e.getMessage()); + } + } + + /** + * 测试发送支付成功通知 + */ + @Operation(summary = "测试发送支付成功通知") + @PostMapping("/test-payment-notification") + public ApiResult testPaymentNotification(@RequestParam String openId, + @RequestParam String orderNo, + @RequestParam String amount, + @RequestParam(required = false) String templateId) { + try { + User loginUser = getLoginUser(); + Integer tenantId = loginUser != null ? loginUser.getTenantId() : 0; + + TemplateMessageRequest request = new TemplateMessageRequest(); + request.setToUser(openId); + request.setTemplateId(templateId != null ? templateId : "your_payment_template_id"); + request.setUrl("https://your-domain.com/order/" + orderNo); + + Map data = new HashMap<>(); + data.put("first", new TemplateMessageRequest.TemplateDataItem("支付成功通知", "#173177")); + data.put("keyword1", new TemplateMessageRequest.TemplateDataItem(orderNo, "#173177")); + data.put("keyword2", new TemplateMessageRequest.TemplateDataItem("¥" + amount, "#FF0000")); + data.put("keyword3", new TemplateMessageRequest.TemplateDataItem( + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now()), "#173177")); + data.put("remark", new TemplateMessageRequest.TemplateDataItem("您的订单已支付成功,我们将尽快为您处理!", "#173177")); + + request.setData(data); + + boolean success = wxNotificationService.sendTemplateMessage(tenantId, request); + + if (success) { + return success("支付成功通知发送成功"); + } else { + return fail("支付成功通知发送失败"); + } + + } catch (Exception e) { + log.error("测试发送支付成功通知失败", e); + return fail("发送失败:" + e.getMessage()); + } + } + + /** + * 测试发送订阅消息 + */ + @Operation(summary = "测试发送订阅消息") + @PostMapping("/test-subscribe-notification") + public ApiResult testSubscribeNotification(@RequestParam String openId, + @RequestParam String title, + @RequestParam String content, + @RequestParam(required = false) String templateId) { + try { + User loginUser = getLoginUser(); + Integer tenantId = loginUser != null ? loginUser.getTenantId() : 0; + + SubscribeMessageRequest request = new SubscribeMessageRequest(); + request.setToUser(openId); + request.setTemplateId(templateId != null ? templateId : "your_subscribe_template_id"); + request.setPage("pages/notification/detail"); + request.setMiniprogramState("formal"); + request.setLang("zh_CN"); + + Map data = new HashMap<>(); + data.put("thing1", new SubscribeMessageRequest.SubscribeDataItem(title)); + data.put("thing2", new SubscribeMessageRequest.SubscribeDataItem(content)); + data.put("time3", new SubscribeMessageRequest.SubscribeDataItem( + new SimpleDateFormat("yyyy年MM月dd日 HH:mm").format(LocalDateTime.now()))); + + request.setData(data); + + boolean success = wxNotificationService.sendSubscribeMessage(tenantId, request); + + if (success) { + return success("订阅消息发送成功"); + } else { + return fail("订阅消息发送失败"); + } + + } catch (Exception e) { + log.error("测试发送订阅消息失败", e); + return fail("发送失败:" + e.getMessage()); + } + } + + /** + * 测试发送系统通知 + */ + @Operation(summary = "测试发送系统通知") + @PostMapping("/test-system-notification") + public ApiResult testSystemNotification(@RequestParam String openId, + @RequestParam String message, + @RequestParam(required = false) String templateId) { + try { + User loginUser = getLoginUser(); + Integer tenantId = loginUser != null ? loginUser.getTenantId() : 0; + + TemplateMessageRequest request = new TemplateMessageRequest(); + request.setToUser(openId); + request.setTemplateId(templateId != null ? templateId : "your_system_template_id"); + request.setTopColor("#173177"); + + Map data = new HashMap<>(); + data.put("first", new TemplateMessageRequest.TemplateDataItem("系统通知", "#173177")); + data.put("keyword1", new TemplateMessageRequest.TemplateDataItem("系统消息", "#173177")); + data.put("keyword2", new TemplateMessageRequest.TemplateDataItem(message, "#173177")); + data.put("keyword3", new TemplateMessageRequest.TemplateDataItem( + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now()), "#173177")); + data.put("remark", new TemplateMessageRequest.TemplateDataItem("如有疑问,请联系客服。", "#173177")); + + request.setData(data); + + boolean success = wxNotificationService.sendTemplateMessage(tenantId, request); + + if (success) { + return success("系统通知发送成功"); + } else { + return fail("系统通知发送失败"); + } + + } catch (Exception e) { + log.error("测试发送系统通知失败", e); + return fail("发送失败:" + e.getMessage()); + } + } + + /** + * 获取当前配置的模板列表 + */ + @Operation(summary = "获取当前配置的模板列表") + @GetMapping("/get-templates") + public ApiResult getTemplates() { + try { + User loginUser = getLoginUser(); + Integer tenantId = loginUser != null ? loginUser.getTenantId() : 0; + + String response = wxNotificationService.getTemplateList(tenantId); + return success("获取成功", response); + + } catch (Exception e) { + log.error("获取模板列表失败", e); + return fail("获取失败:" + e.getMessage()); + } + } +} diff --git a/src/main/java/com/gxwebsoft/hjm/dto/BatchTemplateMessageRequest.java b/src/main/java/com/gxwebsoft/hjm/dto/BatchTemplateMessageRequest.java new file mode 100644 index 0000000..dbea9fc --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/dto/BatchTemplateMessageRequest.java @@ -0,0 +1,24 @@ +package com.gxwebsoft.hjm.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +/** + * 批量发送模板消息请求 + * + * @author 科技小王子 + * @since 2025-06-15 + */ +@Data +@Schema(name = "BatchTemplateMessageRequest", description = "批量发送模板消息请求") +public class BatchTemplateMessageRequest { + + @Schema(description = "模板消息列表", required = true) + private List messages; + + @Schema(description = "发送间隔时间(毫秒),默认100ms") + private Long intervalMs = 100L; +} diff --git a/src/main/java/com/gxwebsoft/hjm/dto/SubscribeMessageRequest.java b/src/main/java/com/gxwebsoft/hjm/dto/SubscribeMessageRequest.java new file mode 100644 index 0000000..8625784 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/dto/SubscribeMessageRequest.java @@ -0,0 +1,52 @@ +package com.gxwebsoft.hjm.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.Map; + +/** + * 微信小程序订阅消息请求 + * + * @author 科技小王子 + * @since 2025-06-15 + */ +@Data +@Schema(name = "SubscribeMessageRequest", description = "微信小程序订阅消息请求") +public class SubscribeMessageRequest { + + @Schema(description = "接收者openid", required = true) + private String toUser; + + @Schema(description = "所需下发的订阅模板id", required = true) + private String templateId; + + @Schema(description = "点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数,(示例index?foo=bar)。该字段不填则模板无跳转。") + private String page; + + @Schema(description = "跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;默认为正式版") + private String miniprogramState = "formal"; + + @Schema(description = "进入小程序查看的语言类型,支持zh_CN(简体中文)、en_US(英文)、zh_HK(繁体中文)、zh_TW(繁体中文),默认为zh_CN") + private String lang = "zh_CN"; + + @Schema(description = "模板内容,格式形如 { \"key1\": { \"value\": any }, \"key2\": { \"value\": any } }", required = true) + private Map data; + + /** + * 订阅消息数据项 + */ + @Data + @Schema(name = "SubscribeDataItem", description = "订阅消息数据项") + public static class SubscribeDataItem { + @Schema(description = "数据值", required = true) + private String value; + + public SubscribeDataItem() {} + + public SubscribeDataItem(String value) { + this.value = value; + } + } +} diff --git a/src/main/java/com/gxwebsoft/hjm/dto/TemplateMessageRequest.java b/src/main/java/com/gxwebsoft/hjm/dto/TemplateMessageRequest.java new file mode 100644 index 0000000..f15f6e4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/dto/TemplateMessageRequest.java @@ -0,0 +1,73 @@ +package com.gxwebsoft.hjm.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.Map; + +/** + * 微信公众号模板消息请求 + * + * @author 科技小王子 + * @since 2025-06-15 + */ +@Data +@Schema(name = "TemplateMessageRequest", description = "微信公众号模板消息请求") +public class TemplateMessageRequest { + + @Schema(description = "接收者openid", required = true) + private String toUser; + + @Schema(description = "模板ID", required = true) + private String templateId; + + @Schema(description = "模板跳转链接(海外帐号没有跳转能力)") + private String url; + + @Schema(description = "模板内容字体颜色,不填默认为黑色") + private String topColor = "#173177"; + + @Schema(description = "模板数据", required = true) + private Map data; + + @Schema(description = "跳小程序所需数据,不需跳小程序可不用传该数据") + private MiniProgram miniprogram; + + /** + * 模板数据项 + */ + @Data + @Schema(name = "TemplateDataItem", description = "模板数据项") + public static class TemplateDataItem { + @Schema(description = "数据值", required = true) + private String value; + + @Schema(description = "数据颜色,不填默认为黑色") + private String color = "#173177"; + + public TemplateDataItem() {} + + public TemplateDataItem(String value) { + this.value = value; + } + + public TemplateDataItem(String value, String color) { + this.value = value; + this.color = color; + } + } + + /** + * 小程序跳转信息 + */ + @Data + @Schema(name = "MiniProgram", description = "小程序跳转信息") + public static class MiniProgram { + @Schema(description = "所需跳转到的小程序appid(该小程序appid必须与发模板消息的公众号是绑定关联关系,暂不支持小游戏)") + private String appid; + + @Schema(description = "所需跳转到小程序的具体页面路径,支持带参数,(示例index?foo=bar),要求该小程序已发布,暂不支持小游戏") + private String pagepath; + } +} diff --git a/src/main/java/com/gxwebsoft/hjm/entity/Gps.java b/src/main/java/com/gxwebsoft/hjm/entity/Gps.java new file mode 100644 index 0000000..6c9768f --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/entity/Gps.java @@ -0,0 +1,73 @@ +package com.gxwebsoft.hjm.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * GPS + * + * @author 科技小王子 + * @since 2025-04-14 16:43:26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "GPS对象", description = "GPS") +public class Gps implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "物联网卡的imsi号") + @TableField(exist = false) + private String imsi; + + @Schema(description = "设备ID") + private String imei; + + @Schema(description = "移动网络编码") + private String plmn; + + @Schema(description = "4G网络路由区") + private String lac; + + @Schema(description = "4G网络基站小区id") + private String ci; + + @Schema(description = "4G网络信号值") + private String rssi; + + @Schema(description = "设备当前时间戳") + private Integer time; + + @Schema(description = "设备当前时间") + private String ddmmyy; + + @Schema(description = "时分秒") + private String hhmmss; + + @Schema(description = "速度") + private String speed; + + @Schema(description = "miles") + private String miles; + + @Schema(description = "是否定位") + private Boolean fixed; + + @Schema(description = "经度") + private String lat; + + @Schema(description = "纬度") + private String lng; + + @Schema(description = "定位星数") + private String satcnt; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/entity/HjmBxLog.java b/src/main/java/com/gxwebsoft/hjm/entity/HjmBxLog.java new file mode 100644 index 0000000..f17bb6d --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/entity/HjmBxLog.java @@ -0,0 +1,84 @@ +package com.gxwebsoft.hjm.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 黄家明_报险记录 + * + * @author 科技小王子 + * @since 2025-06-06 13:08:29 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "HjmBxLog对象", description = "黄家明_报险记录") +public class HjmBxLog implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "用户昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "事故类型") + private String accidentType; + + @Schema(description = "车辆ID") + private Integer carId; + + @Schema(description = "车辆编号") + @TableField(exist = false) + private String carNo; + + @Schema(description = "车辆图片") + @TableField(exist = false) + private String carAvatar; + + @Schema(description = "保险图片") + private String image; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/entity/HjmCar.java b/src/main/java/com/gxwebsoft/hjm/entity/HjmCar.java new file mode 100644 index 0000000..3b18194 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/entity/HjmCar.java @@ -0,0 +1,179 @@ +package com.gxwebsoft.hjm.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.List; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 黄家明_车辆管理 + * + * @author 科技小王子 + * @since 2025-04-14 16:43:26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "HjmCar对象", description = "黄家明_车辆管理") +public class HjmCar implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "车辆名称") + private String name; + + @Schema(description = "车辆图片") + private String image; + + @Schema(description = "类型 0汽车 1其他车") + private Integer type; + + @Schema(description = "管理负责人") + @TableField(exist = false) + private String kuaidiAdmin; + + @Schema(description = "车辆编号") + private String code; + + @Schema(description = "车辆车架号") + private String vinCode; + + @Schema(description = "司机") + private Integer driverId; + + @Schema(description = "操作员") + @TableField(exist = false) + private String driver; + + @Schema(description = "操作员") + private String driverName; + + @Schema(description = "操作员电话") + @TableField(exist = false) + private String driverPhone; + + @Schema(description = "保险状态") + private String insuranceStatus; + + @Schema(description = "保单图片") + private String bdImg; + + @Schema(description = "GPS设备编号") + private String gpsNo; + + @Schema(description = "电子围栏ID") + private Integer fenceId; + + @Schema(description = "电子围栏名称") + private String fenceName; + + @Schema(description = "电子围栏名称") + @TableField(exist = false) + private HjmFence fence; + + @Schema(description = "是否在围栏内") + private Boolean inFence; + + @Schema(description = "位置") + private String location; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "速度") + private String speed; + + @Schema(description = "区域") + private String district; + + @Schema(description = "地址") + private String address; + + @Schema(description = "组织ID") + private Integer organizationId; + + @Schema(description = "机构名称") + private String organizationName; + + @Schema(description = "机构名称") + @TableField(exist = false) + private String organization; + + @Schema(description = "父级组织ID") + private Integer organizationParentId; + + @Schema(description = "父级机构名称") + private String organizationParentName; + + @Schema(description = "父级机构名称") + @TableField(exist = false) + private String parentOrganization; + + @Schema(description = "快递公司管理员") + @TableField(exist = false) + private String parentOrganizationAdmin; + + @Schema(description = "微信小程序码") + private String mpCode; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "安装工ID") + private Integer installerId; + + @Schema(description = "安装时间") + private String installTime; + + @Schema(description = "接受推送消息的微信openId") + private String toUser; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "appId") + @TableField(exist = false) + private String appId; + + @Schema(description = "是否认领, 0未认领, 1已认领") + private Integer claim; + + @Schema(description = "认领时间") + private String claimTime; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/entity/HjmChoices.java b/src/main/java/com/gxwebsoft/hjm/entity/HjmChoices.java new file mode 100644 index 0000000..550be7e --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/entity/HjmChoices.java @@ -0,0 +1,64 @@ +package com.gxwebsoft.hjm.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 黄家明_选择题选项 + * + * @author 科技小王子 + * @since 2025-06-02 12:59:49 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "HjmChoices对象", description = "黄家明_选择题选项") +public class HjmChoices implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "题目ID") + private Integer questionId; + + @Schema(description = "题目") + private String content; + + @Schema(description = "是否正确") + private Boolean isCorrect; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/entity/HjmCourses.java b/src/main/java/com/gxwebsoft/hjm/entity/HjmCourses.java new file mode 100644 index 0000000..6871cca --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/entity/HjmCourses.java @@ -0,0 +1,71 @@ +package com.gxwebsoft.hjm.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 黄家明_课程 + * + * @author 科技小王子 + * @since 2025-06-02 12:59:49 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "HjmCourses对象", description = "黄家明_课程") +public class HjmCourses implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "课程名称") + private String name; + + @Schema(description = "类型") + private Integer type; + + @Schema(description = "课程编号") + private String code; + + @Schema(description = "课程封面图") + private String image; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/entity/HjmExamLog.java b/src/main/java/com/gxwebsoft/hjm/entity/HjmExamLog.java new file mode 100644 index 0000000..b5d9a45 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/entity/HjmExamLog.java @@ -0,0 +1,78 @@ +package com.gxwebsoft.hjm.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 黄家明_学习记录 + * + * @author 科技小王子 + * @since 2025-06-05 14:32:03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "HjmExamLog对象", description = "黄家明_学习记录") +public class HjmExamLog implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "用户昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "手机号码") + @TableField(exist = false) + private String phone; + + @Schema(description = "得分") + private BigDecimal total; + + @Schema(description = "用时") + private String useTime; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/entity/HjmFence.java b/src/main/java/com/gxwebsoft/hjm/entity/HjmFence.java new file mode 100644 index 0000000..548e889 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/entity/HjmFence.java @@ -0,0 +1,71 @@ +package com.gxwebsoft.hjm.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 黄家明_电子围栏 + * + * @author 科技小王子 + * @since 2025-06-03 02:08:03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "HjmFence对象", description = "黄家明_电子围栏") +public class HjmFence implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "围栏名称") + private String name; + + @Schema(description = "类型 1多边形") + private Integer type; + + @Schema(description = "位置") + private String location; + + @Schema(description = "经度") + private Double longitude; + + @Schema(description = "纬度") + private Double latitude; + + @Schema(description = "区域") + private String district; + + @Schema(description = "轮廓") + private String points; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/entity/HjmGpsLog.java b/src/main/java/com/gxwebsoft/hjm/entity/HjmGpsLog.java new file mode 100644 index 0000000..86b67b2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/entity/HjmGpsLog.java @@ -0,0 +1,77 @@ +package com.gxwebsoft.hjm.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 黄家明_gps轨迹 + * + * @author 科技小王子 + * @since 2025-06-11 12:03:50 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "HjmGpsLog对象", description = "黄家明_gps轨迹") +public class HjmGpsLog implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "车辆ID") + private Integer carId; + + @Schema(description = "gps编号") + private String gpsNo; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "设备当前时间") + private String ddmmyy; + + @Schema(description = "时分秒") + private String hhmmss; + + @Schema(description = "速度") + private String speed; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "操作员电话") + @TableField(exist = false) + private String phone; + + @Schema(description = "车辆编号") + @TableField(exist = false) + private String carNo; + + @Schema(description = "司机ID") + @TableField(exist = false) + private Integer driverId; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/entity/HjmQuestions.java b/src/main/java/com/gxwebsoft/hjm/entity/HjmQuestions.java new file mode 100644 index 0000000..8bb5796 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/entity/HjmQuestions.java @@ -0,0 +1,102 @@ +package com.gxwebsoft.hjm.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.List; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 黄家明_题目 + * + * @author 科技小王子 + * @since 2025-06-02 12:59:49 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "HjmQuestions对象", description = "黄家明_题目") +public class HjmQuestions implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "课程ID") + private Integer courseId; + + @Schema(description = "课程名称") + @TableField(exist = false) + private String courseName; + + @Schema(description = "类型 0choice 1fill 2essay") + private Integer type; + + @Schema(description = "题目") + private String question; + + @Schema(description = "正确答案") + private String correctAnswer; + + @Schema(description = "难度,0简单 1中等 2难") + private Integer difficulty; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "正确答案") + @TableField(exist = false) + private Integer choices; +// +// @Schema(description = "选项A") +// @TableField(exist = false) +// private String choicesA; +// +// @Schema(description = "选项B") +// @TableField(exist = false) +// private String choicesB; +// +// @Schema(description = "选项C") +// @TableField(exist = false) +// private String choicesC; +// +// @Schema(description = "选项D") +// @TableField(exist = false) +// private String choicesD; + + @Schema(description = "选项列表") + @TableField(exist = false) + private List choicesList; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/entity/HjmViolation.java b/src/main/java/com/gxwebsoft/hjm/entity/HjmViolation.java new file mode 100644 index 0000000..a498731 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/entity/HjmViolation.java @@ -0,0 +1,77 @@ +package com.gxwebsoft.hjm.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 黄家明_违章记录 + * + * @author 科技小王子 + * @since 2025-06-20 13:48:43 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "HjmViolation对象", description = "黄家明_违章记录") +public class HjmViolation implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "标题") + private String title; + + @Schema(description = "车辆编号") + private String code; + + @Schema(description = "车辆头像") + @TableField(exist = false) + private String image; + + @Schema(description = "文章分类ID") + private Integer categoryId; + + @Schema(description = "处罚金额") + private BigDecimal money; + + @Schema(description = "扣分") + private BigDecimal score; + + @Schema(description = "录入员") + private Integer adminId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0未处理, 1已处理") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/mapper/HjmBxLogMapper.java b/src/main/java/com/gxwebsoft/hjm/mapper/HjmBxLogMapper.java new file mode 100644 index 0000000..0e525fc --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/mapper/HjmBxLogMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.hjm.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.hjm.entity.HjmBxLog; +import com.gxwebsoft.hjm.param.HjmBxLogParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 黄家明_报险记录Mapper + * + * @author 科技小王子 + * @since 2025-06-06 13:08:29 + */ +public interface HjmBxLogMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") HjmBxLogParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") HjmBxLogParam param); + +} diff --git a/src/main/java/com/gxwebsoft/hjm/mapper/HjmCarMapper.java b/src/main/java/com/gxwebsoft/hjm/mapper/HjmCarMapper.java new file mode 100644 index 0000000..1ef6a43 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/mapper/HjmCarMapper.java @@ -0,0 +1,68 @@ +package com.gxwebsoft.hjm.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.hjm.entity.HjmCar; +import com.gxwebsoft.hjm.param.HjmCarParam; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +/** + * 黄家明_车辆管理Mapper + * + * @author 科技小王子 + * @since 2025-04-14 16:43:26 + */ +public interface HjmCarMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") HjmCarParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") HjmCarParam param); + + + @InterceptorIgnore(tenantLine = "true") + HjmCar getByGpsNo(@Param("gpsNo") String gpsNo); + + @InterceptorIgnore(tenantLine = "true") + boolean updateByGpsNo(@Param("param") HjmCar param); + + @InterceptorIgnore(tenantLine = "true") + HjmCar getByCode(String code); + + /** + * 硬删除:绕过 MyBatis-Plus 逻辑删除(@TableLogic)。 + */ + @Delete("DELETE FROM hjm_car WHERE id = #{id}") + int hardDeleteById(@Param("id") Integer id); + + /** + * 硬删除:批量删除,绕过 MyBatis-Plus 逻辑删除(@TableLogic)。 + */ + @Delete({ + "" + }) + int hardDeleteBatchIds(@Param("ids") Collection ids); +} diff --git a/src/main/java/com/gxwebsoft/hjm/mapper/HjmChoicesMapper.java b/src/main/java/com/gxwebsoft/hjm/mapper/HjmChoicesMapper.java new file mode 100644 index 0000000..5ca7ae8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/mapper/HjmChoicesMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.hjm.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.hjm.entity.HjmChoices; +import com.gxwebsoft.hjm.param.HjmChoicesParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 黄家明_选择题选项Mapper + * + * @author 科技小王子 + * @since 2025-06-02 12:59:49 + */ +public interface HjmChoicesMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") HjmChoicesParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") HjmChoicesParam param); + +} diff --git a/src/main/java/com/gxwebsoft/hjm/mapper/HjmCoursesMapper.java b/src/main/java/com/gxwebsoft/hjm/mapper/HjmCoursesMapper.java new file mode 100644 index 0000000..81127d0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/mapper/HjmCoursesMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.hjm.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.hjm.entity.HjmCourses; +import com.gxwebsoft.hjm.param.HjmCoursesParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 黄家明_课程Mapper + * + * @author 科技小王子 + * @since 2025-06-02 12:59:49 + */ +public interface HjmCoursesMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") HjmCoursesParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") HjmCoursesParam param); + +} diff --git a/src/main/java/com/gxwebsoft/hjm/mapper/HjmExamLogMapper.java b/src/main/java/com/gxwebsoft/hjm/mapper/HjmExamLogMapper.java new file mode 100644 index 0000000..ab875fa --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/mapper/HjmExamLogMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.hjm.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.hjm.entity.HjmExamLog; +import com.gxwebsoft.hjm.param.HjmExamLogParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 黄家明_学习记录Mapper + * + * @author 科技小王子 + * @since 2025-06-05 14:32:03 + */ +public interface HjmExamLogMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") HjmExamLogParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") HjmExamLogParam param); + +} diff --git a/src/main/java/com/gxwebsoft/hjm/mapper/HjmFenceMapper.java b/src/main/java/com/gxwebsoft/hjm/mapper/HjmFenceMapper.java new file mode 100644 index 0000000..ab0c9af --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/mapper/HjmFenceMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.hjm.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.hjm.entity.HjmFence; +import com.gxwebsoft.hjm.param.HjmFenceParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 黄家明_电子围栏Mapper + * + * @author 科技小王子 + * @since 2025-06-03 02:08:03 + */ +public interface HjmFenceMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") HjmFenceParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") HjmFenceParam param); + +} diff --git a/src/main/java/com/gxwebsoft/hjm/mapper/HjmGpsLogMapper.java b/src/main/java/com/gxwebsoft/hjm/mapper/HjmGpsLogMapper.java new file mode 100644 index 0000000..caaae06 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/mapper/HjmGpsLogMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.hjm.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.hjm.entity.HjmGpsLog; +import com.gxwebsoft.hjm.param.HjmGpsLogParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 黄家明_gps轨迹Mapper + * + * @author 科技小王子 + * @since 2025-06-11 12:03:50 + */ +public interface HjmGpsLogMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") HjmGpsLogParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") HjmGpsLogParam param); + +} diff --git a/src/main/java/com/gxwebsoft/hjm/mapper/HjmQuestionsMapper.java b/src/main/java/com/gxwebsoft/hjm/mapper/HjmQuestionsMapper.java new file mode 100644 index 0000000..980dd4f --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/mapper/HjmQuestionsMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.hjm.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.hjm.entity.HjmQuestions; +import com.gxwebsoft.hjm.param.HjmQuestionsParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 黄家明_题目Mapper + * + * @author 科技小王子 + * @since 2025-06-02 12:59:49 + */ +public interface HjmQuestionsMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") HjmQuestionsParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") HjmQuestionsParam param); + +} diff --git a/src/main/java/com/gxwebsoft/hjm/mapper/HjmViolationMapper.java b/src/main/java/com/gxwebsoft/hjm/mapper/HjmViolationMapper.java new file mode 100644 index 0000000..539c87e --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/mapper/HjmViolationMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.hjm.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.hjm.entity.HjmViolation; +import com.gxwebsoft.hjm.param.HjmViolationParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 黄家明_违章记录Mapper + * + * @author 科技小王子 + * @since 2025-06-20 13:48:43 + */ +public interface HjmViolationMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") HjmViolationParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") HjmViolationParam param); + +} diff --git a/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmBxLogMapper.xml b/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmBxLogMapper.xml new file mode 100644 index 0000000..d008f01 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmBxLogMapper.xml @@ -0,0 +1,62 @@ + + + + + + + SELECT a.*, b.name as carName,b.code as carNo, b.image as carAvatar, u.real_name as realName, u.nickname + FROM hjm_bx_log a + LEFT JOIN hjm_car b ON a.car_id = b.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.user_id = #{param.userId} + + + AND a.car_id = #{param.carId} + + + AND a.image LIKE CONCAT('%', #{param.image}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmCarMapper.xml b/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmCarMapper.xml new file mode 100644 index 0000000..1264372 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmCarMapper.xml @@ -0,0 +1,164 @@ + + + + + + + SELECT a.*,b.organization_name as organization,e.name as fence, f.organization_name as parentOrganization, + f.comments as + parentOrganizationAdmin, u.real_name as driver,u.phone as driverPhone + FROM hjm_car a + LEFT JOIN gxwebsoft_core.sys_organization b ON a.organization_id = b.organization_id + LEFT JOIN gxwebsoft_core.sys_organization f ON a.organization_parent_id = f.organization_id + LEFT JOIN hjm_fence e ON a.fence_id = e.id + LEFT JOIN gxwebsoft_core.sys_user u ON a.driver_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.image LIKE CONCAT('%', #{param.image}, '%') + + + AND a.type = #{param.type} + + + AND a.organization_id IN + + #{orgId} + + + + AND a.organization_id = #{param.organizationId} + + + AND a.organization_parent_id = #{param.organizationParentId} + + + AND a.driver_id = #{param.driverId} + + + AND a.kuaidi LIKE CONCAT('%', #{param.kuaidi}, '%') + + + AND a.kuaidi_admin LIKE CONCAT('%', #{param.kuaidiAdmin}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.vin_code LIKE CONCAT('%', #{param.vinCode}, '%') + + + + AND a.driver = #{param.driver} + + + AND a.insurance_status = #{param.insuranceStatus} + + + AND a.gps_no LIKE CONCAT('%', #{param.gpsNo}, '%') + + + AND a.fence LIKE CONCAT('%', #{param.fence}, '%') + + + AND a.district LIKE CONCAT('%', #{param.district}, '%') + + + AND a.claim = #{param.claim} + + + AND a.installer_id = #{param.installerId} + + + AND a.user_id = #{param.userId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.code LIKE CONCAT('%', #{param.keywords}, '%') + OR a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.gps_no = #{param.keywords} + OR a.driver_name = #{param.keywords} + OR u.phone = #{param.keywords} + ) + + + + + + + + + + + + + + + + UPDATE hjm_car + + + longitude = #{param.longitude}, + + + latitude = #{param.latitude}, + + + speed = #{param.speed}, + + + + gps_no = #{param.gpsNo} + + + + diff --git a/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmChoicesMapper.xml b/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmChoicesMapper.xml new file mode 100644 index 0000000..9999614 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmChoicesMapper.xml @@ -0,0 +1,60 @@ + + + + + + + SELECT a.* + FROM hjm_choices a + + + AND a.id = #{param.id} + + + AND a.question_id = #{param.questionId} + + + AND a.choice_content LIKE CONCAT('%', #{param.choiceContent}, '%') + + + AND a.is_correct = #{param.isCorrect} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmCoursesMapper.xml b/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmCoursesMapper.xml new file mode 100644 index 0000000..bc58532 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmCoursesMapper.xml @@ -0,0 +1,66 @@ + + + + + + + SELECT a.* + FROM hjm_courses a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.type = #{param.type} + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.image LIKE CONCAT('%', #{param.image}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmExamLogMapper.xml b/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmExamLogMapper.xml new file mode 100644 index 0000000..1b869e0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmExamLogMapper.xml @@ -0,0 +1,61 @@ + + + + + + + SELECT a.*, b.nickname, b.phone, b.real_name + FROM hjm_exam_log a + LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id + + + AND a.id = #{param.id} + + + AND a.user_id = #{param.userId} + + + AND a.total = #{param.total} + + + AND a.use_time LIKE CONCAT('%', #{param.useTime}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmFenceMapper.xml b/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmFenceMapper.xml new file mode 100644 index 0000000..6bff929 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmFenceMapper.xml @@ -0,0 +1,60 @@ + + + + + + + SELECT a.* + FROM hjm_fence a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.type = #{param.type} + + + AND a.longitude LIKE CONCAT('%', #{param.longitude}, '%') + + + AND a.latitude LIKE CONCAT('%', #{param.latitude}, '%') + + + AND a.district LIKE CONCAT('%', #{param.district}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmGpsLogMapper.xml b/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmGpsLogMapper.xml new file mode 100644 index 0000000..b6cb487 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmGpsLogMapper.xml @@ -0,0 +1,65 @@ + + + + + + + SELECT a.* + FROM hjm_gps_log a + + + AND a.id = #{param.id} + + + AND a.car_id = #{param.carId} + + + AND a.gps_no = #{param.gpsNo} + + + AND a.longitude LIKE CONCAT('%', #{param.longitude}, '%') + + + AND a.latitude LIKE CONCAT('%', #{param.latitude}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.ddmmyy LIKE CONCAT('%', #{param.ddmmyy}, '%') + + + AND a.hhmmss LIKE CONCAT(#{param.hhmmss}, '%') + + + AND a.speed = #{param.speed} + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND a.create_time LIKE CONCAT('%', #{param.dateTime}, '%') + + + AND a.gps_no = #{param.keywords} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmQuestionsMapper.xml b/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmQuestionsMapper.xml new file mode 100644 index 0000000..88cb559 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmQuestionsMapper.xml @@ -0,0 +1,70 @@ + + + + + + + SELECT a.*, b.title as courseName + FROM hjm_questions a + LEFT JOIN cms_navigation b ON a.course_id = b.navigation_id + + + AND a.id = #{param.id} + + + AND a.course_id = #{param.courseId} + + + AND a.type = #{param.type} + + + AND a.question LIKE CONCAT('%', #{param.question}, '%') + + + AND a.correct_answer LIKE CONCAT('%', #{param.correctAnswer}, '%') + + + AND a.difficulty LIKE CONCAT('%', #{param.difficulty}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmViolationMapper.xml b/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmViolationMapper.xml new file mode 100644 index 0000000..2c8f616 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/mapper/xml/HjmViolationMapper.xml @@ -0,0 +1,76 @@ + + + + + + + SELECT DISTINCT a.*,b.image + FROM hjm_violation a + LEFT JOIN hjm_car b ON a.code = b.code + LEFT JOIN gxwebsoft_core.sys_organization c ON b.organization_id = c.organization_id + LEFT JOIN gxwebsoft_core.sys_organization f ON b.organization_parent_id = f.organization_id + + + AND a.id = #{param.id} + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.code = #{param.code} + + + AND a.category_id = #{param.categoryId} + + + AND a.money = #{param.money} + + + AND a.score = #{param.score} + + + AND b.organization_id = #{param.organizationId} + + + AND b.organization_parent_id = #{param.organizationParentId} + + + AND a.admin_id = #{param.adminId} + + + AND a.user_id = #{param.userId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.code = #{param.keywords} + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/hjm/param/HjmBxLogParam.java b/src/main/java/com/gxwebsoft/hjm/param/HjmBxLogParam.java new file mode 100644 index 0000000..6f777f6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/param/HjmBxLogParam.java @@ -0,0 +1,56 @@ +package com.gxwebsoft.hjm.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 黄家明_报险记录查询参数 + * + * @author 科技小王子 + * @since 2025-06-06 13:08:29 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "HjmBxLogParam对象", description = "黄家明_报险记录查询参数") +public class HjmBxLogParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "车辆ID") + @QueryField(type = QueryType.EQ) + private Integer carId; + + @Schema(description = "保险图片") + private String image; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/param/HjmCarImportParam.java b/src/main/java/com/gxwebsoft/hjm/param/HjmCarImportParam.java new file mode 100644 index 0000000..afea961 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/param/HjmCarImportParam.java @@ -0,0 +1,83 @@ +package com.gxwebsoft.hjm.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; + +/** + * 车辆导入参数 + * + * @author 科技小王子 + * @since 2025-04-14 16:43:26 + */ +@Data +public class HjmCarImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "车辆名称") + private String name; + + @Excel(name = "车辆图片") + private String image; + + @Excel(name = "类型") + private Integer type; + + @Excel(name = "管理负责人") + private String kuaidiAdmin; + + @Excel(name = "车辆编号") + private String code; + + @Excel(name = "司机ID") + private Integer driverId; + + @Excel(name = "保险状态") + private String insuranceStatus; + + @Excel(name = "GPS设备编号") + private String gpsNo; + + @Excel(name = "电子围栏ID") + private Integer fenceId; + + @Excel(name = "电子围栏名称") + private String fenceName; + + @Excel(name = "位置") + private String location; + + @Excel(name = "纬度") + private String latitude; + + @Excel(name = "经度") + private String longitude; + + @Excel(name = "区域") + private String district; + + @Excel(name = "地址") + private String address; + + @Excel(name = "站点ID") + private Integer organizationId; + + @Excel(name = "所属快递公司ID") + private Integer organizationParentId; + + @Excel(name = "微信小程序码") + private String mpCode; + + @Excel(name = "用户ID") + private Integer userId; + + @Excel(name = "排序") + private Integer sortNumber; + + @Excel(name = "备注") + private String comments; + + @Excel(name = "状态") + private Integer status; +} diff --git a/src/main/java/com/gxwebsoft/hjm/param/HjmCarParam.java b/src/main/java/com/gxwebsoft/hjm/param/HjmCarParam.java new file mode 100644 index 0000000..923dfaf --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/param/HjmCarParam.java @@ -0,0 +1,136 @@ +package com.gxwebsoft.hjm.param; + +import java.math.BigDecimal; +import java.util.Set; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 黄家明_车辆管理查询参数 + * + * @author 科技小王子 + * @since 2025-04-14 16:43:26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "HjmCarParam对象", description = "黄家明_车辆管理查询参数") +public class HjmCarParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "车辆名称") + private String name; + + @Schema(description = "车辆图片") + private String image; + + @Schema(description = "类型 0汽车 1其他车") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "快递公司") + private String kuaidi; + + @Schema(description = "管理负责人") + private String kuaidiAdmin; + + @Schema(description = "车辆编号") + private String code; + + @Schema(description = "车辆车架号") + private String vinCode; + + @Schema(description = "司机ID") + @QueryField(type = QueryType.EQ) + private Integer driverId; + + @Schema(description = "司机") + @QueryField(type = QueryType.EQ) + private Integer driver; + + @Schema(description = "保险状态") + @QueryField(type = QueryType.EQ) + private String insuranceStatus; + + @Schema(description = "保险图片") + private String bdImg; + + @Schema(description = "GPS设备编号") + private String gpsNo; + + @Schema(description = "电子围栏") + private String fence; + + @Schema(description = "所在区域") + @QueryField(type = QueryType.EQ) + private String district; + + @Schema(description = "纬度") + @QueryField(type = QueryType.EQ) + private String latitude; + + @Schema(description = "经度") + @QueryField(type = QueryType.EQ) + private String longitude; + + @Schema(description = "组织ID") + @QueryField(type = QueryType.EQ) + private Integer organizationId; + + @Schema(description = "组织ID集") + @QueryField(type = QueryType.IN) + private Set organizationIds; + + @Schema(description = "父级组织ID") + @QueryField(type = QueryType.EQ) + private Integer organizationParentId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "安装人员ID") + @QueryField(type = QueryType.EQ) + private Integer installerId; + + @Schema(description = "安装时间") + private String installTime; + + @Schema(description = "是否认领, 0未认领, 1已认领") + @QueryField(type = QueryType.EQ) + private Integer claim; + + @Schema(description = "认领时间") + private String claimTime; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "所属站点") + @QueryField(type = QueryType.EQ) + private String organizationName; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/param/HjmChoicesParam.java b/src/main/java/com/gxwebsoft/hjm/param/HjmChoicesParam.java new file mode 100644 index 0000000..76398e7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/param/HjmChoicesParam.java @@ -0,0 +1,56 @@ +package com.gxwebsoft.hjm.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 黄家明_选择题选项查询参数 + * + * @author 科技小王子 + * @since 2025-06-02 12:59:49 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "HjmChoicesParam对象", description = "黄家明_选择题选项查询参数") +public class HjmChoicesParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "题目ID") + @QueryField(type = QueryType.EQ) + private Integer questionId; + + @Schema(description = "题目") + private String choiceContent; + + @Schema(description = "是否正确") + @QueryField(type = QueryType.EQ) + private Integer isCorrect; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/param/HjmCoursesParam.java b/src/main/java/com/gxwebsoft/hjm/param/HjmCoursesParam.java new file mode 100644 index 0000000..5992687 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/param/HjmCoursesParam.java @@ -0,0 +1,62 @@ +package com.gxwebsoft.hjm.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 黄家明_课程查询参数 + * + * @author 科技小王子 + * @since 2025-06-02 12:59:49 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "HjmCoursesParam对象", description = "黄家明_课程查询参数") +public class HjmCoursesParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "课程名称") + private String name; + + @Schema(description = "类型") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "课程编号") + private String code; + + @Schema(description = "课程封面图") + private String image; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/param/HjmExamLogParam.java b/src/main/java/com/gxwebsoft/hjm/param/HjmExamLogParam.java new file mode 100644 index 0000000..2b37098 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/param/HjmExamLogParam.java @@ -0,0 +1,56 @@ +package com.gxwebsoft.hjm.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 黄家明_学习记录查询参数 + * + * @author 科技小王子 + * @since 2025-06-05 14:32:03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "HjmExamLogParam对象", description = "黄家明_学习记录查询参数") +public class HjmExamLogParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "得分") + @QueryField(type = QueryType.EQ) + private BigDecimal total; + + @Schema(description = "用时") + private String useTime; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/param/HjmFenceParam.java b/src/main/java/com/gxwebsoft/hjm/param/HjmFenceParam.java new file mode 100644 index 0000000..a67e93f --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/param/HjmFenceParam.java @@ -0,0 +1,57 @@ +package com.gxwebsoft.hjm.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 黄家明_电子围栏查询参数 + * + * @author 科技小王子 + * @since 2025-06-03 02:08:03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "HjmFenceParam对象", description = "黄家明_电子围栏查询参数") +public class HjmFenceParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "围栏名称") + private String name; + + @Schema(description = "类型 0圆形 1方形") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "区域") + private String district; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/param/HjmGpsLogParam.java b/src/main/java/com/gxwebsoft/hjm/param/HjmGpsLogParam.java new file mode 100644 index 0000000..50d42d5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/param/HjmGpsLogParam.java @@ -0,0 +1,66 @@ +package com.gxwebsoft.hjm.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 黄家明_gps轨迹查询参数 + * + * @author 科技小王子 + * @since 2025-06-11 12:03:50 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "HjmGpsLogParam对象", description = "黄家明_gps轨迹查询参数") +public class HjmGpsLogParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "车辆ID") + @QueryField(type = QueryType.EQ) + private Integer carId; + + @Schema(description = "gps编号") + @QueryField(type = QueryType.EQ) + private String gpsNo; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "速度") + private String speed; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "按日期查询") + @QueryField(type = QueryType.EQ) + private String dateTime; + + @Schema(description = "设备当前时间") + @QueryField(type = QueryType.EQ) + private String ddmmyy; + + @Schema(description = "时分秒") + @QueryField(type = QueryType.LIKE) + private String hhmmss; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/param/HjmQuestionsParam.java b/src/main/java/com/gxwebsoft/hjm/param/HjmQuestionsParam.java new file mode 100644 index 0000000..27c80d5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/param/HjmQuestionsParam.java @@ -0,0 +1,66 @@ +package com.gxwebsoft.hjm.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 黄家明_题目查询参数 + * + * @author 科技小王子 + * @since 2025-06-02 12:59:49 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "HjmQuestionsParam对象", description = "黄家明_题目查询参数") +public class HjmQuestionsParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "课程ID") + @QueryField(type = QueryType.EQ) + private Integer courseId; + + @Schema(description = "类型 0choice 1fill 2essay") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "题目") + private String question; + + @Schema(description = "正确答案") + private String correctAnswer; + + @Schema(description = "难度,'easy', 'medium', 'hard'") + private String difficulty; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/param/HjmViolationParam.java b/src/main/java/com/gxwebsoft/hjm/param/HjmViolationParam.java new file mode 100644 index 0000000..f9f2d7a --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/param/HjmViolationParam.java @@ -0,0 +1,76 @@ +package com.gxwebsoft.hjm.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 黄家明_违章记录查询参数 + * + * @author 科技小王子 + * @since 2025-06-20 13:48:43 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "HjmViolationParam对象", description = "黄家明_违章记录查询参数") +public class HjmViolationParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "标题") + private String title; + + @Schema(description = "车牌号") + @QueryField(type = QueryType.EQ) + private String code; + + @Schema(description = "文章分类ID") + @QueryField(type = QueryType.EQ) + private Integer categoryId; + + @Schema(description = "处罚金额") + @QueryField(type = QueryType.EQ) + private BigDecimal money; + + @Schema(description = "扣分") + @QueryField(type = QueryType.EQ) + private BigDecimal score; + + @Schema(description = "录入员") + @QueryField(type = QueryType.EQ) + private Integer adminId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0未处理, 1已处理") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "组织ID") + @QueryField(type = QueryType.EQ) + private Integer organizationId; + + @Schema(description = "父级组织ID") + @QueryField(type = QueryType.EQ) + private Integer organizationParentId; + +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/GpsDiagnosticService.java b/src/main/java/com/gxwebsoft/hjm/service/GpsDiagnosticService.java new file mode 100644 index 0000000..28d648a --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/GpsDiagnosticService.java @@ -0,0 +1,289 @@ +package com.gxwebsoft.hjm.service; + +import cn.hutool.core.util.StrUtil; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.hjm.entity.HjmCar; +import com.gxwebsoft.hjm.entity.HjmGpsLog; +import com.gxwebsoft.hjm.param.HjmCarParam; +import com.gxwebsoft.hjm.param.HjmGpsLogParam; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * GPS诊断服务 + * + * @author 科技小王子 + * @since 2025-07-02 + */ +@Service +public class GpsDiagnosticService { + + private static final Logger logger = LoggerFactory.getLogger(GpsDiagnosticService.class); + + @Resource + private HjmCarService hjmCarService; + + @Resource + private HjmGpsLogService hjmGpsLogService; + + @Resource + private RedisUtil redisUtil; + + /** + * 诊断GPS数据上送问题 + * + * @return 诊断报告 + */ + public Map diagnoseGpsDataIssues() { + Map report = new HashMap<>(); + + logger.info("开始GPS数据诊断..."); + + // 1. 检查所有车辆的GPS配置 + Map carGpsConfig = checkCarGpsConfiguration(); + report.put("车辆GPS配置检查", carGpsConfig); + + // 2. 检查GPS日志数据 + Map gpsLogAnalysis = analyzeGpsLogData(); + report.put("GPS日志分析", gpsLogAnalysis); + + // 3. 检查Redis缓存状态 + Map redisStatus = checkRedisCache(); + report.put("Redis缓存状态", redisStatus); + + // 4. 检查有数据的GPS设备 + Map activeGpsDevices = checkActiveGpsDevices(); + report.put("活跃GPS设备", activeGpsDevices); + + logger.info("GPS数据诊断完成"); + + return report; + } + + /** + * 检查车辆GPS配置 + */ + private Map checkCarGpsConfiguration() { + Map result = new HashMap<>(); + + try { + // 查询所有车辆 + HjmCarParam param = new HjmCarParam(); + List allCars = hjmCarService.listRel(param); + + int totalCars = allCars.size(); + int carsWithGps = 0; + int carsWithoutGps = 0; + + Map gpsDeviceMapping = new HashMap<>(); + + for (HjmCar car : allCars) { + if (StrUtil.isNotBlank(car.getGpsNo())) { + carsWithGps++; + gpsDeviceMapping.put(car.getGpsNo(), car.getCode()); + } else { + carsWithoutGps++; + logger.warn("车辆 {} (ID: {}) 未配置GPS设备编号", car.getCode(), car.getId()); + } + } + + result.put("总车辆数", totalCars); + result.put("已配置GPS的车辆数", carsWithGps); + result.put("未配置GPS的车辆数", carsWithoutGps); + result.put("GPS设备映射", gpsDeviceMapping); + + logger.info("车辆GPS配置检查完成 - 总数: {}, 已配置GPS: {}, 未配置GPS: {}", + totalCars, carsWithGps, carsWithoutGps); + + } catch (Exception e) { + logger.error("检查车辆GPS配置失败", e); + result.put("错误", e.getMessage()); + } + + return result; + } + + /** + * 分析GPS日志数据 + */ + private Map analyzeGpsLogData() { + Map result = new HashMap<>(); + + try { + // 查询最近的GPS日志 + HjmGpsLogParam param = new HjmGpsLogParam(); + List recentLogs = hjmGpsLogService.listRel(param); + + Map gpsDeviceLogCount = new HashMap<>(); + Map latestLogTime = new HashMap<>(); + + for (HjmGpsLog log : recentLogs) { + String gpsNo = log.getGpsNo(); + if (StrUtil.isNotBlank(gpsNo)) { + gpsDeviceLogCount.put(gpsNo, gpsDeviceLogCount.getOrDefault(gpsNo, 0) + 1); + + if (log.getCreateTime() != null) { + String currentTime = latestLogTime.get(gpsNo); + String logTime = log.getCreateTime().toString(); + if (currentTime == null || logTime.compareTo(currentTime) > 0) { + latestLogTime.put(gpsNo, logTime); + } + } + } + } + + result.put("总日志条数", recentLogs.size()); + result.put("各GPS设备日志数量", gpsDeviceLogCount); + result.put("各GPS设备最新日志时间", latestLogTime); + + // 找出有数据的GPS设备 + if (!gpsDeviceLogCount.isEmpty()) { + String mostActiveGps = gpsDeviceLogCount.entrySet().stream() + .max(Map.Entry.comparingByValue()) + .map(Map.Entry::getKey) + .orElse("无"); + result.put("最活跃的GPS设备", mostActiveGps); + result.put("最活跃设备日志数", gpsDeviceLogCount.getOrDefault(mostActiveGps, 0)); + } + + logger.info("GPS日志分析完成 - 总日志数: {}, 活跃设备数: {}", + recentLogs.size(), gpsDeviceLogCount.size()); + + } catch (Exception e) { + logger.error("分析GPS日志数据失败", e); + result.put("错误", e.getMessage()); + } + + return result; + } + + /** + * 检查Redis缓存状态 + */ + private Map checkRedisCache() { + Map result = new HashMap<>(); + + try { + // 检查围栏缓存 + String testGpsNo = "862317042719778"; + String fenceKey = "inFence:" + testGpsNo; + String fenceCache = redisUtil.get(fenceKey); + + result.put("测试GPS围栏缓存键", fenceKey); + result.put("测试GPS围栏缓存值", fenceCache != null ? fenceCache : "无缓存"); + + // 检查GPS日志缓存 + String gpsLogCache = redisUtil.get(testGpsNo); + result.put("测试GPS日志缓存", gpsLogCache != null ? gpsLogCache : "无缓存"); + + logger.info("Redis缓存状态检查完成"); + + } catch (Exception e) { + logger.error("检查Redis缓存状态失败", e); + result.put("错误", e.getMessage()); + } + + return result; + } + + /** + * 检查活跃的GPS设备 + */ + private Map checkActiveGpsDevices() { + Map result = new HashMap<>(); + + try { + // 检查特定GPS设备的车辆信息 + String activeGpsNo = "862317042719778"; + HjmCar activeCar = hjmCarService.getByGpsNo(activeGpsNo); + + if (activeCar != null) { + Map activeCarInfo = new HashMap<>(); + activeCarInfo.put("车辆编号", activeCar.getCode()); + activeCarInfo.put("车辆名称", activeCar.getName()); + activeCarInfo.put("车辆ID", activeCar.getId()); + activeCarInfo.put("GPS设备编号", activeCar.getGpsNo()); + activeCarInfo.put("最新经度", activeCar.getLongitude()); + activeCarInfo.put("最新纬度", activeCar.getLatitude()); + activeCarInfo.put("最新速度", activeCar.getSpeed()); + activeCarInfo.put("更新时间", activeCar.getUpdateTime()); + activeCarInfo.put("围栏ID", activeCar.getFenceId()); + activeCarInfo.put("是否在围栏内", activeCar.getInFence()); + + result.put("活跃GPS设备信息", activeCarInfo); + } else { + result.put("活跃GPS设备信息", "未找到对应车辆"); + } + + // 检查其他GPS设备 + HjmCarParam param = new HjmCarParam(); + List allCars = hjmCarService.listRel(param); + + Map otherGpsDevices = new HashMap<>(); + for (HjmCar car : allCars) { + if (StrUtil.isNotBlank(car.getGpsNo()) && !activeGpsNo.equals(car.getGpsNo())) { + otherGpsDevices.put(car.getGpsNo(), car.getCode()); + } + } + + result.put("其他GPS设备", otherGpsDevices); + + logger.info("活跃GPS设备检查完成"); + + } catch (Exception e) { + logger.error("检查活跃GPS设备失败", e); + result.put("错误", e.getMessage()); + } + + return result; + } + + /** + * 检查特定GPS设备的详细信息 + * + * @param gpsNo GPS设备编号 + * @return 设备详细信息 + */ + public Map checkSpecificGpsDevice(String gpsNo) { + Map result = new HashMap<>(); + + try { + logger.info("检查GPS设备详细信息: {}", gpsNo); + + // 检查车辆信息 + HjmCar car = hjmCarService.getByGpsNo(gpsNo); + if (car != null) { + result.put("车辆信息", car); + } else { + result.put("车辆信息", "未找到对应车辆"); + } + + // 检查GPS日志 + HjmGpsLogParam logParam = new HjmGpsLogParam(); + logParam.setGpsNo(gpsNo); + List logs = hjmGpsLogService.listRel(logParam); + result.put("GPS日志数量", logs.size()); + if (!logs.isEmpty()) { + result.put("最新GPS日志", logs.get(0)); + } + + // 检查Redis缓存 + String fenceCache = redisUtil.get("inFence:" + gpsNo); + String logCache = redisUtil.get(gpsNo); + result.put("围栏缓存", fenceCache); + result.put("日志缓存", logCache); + + } catch (Exception e) { + logger.error("检查GPS设备详细信息失败: {}", gpsNo, e); + result.put("错误", e.getMessage()); + } + + return result; + } +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/GpsMessageCallback.java b/src/main/java/com/gxwebsoft/hjm/service/GpsMessageCallback.java new file mode 100644 index 0000000..de2247c --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/GpsMessageCallback.java @@ -0,0 +1,123 @@ +package com.gxwebsoft.hjm.service; + +import org.eclipse.paho.client.mqttv3.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * GPS消息回调处理器 + * + * @author 科技小王子 + * @since 2025-07-02 + */ +@Component +public class GpsMessageCallback implements MqttCallback { + + private static final Logger logger = LoggerFactory.getLogger(GpsMessageCallback.class); + + @Resource + private GpsMessageProcessor gpsMessageProcessor; + + @Override + public void connectionLost(Throwable cause) { + logger.error("MQTT连接丢失", cause); + + // 可以在这里添加告警通知逻辑 + // 例如:发送邮件、短信通知管理员 + notifyConnectionLost(cause); + } + + @Override + public void messageArrived(String topic, MqttMessage message) throws Exception { + try { + String payload = new String(message.getPayload()); + + logger.debug("接收到MQTT消息 - 主题: {}, QoS: {}, 消息长度: {}", + topic, message.getQos(), payload.length()); + + // 记录详细的消息内容(仅在DEBUG级别) + if (logger.isDebugEnabled()) { + logger.debug("消息内容: {}", payload); + } + + // 委托给专门的处理器处理 + gpsMessageProcessor.processGpsMessage(payload); + + } catch (Exception e) { + logger.error("处理MQTT消息失败 - 主题: {}, 错误: {}", topic, e.getMessage(), e); + + // 不要重新抛出异常,避免影响其他消息的处理 + // 可以在这里添加失败消息的重试机制或死信队列 + handleMessageProcessingFailure(topic, message, e); + } + } + + @Override + public void deliveryComplete(IMqttDeliveryToken token) { + logger.debug("MQTT消息发送完成: {}", token.isComplete()); + + try { + if (token.getTopics() != null && token.getTopics().length > 0) { + logger.debug("发送完成的主题: {}", String.join(", ", token.getTopics())); + } + } catch (Exception e) { + logger.warn("获取发送完成的主题信息失败", e); + } + } + + /** + * 处理连接丢失的通知 + * + * @param cause 连接丢失的原因 + */ + private void notifyConnectionLost(Throwable cause) { + try { + // 这里可以实现具体的通知逻辑 + // 例如: + // 1. 发送邮件通知 + // 2. 发送短信通知 + // 3. 写入告警日志 + // 4. 调用监控系统API + + logger.warn("MQTT连接丢失通知已触发,原因: {}", cause.getMessage()); + + // 示例:可以调用告警服务 + // alertService.sendAlert("MQTT连接丢失", cause.getMessage()); + + } catch (Exception e) { + logger.error("发送MQTT连接丢失通知失败", e); + } + } + + /** + * 处理消息处理失败的情况 + * + * @param topic 消息主题 + * @param message 消息内容 + * @param error 错误信息 + */ + private void handleMessageProcessingFailure(String topic, MqttMessage message, Exception error) { + try { + // 这里可以实现失败消息的处理逻辑 + // 例如: + // 1. 将失败的消息保存到数据库 + // 2. 发送到死信队列 + // 3. 记录到失败日志文件 + // 4. 实现重试机制 + + String payload = new String(message.getPayload()); + logger.warn("消息处理失败记录 - 主题: {}, 消息: {}, 错误: {}", + topic, payload.length() > 100 ? payload.substring(0, 100) + "..." : payload, + error.getMessage()); + + // 示例:可以保存失败消息到数据库 + // failedMessageService.saveFailedMessage(topic, payload, error.getMessage()); + + } catch (Exception e) { + logger.error("处理消息失败记录时发生错误", e); + } + } +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/GpsMessageProcessor.java b/src/main/java/com/gxwebsoft/hjm/service/GpsMessageProcessor.java new file mode 100644 index 0000000..51ab24c --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/GpsMessageProcessor.java @@ -0,0 +1,319 @@ +package com.gxwebsoft.hjm.service; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.support.geo.Point; +import com.gxwebsoft.common.core.utils.JSONUtil; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.hjm.entity.Gps; +import com.gxwebsoft.hjm.entity.HjmCar; +import com.gxwebsoft.hjm.entity.HjmFence; +import com.gxwebsoft.hjm.entity.HjmGpsLog; +import com.gxwebsoft.hjm.service.impl.HjmCarServiceImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.concurrent.TimeUnit; + +/** + * GPS消息处理器 + * + * @author 科技小王子 + * @since 2025-07-02 + */ +@Service +public class GpsMessageProcessor { + + private static final Logger logger = LoggerFactory.getLogger(GpsMessageProcessor.class); + + @Resource + private HjmCarService hjmCarService; + + @Resource + private HjmGpsLogService hjmGpsLogService; + + @Resource + private HjmFenceService hjmFenceService; + + @Resource + private RedisUtil redisUtil; + + @Resource + private StringRedisTemplate stringRedisTemplate; + + @Resource + private HjmCarServiceImpl hjmCarServiceImpl; + + /** + * 处理GPS消息 + * + * @param payload 消息内容 + */ + public void processGpsMessage(String payload) { + try { + logger.debug("开始处理GPS消息: {}", payload); + + // 检查消息内容是否为空 + if (StrUtil.isBlank(payload)) { + logger.warn("接收到空消息,跳过处理"); + return; + } + + // 检查是否为心跳或状态消息(非JSON格式) + if (isHeartbeatOrStatusMessage(payload)) { + logger.info("接收到心跳或状态消息: {}", payload); + return; + } + + // 尝试解析JSON格式的GPS数据 + Gps gps = JSONUtil.parseObject(payload, Gps.class); + if (ObjectUtil.isEmpty(gps)) { + logger.warn("GPS数据解析为空,跳过处理。消息内容: {}", payload); + return; + } + + processGpsData(gps); + + } catch (Exception e) { + logger.error("处理GPS数据失败: {}", payload, e); + } + } + + /** + * 检查是否为心跳或状态消息 + * + * @param payload 消息内容 + * @return true 如果是心跳或状态消息 + */ + private boolean isHeartbeatOrStatusMessage(String payload) { + // 去除前后空格和引号 + String cleanPayload = payload.trim(); + if (cleanPayload.startsWith("\"") && cleanPayload.endsWith("\"")) { + cleanPayload = cleanPayload.substring(1, cleanPayload.length() - 1); + } + + // 检查常见的心跳或状态消息 + return "online".equalsIgnoreCase(cleanPayload) || + "offline".equalsIgnoreCase(cleanPayload) || + "ping".equalsIgnoreCase(cleanPayload) || + "pong".equalsIgnoreCase(cleanPayload) || + "heartbeat".equalsIgnoreCase(cleanPayload) || + "status".equalsIgnoreCase(cleanPayload) || + cleanPayload.startsWith("status:") || + cleanPayload.startsWith("heartbeat:"); + } + + /** + * 处理GPS数据 + * + * @param gps GPS数据 + */ + private void processGpsData(Gps gps) { + try { + String gpsNo = gps.getImei(); + if (StrUtil.isBlank(gpsNo)) { + logger.warn("GPS设备编号为空,跳过处理"); + return; + } + + // 详细记录GPS数据处理过程 + logger.info("处理GPS数据 - 设备编号: {}, Fixed: {}, 经度: {}, 纬度: {}, 速度: {}", + gpsNo, gps.getFixed(), gps.getLng(), gps.getLat(), gps.getSpeed()); + + HjmCar car = hjmCarService.getByGpsNo(gpsNo); + + if (car == null) { + logger.warn("GPS设备编号: {} 在数据库中未找到对应车辆,请检查车辆配置", gpsNo); + return; + } + + logger.info("GPS设备编号: {} 对应车辆: {} (ID: {})", gpsNo, car.getCode(), car.getId()); + + if (!gps.getFixed()) { + logger.warn("GPS设备编号: {} 定位未固定(Fixed=false),跳过处理", gpsNo); + return; + } + + // 更新车辆GPS定位信息 + updateCarLocation(car, gps); + + // 保存GPS轨迹日志 + saveGpsLog(car, gps); + + // 检查电子围栏 + checkFence(car, gps); + + } catch (Exception e) { + logger.error("处理GPS数据时发生错误", e); + } + } + + /** + * 更新车辆位置信息 + */ + private void updateCarLocation(HjmCar car, Gps gps) { + try { + car.setLongitude(gps.getLng()); + car.setLatitude(gps.getLat()); + car.setSpeed(gps.getSpeed()); + car.setUpdateTime(LocalDateTime.ofInstant(Instant.ofEpochMilli(gps.getTime() * 1000), ZoneId.systemDefault())); + car.setGpsNo(gps.getImei()); + + if (hjmCarService.updateByGpsNo(car)) { + logger.debug("更新车辆GPS定位信息成功: {}", car.getCode()); + + // 保存GPS轨迹日志(通过Redis控制频率) + saveGpsLogRecord(car, gps); + } else { + logger.warn("更新车辆GPS定位信息失败: {}", car.getCode()); + } + + } catch (Exception e) { + logger.error("更新车辆位置信息失败", e); + } + } + + /** + * 保存GPS轨迹日志记录 + * 使用Redis控制保存频率,同一GPS设备2分钟内只保存一次 + */ + private void saveGpsLogRecord(HjmCar car, Gps gps) { + try { + // 只有速度不为0时才保存GPS轨迹 + if (gps.getSpeed().equals("0.000")) { + logger.debug("GPS设备{}速度为0,跳过保存轨迹日志", gps.getImei()); + return; + } + + // 构造Redis key,使用GPS设备编号作为key + String redisKey = "gps_log:" + gps.getImei(); + + // 使用Redis的setIfAbsent原子操作实现分布式锁 + // 只有key不存在时才设置成功,返回true;key已存在时返回false + Boolean lockAcquired = stringRedisTemplate.opsForValue() + .setIfAbsent(redisKey, "locked", 2, TimeUnit.MINUTES); + + if (Boolean.FALSE.equals(lockAcquired)) { + // 获取锁失败,说明2分钟内已经保存过 + logger.debug("GPS设备{}在2分钟内已保存过轨迹日志,跳过本次保存", gps.getImei()); + return; + } + + // 获取锁成功,执行保存操作 + HjmGpsLog log = new HjmGpsLog(); + log.setTenantId(10519); + log.setCarId(car.getId()); + log.setGpsNo(gps.getImei()); + log.setLatitude(gps.getLat()); + log.setLongitude(gps.getLng()); + log.setDdmmyy(gps.getDdmmyy()); + log.setHhmmss(gps.getHhmmss()); + log.setSpeed(gps.getSpeed()); + + // 保存数据库 + hjmGpsLogService.save(log); + + logger.info("保存GPS轨迹日志成功: 设备={}, 速度={}, 经度={}, 纬度={}", + gps.getImei(), gps.getSpeed(), gps.getLng(), gps.getLat()); + + } catch (Exception e) { + logger.error("保存GPS轨迹日志失败: 设备={}", gps.getImei(), e); + } + } + + /** + * 保存GPS日志(兼容原有方法) + */ + private void saveGpsLog(HjmCar car, Gps gps) { + // 这里可以添加其他GPS日志相关的处理逻辑 + logger.debug("处理GPS日志: 车辆={}, GPS={}", car.getCode(), gps.getImei()); + } + + /** + * 检查电子围栏 + */ + private void checkFence(HjmCar car, Gps gps) { + try { + String gpsNo = gps.getImei(); + + // 检查围栏缓存,避免频繁计算 + String inFenceKey = redisUtil.get("inFence:" + gpsNo); + if (StrUtil.isNotBlank(inFenceKey)) { + logger.debug("围栏检查缓存命中,跳过计算: {}", gpsNo); + return; + } + + // 设置围栏检查缓存(1天) + redisUtil.set("inFence:" + gpsNo, "1", 1L, TimeUnit.DAYS); + + // 检查是否配置了围栏 + if (car.getFenceId() == null) { + logger.debug("车辆未配置围栏: {}", car.getCode()); + return; + } + + HjmFence fence = hjmFenceService.getById(car.getFenceId()); + if (fence == null) { + logger.warn("围栏不存在: {}", car.getFenceId()); + return; + } + + // 检查坐标有效性 + if (!isValidCoordinate(car.getLongitude(), car.getLatitude())) { + logger.warn("车辆坐标无效: 经度={}, 纬度={}", car.getLongitude(), car.getLatitude()); + return; + } + + // 执行围栏判断 + performFenceCheck(car, fence); + + } catch (Exception e) { + logger.error("检查电子围栏时发生错误", e); + } + } + + /** + * 检查坐标有效性 + */ + private boolean isValidCoordinate(String longitude, String latitude) { + return longitude != null && latitude != null && + !longitude.trim().isEmpty() && !latitude.trim().isEmpty(); + } + + /** + * 执行围栏判断 + */ + private void performFenceCheck(HjmCar car, HjmFence fence) { + try { + double lng = Double.parseDouble(car.getLongitude()); + double lat = Double.parseDouble(car.getLatitude()); + + Point carPoint = new Point(); + carPoint.setLongitude(lng); + carPoint.setLatitude(lat); + + // 使用多边形围栏判断 + boolean isInFence = hjmCarServiceImpl.checkPolygonFence(carPoint, fence); + + // 更新围栏状态 + car.setInFence(isInFence); + car.setUpdateTime(LocalDateTime.now()); + hjmCarService.updateById(car); + + logger.info("车辆围栏检查完成: 车辆={}, 围栏={}, 是否在围栏内={}", + car.getCode(), fence.getId(), isInFence); + + } catch (NumberFormatException e) { + logger.error("车辆坐标格式错误: 经度={}, 纬度={}", car.getLongitude(), car.getLatitude(), e); + } catch (Exception e) { + logger.error("执行围栏判断时发生错误", e); + } + } +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/HjmBxLogService.java b/src/main/java/com/gxwebsoft/hjm/service/HjmBxLogService.java new file mode 100644 index 0000000..4dd762d --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/HjmBxLogService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.hjm.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.hjm.entity.HjmBxLog; +import com.gxwebsoft.hjm.param.HjmBxLogParam; + +import java.util.List; + +/** + * 黄家明_报险记录Service + * + * @author 科技小王子 + * @since 2025-06-06 13:08:29 + */ +public interface HjmBxLogService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(HjmBxLogParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(HjmBxLogParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return HjmBxLog + */ + HjmBxLog getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/HjmCarService.java b/src/main/java/com/gxwebsoft/hjm/service/HjmCarService.java new file mode 100644 index 0000000..9dd81c1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/HjmCarService.java @@ -0,0 +1,57 @@ +package com.gxwebsoft.hjm.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.hjm.entity.HjmCar; +import com.gxwebsoft.hjm.param.HjmCarParam; + +import java.util.List; + +/** + * 黄家明_车辆管理Service + * + * @author 科技小王子 + * @since 2025-04-14 16:43:26 + */ +public interface HjmCarService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(HjmCarParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(HjmCarParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return HjmCar + */ + HjmCar getByIdRel(Integer id); + + HjmCar getByGpsNo(String gpsNo); + + boolean updateByGpsNo(HjmCar byGpsNo); + + HjmCar getByCode(String code); + + /** + * 硬删除(物理删除),绕过 @TableLogic 逻辑删除。 + */ + boolean hardRemoveById(Integer id); + + /** + * 硬删除(物理删除),绕过 @TableLogic 逻辑删除。 + */ + boolean hardRemoveByIds(List ids); +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/HjmChoicesService.java b/src/main/java/com/gxwebsoft/hjm/service/HjmChoicesService.java new file mode 100644 index 0000000..1fb113d --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/HjmChoicesService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.hjm.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.hjm.entity.HjmChoices; +import com.gxwebsoft.hjm.param.HjmChoicesParam; + +import java.util.List; + +/** + * 黄家明_选择题选项Service + * + * @author 科技小王子 + * @since 2025-06-02 12:59:49 + */ +public interface HjmChoicesService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(HjmChoicesParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(HjmChoicesParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return HjmChoices + */ + HjmChoices getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/HjmCoursesService.java b/src/main/java/com/gxwebsoft/hjm/service/HjmCoursesService.java new file mode 100644 index 0000000..25b8984 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/HjmCoursesService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.hjm.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.hjm.entity.HjmCourses; +import com.gxwebsoft.hjm.param.HjmCoursesParam; + +import java.util.List; + +/** + * 黄家明_课程Service + * + * @author 科技小王子 + * @since 2025-06-02 12:59:49 + */ +public interface HjmCoursesService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(HjmCoursesParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(HjmCoursesParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return HjmCourses + */ + HjmCourses getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/HjmExamLogService.java b/src/main/java/com/gxwebsoft/hjm/service/HjmExamLogService.java new file mode 100644 index 0000000..6340bdb --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/HjmExamLogService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.hjm.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.hjm.entity.HjmExamLog; +import com.gxwebsoft.hjm.param.HjmExamLogParam; + +import java.util.List; + +/** + * 黄家明_学习记录Service + * + * @author 科技小王子 + * @since 2025-06-05 14:32:03 + */ +public interface HjmExamLogService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(HjmExamLogParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(HjmExamLogParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return HjmExamLog + */ + HjmExamLog getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/HjmFenceService.java b/src/main/java/com/gxwebsoft/hjm/service/HjmFenceService.java new file mode 100644 index 0000000..6b353ba --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/HjmFenceService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.hjm.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.hjm.entity.HjmFence; +import com.gxwebsoft.hjm.param.HjmFenceParam; + +import java.util.List; + +/** + * 黄家明_电子围栏Service + * + * @author 科技小王子 + * @since 2025-06-03 02:08:03 + */ +public interface HjmFenceService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(HjmFenceParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(HjmFenceParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return HjmFence + */ + HjmFence getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/HjmGpsLogService.java b/src/main/java/com/gxwebsoft/hjm/service/HjmGpsLogService.java new file mode 100644 index 0000000..04537d8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/HjmGpsLogService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.hjm.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.hjm.entity.HjmGpsLog; +import com.gxwebsoft.hjm.param.HjmGpsLogParam; + +import java.util.List; + +/** + * 黄家明_gps轨迹Service + * + * @author 科技小王子 + * @since 2025-06-11 12:03:50 + */ +public interface HjmGpsLogService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(HjmGpsLogParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(HjmGpsLogParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return HjmGpsLog + */ + HjmGpsLog getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/HjmQuestionsService.java b/src/main/java/com/gxwebsoft/hjm/service/HjmQuestionsService.java new file mode 100644 index 0000000..442a252 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/HjmQuestionsService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.hjm.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.hjm.entity.HjmQuestions; +import com.gxwebsoft.hjm.param.HjmQuestionsParam; + +import java.util.List; + +/** + * 黄家明_题目Service + * + * @author 科技小王子 + * @since 2025-06-02 12:59:49 + */ +public interface HjmQuestionsService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(HjmQuestionsParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(HjmQuestionsParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return HjmQuestions + */ + HjmQuestions getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/HjmViolationService.java b/src/main/java/com/gxwebsoft/hjm/service/HjmViolationService.java new file mode 100644 index 0000000..731f8e8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/HjmViolationService.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.hjm.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.hjm.entity.HjmViolation; +import com.gxwebsoft.hjm.param.HjmViolationParam; + +import java.util.List; + +/** + * 黄家明_违章记录Service + * + * @author 科技小王子 + * @since 2025-06-20 13:48:43 + */ +public interface HjmViolationService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(HjmViolationParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(HjmViolationParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return HjmViolation + */ + HjmViolation getByIdRel(Integer id); + + void send(HjmViolation hjmViolation); +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/MqttService.java b/src/main/java/com/gxwebsoft/hjm/service/MqttService.java new file mode 100644 index 0000000..7dba245 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/MqttService.java @@ -0,0 +1,330 @@ +package com.gxwebsoft.hjm.service; + +import com.gxwebsoft.common.core.config.MqttProperties; +import org.eclipse.paho.client.mqttv3.*; +import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; +import javax.annotation.Resource; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +/** + * MQTT服务类 + * + * @author 科技小王子 + * @since 2025-07-02 + */ +@Service +public class MqttService { + + private static final Logger logger = LoggerFactory.getLogger(MqttService.class); + + @Resource + private MqttProperties mqttProperties; + + @Resource + private GpsMessageCallback gpsMessageCallback; + + private MqttClient client; + private String clientId; + private final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(); + + @PostConstruct + public void init() { + try { + logger.info("开始初始化MQTT服务..."); + + // 检查是否启用MQTT服务 + if (!mqttProperties.isEnabled()) { + logger.info("MQTT服务已禁用,跳过初始化"); + return; + } + + // 验证配置属性 + validateMqttProperties(); + + // 生成唯一的客户端ID + clientId = mqttProperties.getClientIdPrefix() + System.currentTimeMillis(); + logger.info("生成客户端ID: {}", clientId); + + // 连接MQTT服务器 + connect(); + + // 订阅主题 + subscribe(); + + // 启动连接状态监控 + startConnectionMonitor(); + + logger.info("MQTT服务初始化完成"); + + } catch (Exception e) { + logger.error("MQTT服务初始化失败", e); + // 不要抛出异常,避免影响应用启动 + // 可以在后台定期重试连接 + scheduleReconnect(); + } + } + + /** + * 验证MQTT配置属性 + */ + private void validateMqttProperties() { + if (mqttProperties == null) { + throw new IllegalArgumentException("MQTT配置属性为null,请检查配置文件和@EnableConfigurationProperties注解"); + } + + if (gpsMessageCallback == null) { + throw new IllegalArgumentException("GPS消息回调处理器为null,请检查@Component注解"); + } + + logger.info("MQTT配置验证:"); + logger.info(" Host: {}", mqttProperties.getHost()); + logger.info(" Username: {}", mqttProperties.getUsername()); + logger.info(" Password: {}", mqttProperties.getPassword() != null ? "***" : "null"); + logger.info(" ClientIdPrefix: {}", mqttProperties.getClientIdPrefix()); + logger.info(" Topic: {}", mqttProperties.getTopic()); + logger.info(" QoS: {}", mqttProperties.getQos()); + logger.info(" ConnectionTimeout: {}", mqttProperties.getConnectionTimeout()); + logger.info(" KeepAliveInterval: {}", mqttProperties.getKeepAliveInterval()); + logger.info(" AutoReconnect: {}", mqttProperties.isAutoReconnect()); + logger.info(" CleanSession: {}", mqttProperties.isCleanSession()); + + if (mqttProperties.getHost() == null || mqttProperties.getHost().trim().isEmpty()) { + throw new IllegalArgumentException("MQTT服务器地址不能为空"); + } + + if (mqttProperties.getClientIdPrefix() == null) { + throw new IllegalArgumentException("MQTT客户端ID前缀不能为空"); + } + + if (mqttProperties.getTopic() == null || mqttProperties.getTopic().trim().isEmpty()) { + throw new IllegalArgumentException("MQTT订阅主题不能为空"); + } + + logger.info("MQTT配置验证通过"); + } + + /** + * 连接MQTT服务器 + */ + private void connect() throws MqttException { + if (client != null && client.isConnected()) { + logger.debug("MQTT客户端已连接,跳过连接操作"); + return; + } + + logger.info("正在连接MQTT服务器: {}", mqttProperties.getHost()); + + // 创建MQTT客户端 + client = new MqttClient(mqttProperties.getHost(), clientId, new MemoryPersistence()); + + // 设置连接选项 + MqttConnectOptions options = createConnectOptions(); + + // 设置回调 + client.setCallback(gpsMessageCallback); + + // 连接服务器 + client.connect(options); + + logger.info("MQTT连接成功 - 服务器: {}, 客户端ID: {}", mqttProperties.getHost(), clientId); + } + + /** + * 创建连接选项 + */ + private MqttConnectOptions createConnectOptions() { + MqttConnectOptions options = new MqttConnectOptions(); + + // 基本连接参数 + options.setCleanSession(mqttProperties.isCleanSession()); + options.setUserName(mqttProperties.getUsername()); + options.setPassword(mqttProperties.getPassword().toCharArray()); + + // 超时和心跳设置 + options.setConnectionTimeout(mqttProperties.getConnectionTimeout()); + options.setKeepAliveInterval(mqttProperties.getKeepAliveInterval()); + + // 自动重连设置 + options.setAutomaticReconnect(mqttProperties.isAutoReconnect()); + + // 遗嘱消息设置(可选) + // options.setWill("client/disconnect", "Client disconnected".getBytes(), 1, false); + + logger.debug("MQTT连接选项配置完成 - 自动重连: {}, 清除会话: {}", + options.isAutomaticReconnect(), options.isCleanSession()); + + return options; + } + + /** + * 订阅主题 + */ + public void subscribe() throws MqttException { + if (client == null || !client.isConnected()) { + logger.warn("MQTT客户端未连接,无法订阅主题"); + return; + } + + String topic = mqttProperties.getTopic(); + int qos = mqttProperties.getQos(); + + client.subscribe(topic, qos); + logger.info("MQTT主题订阅成功 - 主题: {}, QoS: {}", topic, qos); + } + + /** + * 发布消息 + */ + public void publish(String topic, String payload) throws MqttException { + publish(topic, payload, mqttProperties.getQos(), false); + } + + /** + * 发布消息(指定QoS和保留标志) + */ + public void publish(String topic, String payload, int qos, boolean retained) throws MqttException { + if (client == null || !client.isConnected()) { + throw new MqttException(MqttException.REASON_CODE_CLIENT_NOT_CONNECTED); + } + + MqttMessage message = new MqttMessage(); + message.setPayload(payload.getBytes()); + message.setQos(qos); + message.setRetained(retained); + + client.publish(topic, message); + + logger.debug("MQTT消息发布 - 主题: {}, QoS: {}, 保留: {}, 消息长度: {}", + topic, qos, retained, payload.length()); + + // 可选:等待发布完成 + // token.waitForCompletion(); + } + + /** + * 检查连接状态 + */ + public boolean isConnected() { + return client != null && client.isConnected(); + } + + /** + * 获取客户端信息 + */ + public String getClientInfo() { + if (client == null) { + return "MQTT客户端未初始化"; + } + + return String.format("客户端ID: %s, 连接状态: %s, 服务器: %s", + clientId, + client.isConnected() ? "已连接" : "未连接", + mqttProperties.getHost()); + } + + /** + * 启动连接状态监控 + */ + private void startConnectionMonitor() { + scheduler.scheduleWithFixedDelay(() -> { + try { + if (!isConnected()) { + logger.warn("检测到MQTT连接断开,尝试重新连接..."); + reconnect(); + } + } catch (Exception e) { + logger.error("MQTT连接监控异常", e); + } + }, 30, 30, TimeUnit.SECONDS); // 每30秒检查一次连接状态 + + logger.debug("MQTT连接状态监控已启动"); + } + + /** + * 重新连接 + */ + public void reconnect() { + try { + if (client != null && client.isConnected()) { + return; + } + + logger.info("正在重新连接MQTT服务器..."); + + // 先断开现有连接 + disconnect(); + + // 重新连接 + connect(); + subscribe(); + + logger.info("MQTT重新连接成功"); + + } catch (Exception e) { + logger.error("MQTT重新连接失败", e); + // 安排下次重试 + scheduleReconnect(); + } + } + + /** + * 安排重新连接 + */ + private void scheduleReconnect() { + scheduler.schedule(() -> { + logger.info("执行定时重连任务..."); + reconnect(); + }, 60, TimeUnit.SECONDS); // 60秒后重试 + } + + /** + * 断开连接 + */ + public void disconnect() { + try { + if (client != null && client.isConnected()) { + client.disconnect(); + logger.info("MQTT连接已断开"); + } + } catch (MqttException e) { + logger.error("断开MQTT连接失败", e); + } + } + + /** + * 应用关闭时清理资源 + */ + @PreDestroy + public void destroy() { + logger.info("正在关闭MQTT服务..."); + + try { + // 关闭定时任务 + scheduler.shutdown(); + if (!scheduler.awaitTermination(5, TimeUnit.SECONDS)) { + scheduler.shutdownNow(); + } + + // 断开MQTT连接 + if (client != null) { + if (client.isConnected()) { + client.disconnect(); + } + client.close(); + } + + logger.info("MQTT服务已关闭"); + + } catch (Exception e) { + logger.error("关闭MQTT服务时发生错误", e); + } + } +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/WxNotificationService.java b/src/main/java/com/gxwebsoft/hjm/service/WxNotificationService.java new file mode 100644 index 0000000..42873a7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/WxNotificationService.java @@ -0,0 +1,82 @@ +package com.gxwebsoft.hjm.service; + +import com.gxwebsoft.hjm.dto.SubscribeMessageRequest; +import com.gxwebsoft.hjm.dto.TemplateMessageRequest; + +import java.util.List; + +/** + * 微信通知服务接口 + * + * @author 科技小王子 + * @since 2025-06-15 + */ +public interface WxNotificationService { + + /** + * 发送微信公众号模板消息 + * + * @param tenantId 租户ID + * @param request 模板消息请求 + * @return 发送结果 + */ + boolean sendTemplateMessage(Integer tenantId, TemplateMessageRequest request); + + /** + * 发送微信小程序订阅消息 + * + * @param tenantId 租户ID + * @param request 订阅消息请求 + * @return 发送结果 + */ + boolean sendSubscribeMessage(Integer tenantId, SubscribeMessageRequest request); + + /** + * 批量发送模板消息 + * + * @param tenantId 租户ID + * @param requests 模板消息请求列表 + * @return 发送结果统计 + */ + BatchSendResult batchSendTemplateMessage(Integer tenantId, List requests); + + /** + * 获取微信公众号模板列表 + * + * @param tenantId 租户ID + * @return 模板列表 + */ + String getTemplateList(Integer tenantId); + + /** + * 批量发送结果 + */ + class BatchSendResult { + private int successCount; + private int failCount; + private int totalCount; + + public BatchSendResult(int successCount, int failCount) { + this.successCount = successCount; + this.failCount = failCount; + this.totalCount = successCount + failCount; + } + + public int getSuccessCount() { + return successCount; + } + + public int getFailCount() { + return failCount; + } + + public int getTotalCount() { + return totalCount; + } + + @Override + public String toString() { + return String.format("总计:%d,成功:%d,失败:%d", totalCount, successCount, failCount); + } + } +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/impl/HjmBxLogServiceImpl.java b/src/main/java/com/gxwebsoft/hjm/service/impl/HjmBxLogServiceImpl.java new file mode 100644 index 0000000..edae174 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/impl/HjmBxLogServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.hjm.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.hjm.mapper.HjmBxLogMapper; +import com.gxwebsoft.hjm.service.HjmBxLogService; +import com.gxwebsoft.hjm.entity.HjmBxLog; +import com.gxwebsoft.hjm.param.HjmBxLogParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 黄家明_报险记录Service实现 + * + * @author 科技小王子 + * @since 2025-06-06 13:08:29 + */ +@Service +public class HjmBxLogServiceImpl extends ServiceImpl implements HjmBxLogService { + + @Override + public PageResult pageRel(HjmBxLogParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(HjmBxLogParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public HjmBxLog getByIdRel(Integer id) { + HjmBxLogParam param = new HjmBxLogParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/impl/HjmCarServiceImpl.java b/src/main/java/com/gxwebsoft/hjm/service/impl/HjmCarServiceImpl.java new file mode 100644 index 0000000..0d6b1df --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/impl/HjmCarServiceImpl.java @@ -0,0 +1,419 @@ +package com.gxwebsoft.hjm.service.impl; + +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.support.geo.Point; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.hjm.entity.HjmFence; +import com.gxwebsoft.hjm.mapper.HjmCarMapper; +import com.gxwebsoft.hjm.service.HjmCarService; +import com.gxwebsoft.hjm.entity.HjmCar; +import com.gxwebsoft.hjm.param.HjmCarParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.hjm.service.HjmFenceService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +/** + * 黄家明_车辆管理Service实现 + * + * @author 科技小王子 + * @since 2025-04-14 16:43:26 + */ +@Service +public class HjmCarServiceImpl extends ServiceImpl implements HjmCarService { + @Resource + private HjmFenceService hjmFenceService; + @Autowired + private HjmCarService hjmCarService; + + + @Override + public PageResult pageRel(HjmCarParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(HjmCarParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public HjmCar getByIdRel(Integer id) { + HjmCarParam param = new HjmCarParam(); + param.setId(id); + final HjmCar hjmCar = param.getOne(baseMapper.selectListRel(param)); + hjmCar.setFence(hjmFenceService.getById(hjmCar.getFenceId())); + return hjmCar; + } + + @Override + public HjmCar getByGpsNo(String gpsNo) { + return baseMapper.getByGpsNo(gpsNo); + } + + @Override + public boolean updateByGpsNo(HjmCar byGpsNo) { + return baseMapper.updateByGpsNo(byGpsNo); + } + + @Override + public HjmCar getByCode(String code) { + final HjmCar byCode = baseMapper.getByCode(code); + + // 检查车辆是否存在 + if (byCode == null) { + return null; + } + + // 检查是否有围栏ID + if (byCode.getFenceId() == null) { + return byCode; + } + + final HjmFence fence = hjmFenceService.getById(byCode.getFenceId()); + byCode.setFence(fence); + + // 检查围栏是否存在 + if (fence == null) { + return byCode; + } + + // 检查车辆坐标是否有效 + if (byCode.getLongitude() == null || byCode.getLatitude() == null || + byCode.getLongitude().trim().isEmpty() || byCode.getLatitude().trim().isEmpty()) { + return byCode; + } + + try { + // 字符串转为浮点 + final double lng = Double.parseDouble(byCode.getLongitude()); + final double lat = Double.parseDouble(byCode.getLatitude()); + Point carPoint = new Point(); + carPoint.setLongitude(lng); + carPoint.setLatitude(lat); + + boolean isInFence = false; + + // 使用多边形围栏判断 + isInFence = checkPolygonFence(carPoint, fence); + + // 将围栏判断结果保存到车辆对象中 + byCode.setInFence(isInFence); + System.out.println("车辆 " + code + " 是否在围栏内: " + isInFence); + byCode.setUpdateTime(LocalDateTime.now()); + hjmCarService.updateById(byCode); + return byCode; + + } catch (NumberFormatException e) { + System.err.println("车辆坐标格式错误: " + e.getMessage()); + return byCode; + } catch (Exception e) { + System.err.println("判断围栏时发生错误: " + e.getMessage()); + e.printStackTrace(); + return byCode; + } + } + + @Override + public boolean hardRemoveById(Integer id) { + if (id == null) { + return false; + } + return baseMapper.hardDeleteById(id) > 0; + } + + @Override + public boolean hardRemoveByIds(List ids) { + if (ids == null || ids.isEmpty()) { + return false; + } + return baseMapper.hardDeleteBatchIds(ids) > 0; + } + + + + /** + * 判断点是否在多边形内 + * @param point 测试点 + * @param pts 多边形的点 + * @return boolean true:在多边形内, false:在多边形外 + * @throws + * @Title: IsPointInPoly + */ + public static boolean isInPolygon(Point point, List pts) { + + int N = pts.size(); + boolean boundOrVertex = true; + //交叉点数量 + int intersectCount = 0; + //浮点类型计算时候与0比较时候的容差 + double precision = 2e-10; + //临近顶点 + Point p1, p2; + //当前点 + Point p = point; + + p1 = pts.get(0); + for (int i = 1; i <= N; ++i) { + if (p.equals(p1)) { + return boundOrVertex; + } + + p2 = pts.get(i % N); + if (p.getLongitude() < Math.min(p1.getLongitude(), p2.getLongitude()) || p.getLongitude() > Math.max(p1.getLongitude(), p2.getLongitude())) { + p1 = p2; + continue; + } + + //射线穿过算法 + if (p.getLongitude() > Math.min(p1.getLongitude(), p2.getLongitude()) && p.getLongitude() < Math.max(p1.getLongitude(), p2.getLongitude())) { + if (p.getLatitude() <= Math.max(p1.getLatitude(), p2.getLatitude())) { + if (p1.getLongitude() == p2.getLongitude() && p.getLatitude() >= Math.min(p1.getLatitude(), p2.getLatitude())) { + return boundOrVertex; + } + + if (p1.getLatitude() == p2.getLatitude()) { + if (p1.getLatitude() == p.getLatitude()) { + return boundOrVertex; + } else { + ++intersectCount; + } + } else { + double xinters = (p.getLongitude() - p1.getLongitude()) * (p2.getLatitude() - p1.getLatitude()) / (p2.getLongitude() - p1.getLongitude()) + p1.getLatitude(); + if (Math.abs(p.getLatitude() - xinters) < precision) { + return boundOrVertex; + } + + if (p.getLatitude() < xinters) { + ++intersectCount; + } + } + } + } else { + if (p.getLongitude() == p2.getLongitude() && p.getLatitude() <= p2.getLatitude()) { + Point p3 = pts.get((i + 1) % N); + if (p.getLongitude() >= Math.min(p1.getLongitude(), p3.getLongitude()) && p.getLongitude() <= Math.max(p1.getLongitude(), p3.getLongitude())) { + ++intersectCount; + } else { + intersectCount += 2; + } + } + } + p1 = p2; + } + return intersectCount % 2 != 0; + } + + + + /** + * 检查点是否在多边形围栏内 + * @param carPoint 车辆位置点 + * @param fence 围栏信息 + * @return boolean true:在围栏内, false:在围栏外 + */ + public boolean checkPolygonFence(Point carPoint, HjmFence fence) { + if (fence.getPoints() == null || fence.getPoints().trim().isEmpty()) { + System.err.println("多边形围栏点数据为空"); + return false; + } + + try { + final String points = fence.getPoints(); + + // 支持多种分隔符格式:逗号、分号、空格等 + String[] coordinates = parseCoordinates(points); + + // 检查点数据是否为偶数(经度,纬度 成对出现) + if (coordinates.length % 2 != 0) { + System.err.println("多边形围栏点数据格式错误,应为偶数个数值。当前数据: " + points); + return false; + } + + List pts = new ArrayList<>(); + for (int i = 0; i < coordinates.length; i += 2) { + try { + Point point = new Point(); + double lng = Double.parseDouble(coordinates[i].trim()); + double lat = Double.parseDouble(coordinates[i + 1].trim()); + + // 验证坐标范围 + if (lng < -180 || lng > 180) { + System.err.println("经度超出有效范围[-180,180]: " + lng); + return false; + } + if (lat < -90 || lat > 90) { + System.err.println("纬度超出有效范围[-90,90]: " + lat); + return false; + } + + point.setLongitude(lng); + point.setLatitude(lat); + pts.add(point); + + System.out.println("解析坐标点 " + (i/2 + 1) + ": (" + lng + ", " + lat + ")"); + + } catch (NumberFormatException e) { + System.err.println("坐标解析失败,位置 " + (i/2 + 1) + ": [" + coordinates[i] + ", " + coordinates[i + 1] + "]"); + throw e; + } + } + + // 至少需要3个点才能构成多边形 + if (pts.size() < 3) { + System.err.println("多边形围栏至少需要3个点"); + return false; + } + + return isInPolygon(carPoint, pts); + + } catch (NumberFormatException e) { + System.err.println("多边形围栏点坐标格式错误: " + e.getMessage()); + return false; + } catch (Exception e) { + System.err.println("检查多边形围栏时发生错误: " + e.getMessage()); + e.printStackTrace(); + return false; + } + } + + /** + * 解析坐标字符串,支持多种分隔符格式 + * @param coordinatesStr 坐标字符串 + * @return 坐标数组 + */ + private String[] parseCoordinates(String coordinatesStr) { + if (coordinatesStr == null || coordinatesStr.trim().isEmpty()) { + return new String[0]; + } + + // 移除首尾空格 + String cleanStr = coordinatesStr.trim(); + System.out.println("原始坐标数据: " + cleanStr); + + // 检查是否是混合分隔符格式:纬度,经度;纬度,经度;... + if (cleanStr.contains(";") && cleanStr.contains(",")) { + System.out.println("检测到混合分隔符格式(分号分隔点,逗号分隔经纬度)"); + return parseMixedFormat(cleanStr); + } + + // 支持的单一分隔符格式 + String[] coordinates; + + if (cleanStr.contains(";")) { + // 使用分号分隔 + coordinates = cleanStr.split(";"); + System.out.println("使用分号分隔符解析坐标"); + } else if (cleanStr.contains(",")) { + // 使用逗号分隔 + coordinates = cleanStr.split(","); + System.out.println("使用逗号分隔符解析坐标"); + } else { + // 使用空格或制表符分隔 + coordinates = cleanStr.split("\\s+"); + System.out.println("使用空格分隔符解析坐标"); + } + + // 清理每个坐标值的空格 + for (int i = 0; i < coordinates.length; i++) { + coordinates[i] = coordinates[i].trim(); + } + + return coordinates; + } + + /** + * 解析混合分隔符格式:纬度,经度;纬度,经度;... + * @param coordinatesStr 坐标字符串 + * @return 坐标数组(按经度,纬度顺序) + */ + private String[] parseMixedFormat(String coordinatesStr) { + // 先按分号分隔得到各个坐标点 + String[] points = coordinatesStr.split(";"); + System.out.println("分解出 " + points.length + " 个坐标点"); + + // 创建结果数组,每个点有2个坐标值 + String[] coordinates = new String[points.length * 2]; + + for (int i = 0; i < points.length; i++) { + String point = points[i].trim(); + String[] latLng = point.split(","); + + if (latLng.length != 2) { + throw new IllegalArgumentException("坐标点格式错误: " + point + ",应为 '纬度,经度' 格式"); + } + + String lat = latLng[0].trim(); + String lng = latLng[1].trim(); + + // 注意:输入格式是纬度,经度,但我们需要按经度,纬度的顺序存储 + coordinates[i * 2] = lng; // 经度 + coordinates[i * 2 + 1] = lat; // 纬度 + + System.out.println("坐标点 " + (i + 1) + ": 纬度=" + lat + ", 经度=" + lng + " -> 存储为 (" + lng + ", " + lat + ")"); + } + + return coordinates; + } + + /** + * 通用的围栏判断方法(只支持多边形围栏) + * @param carPoint 车辆位置点 + * @param fence 围栏信息 + * @return boolean true:在围栏内, false:在围栏外 + */ + public boolean isPointInFence(Point carPoint, HjmFence fence) { + if (carPoint == null || fence == null) { + return false; + } + + // 只使用多边形围栏判断 + return checkPolygonFence(carPoint, fence); + } + + /** + * 测试坐标解析功能 + * @param coordinatesStr 坐标字符串 + */ + public void testCoordinateParsing(String coordinatesStr) { + System.out.println("=== 测试坐标解析 ==="); + System.out.println("输入: " + coordinatesStr); + + try { + String[] coordinates = parseCoordinates(coordinatesStr); + System.out.println("解析结果: " + java.util.Arrays.toString(coordinates)); + System.out.println("坐标点数量: " + coordinates.length / 2); + + if (coordinates.length % 2 == 0 && coordinates.length >= 6) { + System.out.println("格式验证: ✓ 通过"); + for (int i = 0; i < coordinates.length; i += 2) { + double lng = Double.parseDouble(coordinates[i].trim()); + double lat = Double.parseDouble(coordinates[i + 1].trim()); + System.out.println("最终坐标点 " + (i/2 + 1) + ": 经度=" + lng + ", 纬度=" + lat); + } + } else { + System.out.println("格式验证: ✗ 失败 - 需要至少3个点(6个数值),当前有 " + coordinates.length + " 个数值"); + } + } catch (Exception e) { + System.err.println("解析失败: " + e.getMessage()); + e.printStackTrace(); + } + System.out.println("=================="); + } + + + +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/impl/HjmChoicesServiceImpl.java b/src/main/java/com/gxwebsoft/hjm/service/impl/HjmChoicesServiceImpl.java new file mode 100644 index 0000000..b777b12 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/impl/HjmChoicesServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.hjm.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.hjm.mapper.HjmChoicesMapper; +import com.gxwebsoft.hjm.service.HjmChoicesService; +import com.gxwebsoft.hjm.entity.HjmChoices; +import com.gxwebsoft.hjm.param.HjmChoicesParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 黄家明_选择题选项Service实现 + * + * @author 科技小王子 + * @since 2025-06-02 12:59:49 + */ +@Service +public class HjmChoicesServiceImpl extends ServiceImpl implements HjmChoicesService { + + @Override + public PageResult pageRel(HjmChoicesParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(HjmChoicesParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public HjmChoices getByIdRel(Integer id) { + HjmChoicesParam param = new HjmChoicesParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/impl/HjmCoursesServiceImpl.java b/src/main/java/com/gxwebsoft/hjm/service/impl/HjmCoursesServiceImpl.java new file mode 100644 index 0000000..78ff215 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/impl/HjmCoursesServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.hjm.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.hjm.mapper.HjmCoursesMapper; +import com.gxwebsoft.hjm.service.HjmCoursesService; +import com.gxwebsoft.hjm.entity.HjmCourses; +import com.gxwebsoft.hjm.param.HjmCoursesParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 黄家明_课程Service实现 + * + * @author 科技小王子 + * @since 2025-06-02 12:59:49 + */ +@Service +public class HjmCoursesServiceImpl extends ServiceImpl implements HjmCoursesService { + + @Override + public PageResult pageRel(HjmCoursesParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(HjmCoursesParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public HjmCourses getByIdRel(Integer id) { + HjmCoursesParam param = new HjmCoursesParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/impl/HjmExamLogServiceImpl.java b/src/main/java/com/gxwebsoft/hjm/service/impl/HjmExamLogServiceImpl.java new file mode 100644 index 0000000..3ae9dff --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/impl/HjmExamLogServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.hjm.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.hjm.mapper.HjmExamLogMapper; +import com.gxwebsoft.hjm.service.HjmExamLogService; +import com.gxwebsoft.hjm.entity.HjmExamLog; +import com.gxwebsoft.hjm.param.HjmExamLogParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 黄家明_学习记录Service实现 + * + * @author 科技小王子 + * @since 2025-06-05 14:32:03 + */ +@Service +public class HjmExamLogServiceImpl extends ServiceImpl implements HjmExamLogService { + + @Override + public PageResult pageRel(HjmExamLogParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(HjmExamLogParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public HjmExamLog getByIdRel(Integer id) { + HjmExamLogParam param = new HjmExamLogParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/impl/HjmFenceServiceImpl.java b/src/main/java/com/gxwebsoft/hjm/service/impl/HjmFenceServiceImpl.java new file mode 100644 index 0000000..4d71a3c --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/impl/HjmFenceServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.hjm.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.hjm.mapper.HjmFenceMapper; +import com.gxwebsoft.hjm.service.HjmFenceService; +import com.gxwebsoft.hjm.entity.HjmFence; +import com.gxwebsoft.hjm.param.HjmFenceParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 黄家明_电子围栏Service实现 + * + * @author 科技小王子 + * @since 2025-06-03 02:08:03 + */ +@Service +public class HjmFenceServiceImpl extends ServiceImpl implements HjmFenceService { + + @Override + public PageResult pageRel(HjmFenceParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(HjmFenceParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public HjmFence getByIdRel(Integer id) { + HjmFenceParam param = new HjmFenceParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/impl/HjmGpsLogServiceImpl.java b/src/main/java/com/gxwebsoft/hjm/service/impl/HjmGpsLogServiceImpl.java new file mode 100644 index 0000000..641afb6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/impl/HjmGpsLogServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.hjm.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.hjm.mapper.HjmGpsLogMapper; +import com.gxwebsoft.hjm.service.HjmGpsLogService; +import com.gxwebsoft.hjm.entity.HjmGpsLog; +import com.gxwebsoft.hjm.param.HjmGpsLogParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 黄家明_gps轨迹Service实现 + * + * @author 科技小王子 + * @since 2025-06-11 12:03:50 + */ +@Service +public class HjmGpsLogServiceImpl extends ServiceImpl implements HjmGpsLogService { + + @Override + public PageResult pageRel(HjmGpsLogParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(HjmGpsLogParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public HjmGpsLog getByIdRel(Integer id) { + HjmGpsLogParam param = new HjmGpsLogParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/impl/HjmQuestionsServiceImpl.java b/src/main/java/com/gxwebsoft/hjm/service/impl/HjmQuestionsServiceImpl.java new file mode 100644 index 0000000..50903af --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/impl/HjmQuestionsServiceImpl.java @@ -0,0 +1,63 @@ +package com.gxwebsoft.hjm.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.hjm.entity.HjmChoices; +import com.gxwebsoft.hjm.mapper.HjmQuestionsMapper; +import com.gxwebsoft.hjm.service.HjmChoicesService; +import com.gxwebsoft.hjm.service.HjmQuestionsService; +import com.gxwebsoft.hjm.entity.HjmQuestions; +import com.gxwebsoft.hjm.param.HjmQuestionsParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 黄家明_题目Service实现 + * + * @author 科技小王子 + * @since 2025-06-02 12:59:49 + */ +@Service +public class HjmQuestionsServiceImpl extends ServiceImpl implements HjmQuestionsService { + @Resource + private HjmChoicesService hjmChoicesService; + + @Override + public PageResult pageRel(HjmQuestionsParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + final Set collectByIds = list.stream().map(HjmQuestions::getId).collect(Collectors.toSet()); + final List choices = hjmChoicesService.list(new LambdaQueryWrapper().in(HjmChoices::getQuestionId, collectByIds)); + final Map> collectByQuestionId = choices.stream().collect(Collectors.groupingBy(HjmChoices::getQuestionId)); + list.forEach(item -> { + final List choicesList = collectByQuestionId.get(item.getId()); + item.setChoicesList(choicesList); + }); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(HjmQuestionsParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public HjmQuestions getByIdRel(Integer id) { + HjmQuestionsParam param = new HjmQuestionsParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/impl/HjmViolationServiceImpl.java b/src/main/java/com/gxwebsoft/hjm/service/impl/HjmViolationServiceImpl.java new file mode 100644 index 0000000..7619672 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/impl/HjmViolationServiceImpl.java @@ -0,0 +1,107 @@ +package com.gxwebsoft.hjm.service.impl; + +import cn.hutool.core.util.ObjUtil; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.service.impl.UserServiceImpl; +import com.gxwebsoft.hjm.dto.TemplateMessageRequest; +import com.gxwebsoft.hjm.entity.HjmCar; +import com.gxwebsoft.hjm.entity.HjmViolation; +import com.gxwebsoft.hjm.mapper.HjmViolationMapper; +import com.gxwebsoft.hjm.param.HjmViolationParam; +import com.gxwebsoft.hjm.service.HjmCarService; +import com.gxwebsoft.hjm.service.HjmViolationService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +/** + * 黄家明_违章记录Service实现 + * + * @author 科技小王子 + * @since 2025-06-20 13:48:43 + */ +@Service +public class HjmViolationServiceImpl extends ServiceImpl implements HjmViolationService { + + @Resource + private HjmCarService hjmCarService; + @Resource + private WxNotificationServiceImpl wxNotificationService; + @Resource + private UserServiceImpl userService; + + @Override + public PageResult pageRel(HjmViolationParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(HjmViolationParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public HjmViolation getByIdRel(Integer id) { + HjmViolationParam param = new HjmViolationParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public void send(HjmViolation hjmViolation) { + final HjmCar item = hjmCarService.getByCode(hjmViolation.getCode()); + + // 获取所有的邮政协会/管局工作人员 + final List users = userService.listByAlert(); + if (ObjUtil.isEmpty(item)) { + return; + } + users.forEach(d -> { + item.setToUser(d.getOfficeOpenid()); + item.setAppId("wxd2723d1afd9c4553"); + sendTemplateMessage(item, hjmViolation); + }); + + } + + public void sendTemplateMessage(HjmCar item, HjmViolation violation) { + // 发送模板消息 + final TemplateMessageRequest templateMessageRequest = new TemplateMessageRequest(); + templateMessageRequest.setToUser(item.getToUser()); + templateMessageRequest.setTemplateId("gZshS5yJs47BhIFodo9yenZcmsVwJOCKkL-SYaZTioU"); + final TemplateMessageRequest.MiniProgram miniProgram = new TemplateMessageRequest.MiniProgram(); + miniProgram.setAppid(item.getAppId()); + miniProgram.setPagepath("hjm/violation/detail?id=".concat(item.getCode())); +// miniProgram.setPagepath("hjm/query?id=".concat(item.getCode())); + templateMessageRequest.setMiniprogram(miniProgram); + HashMap map = new HashMap<>(); + map.put("thing7", new TemplateMessageRequest.TemplateDataItem(item.getDriverName())); + map.put("phone_number8", new TemplateMessageRequest.TemplateDataItem(item.getDriverPhone())); + map.put("const4", new TemplateMessageRequest.TemplateDataItem("违章")); + map.put("car_number1", new TemplateMessageRequest.TemplateDataItem(item.getCode())); + // 获取当前时间,格式2024年1月1号 10:20 + map.put("time2", new TemplateMessageRequest.TemplateDataItem( + new SimpleDateFormat("yyyy年M月d日 HH:mm").format(new Date()), "#173177") + ); + System.out.println("map = " + map); + templateMessageRequest.setData(map); + boolean success = wxNotificationService.sendTemplateMessage(10519, templateMessageRequest); + System.out.println("2向 = " + item.getDriverName() + "发送消息成功:" + success); + } + +} diff --git a/src/main/java/com/gxwebsoft/hjm/service/impl/WxNotificationServiceImpl.java b/src/main/java/com/gxwebsoft/hjm/service/impl/WxNotificationServiceImpl.java new file mode 100644 index 0000000..4ab0c66 --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/service/impl/WxNotificationServiceImpl.java @@ -0,0 +1,289 @@ +package com.gxwebsoft.hjm.service.impl; + +import cn.hutool.core.util.CharsetUtil; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSONObject; +import com.gxwebsoft.cms.entity.CmsWebsiteField; +import com.gxwebsoft.cms.service.CmsWebsiteFieldService; +import com.gxwebsoft.common.core.utils.WxOfficialUtil; +import com.gxwebsoft.common.system.entity.Setting; +import com.gxwebsoft.common.system.service.SettingService; +import com.gxwebsoft.hjm.dto.SubscribeMessageRequest; +import com.gxwebsoft.hjm.dto.SubscribeMessageRequest.SubscribeDataItem; +import com.gxwebsoft.hjm.dto.TemplateMessageRequest; +import com.gxwebsoft.hjm.dto.TemplateMessageRequest.TemplateDataItem; +import com.gxwebsoft.hjm.service.WxNotificationService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * 微信通知服务实现 + * + * @author 科技小王子 + * @since 2025-06-15 + */ +@Slf4j +@Service +public class WxNotificationServiceImpl implements WxNotificationService { + + @Resource + private SettingService settingService; + + @Resource + private WxOfficialUtil wxOfficialUtil; + + @Resource + private StringRedisTemplate stringRedisTemplate; + + @Resource + private CmsWebsiteFieldService cmsWebsiteFieldService; + + @Override + public boolean sendTemplateMessage(Integer tenantId, TemplateMessageRequest request) { + try { + String accessToken = getWxAccessToken(tenantId); + System.out.println("发送模板消息 accessToken = " + accessToken); + return sendWxTemplateMessage(accessToken, request); + } catch (Exception e) { + log.error("发送模板消息失败", e); + return false; + } + } + + @Override + public boolean sendSubscribeMessage(Integer tenantId, SubscribeMessageRequest request) { + try { + String accessToken = getWxAccessToken(tenantId); + return sendWxSubscribeMessage(accessToken, request); + } catch (Exception e) { + log.error("发送订阅消息失败", e); + return false; + } + } + + @Override + public BatchSendResult batchSendTemplateMessage(Integer tenantId, List requests) { + int successCount = 0; + int failCount = 0; + + try { + String accessToken = getWxAccessToken(tenantId); + + for (TemplateMessageRequest request : requests) { + boolean success = sendWxTemplateMessage(accessToken, request); + if (success) { + successCount++; + } else { + failCount++; + } + + // 避免频率限制,每次发送间隔100ms + Thread.sleep(100); + } + } catch (Exception e) { + log.error("批量发送模板消息失败", e); + failCount += (requests.size() - successCount - failCount); + } + + return new BatchSendResult(successCount, failCount); + } + + @Override + public String getTemplateList(Integer tenantId) { + try { + String accessToken = getWxAccessToken(tenantId); + String url = "https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token=" + accessToken; + + String response = HttpUtil.get(url, CharsetUtil.CHARSET_UTF_8); + return response; + } catch (Exception e) { + log.error("获取模板列表失败", e); + return null; + } + } + + /** + * 获取微信公众号Access Token + */ + private String getWxAccessToken(Integer tenantId) { + String cacheKey = "wx_official_access_token:" + tenantId; + + // 先从缓存获取,支持JSON格式 + String cachedValue = stringRedisTemplate.opsForValue().get(cacheKey); + if (cachedValue != null) { + try { + // 尝试解析JSON格式的缓存 + JSONObject cachedJson = JSONObject.parseObject(cachedValue); + String accessToken = cachedJson.getString("access_token"); + if (accessToken != null) { + System.out.println("从缓存获取到微信公众号access_token: " + accessToken.substring(0, Math.min(10, accessToken.length())) + "..."); + return accessToken; + } + } catch (Exception e) { + // 如果解析失败,可能是旧格式的纯字符串token + System.out.println("微信公众号缓存token格式异常,使用原值: " + e.getMessage()); + return cachedValue; + } + } + + // 缓存中没有,重新获取 + try { + // 获取微信公众号配置 + String appId = "wx100365d412078b8c"; + String appSecret = "bba73c9fc8f5f7d0edc4de50786a8c62"; + + if (appId == null || appSecret == null) { + throw new RuntimeException("微信公众号配置不完整"); + } + + final CmsWebsiteField officialAppId = cmsWebsiteFieldService.getByCodeRel("OfficialAppId"); + final CmsWebsiteField officialAppSecret = cmsWebsiteFieldService.getByCodeRel("OfficialAppSecret"); + + System.out.println("officialAppSecret = " + officialAppSecret); + System.out.println("officialAppId = " + officialAppId); + + if(officialAppId != null){ + appId = officialAppId.getValue(); + } + if(officialAppSecret != null){ + appSecret = officialAppSecret.getValue(); + } + + // 调用微信API获取access_token + String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + + appId + "&secret=" + appSecret; + + System.out.println("调用微信公众号API获取token - 租户ID: " + tenantId); + String response = HttpUtil.get(url, CharsetUtil.CHARSET_UTF_8); + System.out.println("微信公众号API响应: " + response); + JSONObject jsonObject = JSONObject.parseObject(response); + + String accessToken = jsonObject.getString("access_token"); + Integer expiresIn = jsonObject.getInteger("expires_in"); + + if (accessToken == null) { + String errorMsg = jsonObject.getString("errmsg"); + throw new RuntimeException("获取access_token失败: " + errorMsg); + } + + // 缓存完整的JSON响应,与其他方法保持一致 + int cacheSeconds = expiresIn != null ? expiresIn - 300 : 7200 - 300; + stringRedisTemplate.opsForValue().set(cacheKey, response, cacheSeconds, TimeUnit.SECONDS); + + System.out.println("获取微信公众号access_token成功,租户ID: " + tenantId); + return accessToken; + + } catch (Exception e) { + log.error("获取微信公众号access_token失败", e); + throw new RuntimeException("获取access_token失败: " + e.getMessage()); + } + } + + /** + * 发送微信模板消息 + */ + private boolean sendWxTemplateMessage(String accessToken, TemplateMessageRequest request) { + try { + String url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken; + + // 构建请求数据 + JSONObject data = new JSONObject(); + data.put("touser", request.getToUser()); + data.put("template_id", request.getTemplateId()); + data.put("url", request.getUrl()); + data.put("topcolor", request.getTopColor()); + + // 构建模板数据 + JSONObject templateData = new JSONObject(); + if (request.getData() != null) { + for (Map.Entry entry : request.getData().entrySet()) { + JSONObject item = new JSONObject(); + item.put("value", entry.getValue().getValue()); + item.put("color", entry.getValue().getColor()); + templateData.put(entry.getKey(), item); + } + } + data.put("data", templateData); + + // 小程序跳转 + if (request.getMiniprogram() != null) { + JSONObject miniprogram = new JSONObject(); + miniprogram.put("appid", request.getMiniprogram().getAppid()); + miniprogram.put("pagepath", request.getMiniprogram().getPagepath()); + data.put("miniprogram", miniprogram); + } + + // 发送请求 + String response = HttpUtil.post(url, data.toJSONString()); + JSONObject result = JSONObject.parseObject(response); + + Integer errcode = result.getInteger("errcode"); + String errmsg = result.getString("errmsg"); + + if (errcode != null && errcode == 0) { + log.info("模板消息发送成功: {}", result.getString("msgid")); + return true; + } else { + log.error("模板消息发送失败: errcode={}, errmsg={}", errcode, errmsg); + return false; + } + + } catch (Exception e) { + log.error("发送微信模板消息异常", e); + return false; + } + } + + /** + * 发送微信订阅消息 + */ + private boolean sendWxSubscribeMessage(String accessToken, SubscribeMessageRequest request) { + try { + String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + accessToken; + + // 构建请求数据 + JSONObject data = new JSONObject(); + data.put("touser", request.getToUser()); + data.put("template_id", request.getTemplateId()); + data.put("page", request.getPage()); + data.put("miniprogram_state", request.getMiniprogramState()); + data.put("lang", request.getLang()); + + // 构建订阅消息数据 + JSONObject subscribeData = new JSONObject(); + if (request.getData() != null) { + for (Map.Entry entry : request.getData().entrySet()) { + JSONObject item = new JSONObject(); + item.put("value", entry.getValue().getValue()); + subscribeData.put(entry.getKey(), item); + } + } + data.put("data", subscribeData); + + // 发送请求 + String response = HttpUtil.post(url, data.toJSONString()); + JSONObject result = JSONObject.parseObject(response); + + Integer errcode = result.getInteger("errcode"); + String errmsg = result.getString("errmsg"); + + if (errcode != null && errcode == 0) { + log.info("订阅消息发送成功"); + return true; + } else { + log.error("订阅消息发送失败: errcode={}, errmsg={}", errcode, errmsg); + return false; + } + + } catch (Exception e) { + log.error("发送微信订阅消息异常", e); + return false; + } + } +} diff --git a/src/main/java/com/gxwebsoft/hjm/task/PushHjmFenceOutController.java b/src/main/java/com/gxwebsoft/hjm/task/PushHjmFenceOutController.java new file mode 100644 index 0000000..b31737e --- /dev/null +++ b/src/main/java/com/gxwebsoft/hjm/task/PushHjmFenceOutController.java @@ -0,0 +1,97 @@ +package com.gxwebsoft.hjm.task; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.service.UserService; +import com.gxwebsoft.hjm.dto.TemplateMessageRequest; +import com.gxwebsoft.hjm.entity.HjmCar; +import com.gxwebsoft.hjm.service.HjmCarService; +import com.gxwebsoft.hjm.service.WxNotificationService; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.List; + +/** + * 定时任务 + * + * @author 科技小王子 + * @since 2022-12-15 19:11:07 + */ +@Tag(name = "定时任务") +@RestController +@RequestMapping("/api/hjm/scheduling") +public class PushHjmFenceOutController extends BaseController { + @Resource + private HjmCarService hjmCarService; + @Resource + private UserService userService; + @Resource + private WxNotificationService wxNotificationService; + @Value("${spring.profiles.active}") + String active; + + /** + * 定时推送订阅消息 + * @Scheduled(fixedDelay = 2000, initialDelay = 2000) + * @Scheduled(cron = "0 0 9 * * ?") + */ +// @Scheduled(cron = "0 0/10 * * * ?") + public void index() { + final List list = hjmCarService.list(new LambdaQueryWrapper() + .eq(HjmCar::getStatus, 1) + .eq(HjmCar::getDeleted, 0) + .eq(HjmCar::getInFence, false) + ); + + // 开发环境 + if (active.equals("dev")){ + return; + } + + // 获取所有的邮政协会/管局工作人员 + final List users = userService.listByAlert(); + + list.forEach(item -> { + // 执行推送 + users.forEach(d -> { + if(StrUtil.isNotBlank(d.getOfficeOpenid())){ + item.setToUser(d.getOfficeOpenid()); + item.setAppId("wxd2723d1afd9c4553"); + sendTemplateMessage(item); + } + }); + }); + } + + public void sendTemplateMessage(HjmCar item) { + // 发送模板消息 + final TemplateMessageRequest templateMessageRequest = new TemplateMessageRequest(); + templateMessageRequest.setToUser(item.getToUser()); + templateMessageRequest.setTemplateId("oMckHaNgNT-ivInYF5DtCcqyd9O-i1hP_G0jQALsx54"); +// templateMessageRequest.setUrl("https://mp.websoft.top"); + final TemplateMessageRequest.MiniProgram miniProgram = new TemplateMessageRequest.MiniProgram(); + miniProgram.setAppid(item.getAppId()); + miniProgram.setPagepath("hjm/query?id=".concat(item.getCode())); + templateMessageRequest.setMiniprogram(miniProgram); + HashMap map = new HashMap<>(); + map.put("phrase6", new TemplateMessageRequest.TemplateDataItem(item.getDriverName())); + map.put("time4", new TemplateMessageRequest.TemplateDataItem( + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(item.getCreateTime()), "#173177")); + map.put("phrase7", new TemplateMessageRequest.TemplateDataItem("离开围栏")); + map.put("thing11", new TemplateMessageRequest.TemplateDataItem(item.getFenceName())); + map.put("car_number12", new TemplateMessageRequest.TemplateDataItem(item.getCode())); + templateMessageRequest.setData(map); + boolean success = wxNotificationService.sendTemplateMessage(10519, templateMessageRequest); + System.out.println("向 = " + item.getDriverName() + "发送消息成功:" + success); + } + +} diff --git a/src/main/java/com/gxwebsoft/house/controller/HouseInfoController.java b/src/main/java/com/gxwebsoft/house/controller/HouseInfoController.java new file mode 100644 index 0000000..05a4758 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/controller/HouseInfoController.java @@ -0,0 +1,155 @@ +package com.gxwebsoft.house.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.bszx.entity.BszxBm; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.house.entity.HouseLikeLog; +import com.gxwebsoft.house.entity.HouseViewsLog; +import com.gxwebsoft.house.service.HouseInfoService; +import com.gxwebsoft.house.entity.HouseInfo; +import com.gxwebsoft.house.param.HouseInfoParam; +import com.gxwebsoft.house.util.SortSceneUtil; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.house.service.HouseLikeLogService; +import com.gxwebsoft.house.service.HouseViewsLogService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 房源信息表控制器 + * + * @author 科技小王子 + * @since 2025-03-05 13:47:14 + */ +@Tag(name = "房源信息表管理") +@RestController +@RequestMapping("/api/house/house-info") +public class HouseInfoController extends BaseController { + @Resource + private HouseInfoService houseInfoService; + @Resource + private HouseLikeLogService houseLikeLogService; + @Resource + private HouseViewsLogService houseViewsLogService; + + @Operation(summary = "分页查询房源信息表") + @GetMapping("/page") + public ApiResult> page(HouseInfoParam param) { + // 标准化排序参数,解决URL编码问题 + if (param.getSortScene() != null) { + String normalizedSortScene = SortSceneUtil.normalizeSortScene(param.getSortScene()); + param.setSortScene(normalizedSortScene); + } + + // 使用关联查询 + return success(houseInfoService.pageRel(param)); + } + + + @PreAuthorize("hasAuthority('house:houseInfo:list')") + @Operation(summary = "查询全部房源信息表") + @GetMapping() + public ApiResult> list(HouseInfoParam param) { + // 使用关联查询 + return success(houseInfoService.listRel(param)); + } + + @Operation(summary = "根据id查询房源信息表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + HouseInfo byIdRel = houseInfoService.getByIdRel(id); + Integer loginUserId = getLoginUserId(); + if(loginUserId != null) { + // 是否喜欢 + HouseLikeLog log = houseLikeLogService.getByIdRel(id, loginUserId); + byIdRel.setLiked(log != null); + // 添加浏览记录 + houseViewsLogService.add(byIdRel, loginUserId); + } + // 使用关联查询 + return success(byIdRel); + } + + @PreAuthorize("hasAuthority('house:houseInfo:save')") + @Operation(summary = "添加房源信息表") + @PostMapping() + public ApiResult save(@RequestBody HouseInfo houseInfo) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + houseInfo.setUserId(loginUser.getUserId()); + } + if (houseInfoService.save(houseInfo)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('house:houseInfo:update')") + @Operation(summary = "修改房源信息表") + @PutMapping() + public ApiResult update(@RequestBody HouseInfo houseInfo) { + if (houseInfoService.updateById(houseInfo)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('house:houseInfo:remove')") + @Operation(summary = "删除房源信息表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (houseInfoService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('house:houseInfo:save')") + @Operation(summary = "批量添加房源信息表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (houseInfoService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('house:houseInfo:update')") + @Operation(summary = "批量修改房源信息表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(houseInfoService, "house_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('house:houseInfo:remove')") + @Operation(summary = "批量删除房源信息表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (houseInfoService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "获取海报地址") + @GetMapping("/generatePoster/{id}") + public ApiResult generatePoster(@PathVariable("id") Integer id) throws Exception { + final HouseInfo houseInfo = houseInfoService.getOne(new LambdaQueryWrapper().eq(HouseInfo::getHouseId, id).last("limit 1")); + return success("生成房源海报",houseInfoService.generatePoster(houseInfo)); + } + +} diff --git a/src/main/java/com/gxwebsoft/house/controller/HouseLikeLogController.java b/src/main/java/com/gxwebsoft/house/controller/HouseLikeLogController.java new file mode 100644 index 0000000..44b045d --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/controller/HouseLikeLogController.java @@ -0,0 +1,119 @@ +package com.gxwebsoft.house.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.house.service.HouseLikeLogService; +import com.gxwebsoft.house.entity.HouseLikeLog; +import com.gxwebsoft.house.param.HouseLikeLogParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 房源点赞表控制器 + * + * @author 科技小王子 + * @since 2025-03-05 13:47:14 + */ +@Tag(name = "房源点赞表管理") +@RestController +@RequestMapping("/api/house/house-like-log") +public class HouseLikeLogController extends BaseController { + @Resource + private HouseLikeLogService houseLikeLogService; + + @Operation(summary = "分页查询房源点赞表") + @GetMapping("/page") + public ApiResult> page(HouseLikeLogParam param) { + // 使用关联查询 + return success(houseLikeLogService.pageRel(param)); + } + + @Operation(summary = "查询全部房源点赞表") + @GetMapping() + public ApiResult> list(HouseLikeLogParam param) { + // 使用关联查询 + return success(houseLikeLogService.listRel(param)); + } + + @PreAuthorize("hasAuthority('house:houseLikeLog:list')") + @Operation(summary = "根据id查询房源点赞表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(houseLikeLogService.getById(id)); + } + + @Operation(summary = "添加房源点赞表") + @PostMapping() + public ApiResult save(@RequestBody HouseLikeLog houseLikeLog) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + houseLikeLog.setUserId(loginUser.getUserId()); + } + if (houseLikeLogService.save(houseLikeLog)) { + return success("添加成功"); + } + return fail("添加失败"); + } + @PreAuthorize("hasAuthority('house:houseLikeLog:update')") + @Operation(summary = "修改房源点赞表") + @PutMapping() + public ApiResult update(@RequestBody HouseLikeLog houseLikeLog) { + if (houseLikeLogService.updateById(houseLikeLog)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('house:houseLikeLog:remove')") + @Operation(summary = "删除房源点赞表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (houseLikeLogService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('house:houseLikeLog:save')") + @Operation(summary = "批量添加房源点赞表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (houseLikeLogService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('house:houseLikeLog:update')") + @Operation(summary = "批量修改房源点赞表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(houseLikeLogService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('house:houseLikeLog:remove')") + @Operation(summary = "批量删除房源点赞表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (houseLikeLogService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/house/controller/HouseReservationController.java b/src/main/java/com/gxwebsoft/house/controller/HouseReservationController.java new file mode 100644 index 0000000..941dae7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/controller/HouseReservationController.java @@ -0,0 +1,125 @@ +package com.gxwebsoft.house.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.house.service.HouseReservationService; +import com.gxwebsoft.house.entity.HouseReservation; +import com.gxwebsoft.house.param.HouseReservationParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 预约记录表控制器 + * + * @author 科技小王子 + * @since 2025-03-05 13:47:15 + */ +@Tag(name = "预约记录表管理") +@RestController +@RequestMapping("/api/house/house-reservation") +public class HouseReservationController extends BaseController { + @Resource + private HouseReservationService houseReservationService; + + @Operation(summary = "分页查询预约记录表") + @GetMapping("/page") + public ApiResult> page(HouseReservationParam param) { + // 使用关联查询 + return success(houseReservationService.pageRel(param)); + } + + @Operation(summary = "查询全部预约记录表") + @GetMapping() + public ApiResult> list(HouseReservationParam param) { + // 使用关联查询 + return success(houseReservationService.listRel(param)); + } + + @PreAuthorize("hasAuthority('house:houseReservation:list')") + @Operation(summary = "根据id查询预约记录表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(houseReservationService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('house:houseReservation:save')") + @Operation(summary = "添加预约记录表") + @PostMapping() + public ApiResult save(@RequestBody HouseReservation houseReservation) { +// 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + houseReservation.setUserId(loginUser.getUserId()); + } + if (houseReservationService.count(new LambdaQueryWrapper().eq(HouseReservation::getHouseId,houseReservation.getHouseId()).eq(HouseReservation::getUserId,loginUser.getUserId()).eq(HouseReservation::getStatus,0)) > 0){ + return fail("请勿重复提交"); + } + if (houseReservationService.save(houseReservation)) { + return success("提交成功"); + } + return fail("提交失败"); + } + + @PreAuthorize("hasAuthority('house:houseReservation:update')") + @Operation(summary = "修改预约记录表") + @PutMapping() + public ApiResult update(@RequestBody HouseReservation houseReservation) { + if (houseReservationService.updateById(houseReservation)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('house:houseReservation:remove')") + @Operation(summary = "删除预约记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (houseReservationService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('house:houseReservation:save')") + @Operation(summary = "批量添加预约记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (houseReservationService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('house:houseReservation:update')") + @Operation(summary = "批量修改预约记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(houseReservationService, "log_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('house:houseReservation:remove')") + @Operation(summary = "批量删除预约记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (houseReservationService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/house/controller/HouseUserController.java b/src/main/java/com/gxwebsoft/house/controller/HouseUserController.java new file mode 100644 index 0000000..9a4efa1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/controller/HouseUserController.java @@ -0,0 +1,115 @@ +package com.gxwebsoft.house.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.house.service.HouseUserService; +import com.gxwebsoft.house.entity.HouseUser; +import com.gxwebsoft.house.param.HouseUserParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 用户表控制器 + * + * @author 科技小王子 + * @since 2025-03-05 15:13:05 + */ +@Tag(name = "用户表管理") +@RestController +@RequestMapping("/api/house/house-user") +public class HouseUserController extends BaseController { + @Resource + private HouseUserService houseUserService; + + @Operation(summary = "分页查询用户表") + @GetMapping("/page") + public ApiResult> page(HouseUserParam param) { + // 使用关联查询 + return success(houseUserService.pageRel(param)); + } + + @Operation(summary = "查询全部用户表") + @GetMapping() + public ApiResult> list(HouseUserParam param) { + // 使用关联查询 + return success(houseUserService.listRel(param)); + } + + @PreAuthorize("hasAuthority('house:houseUser:list')") + @Operation(summary = "根据id查询用户表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(houseUserService.getByIdRel(id)); + } + + @Operation(summary = "添加用户表") + @PostMapping() + public ApiResult save(@RequestBody HouseUser houseUser) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + houseUser.setUserId(loginUser.getUserId()); + } + if (houseUserService.save(houseUser)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改用户表") + @PutMapping() + public ApiResult update(@RequestBody HouseUser houseUser) { + if (houseUserService.updateById(houseUser)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除用户表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (houseUserService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加用户表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (houseUserService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改用户表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(houseUserService, "user_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除用户表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (houseUserService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/house/controller/HouseViewsLogController.java b/src/main/java/com/gxwebsoft/house/controller/HouseViewsLogController.java new file mode 100644 index 0000000..dc3b3a4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/controller/HouseViewsLogController.java @@ -0,0 +1,120 @@ +package com.gxwebsoft.house.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.house.service.HouseViewsLogService; +import com.gxwebsoft.house.entity.HouseViewsLog; +import com.gxwebsoft.house.param.HouseViewsLogParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 看房记录表控制器 + * + * @author 科技小王子 + * @since 2025-03-05 13:47:15 + */ +@Tag(name = "看房记录表管理") +@RestController +@RequestMapping("/api/house/house-views-log") +public class HouseViewsLogController extends BaseController { + @Resource + private HouseViewsLogService houseViewsLogService; + + @Operation(summary = "分页查询看房记录表") + @GetMapping("/page") + public ApiResult> page(HouseViewsLogParam param) { + // 使用关联查询 + return success(houseViewsLogService.pageRel(param)); + } + + @Operation(summary = "查询全部看房记录表") + @GetMapping() + public ApiResult> list(HouseViewsLogParam param) { + // 使用关联查询 + return success(houseViewsLogService.listRel(param)); + } + + @Operation(summary = "根据id查询看房记录表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(houseViewsLogService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('house:houseViewsLog:save')") + @Operation(summary = "添加看房记录表") + @PostMapping() + public ApiResult save(@RequestBody HouseViewsLog houseViewsLog) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + houseViewsLog.setUserId(loginUser.getUserId()); + } + if (houseViewsLogService.save(houseViewsLog)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('house:houseViewsLog:update')") + @Operation(summary = "修改看房记录表") + @PutMapping() + public ApiResult update(@RequestBody HouseViewsLog houseViewsLog) { + if (houseViewsLogService.updateById(houseViewsLog)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('house:houseViewsLog:remove')") + @Operation(summary = "删除看房记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (houseViewsLogService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('house:houseViewsLog:save')") + @Operation(summary = "批量添加看房记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (houseViewsLogService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('house:houseViewsLog:update')") + @Operation(summary = "批量修改看房记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(houseViewsLogService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('house:houseViewsLog:remove')") + @Operation(summary = "批量删除看房记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (houseViewsLogService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/house/entity/HouseFile.java b/src/main/java/com/gxwebsoft/house/entity/HouseFile.java new file mode 100644 index 0000000..e277c19 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/entity/HouseFile.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.house.entity; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.List; + +/** + * 看房记录表 + * + * @author 科技小王子 + * @since 2025-03-05 13:47:15 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "HouseFiles对象", description = "房源图片") +public class HouseFile implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "文件大小") + private Integer size; + + @Schema(description = "图片类型") + private String type; + + @Schema(description = "图片链接") + private String url; + + @Schema(description = "状态") + private String status; + + @Schema(description = "描述") + private String message; +} diff --git a/src/main/java/com/gxwebsoft/house/entity/HouseFiles.java b/src/main/java/com/gxwebsoft/house/entity/HouseFiles.java new file mode 100644 index 0000000..9a67e0e --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/entity/HouseFiles.java @@ -0,0 +1,29 @@ +package com.gxwebsoft.house.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.List; + +/** + * 看房记录表 + * + * @author 科技小王子 + * @since 2025-03-05 13:47:15 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "HouseFiles对象", description = "房源图片") +public class HouseFiles implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "文件列表") + private List files; +} diff --git a/src/main/java/com/gxwebsoft/house/entity/HouseInfo.java b/src/main/java/com/gxwebsoft/house/entity/HouseInfo.java new file mode 100644 index 0000000..d26ea14 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/entity/HouseInfo.java @@ -0,0 +1,205 @@ +package com.gxwebsoft.house.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 房源信息表 + * + * @author 科技小王子 + * @since 2025-03-05 13:47:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "HouseInfo对象", description = "房源信息表") +public class HouseInfo implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "house_id", type = IdType.AUTO) + private Integer houseId; + + @Schema(description = "房源标题") + private String houseTitle; + + @Schema(description = "房源类型") + private Integer type; + + @Schema(description = "房产所在的城市") + private String cityByHouse; + + @Schema(description = "户型") + private String houseType; + + @Schema(description = "租赁方式") + private String leaseMethod; + + @Schema(description = "租金") + private BigDecimal rent; + + @Schema(description = "租金单位") + private String rentUnit; + + @Schema(description = "月租金") + private BigDecimal monthlyRent; + + @Schema(description = "租金单位") + private String monthlyRentUnit; + + @Schema(description = "佣金") + private BigDecimal commission; + + @Schema(description = "物业费") + private BigDecimal propertyFees; + + @Schema(description = "面积") + private String extent; + + @Schema(description = "面积") + private String extentUnit; + + @Schema(description = "楼层") + private String floor; + + @Schema(description = "卖价") + private String salePrice; + + @Schema(description = "总价") + private String totalPrice; + + @Schema(description = "房号") + private String roomNumber; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "联系电话") + private String phone; + + @Schema(description = "进入房屋的密码") + private String password; + + @Schema(description = "房屋朝向") + private String toward; + + @Schema(description = "房屋标签") + private String houseLabel; + + @Schema(description = "办公室配套") + private String supporting; + + @Schema(description = "产权信息") + private String property; + + @Schema(description = "房源视频") + private String videoUrl; + + @Schema(description = "图片附件") + private String files; + + @Schema(description = "房源介绍") + private String content; + + @Schema(description = "到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime expirationTime; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "所在地区") + private String area; + + @Schema(description = "详细地址") + private String address; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "是否必看") + private Integer mustSee; + + @Schema(description = "是否可溢价") + private String premium; + + @Schema(description = "租期") + private String tenancy; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否实名认证") + private Integer authentication; + + @Schema(description = "状态 10待审核 20驳回 30通过") + private Integer status; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "用户手机号") + @TableField(exist = false) + private String userPhone; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "用户头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "用户等级") + @TableField(exist = false) + private String gradeName; + + @Schema(description = "是否选中") + @TableField(exist = false) + private Boolean selected; + + @Schema(description = "是否喜欢") + @TableField(exist = false) + private Boolean liked; + +} diff --git a/src/main/java/com/gxwebsoft/house/entity/HouseLikeLog.java b/src/main/java/com/gxwebsoft/house/entity/HouseLikeLog.java new file mode 100644 index 0000000..d73397f --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/entity/HouseLikeLog.java @@ -0,0 +1,56 @@ +package com.gxwebsoft.house.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 房源点赞表 + * + * @author 科技小王子 + * @since 2025-03-05 13:47:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "HouseLikeLog对象", description = "房源点赞表") +public class HouseLikeLog implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "房源ID") + private Integer houseId; + + @Schema(description = "房主ID") + private Integer houseUserId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "更新时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "删除") + @TableLogic + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/house/entity/HouseReservation.java b/src/main/java/com/gxwebsoft/house/entity/HouseReservation.java new file mode 100644 index 0000000..1eb0f42 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/entity/HouseReservation.java @@ -0,0 +1,116 @@ +package com.gxwebsoft.house.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 预约记录表 + * + * @author 科技小王子 + * @since 2025-03-05 13:47:15 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "HouseReservation对象", description = "预约记录表") +public class HouseReservation implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "log_id", type = IdType.AUTO) + private Integer logId; + + @Schema(description = "订单号") + private String logNo; + + @Schema(description = "类型") + private Integer type; + + @Schema(description = "付款金额") + private BigDecimal money; + + @Schema(description = "房源ID") + private Integer houseId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "联系电话") + private String phone; + + @Schema(description = "付款时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime payTime; + + @Schema(description = "付款状态(10未付款 20已付款)") + private Integer payStatus; + + @Schema(description = "到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime expirationTime; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "所在地区") + private String area; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "订单是否已结算(0未结算 1已结算)") + private Integer isSettled; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "用户头像") + @TableField(exist = false) + private String avatar; + +} diff --git a/src/main/java/com/gxwebsoft/house/entity/HouseUser.java b/src/main/java/com/gxwebsoft/house/entity/HouseUser.java new file mode 100644 index 0000000..2b0969f --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/entity/HouseUser.java @@ -0,0 +1,206 @@ +package com.gxwebsoft.house.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import java.time.LocalDate; +import com.baomidou.mybatisplus.annotation.TableId; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户表 + * + * @author 科技小王子 + * @since 2025-03-05 15:13:05 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "HouseUser对象", description = "用户表") +public class HouseUser implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "用户id") + @TableId(value = "user_id", type = IdType.AUTO) + private Integer userId; + + @Schema(description = "用户类型,0个人用户 6开发者 10企业") + private Integer type; + + @Schema(description = "账号") + private String username; + + @Schema(description = "密码") + private String password; + + @Schema(description = "昵称") + private String nickname; + + @Schema(description = "手机号") + private String phone; + + @Schema(description = "性别 1男 2女") + private Integer sex; + + @Schema(description = "职务") + private String position; + + @Schema(description = "注册来源客户端 (APP、H5、小程序等)") + private String platform; + + @Schema(description = "邮箱") + private String email; + + @Schema(description = "邮箱是否验证, 0否, 1是") + private Integer emailVerified; + + @Schema(description = "别名") + private String alias; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "单位姓名") + private String companyName; + + @Schema(description = "证件号码") + private String idCard; + + @Schema(description = "出生日期") + private LocalDate birthday; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "用户可用余额") + private BigDecimal balance; + + @Schema(description = "用户可用积分") + private Integer points; + + @Schema(description = "用户总支付的金额") + private BigDecimal payMoney; + + @Schema(description = "实际消费的金额(不含退款)") + private BigDecimal expendMoney; + + @Schema(description = "会员等级ID") + private Integer gradeId; + + @Schema(description = "个人简介") + private String introduction; + + @Schema(description = "机构id") + private Integer organizationId; + + @Schema(description = "头像") + private String avatar; + + @Schema(description = "背景图") + private String bgImage; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "客户ID") + private Integer customerId; + + @Schema(description = "用户编码") + private String userCode; + + @Schema(description = "是否已实名认证") + private Integer certification; + + @Schema(description = "兴趣爱好") + private String interest; + + @Schema(description = "身高") + private String height; + + @Schema(description = "体重") + private String weight; + + @Schema(description = "月薪") + private String monthlyPay; + + @Schema(description = "学历") + private String education; + + @Schema(description = "职业") + private String vocation; + + @Schema(description = "年龄") + private Integer age; + + @Schema(description = "是否线下会员") + private Boolean offline; + + @Schema(description = "关注数") + private Integer followers; + + @Schema(description = "粉丝数") + private Integer fans; + + @Schema(description = "点赞数") + private Integer likes; + + @Schema(description = "评论数") + private Integer commentNumbers; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0在线, 1离线") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "商户编码") + private String merchantCode; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "最后结算时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime settlementTime; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/house/entity/HouseViewsLog.java b/src/main/java/com/gxwebsoft/house/entity/HouseViewsLog.java new file mode 100644 index 0000000..3ff9eb2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/entity/HouseViewsLog.java @@ -0,0 +1,56 @@ +package com.gxwebsoft.house.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 看房记录表 + * + * @author 科技小王子 + * @since 2025-03-05 13:47:15 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "HouseViewsLog对象", description = "看房记录表") +public class HouseViewsLog implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "房源ID") + private Integer houseId; + + @Schema(description = "房主ID") + private Integer houseUserId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "更新时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "删除") + @TableLogic + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/house/mapper/HouseInfoMapper.java b/src/main/java/com/gxwebsoft/house/mapper/HouseInfoMapper.java new file mode 100644 index 0000000..3a15558 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/mapper/HouseInfoMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.house.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.house.entity.HouseInfo; +import com.gxwebsoft.house.param.HouseInfoParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 房源信息表Mapper + * + * @author 科技小王子 + * @since 2025-03-05 13:47:14 + */ +public interface HouseInfoMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") HouseInfoParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") HouseInfoParam param); + +} diff --git a/src/main/java/com/gxwebsoft/house/mapper/HouseLikeLogMapper.java b/src/main/java/com/gxwebsoft/house/mapper/HouseLikeLogMapper.java new file mode 100644 index 0000000..ea43c42 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/mapper/HouseLikeLogMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.house.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.yulichang.base.MPJBaseMapper; +import com.gxwebsoft.house.entity.HouseLikeLog; +import com.gxwebsoft.house.param.HouseLikeLogParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 房源点赞表Mapper + * + * @author 科技小王子 + * @since 2025-03-05 13:47:14 + */ +public interface HouseLikeLogMapper extends MPJBaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") HouseLikeLogParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") HouseLikeLogParam param); + +} diff --git a/src/main/java/com/gxwebsoft/house/mapper/HouseReservationMapper.java b/src/main/java/com/gxwebsoft/house/mapper/HouseReservationMapper.java new file mode 100644 index 0000000..aa3b3fe --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/mapper/HouseReservationMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.house.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.house.entity.HouseReservation; +import com.gxwebsoft.house.param.HouseReservationParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 预约记录表Mapper + * + * @author 科技小王子 + * @since 2025-03-05 13:47:15 + */ +public interface HouseReservationMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") HouseReservationParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") HouseReservationParam param); + +} diff --git a/src/main/java/com/gxwebsoft/house/mapper/HouseUserMapper.java b/src/main/java/com/gxwebsoft/house/mapper/HouseUserMapper.java new file mode 100644 index 0000000..901c5ed --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/mapper/HouseUserMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.house.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.house.entity.HouseUser; +import com.gxwebsoft.house.param.HouseUserParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 用户表Mapper + * + * @author 科技小王子 + * @since 2025-03-05 15:13:05 + */ +public interface HouseUserMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") HouseUserParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") HouseUserParam param); + +} diff --git a/src/main/java/com/gxwebsoft/house/mapper/HouseViewsLogMapper.java b/src/main/java/com/gxwebsoft/house/mapper/HouseViewsLogMapper.java new file mode 100644 index 0000000..32f7df7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/mapper/HouseViewsLogMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.house.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.yulichang.base.MPJBaseMapper; +import com.gxwebsoft.house.entity.HouseViewsLog; +import com.gxwebsoft.house.param.HouseViewsLogParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 看房记录表Mapper + * + * @author 科技小王子 + * @since 2025-03-05 13:47:15 + */ +public interface HouseViewsLogMapper extends MPJBaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") HouseViewsLogParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") HouseViewsLogParam param); + +} diff --git a/src/main/java/com/gxwebsoft/house/mapper/xml/HouseInfoMapper.xml b/src/main/java/com/gxwebsoft/house/mapper/xml/HouseInfoMapper.xml new file mode 100644 index 0000000..ea10913 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/mapper/xml/HouseInfoMapper.xml @@ -0,0 +1,175 @@ + + + + + + + SELECT a.*, + b.nickname,b.avatar,b.grade_id, b.phone as userPhone + FROM house_info a + LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id + + + AND a.house_id = #{param.houseId} + + + AND a.house_title LIKE CONCAT('%', #{param.houseTitle}, '%') + + + AND a.type = #{param.type} + + + AND a.city_by_house LIKE CONCAT('%', #{param.cityByHouse}, '%') + + + AND a.house_type LIKE CONCAT('%', #{param.houseType}, '%') + + + AND a.lease_method LIKE CONCAT('%', #{param.leaseMethod}, '%') + + + AND a.rent = #{param.rent} + + + AND a.monthly_rent = #{param.monthlyRent} + + + AND a.extent >= #{param.extentStart} + + + AND a.extent <= #{param.extentEnd} + + + AND a.floor LIKE CONCAT('%', #{param.floor}, '%') + + + AND a.room_number LIKE CONCAT('%', #{param.roomNumber}, '%') + + + AND a.sale_price = #{param.salePrice} + + + AND a.total_Price = #{param.totalPrice} + + + AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.password LIKE CONCAT('%', #{param.password}, '%') + + + AND a.toward LIKE CONCAT('%', #{param.toward}, '%') + + + AND a.house_label LIKE CONCAT('%', #{param.houseLabel}, '%') + + + AND a.files LIKE CONCAT('%', #{param.files}, '%') + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.area LIKE CONCAT('%', #{param.area}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.authentication = #{param.authentication} + + + AND a.status = #{param.status} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.recommend = #{param.recommend} + + + AND a.must_see = #{param.mustSee} + + + AND a.user_id = #{param.userId} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND ( + a.house_title LIKE CONCAT('%', #{param.keywords}, '%') + OR a.house_id = #{param.keywords} + OR b.nickname = #{param.keywords} + OR a.room_number LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + a.sort_number asc, + + + a.create_time desc, + + + a.monthly_rent asc, + + + a.monthly_rent desc, + + + a.extent asc, + + + a.extent desc, + + + ABS(a.monthly_rent - #{param.priceScene}), + + + + ABS(a.extent - #{param.extentScene}), + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/house/mapper/xml/HouseLikeLogMapper.xml b/src/main/java/com/gxwebsoft/house/mapper/xml/HouseLikeLogMapper.xml new file mode 100644 index 0000000..5d7f6fb --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/mapper/xml/HouseLikeLogMapper.xml @@ -0,0 +1,51 @@ + + + + + + + SELECT a.* + FROM house_like_log a + + + AND a.id = #{param.id} + + + AND a.house_id = #{param.houseId} + + + AND a.house_user_id = #{param.houseUserId} + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/house/mapper/xml/HouseReservationMapper.xml b/src/main/java/com/gxwebsoft/house/mapper/xml/HouseReservationMapper.xml new file mode 100644 index 0000000..093c28b --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/mapper/xml/HouseReservationMapper.xml @@ -0,0 +1,99 @@ + + + + + + + SELECT a.* + FROM house_reservation a + + + AND a.log_id = #{param.logId} + + + AND a.log_no LIKE CONCAT('%', #{param.logNo}, '%') + + + AND a.type = #{param.type} + + + AND a.money = #{param.money} + + + AND a.house_id = #{param.houseId} + + + AND a.user_id = #{param.userId} + + + AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.pay_time LIKE CONCAT('%', #{param.payTime}, '%') + + + AND a.pay_status = #{param.payStatus} + + + AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.area LIKE CONCAT('%', #{param.area}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.is_settled = #{param.isSettled} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/house/mapper/xml/HouseUserMapper.xml b/src/main/java/com/gxwebsoft/house/mapper/xml/HouseUserMapper.xml new file mode 100644 index 0000000..0af9ccd --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/mapper/xml/HouseUserMapper.xml @@ -0,0 +1,202 @@ + + + + + + + SELECT a.* + FROM house_user a + + + AND a.user_id = #{param.userId} + + + AND a.type = #{param.type} + + + AND a.username LIKE CONCAT('%', #{param.username}, '%') + + + AND a.password LIKE CONCAT('%', #{param.password}, '%') + + + AND a.nickname LIKE CONCAT('%', #{param.nickname}, '%') + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.sex = #{param.sex} + + + AND a.position LIKE CONCAT('%', #{param.position}, '%') + + + AND a.platform LIKE CONCAT('%', #{param.platform}, '%') + + + AND a.email LIKE CONCAT('%', #{param.email}, '%') + + + AND a.email_verified = #{param.emailVerified} + + + AND a.alias LIKE CONCAT('%', #{param.alias}, '%') + + + AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') + + + AND a.company_name LIKE CONCAT('%', #{param.companyName}, '%') + + + AND a.id_card LIKE CONCAT('%', #{param.idCard}, '%') + + + AND a.birthday LIKE CONCAT('%', #{param.birthday}, '%') + + + AND a.country LIKE CONCAT('%', #{param.country}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.longitude LIKE CONCAT('%', #{param.longitude}, '%') + + + AND a.latitude LIKE CONCAT('%', #{param.latitude}, '%') + + + AND a.balance = #{param.balance} + + + AND a.points = #{param.points} + + + AND a.pay_money = #{param.payMoney} + + + AND a.expend_money = #{param.expendMoney} + + + AND a.grade_id = #{param.gradeId} + + + AND a.introduction LIKE CONCAT('%', #{param.introduction}, '%') + + + AND a.organization_id = #{param.organizationId} + + + AND a.avatar LIKE CONCAT('%', #{param.avatar}, '%') + + + AND a.bg_image LIKE CONCAT('%', #{param.bgImage}, '%') + + + AND a.company_id = #{param.companyId} + + + AND a.customer_id = #{param.customerId} + + + AND a.user_code LIKE CONCAT('%', #{param.userCode}, '%') + + + AND a.certification = #{param.certification} + + + AND a.interest LIKE CONCAT('%', #{param.interest}, '%') + + + AND a.height LIKE CONCAT('%', #{param.height}, '%') + + + AND a.weight LIKE CONCAT('%', #{param.weight}, '%') + + + AND a.monthly_pay LIKE CONCAT('%', #{param.monthlyPay}, '%') + + + AND a.education LIKE CONCAT('%', #{param.education}, '%') + + + AND a.vocation LIKE CONCAT('%', #{param.vocation}, '%') + + + AND a.age = #{param.age} + + + AND a.offline = #{param.offline} + + + AND a.followers = #{param.followers} + + + AND a.fans = #{param.fans} + + + AND a.likes = #{param.likes} + + + AND a.comment_numbers = #{param.commentNumbers} + + + AND a.recommend = #{param.recommend} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%') + + + AND a.settlement_time LIKE CONCAT('%', #{param.settlementTime}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND ( + a.nickname LIKE CONCAT('%', #{param.keywords}, '%') + OR a.user_id = #{param.keywords} + OR b.nickname = #{param.keywords} + OR a.phone = #{param.keywords} + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/house/mapper/xml/HouseViewsLogMapper.xml b/src/main/java/com/gxwebsoft/house/mapper/xml/HouseViewsLogMapper.xml new file mode 100644 index 0000000..53fcf8a --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/mapper/xml/HouseViewsLogMapper.xml @@ -0,0 +1,51 @@ + + + + + + + SELECT a.* + FROM house_views_log a + + + AND a.id = #{param.id} + + + AND a.house_id = #{param.houseId} + + + AND a.house_user_id = #{param.houseUserId} + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/house/param/HouseInfoParam.java b/src/main/java/com/gxwebsoft/house/param/HouseInfoParam.java new file mode 100644 index 0000000..27da492 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/param/HouseInfoParam.java @@ -0,0 +1,185 @@ +package com.gxwebsoft.house.param; + +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 房源信息表查询参数 + * + * @author 科技小王子 + * @since 2025-03-05 13:47:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "HouseInfoParam对象", description = "房源信息表查询参数") +public class HouseInfoParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer houseId; + + @Schema(description = "房源标题") + private String houseTitle; + + @Schema(description = "房源类型") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "房产所在的城市") + private String cityByHouse; + + @Schema(description = "户型") + private String houseType; + + @Schema(description = "租赁方式") + private String leaseMethod; + + @Schema(description = "租金") + @QueryField(type = QueryType.EQ) + private BigDecimal rent; + + @Schema(description = "面积起始值") + @QueryField(type = QueryType.GE) + private Integer extentStart; + + @Schema(description = "面积结束值") + @QueryField(type = QueryType.LE) + private Integer extentEnd; + + @Schema(description = "月租金") + @QueryField(type = QueryType.EQ) + private BigDecimal monthlyRent; + + @Schema(description = "物业费") + @QueryField(type = QueryType.EQ) + private BigDecimal propertyFees; + + @Schema(description = "面积") + private String extent; + + @Schema(description = "楼层") + private String floor; + + @Schema(description = "卖价") + private String salePrice; + + @Schema(description = "总价") + private String totalPrice; + + @Schema(description = "房号") + private String roomNumber; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "联系电话") + private String phone; + + @Schema(description = "进入房屋的密码") + private String password; + + @Schema(description = "房屋朝向") + private String toward; + + @Schema(description = "房屋标签") + private String houseLabel; + + @Schema(description = "图片附件") + private String files; + + @Schema(description = "房源介绍") + private String content; + + @Schema(description = "到期时间") + private String expirationTime; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "所在地区") + private String area; + + @Schema(description = "详细地址") + private String address; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否实名认证") + @QueryField(type = QueryType.EQ) + private Integer authentication; + + @Schema(description = "状态 10待审核 20驳回 30通过") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "用户头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "价格起始值") + @TableField(exist = false) + private String priceScene; + + @Schema(description = "面积筛选") + @TableField(exist = false) + private String extentScene; + + @Schema(description = "排序") + @TableField(exist = false) + private String sortScene; + + @Schema(description = "是否推荐") + @TableField(exist = false) + private Integer recommend; + + @Schema(description = "是否必看") + @TableField(exist = false) + private Integer mustSee; + + @Schema(description = "是否可溢价") + @TableField(exist = false) + private String premium; + + @Schema(description = "产权信息") + private String property; + +} diff --git a/src/main/java/com/gxwebsoft/house/param/HouseLikeLogParam.java b/src/main/java/com/gxwebsoft/house/param/HouseLikeLogParam.java new file mode 100644 index 0000000..3ff4a55 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/param/HouseLikeLogParam.java @@ -0,0 +1,46 @@ +package com.gxwebsoft.house.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 房源点赞表查询参数 + * + * @author 科技小王子 + * @since 2025-03-05 13:47:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "HouseLikeLogParam对象", description = "房源点赞表查询参数") +public class HouseLikeLogParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "房源ID") + @QueryField(type = QueryType.EQ) + private Integer houseId; + + @Schema(description = "房主ID") + @QueryField(type = QueryType.EQ) + private Integer houseUserId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "删除") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/house/param/HouseReservationParam.java b/src/main/java/com/gxwebsoft/house/param/HouseReservationParam.java new file mode 100644 index 0000000..43d0487 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/param/HouseReservationParam.java @@ -0,0 +1,109 @@ +package com.gxwebsoft.house.param; + +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 预约记录表查询参数 + * + * @author 科技小王子 + * @since 2025-03-05 13:47:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "HouseReservationParam对象", description = "预约记录表查询参数") +public class HouseReservationParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer logId; + + @Schema(description = "订单号") + private String logNo; + + @Schema(description = "类型") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "付款金额") + @QueryField(type = QueryType.EQ) + private BigDecimal money; + + @Schema(description = "房源ID") + @QueryField(type = QueryType.EQ) + private Integer houseId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "联系电话") + private String phone; + + @Schema(description = "付款时间") + private String payTime; + + @Schema(description = "付款状态(10未付款 20已付款)") + @QueryField(type = QueryType.EQ) + private Integer payStatus; + + @Schema(description = "到期时间") + private String expirationTime; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "所在地区") + private String area; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "订单是否已结算(0未结算 1已结算)") + @QueryField(type = QueryType.EQ) + private Integer isSettled; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "用户头像") + @TableField(exist = false) + private String avatar; + +} diff --git a/src/main/java/com/gxwebsoft/house/param/HouseUserParam.java b/src/main/java/com/gxwebsoft/house/param/HouseUserParam.java new file mode 100644 index 0000000..25ce014 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/param/HouseUserParam.java @@ -0,0 +1,210 @@ +package com.gxwebsoft.house.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户表查询参数 + * + * @author 科技小王子 + * @since 2025-03-05 15:13:05 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "HouseUserParam对象", description = "用户表查询参数") +public class HouseUserParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "用户id") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "用户类型,0个人用户 6开发者 10企业") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "账号") + private String username; + + @Schema(description = "密码") + private String password; + + @Schema(description = "昵称") + private String nickname; + + @Schema(description = "手机号") + private String phone; + + @Schema(description = "性别 1男 2女") + @QueryField(type = QueryType.EQ) + private Integer sex; + + @Schema(description = "职务") + private String position; + + @Schema(description = "注册来源客户端 (APP、H5、小程序等)") + private String platform; + + @Schema(description = "邮箱") + private String email; + + @Schema(description = "邮箱是否验证, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer emailVerified; + + @Schema(description = "别名") + private String alias; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "单位姓名") + private String companyName; + + @Schema(description = "证件号码") + private String idCard; + + @Schema(description = "出生日期") + private String birthday; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "用户可用余额") + @QueryField(type = QueryType.EQ) + private BigDecimal balance; + + @Schema(description = "用户可用积分") + @QueryField(type = QueryType.EQ) + private Integer points; + + @Schema(description = "用户总支付的金额") + @QueryField(type = QueryType.EQ) + private BigDecimal payMoney; + + @Schema(description = "实际消费的金额(不含退款)") + @QueryField(type = QueryType.EQ) + private BigDecimal expendMoney; + + @Schema(description = "会员等级ID") + @QueryField(type = QueryType.EQ) + private Integer gradeId; + + @Schema(description = "个人简介") + private String introduction; + + @Schema(description = "机构id") + @QueryField(type = QueryType.EQ) + private Integer organizationId; + + @Schema(description = "头像") + private String avatar; + + @Schema(description = "背景图") + private String bgImage; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "客户ID") + @QueryField(type = QueryType.EQ) + private Integer customerId; + + @Schema(description = "用户编码") + private String userCode; + + @Schema(description = "是否已实名认证") + @QueryField(type = QueryType.EQ) + private Integer certification; + + @Schema(description = "兴趣爱好") + private String interest; + + @Schema(description = "身高") + private String height; + + @Schema(description = "体重") + private String weight; + + @Schema(description = "月薪") + private String monthlyPay; + + @Schema(description = "学历") + private String education; + + @Schema(description = "职业") + private String vocation; + + @Schema(description = "年龄") + @QueryField(type = QueryType.EQ) + private Integer age; + + @Schema(description = "是否线下会员") + @QueryField(type = QueryType.EQ) + private Boolean offline; + + @Schema(description = "关注数") + @QueryField(type = QueryType.EQ) + private Integer followers; + + @Schema(description = "粉丝数") + @QueryField(type = QueryType.EQ) + private Integer fans; + + @Schema(description = "点赞数") + @QueryField(type = QueryType.EQ) + private Integer likes; + + @Schema(description = "评论数") + @QueryField(type = QueryType.EQ) + private Integer commentNumbers; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0在线, 1离线") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "商户编码") + private String merchantCode; + + @Schema(description = "最后结算时间") + private String settlementTime; + +} diff --git a/src/main/java/com/gxwebsoft/house/param/HouseViewsLogParam.java b/src/main/java/com/gxwebsoft/house/param/HouseViewsLogParam.java new file mode 100644 index 0000000..b1c2590 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/param/HouseViewsLogParam.java @@ -0,0 +1,46 @@ +package com.gxwebsoft.house.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 看房记录表查询参数 + * + * @author 科技小王子 + * @since 2025-03-05 13:47:15 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "HouseViewsLogParam对象", description = "看房记录表查询参数") +public class HouseViewsLogParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "房源ID") + @QueryField(type = QueryType.EQ) + private Integer houseId; + + @Schema(description = "房主ID") + @QueryField(type = QueryType.EQ) + private Integer houseUserId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "删除") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/house/service/HouseInfoService.java b/src/main/java/com/gxwebsoft/house/service/HouseInfoService.java new file mode 100644 index 0000000..4f1f2a5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/service/HouseInfoService.java @@ -0,0 +1,44 @@ +package com.gxwebsoft.house.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.github.yulichang.base.MPJBaseService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.house.entity.HouseInfo; +import com.gxwebsoft.house.param.HouseInfoParam; + +import java.util.List; + +/** + * 房源信息表Service + * + * @author 科技小王子 + * @since 2025-03-05 13:47:14 + */ +public interface HouseInfoService extends MPJBaseService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(HouseInfoParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(HouseInfoParam param); + + /** + * 根据id查询 + * + * @param houseId 自增ID + * @return HouseInfo + */ + HouseInfo getByIdRel(Integer houseId); + + String generatePoster(HouseInfo houseInfo) throws Exception; +} diff --git a/src/main/java/com/gxwebsoft/house/service/HouseLikeLogService.java b/src/main/java/com/gxwebsoft/house/service/HouseLikeLogService.java new file mode 100644 index 0000000..d04bc0c --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/service/HouseLikeLogService.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.house.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.github.yulichang.base.MPJBaseService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.house.entity.HouseLikeLog; +import com.gxwebsoft.house.param.HouseLikeLogParam; + +import java.util.List; + +/** + * 房源点赞表Service + * + * @author 科技小王子 + * @since 2025-03-05 13:47:14 + */ +public interface HouseLikeLogService extends MPJBaseService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(HouseLikeLogParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(HouseLikeLogParam param); + + /** + * 根据id查询 + * + * @param houseId ID + * @return LikeLog + */ + HouseLikeLog getByIdRel(Integer houseId, Integer userId); + + boolean add(HouseLikeLog likeLog); + +} diff --git a/src/main/java/com/gxwebsoft/house/service/HouseReservationService.java b/src/main/java/com/gxwebsoft/house/service/HouseReservationService.java new file mode 100644 index 0000000..e7f9e5a --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/service/HouseReservationService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.house.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.house.entity.HouseReservation; +import com.gxwebsoft.house.param.HouseReservationParam; + +import java.util.List; + +/** + * 预约记录表Service + * + * @author 科技小王子 + * @since 2025-03-05 13:47:15 + */ +public interface HouseReservationService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(HouseReservationParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(HouseReservationParam param); + + /** + * 根据id查询 + * + * @param logId ID + * @return HouseReservation + */ + HouseReservation getByIdRel(Integer logId); + +} diff --git a/src/main/java/com/gxwebsoft/house/service/HouseUserService.java b/src/main/java/com/gxwebsoft/house/service/HouseUserService.java new file mode 100644 index 0000000..40b8559 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/service/HouseUserService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.house.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.house.entity.HouseUser; +import com.gxwebsoft.house.param.HouseUserParam; + +import java.util.List; + +/** + * 用户表Service + * + * @author 科技小王子 + * @since 2025-03-05 15:13:05 + */ +public interface HouseUserService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(HouseUserParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(HouseUserParam param); + + /** + * 根据id查询 + * + * @param userId 用户id + * @return HouseUser + */ + HouseUser getByIdRel(Integer userId); + +} diff --git a/src/main/java/com/gxwebsoft/house/service/HouseViewsLogService.java b/src/main/java/com/gxwebsoft/house/service/HouseViewsLogService.java new file mode 100644 index 0000000..0424c03 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/service/HouseViewsLogService.java @@ -0,0 +1,44 @@ +package com.gxwebsoft.house.service; + +import com.github.yulichang.base.MPJBaseService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.house.entity.HouseInfo; +import com.gxwebsoft.house.entity.HouseViewsLog; +import com.gxwebsoft.house.param.HouseViewsLogParam; + +import java.util.List; + +/** + * 看房记录表Service + * + * @author 科技小王子 + * @since 2025-03-05 13:47:15 + */ +public interface HouseViewsLogService extends MPJBaseService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(HouseViewsLogParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(HouseViewsLogParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return HouseViewsLog + */ + HouseViewsLog getByIdRel(Integer id); + + void add(HouseInfo houseInfo, Integer loginUserId); +} diff --git a/src/main/java/com/gxwebsoft/house/service/impl/HouseInfoServiceImpl.java b/src/main/java/com/gxwebsoft/house/service/impl/HouseInfoServiceImpl.java new file mode 100644 index 0000000..5d3357e --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/service/impl/HouseInfoServiceImpl.java @@ -0,0 +1,324 @@ +package com.gxwebsoft.house.service.impl; + +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.freewayso.image.combiner.ImageCombiner; +import com.freewayso.image.combiner.enums.OutputFormat; +import com.freewayso.image.combiner.enums.ZoomMode; +import com.gxwebsoft.common.core.config.ConfigProperties; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.utils.ImageUtil; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.system.controller.WxLoginController; +import com.gxwebsoft.common.system.service.SettingService; +import com.gxwebsoft.house.mapper.HouseInfoMapper; +import com.gxwebsoft.house.service.HouseInfoService; +import com.gxwebsoft.house.entity.HouseInfo; +import com.gxwebsoft.house.param.HouseInfoParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.beans.factory.annotation.Value; + +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.awt.*; +import java.io.File; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.TimeUnit; + +/** + * 房源信息表Service实现 + * + * @author 科技小王子 + * @since 2025-03-05 13:47:14 + */ +@Service +public class HouseInfoServiceImpl extends ServiceImpl implements HouseInfoService { + + @Value("${config.upload-path}") + private String uploadPath; + + @Value("${config.file-server}") + private String fileServer; + + @Resource + private ConfigProperties config; + + @Resource + private SettingService settingService; + + @Resource + private RedisUtil redisUtil; + @Resource + private WxLoginController wxLoginController; + + private static final String ACCESS_TOKEN_KEY = "cache:wx:access_token"; + + @Override + public PageResult pageRel(HouseInfoParam param) { + PageParam page = new PageParam<>(param); + // 只有在没有指定排序场景时才设置默认排序 + if (param.getSortScene() == null || param.getSortScene().isEmpty()) { + page.setDefaultOrder("create_time desc"); + } + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(HouseInfoParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + // 只有在没有指定排序场景时才使用默认排序 + if (param.getSortScene() == null || param.getSortScene().isEmpty()) { + page.setDefaultOrder("create_time desc"); + } + return page.sortRecords(list); + } + + @Override + public HouseInfo getByIdRel(Integer houseId) { + HouseInfoParam param = new HouseInfoParam(); + param.setHouseId(houseId); + return param.getOne(baseMapper.selectListRel(param)); + } + + /** + * 生成房产海报 ... + * + * @param houseInfo 房源信息 + * @return 海报图片URL + * @throws Exception 异常 + */ + @Override + public String generatePoster(HouseInfo houseInfo) throws Exception { + if (ObjectUtil.isEmpty(houseInfo)) { + return null; + } + + // 解析房源图片文件 + final String files = houseInfo.getFiles(); + if (StrUtil.isBlank(files)) { + return null; + } + + System.out.println("房源图片文件: " + files); + + try { + // 解析JSON数组格式的图片文件 + JSONArray fileArray = JSONArray.parseArray(files); + if (fileArray == null || fileArray.isEmpty()) { + return null; + } + + // 获取第一张图片作为主图 + JSONObject firstFile = fileArray.getJSONObject(0); + if (firstFile == null) { + return null; + } + + String mainImageUrl = firstFile.getString("url"); + if (StrUtil.isBlank(mainImageUrl)) { + return null; + } + + ImageCombiner combiner = new ImageCombiner(mainImageUrl, OutputFormat.JPG); + // 房源信息区域开始Y坐标 + int infoStartY = 330; + int lineHeight = 40; // 增加行高 + int currentY = infoStartY; + + // 添加房源标题(黑色文字,居中) + if (StrUtil.isNotBlank(houseInfo.getHouseTitle())) { + combiner.addTextElement(houseInfo.getHouseTitle(), 32, 50, currentY) + .setColor(Color.YELLOW) + .setCenter(true); + currentY += lineHeight + 10; // 标题后多留空间 + } + + // 添加房源价格信息(红色突出显示,居中) + if (houseInfo.getRent() != null) { + String priceText = "租金: ¥" + houseInfo.getRent(); + if (houseInfo.getMonthlyRent() != null) { + priceText += "/月"; + } + combiner.addTextElement(priceText, 26, 50, currentY) + .setColor(Color.RED) + .setCenter(true); + currentY += lineHeight; + } + + // 添加房源基本信息 + StringBuilder infoText = new StringBuilder(); + if (StrUtil.isNotBlank(houseInfo.getHouseType())) { + infoText.append(houseInfo.getHouseType()); + } + if (StrUtil.isNotBlank(houseInfo.getExtent())) { + if (infoText.length() > 0) infoText.append(" | "); + infoText.append(houseInfo.getExtent()); + } + if (StrUtil.isNotBlank(houseInfo.getFloor())) { + if (infoText.length() > 0) infoText.append(" | "); + infoText.append(houseInfo.getFloor()); + } + +// if (infoText.length() > 0) { +// combiner.addTextElement(infoText.toString(), 22, 50, currentY) +// .setColor(Color.LIGHT_GRAY) +// .setCenter(true); +// } + + // 生成并添加小程序码(左上角) + String qrCodeUrl = generateMiniProgramQRCode(houseInfo.getHouseId()); + if (StrUtil.isNotBlank(qrCodeUrl)) { + // 小程序码放在左上角,尺寸占宽度20%(600*0.2=120px) +// combiner.addImageElement(qrCodeUrl, 30, 30) +// .setX(5); + combiner.addImageElement(qrCodeUrl,40,40,150,150, ZoomMode.Width); + } + + // 执行图片合并 + combiner.combine(); + + // 创建保存目录 + String posterDir = uploadPath + "/poster/" + houseInfo.getTenantId() + "/house"; + if (!FileUtil.exist(posterDir)) { + FileUtil.mkdir(posterDir); + } + + // 生成文件路径 + String basePath = "/poster/" + houseInfo.getTenantId() + "/house/big-" + houseInfo.getHouseId() + ".jpg"; + String smallPath = "/poster/" + houseInfo.getTenantId() + "/house/" + houseInfo.getHouseId() + ".jpg"; + String filename = uploadPath + "/file" + basePath; + String smallFileName = uploadPath + "/file" + smallPath; + + // 保存原图 + combiner.save(filename); + + // 压缩图片 + File input = new File(filename); + File output = new File(smallFileName); + ImageUtil.adjustQuality(input, output, 0.8f); + + // 删除原图,保留压缩后的图片 + if (input.exists()) { + input.delete(); + } + + // 返回图片访问URL + return fileServer + smallPath + "?r=" + RandomUtil.randomNumbers(4); + + } catch (Exception e) { + System.err.println("生成房产海报失败: " + e.getMessage()); + e.printStackTrace(); + throw e; + } + } + + /** + * 生成房源详情页小程序码 + * + * @param houseId 房源ID + * @return 小程序码图片URL + */ + private String generateMiniProgramQRCode(Integer houseId) { + try { + String apiUrl = "https://api.weixin.qq.com/wxa/getwxacode?access_token=" + wxLoginController.getAccessToken(); + final HashMap map = new HashMap<>(); + // 设置小程序页面路径:sub_pages/house/detail/ + houseId + map.put("path", "sub_pages/house/detail/?houseId=" + houseId); + // 可以设置环境版本,如果需要的话 +// map.put("env_version", "trial"); + + // 获取图片 Buffer + byte[] qrCode = HttpRequest.post(apiUrl) + .body(JSON.toJSONString(map)) + .execute().bodyBytes(); + + // 保存的文件名称 + final String fileName = CommonUtil.randomUUID8().concat(".png"); + // 保存路径 + String filePath = getUploadDir().concat("qrcode/house/") + fileName; + + // 确保目录存在 + String qrCodeDir = getUploadDir().concat("qrcode/house/"); + if (!FileUtil.exist(qrCodeDir)) { + FileUtil.mkdir(qrCodeDir); + } + + File file = FileUtil.writeBytes(qrCode, filePath); + if (file != null) { + return config.getFileServer().concat("/qrcode/house/").concat(fileName); + } + } catch (Exception e) { + System.err.println("生成房源小程序码失败: " + e.getMessage()); + e.printStackTrace(); + } + return null; + } + + /** + * 获取微信小程序Access Token + * + * @return access_token + */ +// private String getAccessToken() { +// String key = ACCESS_TOKEN_KEY.concat(":").concat("1"); // 这里可以根据实际情况获取tenantId +// System.out.println("key = " + key); +// // 获取微信小程序配置信息 +// JSONObject setting = settingService.getBySettingKey("mp-weixin"); +// if (setting == null) { +// throw new RuntimeException("请先配置小程序"); +// } +// +// // 从缓存获取access_token +// String value = redisUtil.get(key); +// System.out.println("redisTemplate-value = " + value); +// if (value != null) { +// JSONObject response = JSON.parseObject(value); +// String accessToken = response.getString("access_token"); +// if (StrUtil.isNotBlank(accessToken)) { +// return accessToken; +// } +// } +// +// // 微信获取凭证接口 +// String apiUrl = "https://api.weixin.qq.com/cgi-bin/token"; +// // 组装url参数 +// String url = apiUrl.concat("?grant_type=client_credential") +// .concat("&appid=").concat(setting.getString("appId")) +// .concat("&secret=").concat(setting.getString("appSecret")); +// +// // 执行get请求 +// String result = cn.hutool.http.HttpUtil.get(url); +// System.out.println("获取access_token结果: " + result); +// +// // 解析access_token +// JSONObject response = JSON.parseObject(result); +// if (response.getString("access_token") != null) { +// // 存入缓存 +// redisUtil.set(key, result, 7000L, TimeUnit.SECONDS); +// return response.getString("access_token"); +// } +// +// throw new RuntimeException("小程序配置不正确"); +// } + + /** + * 文件上传位置(服务器) + */ + private String getUploadDir() { + return config.getUploadPath(); + } + +} diff --git a/src/main/java/com/gxwebsoft/house/service/impl/HouseLikeLogServiceImpl.java b/src/main/java/com/gxwebsoft/house/service/impl/HouseLikeLogServiceImpl.java new file mode 100644 index 0000000..6670d85 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/service/impl/HouseLikeLogServiceImpl.java @@ -0,0 +1,64 @@ +package com.gxwebsoft.house.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.yulichang.base.MPJBaseServiceImpl; +import com.gxwebsoft.house.mapper.HouseLikeLogMapper; +import com.gxwebsoft.house.service.HouseLikeLogService; +import com.gxwebsoft.house.entity.HouseLikeLog; +import com.gxwebsoft.house.param.HouseLikeLogParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 房源点赞表Service实现 + * + * @author 科技小王子 + * @since 2025-03-05 13:47:14 + */ +@Service +public class HouseLikeLogServiceImpl extends MPJBaseServiceImpl implements HouseLikeLogService { + + @Override + public PageResult pageRel(HouseLikeLogParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(HouseLikeLogParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public HouseLikeLog getByIdRel(Integer houseId, Integer userId) { + LambdaQueryWrapper wr = Wrappers.lambdaQuery(HouseLikeLog.class).eq(HouseLikeLog::getHouseId, houseId).eq(HouseLikeLog::getUserId, userId); + HouseLikeLog likeLogs = getBaseMapper().selectOne(wr); + return likeLogs; + } + + @Override + public boolean add( HouseLikeLog likeLog) { + LambdaQueryWrapper wr = Wrappers.lambdaQuery(HouseLikeLog.class).eq(HouseLikeLog::getHouseId, likeLog.getHouseId()).eq(HouseLikeLog::getUserId, likeLog.getUserId()); + + List likeLogs = getBaseMapper().selectList(wr); + if(CollectionUtils.isNotEmpty(likeLogs)) { + baseMapper.delete(wr); + return false; + }else { + int insert = baseMapper.insert(likeLog); + return true; + } + } + +} diff --git a/src/main/java/com/gxwebsoft/house/service/impl/HouseReservationServiceImpl.java b/src/main/java/com/gxwebsoft/house/service/impl/HouseReservationServiceImpl.java new file mode 100644 index 0000000..343b3d6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/service/impl/HouseReservationServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.house.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.house.mapper.HouseReservationMapper; +import com.gxwebsoft.house.service.HouseReservationService; +import com.gxwebsoft.house.entity.HouseReservation; +import com.gxwebsoft.house.param.HouseReservationParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 预约记录表Service实现 + * + * @author 科技小王子 + * @since 2025-03-05 13:47:15 + */ +@Service +public class HouseReservationServiceImpl extends ServiceImpl implements HouseReservationService { + + @Override + public PageResult pageRel(HouseReservationParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(HouseReservationParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public HouseReservation getByIdRel(Integer logId) { + HouseReservationParam param = new HouseReservationParam(); + param.setLogId(logId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/house/service/impl/HouseUserServiceImpl.java b/src/main/java/com/gxwebsoft/house/service/impl/HouseUserServiceImpl.java new file mode 100644 index 0000000..93f0f56 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/service/impl/HouseUserServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.house.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.house.mapper.HouseUserMapper; +import com.gxwebsoft.house.service.HouseUserService; +import com.gxwebsoft.house.entity.HouseUser; +import com.gxwebsoft.house.param.HouseUserParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 用户表Service实现 + * + * @author 科技小王子 + * @since 2025-03-05 15:13:05 + */ +@Service +public class HouseUserServiceImpl extends ServiceImpl implements HouseUserService { + + @Override + public PageResult pageRel(HouseUserParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(HouseUserParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public HouseUser getByIdRel(Integer userId) { + HouseUserParam param = new HouseUserParam(); + param.setUserId(userId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/house/service/impl/HouseViewsLogServiceImpl.java b/src/main/java/com/gxwebsoft/house/service/impl/HouseViewsLogServiceImpl.java new file mode 100644 index 0000000..8ae54b1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/service/impl/HouseViewsLogServiceImpl.java @@ -0,0 +1,65 @@ +package com.gxwebsoft.house.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.gxwebsoft.house.entity.HouseInfo; +import com.gxwebsoft.house.mapper.HouseViewsLogMapper; +import com.gxwebsoft.house.service.HouseViewsLogService; +import com.github.yulichang.base.MPJBaseServiceImpl; +import com.gxwebsoft.house.entity.HouseViewsLog; +import com.gxwebsoft.house.param.HouseViewsLogParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * 看房记录表Service实现 + * + * @author 科技小王子 + * @since 2025-03-05 13:47:15 + */ +@Service +public class HouseViewsLogServiceImpl extends MPJBaseServiceImpl implements HouseViewsLogService { + + @Override + public PageResult pageRel(HouseViewsLogParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(HouseViewsLogParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public HouseViewsLog getByIdRel(Integer id) { + HouseViewsLogParam param = new HouseViewsLogParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public void add(HouseInfo houseInfo, Integer loginUserId) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(HouseViewsLog.class).eq(HouseViewsLog::getUserId, loginUserId).eq(HouseViewsLog::getHouseId, houseInfo.getHouseId()); + HouseViewsLog viewsLog = baseMapper.selectOne(wrapper); + if(viewsLog == null){ + viewsLog = new HouseViewsLog(); + viewsLog.setUserId(loginUserId); + viewsLog.setHouseId(houseInfo.getHouseId()); + viewsLog.setHouseUserId(houseInfo.getUserId()); + } + viewsLog.setUpdateTime(LocalDateTime.now()); + saveOrUpdate(viewsLog); + } + +} diff --git a/src/main/java/com/gxwebsoft/house/util/SortSceneUtil.java b/src/main/java/com/gxwebsoft/house/util/SortSceneUtil.java new file mode 100644 index 0000000..b9873a9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/house/util/SortSceneUtil.java @@ -0,0 +1,128 @@ +package com.gxwebsoft.house.util; + +import cn.hutool.core.util.StrUtil; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; + +/** + * 排序场景工具类 + * 用于处理前端传递的排序参数,解决URL编码和字符串匹配问题 + * + * @author 科技小王子 + * @since 2025-08-04 + */ +public class SortSceneUtil { + + /** + * 标准化排序场景参数 + * @param sortScene 原始排序场景参数 + * @return 标准化后的排序场景参数 + */ + public static String normalizeSortScene(String sortScene) { + if (StrUtil.isBlank(sortScene)) { + return null; + } + + // 尝试URL解码 + String decoded = sortScene; + try { + // 如果包含%,尝试URL解码 + if (sortScene.contains("%")) { + decoded = URLDecoder.decode(sortScene, "UTF-8"); + } + } catch (UnsupportedEncodingException e) { + // 解码失败,使用原始值 + decoded = sortScene; + } + + // 去除首尾空格 + decoded = decoded.trim(); + + // 标准化常见的排序场景 + if (decoded.contains("价格") && decoded.contains("低") && decoded.contains("高")) { + if (decoded.contains("低-高") || decoded.contains("低到高") || decoded.contains("升序")) { + return "价格(低-高)"; + } else if (decoded.contains("高-低") || decoded.contains("高到低") || decoded.contains("降序")) { + return "价格(高-低)"; + } + } + + if (decoded.contains("面积") && decoded.contains("小") && decoded.contains("大")) { + if (decoded.contains("小-大") || decoded.contains("小到大") || decoded.contains("升序")) { + return "面积(小-大)"; + } else if (decoded.contains("大-小") || decoded.contains("大到小") || decoded.contains("降序")) { + return "面积(大-小)"; + } + } + + if (decoded.contains("最新") || decoded.contains("时间") || decoded.contains("发布")) { + return "最新发布"; + } + + if (decoded.contains("综合") || decoded.contains("默认")) { + return "综合排序"; + } + + return decoded; + } + + /** + * 判断是否为价格升序排序 + * @param sortScene 排序场景参数 + * @return true表示价格升序 + */ + public static boolean isPriceAsc(String sortScene) { + String normalized = normalizeSortScene(sortScene); + return "价格(低-高)".equals(normalized); + } + + /** + * 判断是否为价格降序排序 + * @param sortScene 排序场景参数 + * @return true表示价格降序 + */ + public static boolean isPriceDesc(String sortScene) { + String normalized = normalizeSortScene(sortScene); + return "价格(高-低)".equals(normalized); + } + + /** + * 判断是否为面积升序排序 + * @param sortScene 排序场景参数 + * @return true表示面积升序 + */ + public static boolean isAreaAsc(String sortScene) { + String normalized = normalizeSortScene(sortScene); + return "面积(小-大)".equals(normalized); + } + + /** + * 判断是否为面积降序排序 + * @param sortScene 排序场景参数 + * @return true表示面积降序 + */ + public static boolean isAreaDesc(String sortScene) { + String normalized = normalizeSortScene(sortScene); + return "面积(大-小)".equals(normalized); + } + + /** + * 判断是否为最新发布排序 + * @param sortScene 排序场景参数 + * @return true表示最新发布排序 + */ + public static boolean isLatest(String sortScene) { + String normalized = normalizeSortScene(sortScene); + return "最新发布".equals(normalized); + } + + /** + * 判断是否为综合排序 + * @param sortScene 排序场景参数 + * @return true表示综合排序 + */ + public static boolean isComprehensive(String sortScene) { + String normalized = normalizeSortScene(sortScene); + return "综合排序".equals(normalized); + } +} diff --git a/src/main/java/com/gxwebsoft/led/config/BmeApiProperties.java b/src/main/java/com/gxwebsoft/led/config/BmeApiProperties.java new file mode 100644 index 0000000..f0221d6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/led/config/BmeApiProperties.java @@ -0,0 +1,49 @@ +package com.gxwebsoft.led.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * 业务中台(排班接口)调用配置。 + */ +@Data +@Component +@ConfigurationProperties(prefix = "led.bme") +public class BmeApiProperties { + + /** + * 中台基础地址,例如:http://16.1.4.201:7979 + */ + private String baseUrl; + + /** + * 授权应用ID(文档中的 APPID)。 + */ + private String appid; + + /** + * 应用密钥(文档中的 secret_key)。 + */ + private String secretKey; + + /** + * 机构ID,默认按文档要求传 10001。 + */ + private String mechanismId = "10001"; + + /** + * 默认操作员代码。 + */ + private String defaultExtUserId; + + /** + * 默认医院代码,可留空。 + */ + private String defaultHospitalId; + + /** + * 连接/读取超时时间(毫秒)。 + */ + private int timeoutMs = 10000; +} diff --git a/src/main/java/com/gxwebsoft/led/controller/LedApiController.java b/src/main/java/com/gxwebsoft/led/controller/LedApiController.java new file mode 100644 index 0000000..70310c4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/led/controller/LedApiController.java @@ -0,0 +1,86 @@ +package com.gxwebsoft.led.controller; + +import com.alibaba.fastjson.JSONObject; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.led.param.BmeNumberSourcesParam; +import com.gxwebsoft.led.param.BmeStopReplaceParam; +import com.gxwebsoft.led.service.LedScheduleService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.Optional; + +@Tag(name = "LED-排班接口") +@RestController +@RequestMapping("/api/led/bme") +public class LedApiController extends BaseController { + + @Resource + private LedScheduleService ledScheduleService; + + @Operation(summary = "查询一周内停替诊医生排班信息(10017)") + @PostMapping("/stop-replace") + public ApiResult searchStopAndReplace(@RequestBody BmeStopReplaceParam param) { + return success(extractScheduleData(ledScheduleService.searchStopAndReplace(param))); + } + + @Operation(summary = "查询医生排班信息当日剩余号源(10018)") + @PostMapping("/number-sources") + public ApiResult searchNumberSources(@RequestBody BmeNumberSourcesParam param) { + return success(extractScheduleData(ledScheduleService.searchNumberSources(param))); + } + + /** + * 将中台层层嵌套的响应简化为单层:tid、resultCode/resultMsg、data(主要数据)。 + */ + private JSONObject flattenScheduleResponse(JSONObject raw) { + JSONObject current = Optional.ofNullable(raw).orElseGet(JSONObject::new); + String tid = current.getString("tid"); + + // 下钻 data 层级 + while (current.getJSONObject("data") != null) { + current = current.getJSONObject("data"); + if (current.containsKey("tid")) { + tid = current.getString("tid"); + } + } + + JSONObject result = new JSONObject(); + result.put("tid", tid); + result.put("resultCode", firstNonEmpty(current.getString("resultCode"), current.getString("code"))); + result.put("resultMsg", firstNonEmpty(current.getString("resultMsg"), current.getString("msg"))); + + // 主体数据:优先 dataList.data,其次 data + if (current.containsKey("dataList") && current.getJSONObject("dataList") != null) { + result.put("data", current.getJSONObject("dataList").get("data")); + } else if (current.containsKey("data")) { + result.put("data", current.get("data")); + } else { + result.put("data", current); + } + return result; + } + + /** + * 直接返回核心数据字段(即扁平化后的 result.data)。 + */ + private Object extractScheduleData(JSONObject raw) { + JSONObject flattened = flattenScheduleResponse(raw); + return flattened.get("data"); + } + + private String firstNonEmpty(String... values) { + for (String v : values) { + if (v != null && !v.isEmpty()) { + return v; + } + } + return ""; + } +} diff --git a/src/main/java/com/gxwebsoft/led/model/BmeToken.java b/src/main/java/com/gxwebsoft/led/model/BmeToken.java new file mode 100644 index 0000000..9ac429d --- /dev/null +++ b/src/main/java/com/gxwebsoft/led/model/BmeToken.java @@ -0,0 +1,28 @@ +package com.gxwebsoft.led.model; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 业务中台授权令牌缓存实体。 + */ +@Data +public class BmeToken implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 接口调用凭证 access_token。 + */ + private String accessToken; + + /** + * 刷新 access_token 的 refresh_token。 + */ + private String refreshToken; + + /** + * access_token 过期时间戳(秒级)。 + */ + private long expireAt; +} diff --git a/src/main/java/com/gxwebsoft/led/param/BmeNumberSourcesParam.java b/src/main/java/com/gxwebsoft/led/param/BmeNumberSourcesParam.java new file mode 100644 index 0000000..9391be3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/led/param/BmeNumberSourcesParam.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.led.param; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * 查询医生排班信息当日剩余号源(10018)入参。 + */ +@Data +public class BmeNumberSourcesParam { + + @Schema(description = "开始日期,yyyy-MM-dd") + private String startDate; + + @Schema(description = "结束日期,yyyy-MM-dd") + private String endDate; + + @Schema(description = "科室代码,可选") + private String deptCode; + + @Schema(description = "医生工号,可选") + private String userCode; + + @Schema(description = "时段,可选:01上午 02下午 03全天 04中午") + @JsonProperty("aSTimeRange") + private String aSTimeRange; + + @Schema(description = "医院代码,可选") + private String hospitalId; + + @Schema(description = "机构ID,默认10001") + private String mechanismId; + + @Schema(description = "操作员代码") + private String extUserID; + + @Schema(description = "交易代码,默认10018") + private String tradeCode; + + public String getASTimeRange() { + return aSTimeRange; + } + + public void setASTimeRange(String aSTimeRange) { + this.aSTimeRange = aSTimeRange; + } +} diff --git a/src/main/java/com/gxwebsoft/led/param/BmeStopReplaceParam.java b/src/main/java/com/gxwebsoft/led/param/BmeStopReplaceParam.java new file mode 100644 index 0000000..27a53c1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/led/param/BmeStopReplaceParam.java @@ -0,0 +1,35 @@ +package com.gxwebsoft.led.param; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * 查询一周内停替诊排班(10017)入参。 + */ +@Data +public class BmeStopReplaceParam { + + @Schema(description = "开始日期,yyyy-MM-dd") + private String startDate; + + @Schema(description = "结束日期,yyyy-MM-dd") + private String endDate; + + @Schema(description = "科室代码,可选") + private String deptCode; + + @Schema(description = "医生工号,可选") + private String userCode; + + @Schema(description = "医院代码,可选") + private String hospitalId; + + @Schema(description = "机构ID,默认10001") + private String mechanismId; + + @Schema(description = "操作员代码") + private String extUserID; + + @Schema(description = "交易代码,默认10017") + private String tradeCode; +} diff --git a/src/main/java/com/gxwebsoft/led/service/LedScheduleService.java b/src/main/java/com/gxwebsoft/led/service/LedScheduleService.java new file mode 100644 index 0000000..34f263e --- /dev/null +++ b/src/main/java/com/gxwebsoft/led/service/LedScheduleService.java @@ -0,0 +1,288 @@ +package com.gxwebsoft.led.service; + +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.crypto.digest.DigestUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.gxwebsoft.common.core.exception.BusinessException; +import com.gxwebsoft.common.core.utils.JSONUtil; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.led.config.BmeApiProperties; +import com.gxwebsoft.led.model.BmeToken; +import com.gxwebsoft.led.param.BmeNumberSourcesParam; +import com.gxwebsoft.led.param.BmeStopReplaceParam; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.time.Duration; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * 排班接口对接服务。 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class LedScheduleService { + + private static final String TOKEN_CACHE_KEY = "led:bme:auth"; + private static final long TOKEN_EXPIRE_MARGIN_SECONDS = 60L; + + private final BmeApiProperties properties; + private final RedisUtil redisUtil; + + public JSONObject searchStopAndReplace(BmeStopReplaceParam param) { + BmeStopReplaceParam requestParam = fillStopReplaceDefaults(param); + BmeToken token = ensureToken(); + String body = buildStopReplaceBody(requestParam); + return doSignedPost("/cgi-bin/bme-app-register/outpatient/registered/searchDoctorsStopAndReplaceInfo", body, token); + } + + public JSONObject searchNumberSources(BmeNumberSourcesParam param) { + BmeNumberSourcesParam requestParam = fillNumberSourcesDefaults(param); + BmeToken token = ensureToken(); + String body = buildNumberSourcesBody(requestParam); + return doSignedPost("/cgi-bin/bme-app-register/outpatient/registered/searchDoctorsNumberSources", body, token); + } + + private JSONObject doSignedPost(String path, String body, BmeToken token) { + if (StrUtil.isBlank(body)) { + throw new BusinessException("请求体为空"); + } + ensureConfig(); + long timestamp = System.currentTimeMillis() / 1000; + String nonce = RandomUtil.randomString(16); + String signStr = body + "|" + token.getAccessToken() + "|" + token.getRefreshToken() + "|" + timestamp + "|" + nonce; + String sig = DigestUtil.md5Hex(signStr); + HttpResponse response = HttpRequest.post(buildUrl(path)) + .header("sig", sig) + .header("timestamp", String.valueOf(timestamp)) + .header("nonce", nonce) + .header("access-token", token.getAccessToken()) + .contentType("application/json") + .body(body) + .timeout(properties.getTimeoutMs()) + .execute(); + if (response.getStatus() != 200) { + throw new BusinessException("调用中台接口失败,HTTP状态码:" + response.getStatus()); + } + String respBody = response.body(); + JSONObject respJson; + try { + respJson = JSON.parseObject(respBody); + } catch (Exception e) { + throw new BusinessException("解析中台响应失败"); + } + if (respJson == null || !"0".equals(respJson.getString("code"))) { + String message = respJson != null ? respJson.getString("msg") : "未知错误"; + throw new BusinessException("中台接口调用失败:" + message); + } + return respJson; + } + + private BmeStopReplaceParam fillStopReplaceDefaults(BmeStopReplaceParam param) { + if (param == null) { + throw new BusinessException("请求参数不能为空"); + } + if (StrUtil.isBlank(param.getStartDate()) || StrUtil.isBlank(param.getEndDate())) { + throw new BusinessException("开始日期和结束日期必填"); + } + if (StrUtil.isBlank(param.getMechanismId())) { + param.setMechanismId(properties.getMechanismId()); + } + if (StrUtil.isBlank(param.getExtUserID())) { + param.setExtUserID(properties.getDefaultExtUserId()); + } + if (StrUtil.isBlank(param.getHospitalId())) { + param.setHospitalId(properties.getDefaultHospitalId()); + } + if (StrUtil.isBlank(param.getTradeCode())) { + param.setTradeCode("10017"); + } + if (StrUtil.hasBlank(param.getMechanismId(), param.getExtUserID(), param.getTradeCode())) { + throw new BusinessException("机构ID、操作员代码、交易代码必填"); + } + return param; + } + + private BmeNumberSourcesParam fillNumberSourcesDefaults(BmeNumberSourcesParam param) { + if (param == null) { + throw new BusinessException("请求参数不能为空"); + } + if (StrUtil.isBlank(param.getStartDate()) || StrUtil.isBlank(param.getEndDate())) { + throw new BusinessException("开始日期和结束日期必填"); + } + if (StrUtil.isBlank(param.getMechanismId())) { + param.setMechanismId(properties.getMechanismId()); + } + if (StrUtil.isBlank(param.getExtUserID())) { + param.setExtUserID(properties.getDefaultExtUserId()); + } + if (StrUtil.isBlank(param.getHospitalId())) { + param.setHospitalId(properties.getDefaultHospitalId()); + } + if (StrUtil.isBlank(param.getTradeCode())) { + param.setTradeCode("10018"); + } + if (StrUtil.hasBlank(param.getMechanismId(), param.getExtUserID(), param.getTradeCode())) { + throw new BusinessException("机构ID、操作员代码、交易代码必填"); + } + return param; + } + + private String buildStopReplaceBody(BmeStopReplaceParam param) { + Map body = new LinkedHashMap<>(); + body.put("mechanismId", param.getMechanismId()); + body.put("tradeCode", param.getTradeCode()); + body.put("startDate", param.getStartDate()); + body.put("endDate", param.getEndDate()); + putIfNotBlank(body, "deptCode", param.getDeptCode()); + putIfNotBlank(body, "userCode", param.getUserCode()); + putIfNotBlank(body, "hospitalId", param.getHospitalId()); + body.put("extUserID", param.getExtUserID()); + return JSONUtil.toJSONString(body); + } + + private String buildNumberSourcesBody(BmeNumberSourcesParam param) { + Map body = new LinkedHashMap<>(); + body.put("mechanismId", param.getMechanismId()); + body.put("tradeCode", param.getTradeCode()); + body.put("startDate", param.getStartDate()); + body.put("endDate", param.getEndDate()); + putIfNotBlank(body, "deptCode", param.getDeptCode()); + putIfNotBlank(body, "userCode", param.getUserCode()); + putIfNotBlank(body, "aSTimeRange", param.getASTimeRange()); + putIfNotBlank(body, "hospitalId", param.getHospitalId()); + body.put("extUserID", param.getExtUserID()); + return JSONUtil.toJSONString(body); + } + + private void putIfNotBlank(Map body, String key, String value) { + if (StrUtil.isNotBlank(value)) { + body.put(key, value); + } + } + + private BmeToken ensureToken() { + ensureConfig(); + long now = System.currentTimeMillis() / 1000; + BmeToken cached = redisUtil.get(TOKEN_CACHE_KEY, BmeToken.class); + if (cached != null && cached.getExpireAt() > now + TOKEN_EXPIRE_MARGIN_SECONDS) { + return cached; + } + if (cached != null && StrUtil.isNotBlank(cached.getRefreshToken())) { + try { + return refreshToken(cached.getRefreshToken()); + } catch (Exception e) { + log.warn("刷新 access_token 失败,尝试重新申请: {}", e.getMessage()); + } + } + return fetchToken(); + } + + private BmeToken fetchToken() { + long timestamp = System.currentTimeMillis() / 1000; + String nonce = IdUtil.fastSimpleUUID(); + String grantType = "secret"; + Map form = new HashMap<>(); + form.put("appid", properties.getAppid()); + form.put("grant_type", grantType); + form.put("secret_key", properties.getSecretKey()); + form.put("timestamp", timestamp); + form.put("nonce", nonce); + String signStr = properties.getAppid() + "|" + properties.getSecretKey() + "|" + grantType + "|" + timestamp + "|" + nonce; + form.put("sign", DigestUtil.md5Hex(signStr)); + + HttpResponse response = HttpRequest.get(buildUrl("/cgi-bin/bme-auth/auth/access_token")) + .form(form) + .timeout(properties.getTimeoutMs()) + .execute(); + return handleTokenResponse(response); + } + + private BmeToken refreshToken(String refreshToken) { + long timestamp = System.currentTimeMillis() / 1000; + String nonce = IdUtil.fastSimpleUUID(); + String grantType = "refresh_token"; + Map form = new HashMap<>(); + form.put("appid", properties.getAppid()); + form.put("grant_type", grantType); + form.put("refresh_token", refreshToken); + form.put("timestamp", timestamp); + form.put("nonce", nonce); + String signStr = properties.getAppid() + "|" + properties.getSecretKey() + "|" + refreshToken + "|" + grantType + "|" + timestamp + "|" + nonce; + form.put("sign", DigestUtil.md5Hex(signStr)); + HttpResponse response = HttpRequest.get(buildUrl("/cgi-bin/bme-auth/auth/refresh_token")) + .form(form) + .timeout(properties.getTimeoutMs()) + .execute(); + return handleTokenResponse(response); + } + + private BmeToken handleTokenResponse(HttpResponse response) { + if (response.getStatus() != 200) { + throw new BusinessException("获取中台token失败,HTTP状态码:" + response.getStatus()); + } + JSONObject resp; + try { + resp = JSON.parseObject(response.body()); + } catch (Exception e) { + throw new BusinessException("解析中台token响应失败"); + } + if (resp == null || !"0".equals(resp.getString("code"))) { + String message = resp != null ? resp.getString("msg") : "未知错误"; + throw new BusinessException("获取中台token失败:" + message); + } + JSONObject data = resp.getJSONObject("data"); + if (data == null) { + throw new BusinessException("中台token响应缺少数据"); + } + String accessToken = data.getString("access_token"); + String refreshToken = data.getString("refresh_token"); + int expiresIn = data.getIntValue("expires_in"); + if (StrUtil.hasBlank(accessToken, refreshToken) || expiresIn <= 0) { + throw new BusinessException("中台token响应不完整"); + } + long expireAt = System.currentTimeMillis() / 1000 + expiresIn - TOKEN_EXPIRE_MARGIN_SECONDS; + BmeToken token = new BmeToken(); + token.setAccessToken(accessToken); + token.setRefreshToken(refreshToken); + token.setExpireAt(expireAt); + // refresh_token有效期5天,这里缓存5天 + redisUtil.set(TOKEN_CACHE_KEY, token, Duration.ofDays(5).getSeconds(), TimeUnit.SECONDS); + System.out.println("token = " + token); + return token; + } + + private void ensureConfig() { + if (StrUtil.hasBlank(properties.getBaseUrl(), properties.getAppid(), properties.getSecretKey())) { + throw new BusinessException("排班接口配置缺失,请检查 led.bme 配置"); + } + } + + private String buildUrl(String path) { + String base = properties.getBaseUrl(); + if (StrUtil.isBlank(base)) { + throw new BusinessException("排班接口基础地址未配置"); + } + if (base.endsWith("/")) { + base = base.substring(0, base.length() - 1); + } + if (!path.startsWith("/")) { + path = "/" + path; + } + // 兼容 baseUrl 已包含 /cgi-bin 的场景,避免拼接成 /cgi-bin/cgi-bin + if (base.endsWith("/cgi-bin") && path.startsWith("/cgi-bin/")) { + path = path.substring("/cgi-bin".length()); + } + return base + path; + } +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaAppController.java b/src/main/java/com/gxwebsoft/oa/controller/OaAppController.java new file mode 100644 index 0000000..001c3f8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaAppController.java @@ -0,0 +1,328 @@ +package com.gxwebsoft.oa.controller; + +import cn.hutool.core.net.url.UrlBuilder; +import cn.hutool.core.net.url.UrlQuery; +import cn.hutool.core.util.DesensitizedUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.security.JwtUtil; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.FileRecord; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.entity.OaAppUrl; +import com.gxwebsoft.oa.entity.OaAppUser; +import com.gxwebsoft.oa.service.OaAppService; +import com.gxwebsoft.oa.entity.OaApp; +import com.gxwebsoft.oa.param.OaAppParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.oa.service.OaAppUrlService; +import com.gxwebsoft.oa.service.OaAppUserService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import static com.gxwebsoft.common.core.constants.AppUserConstants.ADMINISTRATOR; + +/** + * 应用控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Tag(name = "应用管理") +@RestController +@RequestMapping("/api/oa/oa-app") +public class OaAppController extends BaseController { + @Resource + private OaAppService oaAppService; + @Resource + private OaAppUrlService oaAppUrlService; + @Resource + private OaAppUserService oaAppUserService; + @Resource + private RedisUtil redisUtil; + + @PreAuthorize("hasAuthority('oa:app:list')") + @Operation(summary = "分页查询应用") + @GetMapping("/page") + public ApiResult> page(OaAppParam param, HttpServletRequest request) { + final User loginUser = getLoginUser(); + // 未登录情况 + if(loginUser == null){ + String access_token = JwtUtil.getAccessToken(request); + param.setToken(access_token); + return success("案例列表",caseList(param)); + } + final Integer userId = loginUser.getUserId(); + loginUser.getRoles().forEach(d -> { + if(!StrUtil.equals(d.getRoleCode(),"superAdmin") && !StrUtil.equals(d.getRoleCode(),"admin")){ + // 非管理员按项目成员权限显示 + final List list = oaAppUserService.list(new LambdaQueryWrapper().eq(OaAppUser::getUserId, userId)); + System.out.println("非管理员按项目成员权限显示 list = " + list); + final Set collect = list.stream().map(OaAppUser::getAppId).collect(Collectors.toSet()); + param.setAppIds(collect); + } + }); + // 过滤续费提醒参数 + if (param.getAppStatus() != null && param.getAppStatus().equals("续费中")) { + param.setAppStatus(null); + } + // 使用关联查询 + return success(oaAppService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('oa:app:list')") + @Operation(summary = "查询全部应用") + @GetMapping() + public ApiResult> list(OaAppParam param) { + // 使用关联查询 + return success(oaAppService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:app:list')") + @Operation(summary = "根据id查询应用") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + final User loginUser = getLoginUser(); + // 未登录情况 + if(loginUser == null){ + return success("案例详情",getDesensitizedApp(id)); + } + if (!CommonUtil.hasRole(loginUser.getRoles(),"superAdmin") && !CommonUtil.hasRole(loginUser.getRoles(),"admin")) { + // 查询权限 + if (oaAppUserService.count(new LambdaQueryWrapper().eq(OaAppUser::getUserId, getLoginUserId()).eq(OaAppUser::getAppId,id)) == 0) { + return fail("无查看权限",null); + } + } + // 使用关联查询 + return success(oaAppService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('oa:app:save')") + @Operation(summary = "添加应用") + @PostMapping() + public ApiResult save(@RequestBody OaApp app) { + // 记录当前登录用户id、租户id、商户编号 + User loginUser = getLoginUser(); + OaAppUser appUser = new OaAppUser(); + if (loginUser != null) { + app.setUserId(loginUser.getUserId()); + app.setTenantId(loginUser.getTenantId()); + } + if (oaAppService.count(new LambdaQueryWrapper() + .eq(OaApp::getAppCode, app.getAppCode())) > 0) { + return fail("应用标识已存在"); + } + if (oaAppService.save(app)) { + // 添加应用管理员 + if (loginUser != null) { + appUser.setUserId(loginUser.getUserId()); + appUser.setNickname(loginUser.getNickname()); + appUser.setAppId(app.getAppId()); + appUser.setRole(ADMINISTRATOR); + oaAppUserService.save(appUser); + } + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:app:update')") + @Operation(summary = "修改应用") + @PutMapping() + public ApiResult update(@RequestBody OaApp oaApp) { + if (oaAppService.updateById(oaApp)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:app:remove')") + @Operation(summary = "删除应用") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaAppService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('oa:app:save')") + @Operation(summary = "批量添加应用") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaAppService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:app:update')") + @Operation(summary = "批量修改应用") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaAppService, "app_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:app:remove')") + @Operation(summary = "批量删除应用") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaAppService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "统计信息") + @GetMapping("/data") + public ApiResult> data() { + Map data = new HashMap<>(); + Integer totalNum = oaAppService.count( + new LambdaQueryWrapper<>() + ); + Integer totalNum2 = oaAppService.count( + new LambdaQueryWrapper() + .eq(OaApp::getAppStatus, "开发中") + ); + Integer totalNum3 = oaAppService.count( + new LambdaQueryWrapper() + .eq(OaApp::getAppStatus, "已上架") + ); + Integer totalNum4 = oaAppService.count( + new LambdaQueryWrapper() + .eq(OaApp::getAppStatus, "已上架") + .eq(OaApp::getShowExpiration,false) + ); + Integer totalNum5 = oaAppService.count( + new LambdaQueryWrapper() + .eq(OaApp::getAppStatus, "已下架") + ); + Integer totalNum6 = oaAppService.count( + new LambdaQueryWrapper() + .eq(OaApp::getShowCase,true) + ); + Integer totalNum7 = oaAppService.count( + new LambdaQueryWrapper() + .eq(OaApp::getShowIndex, true) + ); + + data.put("totalNum", totalNum); + data.put("totalNum2", totalNum2); + data.put("totalNum3", totalNum3); + data.put("totalNum4", totalNum4); + data.put("totalNum5", totalNum5); + data.put("totalNum6", totalNum6); + data.put("totalNum7", totalNum7); + return success(data); + } + + + // 读取案例列表 + private PageResult caseList(OaAppParam param){ + param.setShowCase(true); + final PageResult appPageResult = oaAppService.pageRel(param); + appPageResult.getList().forEach(d -> { + d.setContent(null); + // 读取账号列表 + d.setAppUrlList(oaAppUrlService.list(new LambdaQueryWrapper().eq(OaAppUrl::getAppId,d.getAppId()))); + // 读取项目附件(链式构建GET请求) + HashMap map = new HashMap<>(); + map.put("appId", d.getAppId()); + final String build = UrlBuilder.of("https://server.gxwebsoft.com/api/file/page").setQuery(new UrlQuery(map)).build(); + String response = HttpRequest.get(build) + .header("Authorization", param.getToken()) + .header("Tenantid", d.getTenantId().toString()) + .body(JSONObject.toJSONString(map))//表单内容 + .timeout(20000)//超时,毫秒 + .execute().body(); + + final ApiResult> userResult = JSONObject.parseObject(response, new TypeReference>>() { + }); + d.setAppFiles(userResult.getData().getList()); + }); + return appPageResult; + } + + private OaApp getDesensitizedApp(Integer id) { + final OaApp app = oaAppService.getByIdRel(id); + app.setPhone(DesensitizedUtil.mobilePhone(app.getPhone())); + app.setCompanyName( + StrUtil.hide(app.getCompanyName(), 2, app.getCompanyName().length() - 2)); + app.setRequirement(DesensitizedUtil.chineseName(app.getCompanyName())); + return app; + } + + @PreAuthorize("hasAuthority('oa:app:update')") + @Operation(summary = "重置秘钥") + @PostMapping("/updateAppSecret") + public ApiResult updateAppSecret(@RequestBody OaApp app) { + String key = "code:" + app.getPhone(); + final String code = redisUtil.get(key); + if (app.getAppId() == null) { + return fail("appId不合法"); + } + if(app.getAppSecret() == null){ + return fail("appSecret不合法"); + } + if(app.getAppCode() == null){ + return fail("短信验证码不正确"); + } +// && !app.getAppCode().equals("170083") + if(!app.getAppCode().equals(code)){ + return fail("短信验证码不正确"); + } + oaAppService.updateById(app); + // 保存到redis + redisUtil.set("AppSecret:" + app.getAppId(),app.getAppSecret()); + redisUtil.delete(key); + return success("重置成功",app.getAppSecret()); + } + + @PreAuthorize("hasAuthority('oa:app:list')") + @Operation(summary = "APP应用授权身份效验") + @GetMapping("/authentication/{appid}") + public ApiResult authentication(@PathVariable("appid") String appid) { + final OaApp appInfo = oaAppService.getById(appid); + if(appInfo == null){ + return fail("应用不存在:".concat(appid)); + } + return success("应用信息",appInfo); + } + + @Operation(summary = "查询我的项目信息") + @GetMapping("/getMyApp") + public ApiResult getMyApp() { + final User loginUser = getLoginUser(); + // 未登录情况 + if(loginUser == null){ + return fail("请先登录",null); + } + oaAppService.list(); + + // 使用关联查询 + return success("查询成功",null); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaAppFieldController.java b/src/main/java/com/gxwebsoft/oa/controller/OaAppFieldController.java new file mode 100644 index 0000000..7805e3c --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaAppFieldController.java @@ -0,0 +1,120 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaAppFieldService; +import com.gxwebsoft.oa.entity.OaAppField; +import com.gxwebsoft.oa.param.OaAppFieldParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 应用参数控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Tag(name = "应用参数管理") +@RestController +@RequestMapping("/api/oa/oa-app-field") +public class OaAppFieldController extends BaseController { + @Resource + private OaAppFieldService oaAppFieldService; + + @Operation(summary = "分页查询应用参数") + @GetMapping("/page") + public ApiResult> page(OaAppFieldParam param) { + // 使用关联查询 + return success(oaAppFieldService.pageRel(param)); + } + + @Operation(summary = "查询全部应用参数") + @GetMapping() + public ApiResult> list(OaAppFieldParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(oaAppFieldService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(oaAppFieldService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAppField:list')") + @OperationLog + @Operation(summary = "根据id查询应用参数") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(oaAppFieldService.getById(id)); + // 使用关联查询 + //return success(oaAppFieldService.getByIdRel(id)); + } + + @Operation(summary = "添加应用参数") + @PostMapping() + public ApiResult save(@RequestBody OaAppField oaAppField) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaAppField.setUserId(loginUser.getUserId()); + } + if (oaAppFieldService.save(oaAppField)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改应用参数") + @PutMapping() + public ApiResult update(@RequestBody OaAppField oaAppField) { + if (oaAppFieldService.updateById(oaAppField)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除应用参数") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaAppFieldService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加应用参数") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaAppFieldService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改应用参数") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaAppFieldService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除应用参数") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaAppFieldService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaAppRenewController.java b/src/main/java/com/gxwebsoft/oa/controller/OaAppRenewController.java new file mode 100644 index 0000000..bcd62bc --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaAppRenewController.java @@ -0,0 +1,163 @@ +package com.gxwebsoft.oa.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.entity.OaApp; +import com.gxwebsoft.oa.service.OaAppRenewService; +import com.gxwebsoft.oa.entity.OaAppRenew; +import com.gxwebsoft.oa.param.OaAppRenewParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.oa.service.OaAppService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 续费管理控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Tag(name = "续费管理管理") +@RestController +@RequestMapping("/api/oa/oa-app-renew") +public class OaAppRenewController extends BaseController { + @Resource + private OaAppRenewService oaAppRenewService; + @Resource + private OaAppService oaAppService; + + @Operation(summary = "分页查询续费管理") + @GetMapping("/page") + public ApiResult> page(OaAppRenewParam param) { + // 使用关联查询 + return success(oaAppRenewService.pageRel(param)); + } + + @Operation(summary = "查询全部续费管理") + @GetMapping() + public ApiResult> list(OaAppRenewParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(oaAppRenewService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(oaAppRenewService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAppRenew:list')") + @OperationLog + @Operation(summary = "根据id查询续费管理") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(oaAppRenewService.getById(id)); + // 使用关联查询 + //return success(oaAppRenewService.getByIdRel(id)); + } + + @Operation(summary = "添加续费管理") + @PostMapping() + public ApiResult save(@RequestBody OaAppRenew oaAppRenew) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaAppRenew.setUserId(loginUser.getUserId()); + } + if (oaAppRenewService.save(oaAppRenew)) { + oaAppService.update(new LambdaUpdateWrapper().eq(OaApp::getAppId, oaAppRenew.getAppId()).set(OaApp::getShowExpiration, true)); + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改续费管理") + @PutMapping() + public ApiResult update(@RequestBody OaAppRenew oaAppRenew) { + if (oaAppRenewService.updateById(oaAppRenew)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除续费管理") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaAppRenewService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加续费管理") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaAppRenewService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改续费管理") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaAppRenewService, "app_renew_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除续费管理") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaAppRenewService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + + @Operation(summary = "统计信息") + @GetMapping("/data") + public ApiResult> data() { + Map data = new HashMap<>(); + final User loginUser = getLoginUser(); + if(loginUser == null){ + return fail("请先登录",null); + } + + // 获取当前年份的起止时间 + LocalDateTime startOfYear = LocalDateTime.now().withMonth(1).withDayOfMonth(1) + .withHour(0).withMinute(0).withSecond(0); + LocalDateTime endOfYear = startOfYear.plusYears(1).minusNanos(1); + + // 今年应收续费总金额(到期时间在今年的记录) + BigDecimal totalNum1 = oaAppService.sumMoney(new LambdaQueryWrapper() + .between(OaApp::getExpirationTime, startOfYear, endOfYear)); + // 今年已收续费总金额(到期时间在今年的记录) + BigDecimal totalNum2 = oaAppRenewService.sumMoney(new LambdaQueryWrapper() + .between(OaAppRenew::getEndTime, startOfYear, endOfYear)); + + // 今年已收续费总金额(创建时间在今年且已支付的记录) + BigDecimal totalNum3 = oaAppRenewService.sumMoney(new LambdaQueryWrapper() + .between(OaAppRenew::getCreateTime, startOfYear, endOfYear) + .isNotNull(OaAppRenew::getMoney)); + + data.put("totalNum1", totalNum1 != null ? totalNum1 : BigDecimal.ZERO); + data.put("totalNum2", totalNum2 != null ? totalNum2 : BigDecimal.ZERO); + return success(data); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaAppUrlController.java b/src/main/java/com/gxwebsoft/oa/controller/OaAppUrlController.java new file mode 100644 index 0000000..49bf27b --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaAppUrlController.java @@ -0,0 +1,115 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaAppUrlService; +import com.gxwebsoft.oa.entity.OaAppUrl; +import com.gxwebsoft.oa.param.OaAppUrlParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 项目域名控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Tag(name = "项目域名管理") +@RestController +@RequestMapping("/api/oa/oa-app-url") +public class OaAppUrlController extends BaseController { + @Resource + private OaAppUrlService oaAppUrlService; + + @Operation(summary = "分页查询项目域名") + @GetMapping("/page") + public ApiResult> page(OaAppUrlParam param) { + // 使用关联查询 + return success(oaAppUrlService.pageRel(param)); + } + + @Operation(summary = "查询全部项目域名") + @GetMapping() + public ApiResult> list(OaAppUrlParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(oaAppUrlService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(oaAppUrlService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAppUrl:list')") + @OperationLog + @Operation(summary = "根据id查询项目域名") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(oaAppUrlService.getById(id)); + // 使用关联查询 + //return success(oaAppUrlService.getByIdRel(id)); + } + + @Operation(summary = "添加项目域名") + @PostMapping() + public ApiResult save(@RequestBody OaAppUrl oaAppUrl) { + if (oaAppUrlService.save(oaAppUrl)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改项目域名") + @PutMapping() + public ApiResult update(@RequestBody OaAppUrl oaAppUrl) { + if (oaAppUrlService.updateById(oaAppUrl)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除项目域名") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaAppUrlService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加项目域名") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaAppUrlService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改项目域名") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaAppUrlService, "app_url_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除项目域名") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaAppUrlService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaAppUserController.java b/src/main/java/com/gxwebsoft/oa/controller/OaAppUserController.java new file mode 100644 index 0000000..ab3687d --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaAppUserController.java @@ -0,0 +1,111 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaAppUserService; +import com.gxwebsoft.oa.entity.OaAppUser; +import com.gxwebsoft.oa.param.OaAppUserParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 应用成员控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Tag(name = "应用成员管理") +@RestController +@RequestMapping("/api/oa/oa-app-user") +public class OaAppUserController extends BaseController { + @Resource + private OaAppUserService oaAppUserService; + + @Operation(summary = "分页查询应用成员") + @GetMapping("/page") + public ApiResult> page(OaAppUserParam param) { + // 使用关联查询 + return success(oaAppUserService.pageRel(param)); + } + + @Operation(summary = "查询全部应用成员") + @GetMapping() + public ApiResult> list(OaAppUserParam param) { + // 使用关联查询 + return success(oaAppUserService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAppUser:list')") + @OperationLog + @Operation(summary = "根据id查询应用成员") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(oaAppUserService.getByIdRel(id)); + } + + @Operation(summary = "添加应用成员") + @PostMapping() + public ApiResult save(@RequestBody OaAppUser oaAppUser) { + if (oaAppUserService.save(oaAppUser)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改应用成员") + @PutMapping() + public ApiResult update(@RequestBody OaAppUser oaAppUser) { + if (oaAppUserService.updateById(oaAppUser)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除应用成员") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaAppUserService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加应用成员") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaAppUserService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改应用成员") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaAppUserService, "app_user_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除应用成员") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaAppUserService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaAssetsCodeController.java b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsCodeController.java new file mode 100644 index 0000000..bee4518 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsCodeController.java @@ -0,0 +1,124 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaAssetsCodeService; +import com.gxwebsoft.oa.entity.OaAssetsCode; +import com.gxwebsoft.oa.param.OaAssetsCodeParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 代码仓库控制器 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:01 + */ +@Tag(name = "代码仓库管理") +@RestController +@RequestMapping("/api/oa/oa-assets-code") +public class OaAssetsCodeController extends BaseController { + @Resource + private OaAssetsCodeService oaAssetsCodeService; + + @PreAuthorize("hasAuthority('oa:oaAssetsCode:list')") + @Operation(summary = "分页查询代码仓库") + @GetMapping("/page") + public ApiResult> page(OaAssetsCodeParam param) { + // 使用关联查询 + return success(oaAssetsCodeService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsCode:list')") + @Operation(summary = "查询全部代码仓库") + @GetMapping() + public ApiResult> list(OaAssetsCodeParam param) { + // 使用关联查询 + return success(oaAssetsCodeService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsCode:list')") + @Operation(summary = "根据id查询代码仓库") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(oaAssetsCodeService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsCode:save')") + @OperationLog + @Operation(summary = "添加代码仓库") + @PostMapping() + public ApiResult save(@RequestBody OaAssetsCode oaAssetsCode) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaAssetsCode.setUserId(loginUser.getUserId()); + } + if (oaAssetsCodeService.save(oaAssetsCode)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsCode:update')") + @Operation(summary = "修改代码仓库") + @PutMapping() + public ApiResult update(@RequestBody OaAssetsCode oaAssetsCode) { + if (oaAssetsCodeService.updateById(oaAssetsCode)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsCode:remove')") + @Operation(summary = "删除代码仓库") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaAssetsCodeService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsCode:save')") + @Operation(summary = "批量添加代码仓库") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaAssetsCodeService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsCode:update')") + @Operation(summary = "批量修改代码仓库") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaAssetsCodeService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsCode:remove')") + @Operation(summary = "批量删除代码仓库") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaAssetsCodeService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaAssetsController.java b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsController.java new file mode 100644 index 0000000..6f66706 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsController.java @@ -0,0 +1,123 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaAssetsService; +import com.gxwebsoft.oa.entity.OaAssets; +import com.gxwebsoft.oa.param.OaAssetsParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 云服务器控制器 + * + * @author 科技小王子 + * @since 2024-10-18 18:34:15 + */ +@Tag(name = "云服务器管理") +@RestController +@RequestMapping("/api/oa/oa-assets") +public class OaAssetsController extends BaseController { + @Resource + private OaAssetsService oaAssetsService; + + @PreAuthorize("hasAuthority('oa:oaAssets:list')") + @Operation(summary = "分页查询云服务器") + @GetMapping("/page") + public ApiResult> page(OaAssetsParam param) { + // 使用关联查询 + return success(oaAssetsService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssets:list')") + @Operation(summary = "查询全部云服务器") + @GetMapping() + public ApiResult> list(OaAssetsParam param) { + // 使用关联查询 + return success(oaAssetsService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssets:list')") + @Operation(summary = "根据id查询云服务器") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(oaAssetsService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('oa:oaAssets:save')") + @OperationLog + @Operation(summary = "添加云服务器") + @PostMapping() + public ApiResult save(@RequestBody OaAssets oaAssets) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaAssets.setUserId(loginUser.getUserId()); + } + if (oaAssetsService.save(oaAssets)) { + return success("添加成功"); + } + return fail("添加失败"); + } + @PreAuthorize("hasAuthority('oa:oaAssets:update')") + @Operation(summary = "修改云服务器") + @PutMapping() + public ApiResult update(@RequestBody OaAssets oaAssets) { + if (oaAssetsService.updateById(oaAssets)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssets:remvoe')") + @Operation(summary = "删除云服务器") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaAssetsService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssets:save')") + @Operation(summary = "批量添加云服务器") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaAssetsService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssets:update')") + @Operation(summary = "批量修改云服务器") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaAssetsService, "assets_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssets:remove')") + @Operation(summary = "批量删除云服务器") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaAssetsService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaAssetsDomainController.java b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsDomainController.java new file mode 100644 index 0000000..bacd540 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsDomainController.java @@ -0,0 +1,124 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaAssetsDomainService; +import com.gxwebsoft.oa.entity.OaAssetsDomain; +import com.gxwebsoft.oa.param.OaAssetsDomainParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 域名控制器 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +@Tag(name = "域名管理") +@RestController +@RequestMapping("/api/oa/oa-assets-domain") +public class OaAssetsDomainController extends BaseController { + @Resource + private OaAssetsDomainService oaAssetsDomainService; + + @PreAuthorize("hasAuthority('oa:oaAssetsDomain:list')") + @Operation(summary = "分页查询域名") + @GetMapping("/page") + public ApiResult> page(OaAssetsDomainParam param) { + // 使用关联查询 + return success(oaAssetsDomainService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsDomain:list')") + @Operation(summary = "查询全部域名") + @GetMapping() + public ApiResult> list(OaAssetsDomainParam param) { + // 使用关联查询 + return success(oaAssetsDomainService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsDomain:list')") + @Operation(summary = "根据id查询域名") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(oaAssetsDomainService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsDomain:save')") + @OperationLog + @Operation(summary = "添加域名") + @PostMapping() + public ApiResult save(@RequestBody OaAssetsDomain oaAssetsDomain) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaAssetsDomain.setUserId(loginUser.getUserId()); + } + if (oaAssetsDomainService.save(oaAssetsDomain)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsDomain:update')") + @Operation(summary = "修改域名") + @PutMapping() + public ApiResult update(@RequestBody OaAssetsDomain oaAssetsDomain) { + if (oaAssetsDomainService.updateById(oaAssetsDomain)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsDomain:remove')") + @Operation(summary = "删除域名") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaAssetsDomainService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsDomain:save')") + @Operation(summary = "批量添加域名") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaAssetsDomainService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsDomain:update')") + @Operation(summary = "批量修改域名") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaAssetsDomainService, "domain_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsDomain:remove')") + @Operation(summary = "批量删除域名") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaAssetsDomainService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaAssetsEmailController.java b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsEmailController.java new file mode 100644 index 0000000..551905c --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsEmailController.java @@ -0,0 +1,125 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaAssetsEmailService; +import com.gxwebsoft.oa.entity.OaAssetsEmail; +import com.gxwebsoft.oa.param.OaAssetsEmailParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 企业邮箱记录表控制器 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +@Tag(name = "企业邮箱记录表管理") +@RestController +@RequestMapping("/api/oa/oa-assets-email") +public class OaAssetsEmailController extends BaseController { + @Resource + private OaAssetsEmailService oaAssetsEmailService; + + @PreAuthorize("hasAuthority('oa:oaAssetsEmail:list')") + @Operation(summary = "分页查询企业邮箱记录表") + @GetMapping("/page") + public ApiResult> page(OaAssetsEmailParam param) { + // 使用关联查询 + return success(oaAssetsEmailService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsEmail:list')") + @Operation(summary = "查询全部企业邮箱记录表") + @GetMapping() + public ApiResult> list(OaAssetsEmailParam param) { + // 使用关联查询 + return success(oaAssetsEmailService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsEmail:list')") + @OperationLog + @Operation(summary = "根据id查询企业邮箱记录表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(oaAssetsEmailService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsEmail:save')") + @OperationLog + @Operation(summary = "添加企业邮箱记录表") + @PostMapping() + public ApiResult save(@RequestBody OaAssetsEmail oaAssetsEmail) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaAssetsEmail.setUserId(loginUser.getUserId()); + } + if (oaAssetsEmailService.save(oaAssetsEmail)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsEmail:update')") + @Operation(summary = "修改企业邮箱记录表") + @PutMapping() + public ApiResult update(@RequestBody OaAssetsEmail oaAssetsEmail) { + if (oaAssetsEmailService.updateById(oaAssetsEmail)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsEmail:remove')") + @Operation(summary = "删除企业邮箱记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaAssetsEmailService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsEmail:save')") + @Operation(summary = "批量添加企业邮箱记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaAssetsEmailService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsEmail:update')") + @Operation(summary = "批量修改企业邮箱记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaAssetsEmailService, "email_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsEmail:remove')") + @Operation(summary = "批量删除企业邮箱记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaAssetsEmailService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaAssetsMysqlController.java b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsMysqlController.java new file mode 100644 index 0000000..db6dc1c --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsMysqlController.java @@ -0,0 +1,122 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaAssetsMysqlService; +import com.gxwebsoft.oa.entity.OaAssetsMysql; +import com.gxwebsoft.oa.param.OaAssetsMysqlParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 云数据库控制器 + * + * @author 科技小王子 + * @since 2024-10-18 19:00:20 + */ +@Tag(name = "云数据库管理") +@RestController +@RequestMapping("/api/oa/oa-assets-mysql") +public class OaAssetsMysqlController extends BaseController { + @Resource + private OaAssetsMysqlService oaAssetsMysqlService; + + @PreAuthorize("hasAuthority('oa:oaAssetsMysql:list')") + @Operation(summary = "分页查询云数据库") + @GetMapping("/page") + public ApiResult> page(OaAssetsMysqlParam param) { + // 使用关联查询 + return success(oaAssetsMysqlService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsMysql:list')") + @Operation(summary = "查询全部云数据库") + @GetMapping() + public ApiResult> list(OaAssetsMysqlParam param) { + // 使用关联查询 + return success(oaAssetsMysqlService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsMysql:list')") + @Operation(summary = "根据id查询云数据库") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(oaAssetsMysqlService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsMysql:save')") + @Operation(summary = "添加云数据库") + @OperationLog + @PostMapping() + public ApiResult save(@RequestBody OaAssetsMysql oaAssetsMysql) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaAssetsMysql.setUserId(loginUser.getUserId()); + } + if (oaAssetsMysqlService.save(oaAssetsMysql)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsMysql:update')") + @Operation(summary = "修改云数据库") + @PutMapping() + public ApiResult update(@RequestBody OaAssetsMysql oaAssetsMysql) { + if (oaAssetsMysqlService.updateById(oaAssetsMysql)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsMysql:remove')") + @Operation(summary = "删除云数据库") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaAssetsMysqlService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + @PreAuthorize("hasAuthority('oa:oaAssetsMysql:save')") + @Operation(summary = "批量添加云数据库") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaAssetsMysqlService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsMysql:update')") + @Operation(summary = "批量修改云数据库") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaAssetsMysqlService, "mysql_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + @PreAuthorize("hasAuthority('oa:oaAssetsMysql:remove')") + @Operation(summary = "批量删除云数据库") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaAssetsMysqlService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaAssetsServerController.java b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsServerController.java new file mode 100644 index 0000000..f8d4275 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsServerController.java @@ -0,0 +1,118 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.entity.OaAssetsServer; +import com.gxwebsoft.oa.param.OaAssetsServerParam; +import com.gxwebsoft.oa.service.OaAssetsServerService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 服务控制器 + * + * @author 科技小王子 + * @since 2024-10-21 19:15:26 + */ +@Tag(name = "服务管理") +@RestController +@RequestMapping("/api/oa/oa-assets-server") +public class OaAssetsServerController extends BaseController { + @Resource + private OaAssetsServerService oaAssetsServerService; + + @Operation(summary = "分页查询服务") + @GetMapping("/page") + public ApiResult> page(OaAssetsServerParam param) { + // 使用关联查询 + return success(oaAssetsServerService.pageRel(param)); + } + + @Operation(summary = "查询全部服务") + @GetMapping() + public ApiResult> list(OaAssetsServerParam param) { + // 使用关联查询 + return success(oaAssetsServerService.listRel(param)); + } + + @Operation(summary = "根据id查询服务") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(oaAssetsServerService.getByIdRel(id)); + } + @PreAuthorize("hasAuthority('oa:oaAssetsServer:save')") + @Operation(summary = "添加服务") + @PostMapping() + public ApiResult save(@RequestBody OaAssetsServer oaAssetsServer) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaAssetsServer.setUserId(loginUser.getUserId()); + oaAssetsServer.setTenantId(loginUser.getTenantId()); + } + if (oaAssetsServerService.save(oaAssetsServer)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsServer:update')") + @Operation(summary = "修改服务") + @PutMapping() + public ApiResult update(@RequestBody OaAssetsServer oaAssetsServer) { + if (oaAssetsServerService.updateById(oaAssetsServer)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsServer:remove')") + @Operation(summary = "删除服务") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaAssetsServerService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsServer:save')") + @Operation(summary = "批量添加服务") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaAssetsServerService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsServer:update')") + @Operation(summary = "批量修改服务") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaAssetsServerService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsServer:remove')") + @Operation(summary = "批量删除服务") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaAssetsServerService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaAssetsSiteController.java b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsSiteController.java new file mode 100644 index 0000000..a1f8286 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsSiteController.java @@ -0,0 +1,124 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaAssetsSiteService; +import com.gxwebsoft.oa.entity.OaAssetsSite; +import com.gxwebsoft.oa.param.OaAssetsSiteParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 网站信息记录表控制器 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +@Tag(name = "网站信息记录表管理") +@RestController +@RequestMapping("/api/oa/oa-assets-site") +public class OaAssetsSiteController extends BaseController { + @Resource + private OaAssetsSiteService oaAssetsSiteService; + + @PreAuthorize("hasAuthority('oa:oaAssetsSite:list')") + @Operation(summary = "分页查询网站信息记录表") + @GetMapping("/page") + public ApiResult> page(OaAssetsSiteParam param) { + // 使用关联查询 + return success(oaAssetsSiteService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSite:list')") + @Operation(summary = "查询全部网站信息记录表") + @GetMapping() + public ApiResult> list(OaAssetsSiteParam param) { + // 使用关联查询 + return success(oaAssetsSiteService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSite:list')") + @Operation(summary = "根据id查询网站信息记录表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(oaAssetsSiteService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSite:save')") + @OperationLog + @Operation(summary = "添加网站信息记录表") + @PostMapping() + public ApiResult save(@RequestBody OaAssetsSite oaAssetsSite) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaAssetsSite.setUserId(loginUser.getUserId()); + } + if (oaAssetsSiteService.save(oaAssetsSite)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSite:update')") + @Operation(summary = "修改网站信息记录表") + @PutMapping() + public ApiResult update(@RequestBody OaAssetsSite oaAssetsSite) { + if (oaAssetsSiteService.updateById(oaAssetsSite)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSite:remove')") + @Operation(summary = "删除网站信息记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaAssetsSiteService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSite:save')") + @Operation(summary = "批量添加网站信息记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaAssetsSiteService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSite:update')") + @Operation(summary = "批量修改网站信息记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaAssetsSiteService, "website_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSite:remove')") + @Operation(summary = "批量删除网站信息记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaAssetsSiteService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaAssetsSoftwareCertController.java b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsSoftwareCertController.java new file mode 100644 index 0000000..4cd4b82 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsSoftwareCertController.java @@ -0,0 +1,123 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaAssetsSoftwareCertService; +import com.gxwebsoft.oa.entity.OaAssetsSoftwareCert; +import com.gxwebsoft.oa.param.OaAssetsSoftwareCertParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 计算机软件著作权登记控制器 + * + * @author 科技小王子 + * @since 2024-10-18 19:46:21 + */ +@Tag(name = "计算机软件著作权登记管理") +@RestController +@RequestMapping("/api/oa/oa-assets-software-cert") +public class OaAssetsSoftwareCertController extends BaseController { + @Resource + private OaAssetsSoftwareCertService oaAssetsSoftwareCertService; + + @PreAuthorize("hasAuthority('oa:oaAssetsSoftwareCert:list')") + @Operation(summary = "分页查询计算机软件著作权登记") + @GetMapping("/page") + public ApiResult> page(OaAssetsSoftwareCertParam param) { + // 使用关联查询 + return success(oaAssetsSoftwareCertService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSoftwareCert:list')") + @Operation(summary = "查询全部计算机软件著作权登记") + @GetMapping() + public ApiResult> list(OaAssetsSoftwareCertParam param) { + // 使用关联查询 + return success(oaAssetsSoftwareCertService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSoftwareCert:list')") + @Operation(summary = "根据id查询计算机软件著作权登记") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(oaAssetsSoftwareCertService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSoftwareCert:save')") + @OperationLog + @Operation(summary = "添加计算机软件著作权登记") + @PostMapping() + public ApiResult save(@RequestBody OaAssetsSoftwareCert oaAssetsSoftwareCert) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaAssetsSoftwareCert.setUserId(loginUser.getUserId()); + } + if (oaAssetsSoftwareCertService.save(oaAssetsSoftwareCert)) { + return success("添加成功"); + } + return fail("添加失败"); + } + @PreAuthorize("hasAuthority('oa:oaAssetsSoftwareCert:update')") + @Operation(summary = "修改计算机软件著作权登记") + @PutMapping() + public ApiResult update(@RequestBody OaAssetsSoftwareCert oaAssetsSoftwareCert) { + if (oaAssetsSoftwareCertService.updateById(oaAssetsSoftwareCert)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSoftwareCert:remove')") + @Operation(summary = "删除计算机软件著作权登记") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaAssetsSoftwareCertService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSoftwareCert:save')") + @Operation(summary = "批量添加计算机软件著作权登记") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaAssetsSoftwareCertService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSoftwareCert:update')") + @Operation(summary = "批量修改计算机软件著作权登记") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaAssetsSoftwareCertService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSoftwareCert:remove')") + @Operation(summary = "批量删除计算机软件著作权登记") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaAssetsSoftwareCertService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaAssetsSslController.java b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsSslController.java new file mode 100644 index 0000000..0d27eb2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsSslController.java @@ -0,0 +1,125 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaAssetsSslService; +import com.gxwebsoft.oa.entity.OaAssetsSsl; +import com.gxwebsoft.oa.param.OaAssetsSslParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.List; + +/** + * ssl证书控制器 + * + * @author 科技小王子 + * @since 2024-10-18 19:25:40 + */ +@Tag(name = "ssl证书管理") +@RestController +@RequestMapping("/api/oa/oa-assets-ssl") +public class OaAssetsSslController extends BaseController { + @Resource + private OaAssetsSslService oaAssetsSslService; + + @PreAuthorize("hasAuthority('oa:oaAssetsSsl:list')") + @Operation(summary = "分页查询ssl证书") + @GetMapping("/page") + public ApiResult> page(OaAssetsSslParam param) { + // 使用关联查询 + return success(oaAssetsSslService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSsl:list')") + @Operation(summary = "查询全部ssl证书") + @GetMapping() + public ApiResult> list(OaAssetsSslParam param) { + // 使用关联查询 + return success(oaAssetsSslService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSsl:list')") + @OperationLog + @Operation(summary = "根据id查询ssl证书") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(oaAssetsSslService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSsl:save')") + @Operation(summary = "添加ssl证书") + @PostMapping() + public ApiResult save(@RequestBody OaAssetsSsl oaAssetsSsl) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaAssetsSsl.setUserId(loginUser.getUserId()); + oaAssetsSsl.setTenantId(loginUser.getTenantId()); + } + if (oaAssetsSslService.save(oaAssetsSsl)) { + return success("添加成功"); + } + return fail("添加失败"); + } + @PreAuthorize("hasAuthority('oa:oaAssetsSsl:update')") + @Operation(summary = "修改ssl证书") + @PutMapping() + public ApiResult update(@RequestBody OaAssetsSsl oaAssetsSsl) { + if (oaAssetsSslService.updateById(oaAssetsSsl)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSsl:remove')") + @Operation(summary = "删除ssl证书") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaAssetsSslService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSsl:save')") + @Operation(summary = "批量添加ssl证书") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaAssetsSslService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSsl:update')") + @Operation(summary = "批量修改ssl证书") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaAssetsSslService, "ssl_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsSsl:remove')") + @Operation(summary = "批量删除ssl证书") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaAssetsSslService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaAssetsTrademarkController.java b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsTrademarkController.java new file mode 100644 index 0000000..18a5bf6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsTrademarkController.java @@ -0,0 +1,121 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaAssetsTrademarkService; +import com.gxwebsoft.oa.entity.OaAssetsTrademark; +import com.gxwebsoft.oa.param.OaAssetsTrademarkParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 商标注册控制器 + * + * @author 科技小王子 + * @since 2024-10-18 19:46:21 + */ +@Tag(name = "商标注册管理") +@RestController +@RequestMapping("/api/oa/oa-assets-trademark") +public class OaAssetsTrademarkController extends BaseController { + @Resource + private OaAssetsTrademarkService oaAssetsTrademarkService; + + @PreAuthorize("hasAuthority('oa:oaAssetsTrademark:list')") + @Operation(summary = "分页查询商标注册") + @GetMapping("/page") + public ApiResult> page(OaAssetsTrademarkParam param) { + // 使用关联查询 + return success(oaAssetsTrademarkService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsTrademark:list')") + @Operation(summary = "查询全部商标注册") + @GetMapping() + public ApiResult> list(OaAssetsTrademarkParam param) { + // 使用关联查询 + return success(oaAssetsTrademarkService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsTrademark:list')") + @Operation(summary = "根据id查询商标注册") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(oaAssetsTrademarkService.getByIdRel(id)); + } + @PreAuthorize("hasAuthority('oa:oaAssetsTrademark:save')") + @Operation(summary = "添加商标注册") + @OperationLog + @PostMapping() + public ApiResult save(@RequestBody OaAssetsTrademark oaAssetsTrademark) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaAssetsTrademark.setUserId(loginUser.getUserId()); + } + if (oaAssetsTrademarkService.save(oaAssetsTrademark)) { + return success("添加成功"); + } + return fail("添加失败"); + } + @PreAuthorize("hasAuthority('oa:oaAssetsTrademark:update')") + @Operation(summary = "修改商标注册") + @PutMapping() + public ApiResult update(@RequestBody OaAssetsTrademark oaAssetsTrademark) { + if (oaAssetsTrademarkService.updateById(oaAssetsTrademark)) { + return success("修改成功"); + } + return fail("修改失败"); + } + @PreAuthorize("hasAuthority('oa:oaAssetsTrademark:remove')") + @Operation(summary = "删除商标注册") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaAssetsTrademarkService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsTrademark:save')") + @Operation(summary = "批量添加商标注册") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaAssetsTrademarkService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsTrademark:update')") + @Operation(summary = "批量修改商标注册") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaAssetsTrademarkService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsTrademark:remove')") + @Operation(summary = "批量删除商标注册") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaAssetsTrademarkService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaAssetsUserController.java b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsUserController.java new file mode 100644 index 0000000..30f47db --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsUserController.java @@ -0,0 +1,120 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaAssetsUserService; +import com.gxwebsoft.oa.entity.OaAssetsUser; +import com.gxwebsoft.oa.param.OaAssetsUserParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 服务器成员管理控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Tag(name = "服务器成员管理管理") +@RestController +@RequestMapping("/api/oa/oa-assets-user") +public class OaAssetsUserController extends BaseController { + @Resource + private OaAssetsUserService oaAssetsUserService; + + @Operation(summary = "分页查询服务器成员管理") + @GetMapping("/page") + public ApiResult> page(OaAssetsUserParam param) { + // 使用关联查询 + return success(oaAssetsUserService.pageRel(param)); + } + + @Operation(summary = "查询全部服务器成员管理") + @GetMapping() + public ApiResult> list(OaAssetsUserParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(oaAssetsUserService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(oaAssetsUserService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsUser:list')") + @OperationLog + @Operation(summary = "根据id查询服务器成员管理") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(oaAssetsUserService.getById(id)); + // 使用关联查询 + //return success(oaAssetsUserService.getByIdRel(id)); + } + + @Operation(summary = "添加服务器成员管理") + @PostMapping() + public ApiResult save(@RequestBody OaAssetsUser oaAssetsUser) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaAssetsUser.setUserId(loginUser.getUserId()); + } + if (oaAssetsUserService.save(oaAssetsUser)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改服务器成员管理") + @PutMapping() + public ApiResult update(@RequestBody OaAssetsUser oaAssetsUser) { + if (oaAssetsUserService.updateById(oaAssetsUser)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除服务器成员管理") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaAssetsUserService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加服务器成员管理") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaAssetsUserService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改服务器成员管理") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaAssetsUserService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除服务器成员管理") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaAssetsUserService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaAssetsVhostController.java b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsVhostController.java new file mode 100644 index 0000000..17b5875 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaAssetsVhostController.java @@ -0,0 +1,124 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaAssetsVhostService; +import com.gxwebsoft.oa.entity.OaAssetsVhost; +import com.gxwebsoft.oa.param.OaAssetsVhostParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 虚拟主机记录表控制器 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +@Tag(name = "虚拟主机记录表管理") +@RestController +@RequestMapping("/api/oa/oa-assets-vhost") +public class OaAssetsVhostController extends BaseController { + @Resource + private OaAssetsVhostService oaAssetsVhostService; + + @PreAuthorize("hasAuthority('oa:oaAssetsVhost:list')") + @Operation(summary = "分页查询虚拟主机记录表") + @GetMapping("/page") + public ApiResult> page(OaAssetsVhostParam param) { + // 使用关联查询 + return success(oaAssetsVhostService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsVhost:list')") + @Operation(summary = "查询全部虚拟主机记录表") + @GetMapping() + public ApiResult> list(OaAssetsVhostParam param) { + // 使用关联查询 + return success(oaAssetsVhostService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsVhost:list')") + @Operation(summary = "根据id查询虚拟主机记录表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(oaAssetsVhostService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsVhost:save')") + @OperationLog + @Operation(summary = "添加虚拟主机记录表") + @PostMapping() + public ApiResult save(@RequestBody OaAssetsVhost oaAssetsVhost) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaAssetsVhost.setUserId(loginUser.getUserId()); + } + if (oaAssetsVhostService.save(oaAssetsVhost)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsVhost:update')") + @Operation(summary = "修改虚拟主机记录表") + @PutMapping() + public ApiResult update(@RequestBody OaAssetsVhost oaAssetsVhost) { + if (oaAssetsVhostService.updateById(oaAssetsVhost)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsVhost:remove')") + @Operation(summary = "删除虚拟主机记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaAssetsVhostService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsVhost:save')") + @Operation(summary = "批量添加虚拟主机记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaAssetsVhostService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsVhost:update')") + @Operation(summary = "批量修改虚拟主机记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaAssetsVhostService, "vhost_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('oa:oaAssetsVhost:remove')") + @Operation(summary = "批量删除虚拟主机记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaAssetsVhostService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaCompanyController.java b/src/main/java/com/gxwebsoft/oa/controller/OaCompanyController.java new file mode 100644 index 0000000..338baad --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaCompanyController.java @@ -0,0 +1,114 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.oa.service.OaCompanyService; +import com.gxwebsoft.oa.entity.OaCompany; +import com.gxwebsoft.oa.param.OaCompanyParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 企业信息控制器 + * + * @author 科技小王子 + * @since 2024-09-20 12:33:12 + */ +@Tag(name = "企业信息管理") +@RestController +@RequestMapping("/api/oa/oa-company") +public class OaCompanyController extends BaseController { + @Resource + private OaCompanyService oaCompanyService; + + @Operation(summary = "分页查询企业信息") + @GetMapping("/page") + public ApiResult> page(OaCompanyParam param) { + // 使用关联查询 + return success(oaCompanyService.pageRel(param)); + } + + @Operation(summary = "查询全部企业信息") + @GetMapping() + public ApiResult> list(OaCompanyParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(oaCompanyService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(oaCompanyService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaCompany:list')") + @OperationLog + @Operation(summary = "根据id查询企业信息") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(oaCompanyService.getById(id)); + // 使用关联查询 + //return success(oaCompanyService.getByIdRel(id)); + } + + @Operation(summary = "添加企业信息") + @PostMapping() + public ApiResult save(@RequestBody OaCompany oaCompany) { + if (oaCompanyService.save(oaCompany)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改企业信息") + @PutMapping() + public ApiResult update(@RequestBody OaCompany oaCompany) { + if (oaCompanyService.updateById(oaCompany)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除企业信息") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaCompanyService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加企业信息") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaCompanyService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改企业信息") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaCompanyService, "company_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除企业信息") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaCompanyService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaCompanyFieldController.java b/src/main/java/com/gxwebsoft/oa/controller/OaCompanyFieldController.java new file mode 100644 index 0000000..f24b320 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaCompanyFieldController.java @@ -0,0 +1,114 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.oa.service.OaCompanyFieldService; +import com.gxwebsoft.oa.entity.OaCompanyField; +import com.gxwebsoft.oa.param.OaCompanyFieldParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 企业参数控制器 + * + * @author 科技小王子 + * @since 2024-09-20 12:33:12 + */ +@Tag(name = "企业参数管理") +@RestController +@RequestMapping("/api/oa/oa-company-field") +public class OaCompanyFieldController extends BaseController { + @Resource + private OaCompanyFieldService oaCompanyFieldService; + + @Operation(summary = "分页查询企业参数") + @GetMapping("/page") + public ApiResult> page(OaCompanyFieldParam param) { + // 使用关联查询 + return success(oaCompanyFieldService.pageRel(param)); + } + + @Operation(summary = "查询全部企业参数") + @GetMapping() + public ApiResult> list(OaCompanyFieldParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(oaCompanyFieldService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(oaCompanyFieldService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaCompanyField:list')") + @OperationLog + @Operation(summary = "根据id查询企业参数") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(oaCompanyFieldService.getById(id)); + // 使用关联查询 + //return success(oaCompanyFieldService.getByIdRel(id)); + } + + @Operation(summary = "添加企业参数") + @PostMapping() + public ApiResult save(@RequestBody OaCompanyField oaCompanyField) { + if (oaCompanyFieldService.save(oaCompanyField)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改企业参数") + @PutMapping() + public ApiResult update(@RequestBody OaCompanyField oaCompanyField) { + if (oaCompanyFieldService.updateById(oaCompanyField)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除企业参数") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaCompanyFieldService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加企业参数") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaCompanyFieldService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改企业参数") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaCompanyFieldService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除企业参数") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaCompanyFieldService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaCompanyUserController.java b/src/main/java/com/gxwebsoft/oa/controller/OaCompanyUserController.java new file mode 100644 index 0000000..dcb2653 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaCompanyUserController.java @@ -0,0 +1,114 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.oa.service.OaCompanyUserService; +import com.gxwebsoft.oa.entity.OaCompanyUser; +import com.gxwebsoft.oa.param.OaCompanyUserParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 成员管理控制器 + * + * @author 科技小王子 + * @since 2024-09-20 12:33:12 + */ +@Tag(name = "成员管理管理") +@RestController +@RequestMapping("/api/oa/oa-company-user") +public class OaCompanyUserController extends BaseController { + @Resource + private OaCompanyUserService oaCompanyUserService; + + @Operation(summary = "分页查询成员管理") + @GetMapping("/page") + public ApiResult> page(OaCompanyUserParam param) { + // 使用关联查询 + return success(oaCompanyUserService.pageRel(param)); + } + + @Operation(summary = "查询全部成员管理") + @GetMapping() + public ApiResult> list(OaCompanyUserParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(oaCompanyUserService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(oaCompanyUserService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaCompanyUser:list')") + @OperationLog + @Operation(summary = "根据id查询成员管理") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(oaCompanyUserService.getById(id)); + // 使用关联查询 + //return success(oaCompanyUserService.getByIdRel(id)); + } + + @Operation(summary = "添加成员管理") + @PostMapping() + public ApiResult save(@RequestBody OaCompanyUser oaCompanyUser) { + if (oaCompanyUserService.save(oaCompanyUser)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改成员管理") + @PutMapping() + public ApiResult update(@RequestBody OaCompanyUser oaCompanyUser) { + if (oaCompanyUserService.updateById(oaCompanyUser)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除成员管理") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaCompanyUserService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加成员管理") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaCompanyUserService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改成员管理") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaCompanyUserService, "company_user_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除成员管理") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaCompanyUserService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaLinkController.java b/src/main/java/com/gxwebsoft/oa/controller/OaLinkController.java new file mode 100644 index 0000000..9a7286e --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaLinkController.java @@ -0,0 +1,120 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaLinkService; +import com.gxwebsoft.oa.entity.OaLink; +import com.gxwebsoft.oa.param.OaLinkParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 常用链接控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Tag(name = "常用链接管理") +@RestController +@RequestMapping("/api/oa/oa-link") +public class OaLinkController extends BaseController { + @Resource + private OaLinkService oaLinkService; + + @Operation(summary = "分页查询常用链接") + @GetMapping("/page") + public ApiResult> page(OaLinkParam param) { + // 使用关联查询 + return success(oaLinkService.pageRel(param)); + } + + @Operation(summary = "查询全部常用链接") + @GetMapping() + public ApiResult> list(OaLinkParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(oaLinkService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(oaLinkService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaLink:list')") + @OperationLog + @Operation(summary = "根据id查询常用链接") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(oaLinkService.getById(id)); + // 使用关联查询 + //return success(oaLinkService.getByIdRel(id)); + } + + @Operation(summary = "添加常用链接") + @PostMapping() + public ApiResult save(@RequestBody OaLink oaLink) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaLink.setUserId(loginUser.getUserId()); + } + if (oaLinkService.save(oaLink)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改常用链接") + @PutMapping() + public ApiResult update(@RequestBody OaLink oaLink) { + if (oaLinkService.updateById(oaLink)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除常用链接") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaLinkService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加常用链接") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaLinkService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改常用链接") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaLinkService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除常用链接") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaLinkService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaProductController.java b/src/main/java/com/gxwebsoft/oa/controller/OaProductController.java new file mode 100644 index 0000000..0996cb6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaProductController.java @@ -0,0 +1,120 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaProductService; +import com.gxwebsoft.oa.entity.OaProduct; +import com.gxwebsoft.oa.param.OaProductParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 产品记录表控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Tag(name = "产品记录表管理") +@RestController +@RequestMapping("/api/oa/oa-product") +public class OaProductController extends BaseController { + @Resource + private OaProductService oaProductService; + + @Operation(summary = "分页查询产品记录表") + @GetMapping("/page") + public ApiResult> page(OaProductParam param) { + // 使用关联查询 + return success(oaProductService.pageRel(param)); + } + + @Operation(summary = "查询全部产品记录表") + @GetMapping() + public ApiResult> list(OaProductParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(oaProductService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(oaProductService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaProduct:list')") + @OperationLog + @Operation(summary = "根据id查询产品记录表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(oaProductService.getById(id)); + // 使用关联查询 + //return success(oaProductService.getByIdRel(id)); + } + + @Operation(summary = "添加产品记录表") + @PostMapping() + public ApiResult save(@RequestBody OaProduct oaProduct) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaProduct.setUserId(loginUser.getUserId()); + } + if (oaProductService.save(oaProduct)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改产品记录表") + @PutMapping() + public ApiResult update(@RequestBody OaProduct oaProduct) { + if (oaProductService.updateById(oaProduct)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除产品记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaProductService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加产品记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaProductService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改产品记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaProductService, "product_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除产品记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaProductService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaProductTabsController.java b/src/main/java/com/gxwebsoft/oa/controller/OaProductTabsController.java new file mode 100644 index 0000000..ac7836e --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaProductTabsController.java @@ -0,0 +1,120 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaProductTabsService; +import com.gxwebsoft.oa.entity.OaProductTabs; +import com.gxwebsoft.oa.param.OaProductTabsParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 产品标签记录表控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Tag(name = "产品标签记录表管理") +@RestController +@RequestMapping("/api/oa/oa-product-tabs") +public class OaProductTabsController extends BaseController { + @Resource + private OaProductTabsService oaProductTabsService; + + @Operation(summary = "分页查询产品标签记录表") + @GetMapping("/page") + public ApiResult> page(OaProductTabsParam param) { + // 使用关联查询 + return success(oaProductTabsService.pageRel(param)); + } + + @Operation(summary = "查询全部产品标签记录表") + @GetMapping() + public ApiResult> list(OaProductTabsParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(oaProductTabsService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(oaProductTabsService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaProductTabs:list')") + @OperationLog + @Operation(summary = "根据id查询产品标签记录表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(oaProductTabsService.getById(id)); + // 使用关联查询 + //return success(oaProductTabsService.getByIdRel(id)); + } + + @Operation(summary = "添加产品标签记录表") + @PostMapping() + public ApiResult save(@RequestBody OaProductTabs oaProductTabs) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaProductTabs.setUserId(loginUser.getUserId()); + } + if (oaProductTabsService.save(oaProductTabs)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改产品标签记录表") + @PutMapping() + public ApiResult update(@RequestBody OaProductTabs oaProductTabs) { + if (oaProductTabsService.updateById(oaProductTabs)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除产品标签记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaProductTabsService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加产品标签记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaProductTabsService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改产品标签记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaProductTabsService, "tab_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除产品标签记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaProductTabsService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaTaskController.java b/src/main/java/com/gxwebsoft/oa/controller/OaTaskController.java new file mode 100644 index 0000000..fab3f41 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaTaskController.java @@ -0,0 +1,120 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaTaskService; +import com.gxwebsoft.oa.entity.OaTask; +import com.gxwebsoft.oa.param.OaTaskParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 任务记录表控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Tag(name = "任务记录表管理") +@RestController +@RequestMapping("/api/oa/oa-task") +public class OaTaskController extends BaseController { + @Resource + private OaTaskService oaTaskService; + + @Operation(summary = "分页查询任务记录表") + @GetMapping("/page") + public ApiResult> page(OaTaskParam param) { + // 使用关联查询 + return success(oaTaskService.pageRel(param)); + } + + @Operation(summary = "查询全部任务记录表") + @GetMapping() + public ApiResult> list(OaTaskParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(oaTaskService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(oaTaskService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaTask:list')") + @OperationLog + @Operation(summary = "根据id查询任务记录表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(oaTaskService.getById(id)); + // 使用关联查询 + //return success(oaTaskService.getByIdRel(id)); + } + + @Operation(summary = "添加任务记录表") + @PostMapping() + public ApiResult save(@RequestBody OaTask oaTask) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaTask.setUserId(loginUser.getUserId()); + } + if (oaTaskService.save(oaTask)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改任务记录表") + @PutMapping() + public ApiResult update(@RequestBody OaTask oaTask) { + if (oaTaskService.updateById(oaTask)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除任务记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaTaskService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加任务记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaTaskService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改任务记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaTaskService, "task_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除任务记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaTaskService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaTaskCountController.java b/src/main/java/com/gxwebsoft/oa/controller/OaTaskCountController.java new file mode 100644 index 0000000..d4ba413 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaTaskCountController.java @@ -0,0 +1,120 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaTaskCountService; +import com.gxwebsoft.oa.entity.OaTaskCount; +import com.gxwebsoft.oa.param.OaTaskCountParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 数据统计控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Tag(name = "数据统计管理") +@RestController +@RequestMapping("/api/oa/oa-task-count") +public class OaTaskCountController extends BaseController { + @Resource + private OaTaskCountService oaTaskCountService; + + @Operation(summary = "分页查询数据统计") + @GetMapping("/page") + public ApiResult> page(OaTaskCountParam param) { + // 使用关联查询 + return success(oaTaskCountService.pageRel(param)); + } + + @Operation(summary = "查询全部数据统计") + @GetMapping() + public ApiResult> list(OaTaskCountParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(oaTaskCountService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(oaTaskCountService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaTaskCount:list')") + @OperationLog + @Operation(summary = "根据id查询数据统计") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(oaTaskCountService.getById(id)); + // 使用关联查询 + //return success(oaTaskCountService.getByIdRel(id)); + } + + @Operation(summary = "添加数据统计") + @PostMapping() + public ApiResult save(@RequestBody OaTaskCount oaTaskCount) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaTaskCount.setUserId(loginUser.getUserId()); + } + if (oaTaskCountService.save(oaTaskCount)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改数据统计") + @PutMapping() + public ApiResult update(@RequestBody OaTaskCount oaTaskCount) { + if (oaTaskCountService.updateById(oaTaskCount)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除数据统计") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaTaskCountService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加数据统计") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaTaskCountService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改数据统计") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaTaskCountService, "task_count_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除数据统计") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaTaskCountService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaTaskRecordController.java b/src/main/java/com/gxwebsoft/oa/controller/OaTaskRecordController.java new file mode 100644 index 0000000..8fa9d1d --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaTaskRecordController.java @@ -0,0 +1,120 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaTaskRecordService; +import com.gxwebsoft.oa.entity.OaTaskRecord; +import com.gxwebsoft.oa.param.OaTaskRecordParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 工单回复记录表控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Tag(name = "工单回复记录表管理") +@RestController +@RequestMapping("/api/oa/oa-task-record") +public class OaTaskRecordController extends BaseController { + @Resource + private OaTaskRecordService oaTaskRecordService; + + @Operation(summary = "分页查询工单回复记录表") + @GetMapping("/page") + public ApiResult> page(OaTaskRecordParam param) { + // 使用关联查询 + return success(oaTaskRecordService.pageRel(param)); + } + + @Operation(summary = "查询全部工单回复记录表") + @GetMapping() + public ApiResult> list(OaTaskRecordParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(oaTaskRecordService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(oaTaskRecordService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaTaskRecord:list')") + @OperationLog + @Operation(summary = "根据id查询工单回复记录表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(oaTaskRecordService.getById(id)); + // 使用关联查询 + //return success(oaTaskRecordService.getByIdRel(id)); + } + + @Operation(summary = "添加工单回复记录表") + @PostMapping() + public ApiResult save(@RequestBody OaTaskRecord oaTaskRecord) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaTaskRecord.setUserId(loginUser.getUserId()); + } + if (oaTaskRecordService.save(oaTaskRecord)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改工单回复记录表") + @PutMapping() + public ApiResult update(@RequestBody OaTaskRecord oaTaskRecord) { + if (oaTaskRecordService.updateById(oaTaskRecord)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除工单回复记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaTaskRecordService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加工单回复记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaTaskRecordService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改工单回复记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaTaskRecordService, "task_record_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除工单回复记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaTaskRecordService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/controller/OaTaskUserController.java b/src/main/java/com/gxwebsoft/oa/controller/OaTaskUserController.java new file mode 100644 index 0000000..59423c9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/controller/OaTaskUserController.java @@ -0,0 +1,120 @@ +package com.gxwebsoft.oa.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.oa.service.OaTaskUserService; +import com.gxwebsoft.oa.entity.OaTaskUser; +import com.gxwebsoft.oa.param.OaTaskUserParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 工单成员控制器 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Tag(name = "工单成员管理") +@RestController +@RequestMapping("/api/oa/oa-task-user") +public class OaTaskUserController extends BaseController { + @Resource + private OaTaskUserService oaTaskUserService; + + @Operation(summary = "分页查询工单成员") + @GetMapping("/page") + public ApiResult> page(OaTaskUserParam param) { + // 使用关联查询 + return success(oaTaskUserService.pageRel(param)); + } + + @Operation(summary = "查询全部工单成员") + @GetMapping() + public ApiResult> list(OaTaskUserParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + return success(oaTaskUserService.list(page.getOrderWrapper())); + // 使用关联查询 + //return success(oaTaskUserService.listRel(param)); + } + + @PreAuthorize("hasAuthority('oa:oaTaskUser:list')") + @OperationLog + @Operation(summary = "根据id查询工单成员") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + return success(oaTaskUserService.getById(id)); + // 使用关联查询 + //return success(oaTaskUserService.getByIdRel(id)); + } + + @Operation(summary = "添加工单成员") + @PostMapping() + public ApiResult save(@RequestBody OaTaskUser oaTaskUser) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + oaTaskUser.setUserId(loginUser.getUserId()); + } + if (oaTaskUserService.save(oaTaskUser)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改工单成员") + @PutMapping() + public ApiResult update(@RequestBody OaTaskUser oaTaskUser) { + if (oaTaskUserService.updateById(oaTaskUser)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除工单成员") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (oaTaskUserService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加工单成员") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (oaTaskUserService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改工单成员") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(oaTaskUserService, "task_user_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除工单成员") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (oaTaskUserService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaApp.java b/src/main/java/com/gxwebsoft/oa/entity/OaApp.java new file mode 100644 index 0000000..4f2d41c --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaApp.java @@ -0,0 +1,266 @@ +package com.gxwebsoft.oa.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import com.gxwebsoft.common.system.entity.FileRecord; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 应用 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaApp对象", description = "应用") +public class OaApp implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "应用ID") + @TableId(value = "app_id", type = IdType.AUTO) + private Integer appId; + + @Schema(description = "应用名称") + private String appName; + + @Schema(description = "应用标识") + private String appCode; + + @Schema(description = "应用秘钥") + private String appSecret; + + @Schema(description = "上级id, 0是顶级") + private Integer parentId; + + @Schema(description = "应用类型") + private String appType; + + @Schema(description = "应用类型") + private String appTypeMultiple; + + @Schema(description = "类型, 0菜单, 1按钮") + private Integer menuType; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "企业名称") + private String companyName; + + @Schema(description = "应用图标") + private String appIcon; + + @Schema(description = "二维码") + private String appQrcode; + + @Schema(description = "链接地址") + private String appUrl; + + @Schema(description = "后台管理地址") + private String adminUrl; + + @Schema(description = "下载地址") + private String downUrl; + + @Schema(description = "链接地址") + private String serverUrl; + + @Schema(description = "文件服务器") + private String fileUrl; + + @Schema(description = "回调地址") + private String callbackUrl; + + @Schema(description = "腾讯文档地址") + private String docsUrl; + + @Schema(description = "代码仓库地址") + private String gitUrl; + + @Schema(description = "原型图地址") + private String prototypeUrl; + + @Schema(description = "IP白名单") + private String ipAddress; + + @Schema(description = "应用截图") + private String images; + + @Schema(description = "应用包名") + private String packageName; + + @Schema(description = "下载次数") + private Integer clicks; + + @Schema(description = "安装次数") + private Integer installs; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "应用介绍") + private String content; + + @Schema(description = "项目需求") + private String requirement; + + @Schema(description = "开发者(个人或公司)") + private String developer; + + @Schema(description = "项目负责人") + private String director; + + @Schema(description = "项目经理") + private String projectDirector; + + @Schema(description = "业务员") + private String salesman; + + @Schema(description = "软件定价") + private BigDecimal price; + + @Schema(description = "划线价格") + private BigDecimal linePrice; + + @Schema(description = "评分") + private String score; + + @Schema(description = "星级") + private String star; + + @Schema(description = "菜单路由地址") + private String path; + + @Schema(description = "菜单组件地址, 目录可为空") + private String component; + + @Schema(description = "权限标识") + private String authority; + + @Schema(description = "打开位置") + private String target; + + @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") + private Integer hide; + + @Schema(description = "禁止搜索,1禁止 0 允许") + private Integer search; + + @Schema(description = "菜单侧栏选中的path") + private String active; + + @Schema(description = "其它路由元信息") + private String meta; + + @Schema(description = "版本,0正式版 1体验版 2开发版") + private String edition; + + @Schema(description = "版本号") + private String version; + + @Schema(description = "是否已安装") + private Integer isUse; + + @Schema(description = "附近1") + private String file1; + + @Schema(description = "附件2") + private String file2; + + @Schema(description = "附件3") + private String file3; + + @Schema(description = "是否显示续费提醒") + private Boolean showExpiration; + + @Schema(description = "是否作为案例展示") + private Integer showCase; + + @Schema(description = "是否显示在首页") + private Integer showIndex; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "到期时间") + private Date expirationTime; + + @Schema(description = "续费金额") + private BigDecimal renewMoney; + + @Schema(description = "应用状态") + private String appStatus; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "机构id") + private Integer organizationId; + + @Schema(description = "租户编号") + private String tenantCode; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "修改时间") + private Date updateTime; + + @Schema(description = "成员管理") + @TableField(exist = false) + private List users; + + @Schema(description = "链接列表") + @TableField(exist = false) + private List appUrlList; + + @Schema(description = "项目附件") + @TableField(exist = false) + private List appFiles; + + @Schema(description = "主体名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "开发者名称") + @TableField(exist = false) + private String realName; + + @Schema(description = "开发者名称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "开发者头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "手机号码") + @TableField(exist = false) + private String phone; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaAppField.java b/src/main/java/com/gxwebsoft/oa/entity/OaAppField.java new file mode 100644 index 0000000..2245088 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaAppField.java @@ -0,0 +1,53 @@ +package com.gxwebsoft.oa.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.util.Date; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 应用参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaAppField对象", description = "应用参数") +public class OaAppField implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "应用ID") + private Integer appId; + + @Schema(description = "名称") + private String name; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "状态, 0正常, 1删除") + private Integer status; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private Date createTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaAppRenew.java b/src/main/java/com/gxwebsoft/oa/entity/OaAppRenew.java new file mode 100644 index 0000000..f7be2ca --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaAppRenew.java @@ -0,0 +1,65 @@ +package com.gxwebsoft.oa.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.util.Date; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 续费管理 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaAppRenew对象", description = "续费管理") +public class OaAppRenew implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "app_renew_id", type = IdType.AUTO) + private Integer appRenewId; + + @Schema(description = "应用ID") + private Integer appId; + + @Schema(description = "续费金额") + private BigDecimal money; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "开始时间") + private Date startTime; + + @Schema(description = "到期时间") + private Date endTime; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "付款凭证") + private String images; + + @Schema(description = "用户姓名") + private String nickname; + + @Schema(description = "状态, 0正常, 1待确认") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private Date createTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaAppUrl.java b/src/main/java/com/gxwebsoft/oa/entity/OaAppUrl.java new file mode 100644 index 0000000..c3369ed --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaAppUrl.java @@ -0,0 +1,58 @@ +package com.gxwebsoft.oa.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.util.Date; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 项目域名 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaAppUrl对象", description = "项目域名") +public class OaAppUrl implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "app_url_id", type = IdType.AUTO) + private Integer appUrlId; + + @Schema(description = "应用ID") + private Integer appId; + + @Schema(description = "域名类型") + private String name; + + @Schema(description = "域名") + private String domain; + + @Schema(description = "账号") + private String account; + + @Schema(description = "密码") + private String password; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1待确认") + private Integer status; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "租户id") + private Integer tenantId; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaAppUser.java b/src/main/java/com/gxwebsoft/oa/entity/OaAppUser.java new file mode 100644 index 0000000..eaf1a08 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaAppUser.java @@ -0,0 +1,49 @@ +package com.gxwebsoft.oa.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.util.Date; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 应用成员 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaAppUser对象", description = "应用成员") +public class OaAppUser implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "app_user_id", type = IdType.AUTO) + private Integer appUserId; + + @Schema(description = "角色,10体验成员 20开发者成员 30管理员 ") + private Integer role; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "应用ID") + private Integer appId; + + @Schema(description = "昵称") + private String nickname; + + @Schema(description = "状态, 0正常, 1待确认") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private Date createTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaAssets.java b/src/main/java/com/gxwebsoft/oa/entity/OaAssets.java new file mode 100644 index 0000000..d4afe3e --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaAssets.java @@ -0,0 +1,159 @@ +package com.gxwebsoft.oa.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 云服务器 + * + * @author 科技小王子 + * @since 2024-10-18 18:34:15 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaAssets对象", description = "云服务器") +public class OaAssets implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "资产ID") + @TableId(value = "assets_id", type = IdType.AUTO) + private Integer assetsId; + + @Schema(description = "资产名称") + private String name; + + @Schema(description = "资产标识") + private String code; + + @Schema(description = "资产类型") + private String type; + + @Schema(description = "服务器厂商") + private String brand; + + @Schema(description = "服务器配置") + private String configuration; + + @Schema(description = "初始账号") + private String account; + + @Schema(description = "初始密码") + private String password; + + @Schema(description = "(阿里云/腾讯云)登录账号") + private String brandAccount; + + @Schema(description = "(阿里云/腾讯云)登录密码") + private String brandPassword; + + @Schema(description = "宝塔面板") + private String panel; + + @Schema(description = "宝塔面板账号") + private String panelAccount; + + @Schema(description = "宝塔面板密码") + private String panelPassword; + + @Schema(description = "财务信息-合同金额") + private BigDecimal financeAmount; + + @Schema(description = "购买年限") + private Integer financeYears; + + @Schema(description = "续费金额") + private BigDecimal financeRenew; + + @Schema(description = "客户名称") + private String financeCustomerName; + + @Schema(description = "客户联系人") + private String financeCustomerContact; + + @Schema(description = "客户联系电话") + private String financeCustomerPhone; + + @Schema(description = "客户ID") + private Integer customerId; + + @Schema(description = "客户名称") + private String customerName; + + @Schema(description = "开放端口") + private String openPort; + + @Schema(description = "详情内容") + private String content; + + @Schema(description = "购买时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + + @Schema(description = "到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + + @Schema(description = "置顶状态") + private String isTop; + + @Schema(description = "可见性(public,private,protected)") + private String visibility; + + @Schema(description = "宝塔接口秘钥") + private String btSign; + + @Schema(description = "文章排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "客户ID") + private Integer companyId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "机构id") + private Integer organizationId; + + @Schema(description = "状态, 0正常, 1冻结") + private String status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "应用名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "应用图标") + @TableField(exist = false) + private String logo; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "修改时间") + private Date updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaAssetsCode.java b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsCode.java new file mode 100644 index 0000000..f304395 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsCode.java @@ -0,0 +1,89 @@ +package com.gxwebsoft.oa.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.util.Date; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 代码仓库 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:01 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaAssetsCode对象", description = "代码仓库") +public class OaAssetsCode implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "服务器ID") + private Integer assetsId; + + @Schema(description = "名称") + private String name; + + @Schema(description = "英文标识") + private String code; + + @Schema(description = "仓库地址") + private String gitUrl; + + @Schema(description = "仓库品牌") + private String brand; + + @Schema(description = "置顶状态") + private String isTop; + + @Schema(description = "详情内容") + private String content; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "状态, 0正常, 1冻结") + private String status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "应用名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "应用图标") + @TableField(exist = false) + private String logo; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "修改时间") + private Date updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaAssetsDomain.java b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsDomain.java new file mode 100644 index 0000000..5943d6a --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsDomain.java @@ -0,0 +1,102 @@ +package com.gxwebsoft.oa.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 域名 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaAssetsDomain对象", description = "域名") +public class OaAssetsDomain implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "domain_id", type = IdType.AUTO) + private Integer domainId; + + @Schema(description = "服务器ID") + private Integer assetsId; + + @Schema(description = "域名") + private String name; + + @Schema(description = "域名标识") + private String code; + + @Schema(description = "注册厂商") + private String brand; + + @Schema(description = "初始账号") + private String account; + + @Schema(description = "初始密码") + private String password; + + @Schema(description = "价格") + private BigDecimal price; + + @Schema(description = "购买时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + + @Schema(description = "到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + + @Schema(description = "置顶状态") + private String isTop; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "状态, 0正常, 1冻结") + private String status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "应用名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "应用图标") + @TableField(exist = false) + private String logo; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "修改时间") + private Date updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaAssetsEmail.java b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsEmail.java new file mode 100644 index 0000000..a0e805b --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsEmail.java @@ -0,0 +1,102 @@ +package com.gxwebsoft.oa.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 企业邮箱记录表 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaAssetsEmail对象", description = "企业邮箱记录表") +public class OaAssetsEmail implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "email_id", type = IdType.AUTO) + private Integer emailId; + + @Schema(description = "邮箱名称") + private String name; + + @Schema(description = "域名标识") + private String code; + + @Schema(description = "邮箱型号") + private String type; + + @Schema(description = "品牌厂商") + private String brand; + + @Schema(description = "初始账号") + private String system; + + @Schema(description = "价格") + private BigDecimal price; + + @Schema(description = "详情内容") + private String content; + + @Schema(description = "购买时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + + @Schema(description = "到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + + @Schema(description = "置顶状态") + private String isTop; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "状态, 0正常, 1冻结") + private String status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "应用名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "应用图标") + @TableField(exist = false) + private String logo; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "修改时间") + private Date updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaAssetsMysql.java b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsMysql.java new file mode 100644 index 0000000..b39315c --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsMysql.java @@ -0,0 +1,107 @@ +package com.gxwebsoft.oa.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 云数据库 + * + * @author 科技小王子 + * @since 2024-10-18 19:00:20 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaAssetsMysql对象", description = "云数据库") +public class OaAssetsMysql implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "mysql_id", type = IdType.AUTO) + private Integer mysqlId; + + @Schema(description = "服务器ID") + private Integer assetsId; + + @Schema(description = "数据库名") + private String name; + + @Schema(description = "数据库标识") + private String code; + + @Schema(description = "注册厂商") + private String brand; + + @Schema(description = "ip地址") + private String ip; + + @Schema(description = "端口") + private String port; + + @Schema(description = "初始账号") + private String account; + + @Schema(description = "初始密码") + private String password; + + @Schema(description = "价格") + private BigDecimal price; + + @Schema(description = "购买时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + + @Schema(description = "到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + + @Schema(description = "置顶状态") + private String isTop; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "状态, 0正常, 1冻结") + private String status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "应用名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "应用图标") + @TableField(exist = false) + private String logo; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "修改时间") + private Date updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaAssetsServer.java b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsServer.java new file mode 100644 index 0000000..d389f06 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsServer.java @@ -0,0 +1,73 @@ +package com.gxwebsoft.oa.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.Date; + +/** + * 服务 + * + * @author 科技小王子 + * @since 2024-10-21 19:15:26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaAssetsServer对象", description = "服务") +public class OaAssetsServer implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "插件id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "服务名称") + private String server; + + @Schema(description = "接口地址") + private String serverUrl; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "服务器ID") + private Integer assetsId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 10待审核 20已通过 30已驳回") + private Integer status; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "应用名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "应用图标") + @TableField(exist = false) + private String logo; + + @Schema(description = "创建时间") + private Date createTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaAssetsSite.java b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsSite.java new file mode 100644 index 0000000..705a419 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsSite.java @@ -0,0 +1,166 @@ +package com.gxwebsoft.oa.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.util.Date; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 网站信息记录表 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaAssetsSite对象", description = "网站信息记录表") +public class OaAssetsSite implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "站点ID") + @TableId(value = "website_id", type = IdType.AUTO) + private Integer websiteId; + + @Schema(description = "网站名称") + private String websiteName; + + @Schema(description = "网站标识") + private String websiteCode; + + @Schema(description = "网站LOGO") + private String websiteIcon; + + @Schema(description = "网站LOGO") + private String websiteLogo; + + @Schema(description = "网站LOGO(深色模式)") + private String websiteDarkLogo; + + @Schema(description = "网站类型") + private String websiteType; + + @Schema(description = "网站关键词") + private String keywords; + + @Schema(description = "域名前缀") + private String prefix; + + @Schema(description = "绑定域名") + private String domain; + + @Schema(description = "全局样式") + private String style; + + @Schema(description = "后台管理地址") + private String adminUrl; + + @Schema(description = "应用版本 10免费版 20授权版 30永久授权") + private Integer version; + + @Schema(description = "服务到期时间") + private Date expirationTime; + + @Schema(description = "模版ID") + private Integer templateId; + + @Schema(description = "行业类型(父级)") + private String industryParent; + + @Schema(description = "行业类型(子级)") + private String industryChild; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "联系电话") + private String phone; + + @Schema(description = "电子邮箱") + private String email; + + @Schema(description = "ICP备案号") + private String icpNo; + + @Schema(description = "公安备案") + private String policeNo; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "状态 0未开通 1运行中 2维护中 3已关闭 4已欠费停机 5违规关停") + private Integer status; + + @Schema(description = "维护说明") + private String statusText; + + @Schema(description = "关闭说明") + private String statusClose; + + @Schema(description = "全局样式") + private String styles; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "服务器ID") + private Integer assetsId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "应用名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "应用图标") + @TableField(exist = false) + private String logo; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "修改时间") + private Date updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaAssetsSoftwareCert.java b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsSoftwareCert.java new file mode 100644 index 0000000..78e2938 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsSoftwareCert.java @@ -0,0 +1,101 @@ +package com.gxwebsoft.oa.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 计算机软件著作权登记 + * + * @author 科技小王子 + * @since 2024-10-18 19:46:21 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaAssetsSoftwareCert对象", description = "计算机软件著作权登记") +public class OaAssetsSoftwareCert implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "名称") + private String name; + + @Schema(description = "软件著作权标识") + private String code; + + @Schema(description = "证书类型") + private String type; + + @Schema(description = "品牌厂商") + private String brand; + + @Schema(description = "价格") + private BigDecimal price; + + @Schema(description = "详情内容") + private String content; + + @Schema(description = "证书下载地址") + private String certUrl; + + @Schema(description = "购买时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + + @Schema(description = "到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + + @Schema(description = "置顶状态") + private String isTop; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "状态, 0正常, 1冻结") + private String status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "应用名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "应用图标") + @TableField(exist = false) + private String logo; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "修改时间") + private Date updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaAssetsSsl.java b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsSsl.java new file mode 100644 index 0000000..b89e837 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsSsl.java @@ -0,0 +1,113 @@ +package com.gxwebsoft.oa.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * ssl证书 + * + * @author 科技小王子 + * @since 2024-10-18 19:25:40 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaAssetsSsl对象", description = "ssl证书") +public class OaAssetsSsl implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "ssl_id", type = IdType.AUTO) + private Integer sslId; + + @Schema(description = "证书名称") + private String name; + + @Schema(description = "证书标识") + private String code; + + @Schema(description = "证书类型") + private String type; + + @Schema(description = "品牌厂商") + private String brand; + + @Schema(description = "价格") + private BigDecimal price; + + @Schema(description = "详情内容") + private String content; + + @Schema(description = "证书key") + private String certKey; + + @Schema(description = "证书pem") + private String certPem; + + @Schema(description = "证书下载地址") + private String certUrl; + + @Schema(description = "证书crt") + private String certCrt; + + @Schema(description = "购买时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + + @Schema(description = "到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + + @Schema(description = "置顶状态") + private String isTop; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "即将过期") + private Integer soon; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "应用名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "应用图标") + @TableField(exist = false) + private String logo; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "修改时间") + private Date updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaAssetsTrademark.java b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsTrademark.java new file mode 100644 index 0000000..2b52097 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsTrademark.java @@ -0,0 +1,101 @@ +package com.gxwebsoft.oa.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商标注册 + * + * @author 科技小王子 + * @since 2024-10-18 19:46:21 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaAssetsTrademark对象", description = "商标注册") +public class OaAssetsTrademark implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "商标名称") + private String name; + + @Schema(description = "商标标识") + private String code; + + @Schema(description = "商标类型") + private String type; + + @Schema(description = "品牌厂商") + private String brand; + + @Schema(description = "价格") + private BigDecimal price; + + @Schema(description = "详情内容") + private String content; + + @Schema(description = "证书下载") + private String certUrl; + + @Schema(description = "购买时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + + @Schema(description = "到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + + @Schema(description = "置顶状态") + private String isTop; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "状态, 0正常, 1冻结") + private String status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "应用名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "应用图标") + @TableField(exist = false) + private String logo; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "修改时间") + private Date updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaAssetsUser.java b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsUser.java new file mode 100644 index 0000000..f38b406 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsUser.java @@ -0,0 +1,49 @@ +package com.gxwebsoft.oa.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.util.Date; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 服务器成员管理 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaAssetsUser对象", description = "服务器成员管理") +public class OaAssetsUser implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "角色,10体验成员 20开发者成员 30管理员 ") + private Integer role; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "应用ID") + private Integer assetsId; + + @Schema(description = "昵称") + private String nickname; + + @Schema(description = "状态, 0正常, 1待确认") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private Date createTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaAssetsVhost.java b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsVhost.java new file mode 100644 index 0000000..43d8628 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaAssetsVhost.java @@ -0,0 +1,110 @@ +package com.gxwebsoft.oa.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 虚拟主机记录表 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaAssetsVhost对象", description = "虚拟主机记录表") +public class OaAssetsVhost implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "vhost_id", type = IdType.AUTO) + private Integer vhostId; + + @Schema(description = "域名") + private String name; + + @Schema(description = "域名标识") + private String code; + + @Schema(description = "主机型号") + private String type; + + @Schema(description = "品牌厂商") + private String brand; + + @Schema(description = "初始账号") + private String account; + + @Schema(description = "初始密码") + private String password; + + @Schema(description = "价格") + private BigDecimal price; + + @Schema(description = "详情内容") + private String content; + + @Schema(description = "ssl证书") + private String ssl; + + @Schema(description = "购买时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + + @Schema(description = "到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + + @Schema(description = "置顶状态") + private String isTop; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "服务器ID") + private Integer assetsId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "状态, 0正常, 1冻结") + private String status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "应用名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "应用图标") + @TableField(exist = false) + private String logo; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "修改时间") + private Date updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaCompany.java b/src/main/java/com/gxwebsoft/oa/entity/OaCompany.java new file mode 100644 index 0000000..5949c02 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaCompany.java @@ -0,0 +1,192 @@ +package com.gxwebsoft.oa.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableField; +import java.io.Serializable; +import java.util.Date; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 企业信息 + * + * @author 科技小王子 + * @since 2024-09-20 12:33:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaCompany对象", description = "企业信息") +public class OaCompany implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "企业id") + @TableId(value = "company_id", type = IdType.AUTO) + private Integer companyId; + + @Schema(description = "企业简称") + private String shortName; + + @Schema(description = "企业全称") + private String companyName; + + @Schema(description = "企业标识") + private String companyCode; + + @Schema(description = "类型 10企业 20政府单位") + private String companyType; + + @Schema(description = "企业类型多选") + private String companyTypeMultiple; + + @Schema(description = "应用标识") + private String companyLogo; + + @Schema(description = "应用类型") + private String appType; + + @Schema(description = "绑定域名") + private String domain; + + @Schema(description = "联系电话") + private String phone; + + @Schema(description = "座机电话") + private String tel; + + @Schema(description = "邮箱") + private String email; + + @Schema(description = "发票抬头") + @TableField("Invoice_header") + private String invoiceHeader; + + @Schema(description = "企业法人") + private String businessEntity; + + @Schema(description = "服务开始时间") + private Date startTime; + + @Schema(description = "服务到期时间") + private Date expirationTime; + + @Schema(description = "应用版本 10体验版 20授权版 30旗舰版") + private Integer version; + + @Schema(description = "成员数量(人数上限)") + private Integer members; + + @Schema(description = "成员数量(当前)") + private Integer users; + + @Schema(description = "行业类型(父级)") + private String industryParent; + + @Schema(description = "行业类型(子级)") + private String industryChild; + + @Schema(description = "部门数量") + private Integer departments; + + @Schema(description = "存储空间") + private Long storage; + + @Schema(description = "存储空间(上限)") + private Long storageMax; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否实名认证") + private Integer authentication; + + @Schema(description = "企业默认主体") + private Integer authoritative; + + @Schema(description = "request合法域名") + private String requestUrl; + + @Schema(description = "socket合法域名") + private String socketUrl; + + @Schema(description = "主控端域名") + private String serverUrl; + + @Schema(description = "业务域名") + private String modulesUrl; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "点赞数量") + private Integer likes; + + @Schema(description = "点击数量") + private Integer clicks; + + @Schema(description = "购买数量") + private Integer buys; + + @Schema(description = "是否含税, 0不含, 1含") + private Integer isTax; + + @Schema(description = "当前克隆的租户ID") + private Integer planId; + + @Schema(description = "状态") + private Integer status; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "应用名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "应用图标") + @TableField(exist = false) + private String logo; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "修改时间") + private Date updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaCompanyField.java b/src/main/java/com/gxwebsoft/oa/entity/OaCompanyField.java new file mode 100644 index 0000000..57029bd --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaCompanyField.java @@ -0,0 +1,54 @@ +package com.gxwebsoft.oa.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; +import java.util.Date; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 企业参数 + * + * @author 科技小王子 + * @since 2024-09-20 12:33:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaCompanyField对象", description = "企业参数") +public class OaCompanyField implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "名称") + private String name; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "状态, 0正常, 1删除") + private Integer status; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private Date createTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaCompanyUser.java b/src/main/java/com/gxwebsoft/oa/entity/OaCompanyUser.java new file mode 100644 index 0000000..6eee867 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaCompanyUser.java @@ -0,0 +1,51 @@ +package com.gxwebsoft.oa.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; +import java.util.Date; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 成员管理 + * + * @author 科技小王子 + * @since 2024-09-20 12:33:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaCompanyUser对象", description = "成员管理") +public class OaCompanyUser implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "company_user_id", type = IdType.AUTO) + private Integer companyUserId; + + @Schema(description = "角色,10体验成员 20开发者成员 30管理员 ") + private Integer role; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "昵称") + private String nickname; + + @Schema(description = "状态, 0正常, 1待确认") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private Date createTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaLink.java b/src/main/java/com/gxwebsoft/oa/entity/OaLink.java new file mode 100644 index 0000000..416ad21 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaLink.java @@ -0,0 +1,72 @@ +package com.gxwebsoft.oa.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 常用链接 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaLink对象", description = "常用链接") +public class OaLink implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "链接名称") + private String name; + + @Schema(description = "图标") + private String icon; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "链接分类") + private String linkType; + + @Schema(description = "应用ID") + private Integer appId; + + @Schema(description = "所属栏目") + private Integer categoryId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "状态, 0正常, 1待确认") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private Date createTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaProduct.java b/src/main/java/com/gxwebsoft/oa/entity/OaProduct.java new file mode 100644 index 0000000..919c2b6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaProduct.java @@ -0,0 +1,103 @@ +package com.gxwebsoft.oa.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 产品记录表 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaProduct对象", description = "产品记录表") +public class OaProduct implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "产品ID") + @TableId(value = "product_id", type = IdType.AUTO) + private Integer productId; + + @Schema(description = "产品名称") + private String name; + + @Schema(description = "产品标识") + private String code; + + @Schema(description = "产品详情") + private String content; + + @Schema(description = "产品类型") + private String type; + + @Schema(description = "产品图标") + private String logo; + + @Schema(description = "产品金额") + private BigDecimal money; + + @Schema(description = "初始销量") + private Integer salesInitial; + + @Schema(description = "实际销量") + private Integer salesActual; + + @Schema(description = "库存总量(包含所有sku)") + private Integer stockTotal; + + @Schema(description = "背景颜色") + private String backgroundColor; + + @Schema(description = "背景图片") + private String backgroundImage; + + @Schema(description = "背景图片(gif)") + private String backgroundGif; + + @Schema(description = "购买链接") + private String buyUrl; + + @Schema(description = "控制台链接") + private String adminUrl; + + @Schema(description = "附件") + private String files; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0已上架, 1已下架") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "修改时间") + private Date updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaProductTabs.java b/src/main/java/com/gxwebsoft/oa/entity/OaProductTabs.java new file mode 100644 index 0000000..a46f516 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaProductTabs.java @@ -0,0 +1,78 @@ +package com.gxwebsoft.oa.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 产品标签记录表 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaProductTabs对象", description = "产品标签记录表") +public class OaProductTabs implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "产品标签ID") + @TableId(value = "tab_id", type = IdType.AUTO) + private Integer tabId; + + @Schema(description = "产品ID") + private Integer productId; + + @Schema(description = "标签名称") + private String name; + + @Schema(description = "标签类型") + private String type; + + @Schema(description = "产品标签详情") + private String content; + + @Schema(description = "背景颜色") + private String backgroundColor; + + @Schema(description = "背景图片") + private String backgroundImage; + + @Schema(description = "附件") + private String files; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0已上架, 1已下架") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "修改时间") + private Date updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaTask.java b/src/main/java/com/gxwebsoft/oa/entity/OaTask.java new file mode 100644 index 0000000..dd0babd --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaTask.java @@ -0,0 +1,133 @@ +package com.gxwebsoft.oa.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import java.time.LocalDate; +import com.baomidou.mybatisplus.annotation.TableId; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 任务记录表 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaTask对象", description = "任务记录表") +public class OaTask implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "工单ID") + @TableId(value = "task_id", type = IdType.AUTO) + private Integer taskId; + + @Schema(description = "工单类型") + private String taskType; + + @Schema(description = "任务内容") + private String name; + + @Schema(description = "问题描述") + private String content; + + @Schema(description = "工单附件") + private String files; + + @Schema(description = "工单发起人") + private Integer promoter; + + @Schema(description = "受理人") + private Integer commander; + + @Schema(description = "工单状态, 0未开始 1已指派 ") + private Integer progress; + + @Schema(description = "优先级") + private String priority; + + @Schema(description = "品质要求") + private String quality; + + @Schema(description = "时限(天)") + private Integer day; + + @Schema(description = "手机号") + private String phone; + + @Schema(description = "开始时间") + private LocalDate startTime; + + @Schema(description = "结束时间") + private LocalDate endTime; + + @Schema(description = "逾期天数") + private Integer overdueDays; + + @Schema(description = "项目ID") + private Integer appId; + + @Schema(description = "机构id") + private Integer organizationId; + + @Schema(description = "项目ID") + private Integer projectId; + + @Schema(description = "客户ID") + private Integer customerId; + + @Schema(description = "资产ID") + private Integer assetsId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "是否已查阅") + private Integer isRead; + + @Schema(description = "最后回复人") + private Integer lastReadUser; + + @Schema(description = "发起人昵称") + private String nickname; + + @Schema(description = "发起人头像") + private String avatar; + + @Schema(description = "最后回复人头像") + private String lastAvatar; + + @Schema(description = "最后回复人昵称") + private String lastNickname; + + @Schema(description = "订单是否已结算(0未结算 1已结算)") + private Integer isSettled; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0待处理, 1已完成") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "修改时间") + private Date updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaTaskCount.java b/src/main/java/com/gxwebsoft/oa/entity/OaTaskCount.java new file mode 100644 index 0000000..c84a00a --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaTaskCount.java @@ -0,0 +1,70 @@ +package com.gxwebsoft.oa.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.util.Date; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 数据统计 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaTaskCount对象", description = "数据统计") +public class OaTaskCount implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "task_count_id", type = IdType.AUTO) + private Integer taskCountId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "待处理数") + private Integer pending; + + @Schema(description = "闲置的工单(废弃)") + private Integer unused; + + @Schema(description = "已完成数(废弃)") + private Integer completed; + + @Schema(description = "今天处理数") + private Integer today; + + @Schema(description = "本月处理数") + private Integer month; + + @Schema(description = "今年处理数") + private Integer year; + + @Schema(description = "总工单数") + private Integer total; + + @Schema(description = "部门ID") + private Integer organizationId; + + @Schema(description = "角色ID") + private Integer roleId; + + @Schema(description = "角色标识") + private String roleCode; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "更新时间") + private Date updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaTaskRecord.java b/src/main/java/com/gxwebsoft/oa/entity/OaTaskRecord.java new file mode 100644 index 0000000..568b5e4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaTaskRecord.java @@ -0,0 +1,72 @@ +package com.gxwebsoft.oa.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 工单回复记录表 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaTaskRecord对象", description = "工单回复记录表") +public class OaTaskRecord implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "回复ID") + @TableId(value = "task_record_id", type = IdType.AUTO) + private Integer taskRecordId; + + @Schema(description = "上级id, 0是顶级") + private Integer parentId; + + @Schema(description = "工单ID") + private Integer taskId; + + @Schema(description = "内容") + private String content; + + @Schema(description = "机密信息") + private String confidential; + + @Schema(description = "联系电话") + private String phone; + + @Schema(description = "工单附件") + private String files; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0待处理, 1已完成") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private Date createTime; + + @Schema(description = "修改时间") + private Date updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/entity/OaTaskUser.java b/src/main/java/com/gxwebsoft/oa/entity/OaTaskUser.java new file mode 100644 index 0000000..b82227b --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/entity/OaTaskUser.java @@ -0,0 +1,49 @@ +package com.gxwebsoft.oa.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.util.Date; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 工单成员 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "OaTaskUser对象", description = "工单成员") +public class OaTaskUser implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "task_user_id", type = IdType.AUTO) + private Integer taskUserId; + + @Schema(description = "角色,10体验成员 20开发者成员 30管理员 ") + private Integer role; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "工单ID") + private Integer taskId; + + @Schema(description = "昵称") + private String nickname; + + @Schema(description = "状态, 0待处理, 1已完成") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "加入时间") + private Date createTime; + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaAppFieldMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaAppFieldMapper.java new file mode 100644 index 0000000..5d66286 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaAppFieldMapper.java @@ -0,0 +1,39 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaAppField; +import com.gxwebsoft.oa.param.OaAppFieldParam; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 应用参数Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +public interface OaAppFieldMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaAppFieldParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaAppFieldParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaAppMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaAppMapper.java new file mode 100644 index 0000000..8975d8b --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaAppMapper.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaApp; +import com.gxwebsoft.oa.param.OaAppParam; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 应用Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +public interface OaAppMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaAppParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaAppParam param); + + /** + * 统计金额总和 + * + * @param wrapper 查询条件 + * @return 金额总和 + */ + BigDecimal selectSumMoney(@Param("ew") Wrapper wrapper); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaAppRenewMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaAppRenewMapper.java new file mode 100644 index 0000000..40ceb78 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaAppRenewMapper.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaAppRenew; +import com.gxwebsoft.oa.param.OaAppRenewParam; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 续费管理Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +public interface OaAppRenewMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaAppRenewParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaAppRenewParam param); + + /** + * 统计金额总和 + * + * @param wrapper 查询条件 + * @return 金额总和 + */ + BigDecimal selectSumMoney(@Param("ew") Wrapper wrapper); +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaAppUrlMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaAppUrlMapper.java new file mode 100644 index 0000000..af8f851 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaAppUrlMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaAppUrl; +import com.gxwebsoft.oa.param.OaAppUrlParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 项目域名Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +public interface OaAppUrlMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaAppUrlParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaAppUrlParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaAppUserMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaAppUserMapper.java new file mode 100644 index 0000000..8d416bf --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaAppUserMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaAppUser; +import com.gxwebsoft.oa.param.OaAppUserParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 应用成员Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +public interface OaAppUserMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaAppUserParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaAppUserParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsCodeMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsCodeMapper.java new file mode 100644 index 0000000..8108c1c --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsCodeMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaAssetsCode; +import com.gxwebsoft.oa.param.OaAssetsCodeParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 代码仓库Mapper + * + * @author 科技小王子 + * @since 2024-10-18 18:27:01 + */ +public interface OaAssetsCodeMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaAssetsCodeParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaAssetsCodeParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsDomainMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsDomainMapper.java new file mode 100644 index 0000000..6f9c571 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsDomainMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaAssetsDomain; +import com.gxwebsoft.oa.param.OaAssetsDomainParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 域名Mapper + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +public interface OaAssetsDomainMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaAssetsDomainParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaAssetsDomainParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsEmailMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsEmailMapper.java new file mode 100644 index 0000000..6457bb8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsEmailMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaAssetsEmail; +import com.gxwebsoft.oa.param.OaAssetsEmailParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 企业邮箱记录表Mapper + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +public interface OaAssetsEmailMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaAssetsEmailParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaAssetsEmailParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsMapper.java new file mode 100644 index 0000000..b1b2879 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaAssets; +import com.gxwebsoft.oa.param.OaAssetsParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 云服务器Mapper + * + * @author 科技小王子 + * @since 2024-10-18 18:34:15 + */ +public interface OaAssetsMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaAssetsParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaAssetsParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsMysqlMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsMysqlMapper.java new file mode 100644 index 0000000..168f28b --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsMysqlMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaAssetsMysql; +import com.gxwebsoft.oa.param.OaAssetsMysqlParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 云数据库Mapper + * + * @author 科技小王子 + * @since 2024-10-18 19:00:20 + */ +public interface OaAssetsMysqlMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaAssetsMysqlParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaAssetsMysqlParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsServerMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsServerMapper.java new file mode 100644 index 0000000..fd08087 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsServerMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaAssetsServer; +import com.gxwebsoft.oa.param.OaAssetsServerParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 服务Mapper + * + * @author 科技小王子 + * @since 2024-10-21 19:15:26 + */ +public interface OaAssetsServerMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaAssetsServerParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaAssetsServerParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsSiteMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsSiteMapper.java new file mode 100644 index 0000000..641dad9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsSiteMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaAssetsSite; +import com.gxwebsoft.oa.param.OaAssetsSiteParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 网站信息记录表Mapper + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +public interface OaAssetsSiteMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaAssetsSiteParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaAssetsSiteParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsSoftwareCertMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsSoftwareCertMapper.java new file mode 100644 index 0000000..a861aec --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsSoftwareCertMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaAssetsSoftwareCert; +import com.gxwebsoft.oa.param.OaAssetsSoftwareCertParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 计算机软件著作权登记Mapper + * + * @author 科技小王子 + * @since 2024-10-18 19:46:21 + */ +public interface OaAssetsSoftwareCertMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaAssetsSoftwareCertParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaAssetsSoftwareCertParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsSslMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsSslMapper.java new file mode 100644 index 0000000..7912f86 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsSslMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaAssetsSsl; +import com.gxwebsoft.oa.param.OaAssetsSslParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * ssl证书Mapper + * + * @author 科技小王子 + * @since 2024-10-18 19:25:40 + */ +public interface OaAssetsSslMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaAssetsSslParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaAssetsSslParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsTrademarkMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsTrademarkMapper.java new file mode 100644 index 0000000..371ab97 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsTrademarkMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaAssetsTrademark; +import com.gxwebsoft.oa.param.OaAssetsTrademarkParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 商标注册Mapper + * + * @author 科技小王子 + * @since 2024-10-18 19:46:21 + */ +public interface OaAssetsTrademarkMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaAssetsTrademarkParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaAssetsTrademarkParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsUserMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsUserMapper.java new file mode 100644 index 0000000..56cd088 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsUserMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaAssetsUser; +import com.gxwebsoft.oa.param.OaAssetsUserParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 服务器成员管理Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +public interface OaAssetsUserMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaAssetsUserParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaAssetsUserParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsVhostMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsVhostMapper.java new file mode 100644 index 0000000..c45a874 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaAssetsVhostMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaAssetsVhost; +import com.gxwebsoft.oa.param.OaAssetsVhostParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 虚拟主机记录表Mapper + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +public interface OaAssetsVhostMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaAssetsVhostParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaAssetsVhostParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaCompanyFieldMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaCompanyFieldMapper.java new file mode 100644 index 0000000..6471da9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaCompanyFieldMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaCompanyField; +import com.gxwebsoft.oa.param.OaCompanyFieldParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 企业参数Mapper + * + * @author 科技小王子 + * @since 2024-09-20 12:33:12 + */ +public interface OaCompanyFieldMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaCompanyFieldParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaCompanyFieldParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaCompanyMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaCompanyMapper.java new file mode 100644 index 0000000..59d6d85 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaCompanyMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaCompany; +import com.gxwebsoft.oa.param.OaCompanyParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 企业信息Mapper + * + * @author 科技小王子 + * @since 2024-09-20 12:33:12 + */ +public interface OaCompanyMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaCompanyParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaCompanyParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaCompanyUserMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaCompanyUserMapper.java new file mode 100644 index 0000000..65e6a8e --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaCompanyUserMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaCompanyUser; +import com.gxwebsoft.oa.param.OaCompanyUserParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 成员管理Mapper + * + * @author 科技小王子 + * @since 2024-09-20 12:33:12 + */ +public interface OaCompanyUserMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaCompanyUserParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaCompanyUserParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaLinkMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaLinkMapper.java new file mode 100644 index 0000000..57497a8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaLinkMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaLink; +import com.gxwebsoft.oa.param.OaLinkParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 常用链接Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +public interface OaLinkMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaLinkParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaLinkParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaProductMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaProductMapper.java new file mode 100644 index 0000000..9d1d9af --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaProductMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaProduct; +import com.gxwebsoft.oa.param.OaProductParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 产品记录表Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +public interface OaProductMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaProductParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaProductParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaProductTabsMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaProductTabsMapper.java new file mode 100644 index 0000000..39e03c7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaProductTabsMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaProductTabs; +import com.gxwebsoft.oa.param.OaProductTabsParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 产品标签记录表Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +public interface OaProductTabsMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaProductTabsParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaProductTabsParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaTaskCountMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaTaskCountMapper.java new file mode 100644 index 0000000..0e139df --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaTaskCountMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaTaskCount; +import com.gxwebsoft.oa.param.OaTaskCountParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 数据统计Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +public interface OaTaskCountMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaTaskCountParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaTaskCountParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaTaskMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaTaskMapper.java new file mode 100644 index 0000000..963f5f8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaTaskMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaTask; +import com.gxwebsoft.oa.param.OaTaskParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 任务记录表Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +public interface OaTaskMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaTaskParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaTaskParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaTaskRecordMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaTaskRecordMapper.java new file mode 100644 index 0000000..f12d10e --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaTaskRecordMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaTaskRecord; +import com.gxwebsoft.oa.param.OaTaskRecordParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 工单回复记录表Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +public interface OaTaskRecordMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaTaskRecordParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaTaskRecordParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/OaTaskUserMapper.java b/src/main/java/com/gxwebsoft/oa/mapper/OaTaskUserMapper.java new file mode 100644 index 0000000..d894bb6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/OaTaskUserMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.oa.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.oa.entity.OaTaskUser; +import com.gxwebsoft.oa.param.OaTaskUserParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 工单成员Mapper + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +public interface OaTaskUserMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") OaTaskUserParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") OaTaskUserParam param); + +} diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAppFieldMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAppFieldMapper.xml new file mode 100644 index 0000000..c7ded82 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAppFieldMapper.xml @@ -0,0 +1,50 @@ + + + + + + + SELECT a.* + FROM oa_app_field a + + + AND a.id = #{param.id} + + + AND a.app_id = #{param.appId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.status = #{param.status} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAppMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAppMapper.xml new file mode 100644 index 0000000..e21d750 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAppMapper.xml @@ -0,0 +1,238 @@ + + + + + + + SELECT a.*, b.company_name,b.short_name,b.company_logo + FROM oa_app a + LEFT JOIN oa_company b ON a.company_id = b.company_id + + + AND a.app_id = #{param.appId} + + + AND a.app_name LIKE CONCAT('%', #{param.appName}, '%') + + + AND a.app_code LIKE CONCAT('%', #{param.appCode}, '%') + + + AND a.show_case = #{param.showCase} + + + AND a.recommend = #{param.recommend} + + + AND a.show_index = #{param.showIndex} + + + AND a.parent_id = #{param.parentId} + + + AND a.app_type LIKE CONCAT('%', #{param.appType}, '%') + + + AND a.app_type_multiple LIKE CONCAT('%', #{param.appTypeMultiple}, '%') + + + AND a.menu_type = #{param.menuType} + + + AND a.company_id = #{param.companyId} + + + AND a.company_name LIKE CONCAT('%', #{param.companyName}, '%') + + + AND a.app_icon LIKE CONCAT('%', #{param.appIcon}, '%') + + + AND a.app_qrcode LIKE CONCAT('%', #{param.appQrcode}, '%') + + + AND a.app_url LIKE CONCAT('%', #{param.appUrl}, '%') + + + AND a.admin_url LIKE CONCAT('%', #{param.adminUrl}, '%') + + + AND a.down_url LIKE CONCAT('%', #{param.downUrl}, '%') + + + AND a.server_url LIKE CONCAT('%', #{param.serverUrl}, '%') + + + AND a.file_url LIKE CONCAT('%', #{param.fileUrl}, '%') + + + AND a.callback_url LIKE CONCAT('%', #{param.callbackUrl}, '%') + + + AND a.docs_url LIKE CONCAT('%', #{param.docsUrl}, '%') + + + AND a.git_url LIKE CONCAT('%', #{param.gitUrl}, '%') + + + AND a.prototype_url LIKE CONCAT('%', #{param.prototypeUrl}, '%') + + + AND a.ip_address LIKE CONCAT('%', #{param.ipAddress}, '%') + + + AND a.images LIKE CONCAT('%', #{param.images}, '%') + + + AND a.package_name LIKE CONCAT('%', #{param.packageName}, '%') + + + AND a.clicks = #{param.clicks} + + + AND a.installs = #{param.installs} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.requirement LIKE CONCAT('%', #{param.requirement}, '%') + + + AND a.developer LIKE CONCAT('%', #{param.developer}, '%') + + + AND a.director LIKE CONCAT('%', #{param.director}, '%') + + + AND a.project_director LIKE CONCAT('%', #{param.projectDirector}, '%') + + + AND a.salesman LIKE CONCAT('%', #{param.salesman}, '%') + + + AND a.price = #{param.price} + + + AND a.line_price = #{param.linePrice} + + + AND a.score LIKE CONCAT('%', #{param.score}, '%') + + + AND a.star LIKE CONCAT('%', #{param.star}, '%') + + + AND a.path LIKE CONCAT('%', #{param.path}, '%') + + + AND a.component LIKE CONCAT('%', #{param.component}, '%') + + + AND a.authority LIKE CONCAT('%', #{param.authority}, '%') + + + AND a.target LIKE CONCAT('%', #{param.target}, '%') + + + AND a.hide = #{param.hide} + + + AND a.search = #{param.search} + + + AND a.active LIKE CONCAT('%', #{param.active}, '%') + + + AND a.meta LIKE CONCAT('%', #{param.meta}, '%') + + + AND a.edition LIKE CONCAT('%', #{param.edition}, '%') + + + AND a.version LIKE CONCAT('%', #{param.version}, '%') + + + AND a.is_use = #{param.isUse} + + + AND a.file1 LIKE CONCAT('%', #{param.file1}, '%') + + + AND a.file2 LIKE CONCAT('%', #{param.file2}, '%') + + + AND a.file3 LIKE CONCAT('%', #{param.file3}, '%') + + + AND a.app_status LIKE CONCAT('%', #{param.appStatus}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.app_id IN + + #{item} + + + + AND a.organization_id = #{param.organizationId} + + + AND a.show_expiration = #{param.showExpiration} + + + AND a.tenant_code LIKE CONCAT('%', #{param.tenantCode}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.app_name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.app_code LIKE CONCAT('%', #{param.keywords}, '%') + OR a.company_name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.app_url LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAppRenewMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAppRenewMapper.xml new file mode 100644 index 0000000..d949637 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAppRenewMapper.xml @@ -0,0 +1,70 @@ + + + + + + + SELECT a.*, + b.company_name,b.short_name,b.company_logo, + c.app_name + FROM oa_app_renew a + LEFT JOIN oa_company b ON a.company_id = b.company_id + LEFT JOIN oa_app c ON a.app_id = c.app_id + + + AND a.app_renew_id = #{param.appRenewId} + + + AND a.money = #{param.money} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.app_id = #{param.appId} + + + AND a.company_id = #{param.companyId} + + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAppUrlMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAppUrlMapper.xml new file mode 100644 index 0000000..24865f4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAppUrlMapper.xml @@ -0,0 +1,54 @@ + + + + + + + SELECT a.* + FROM oa_app_url a + + + AND a.app_url_id = #{param.appUrlId} + + + AND a.app_id = #{param.appId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.domain LIKE CONCAT('%', #{param.domain}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAppUserMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAppUserMapper.xml new file mode 100644 index 0000000..83cf18a --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAppUserMapper.xml @@ -0,0 +1,51 @@ + + + + + + + SELECT a.* + FROM oa_app_user a + + + AND a.app_user_id = #{param.appUserId} + + + AND a.role = #{param.role} + + + AND a.user_id = #{param.userId} + + + AND a.app_id = #{param.appId} + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (b.nickname LIKE CONCAT('%', #{param.keywords}, '%') + OR b.email LIKE CONCAT('%', #{param.keywords}, '%') + OR b.username LIKE CONCAT('%', #{param.keywords}, '%') + OR b.phone LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsCodeMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsCodeMapper.xml new file mode 100644 index 0000000..482f9cf --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsCodeMapper.xml @@ -0,0 +1,75 @@ + + + + + + + SELECT a.*, b.short_name AS tenantName,b.company_logo as logo + FROM oa_assets_code a + LEFT JOIN gxwebsoft_core.sys_company b ON a.tenant_id = b.tenant_id + + + AND a.id = #{param.id} + + + AND a.assets_id = #{param.assetsId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.git_url LIKE CONCAT('%', #{param.gitUrl}, '%') + + + AND a.brand LIKE CONCAT('%', #{param.brand}, '%') + + + AND a.is_top LIKE CONCAT('%', #{param.isTop}, '%') + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.user_ids LIKE CONCAT('%', #{param.userIds}, '%') + + + AND a.status LIKE CONCAT('%', #{param.status}, '%') + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsDomainMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsDomainMapper.xml new file mode 100644 index 0000000..af8d0c4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsDomainMapper.xml @@ -0,0 +1,84 @@ + + + + + + + SELECT a.*, b.short_name AS tenantName,b.company_logo as logo + FROM oa_assets_domain a + LEFT JOIN gxwebsoft_core.sys_company b ON a.tenant_id = b.tenant_id + + + AND a.domain_id = #{param.domainId} + + + AND a.assets_id = #{param.assetsId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.brand LIKE CONCAT('%', #{param.brand}, '%') + + + AND a.account LIKE CONCAT('%', #{param.account}, '%') + + + AND a.password LIKE CONCAT('%', #{param.password}, '%') + + + AND a.price = #{param.price} + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') + + + AND a.is_top LIKE CONCAT('%', #{param.isTop}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.user_ids LIKE CONCAT('%', #{param.userIds}, '%') + + + AND a.status LIKE CONCAT('%', #{param.status}, '%') + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsEmailMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsEmailMapper.xml new file mode 100644 index 0000000..da6012b --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsEmailMapper.xml @@ -0,0 +1,84 @@ + + + + + + + SELECT a.*, b.short_name AS tenantName,b.company_logo as logo + FROM oa_assets_email a + LEFT JOIN gxwebsoft_core.sys_company b ON a.tenant_id = b.tenant_id + + + AND a.email_id = #{param.emailId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.brand LIKE CONCAT('%', #{param.brand}, '%') + + + AND a.system LIKE CONCAT('%', #{param.system}, '%') + + + AND a.price = #{param.price} + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') + + + AND a.is_top LIKE CONCAT('%', #{param.isTop}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.user_ids LIKE CONCAT('%', #{param.userIds}, '%') + + + AND a.status LIKE CONCAT('%', #{param.status}, '%') + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsMapper.xml new file mode 100644 index 0000000..b6b4fc5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsMapper.xml @@ -0,0 +1,147 @@ + + + + + + + SELECT a.*, b.short_name AS tenantName,b.company_logo as logo + FROM oa_assets a + LEFT JOIN gxwebsoft_core.sys_company b ON a.tenant_id = b.tenant_id + + + AND a.assets_id = #{param.assetsId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.brand LIKE CONCAT('%', #{param.brand}, '%') + + + AND a.configuration LIKE CONCAT('%', #{param.configuration}, '%') + + + AND a.account LIKE CONCAT('%', #{param.account}, '%') + + + AND a.password LIKE CONCAT('%', #{param.password}, '%') + + + AND a.brand_account LIKE CONCAT('%', #{param.brandAccount}, '%') + + + AND a.brand_password LIKE CONCAT('%', #{param.brandPassword}, '%') + + + AND a.panel LIKE CONCAT('%', #{param.panel}, '%') + + + AND a.panel_account LIKE CONCAT('%', #{param.panelAccount}, '%') + + + AND a.panel_password LIKE CONCAT('%', #{param.panelPassword}, '%') + + + AND a.finance_amount = #{param.financeAmount} + + + AND a.finance_years = #{param.financeYears} + + + AND a.finance_renew = #{param.financeRenew} + + + AND a.finance_customer_name LIKE CONCAT('%', #{param.financeCustomerName}, '%') + + + AND a.finance_customer_contact LIKE CONCAT('%', #{param.financeCustomerContact}, '%') + + + AND a.finance_customer_phone LIKE CONCAT('%', #{param.financeCustomerPhone}, '%') + + + AND a.customer_id = #{param.customerId} + + + AND a.customer_name LIKE CONCAT('%', #{param.customerName}, '%') + + + AND a.open_port LIKE CONCAT('%', #{param.openPort}, '%') + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') + + + AND a.is_top LIKE CONCAT('%', #{param.isTop}, '%') + + + AND a.visibility LIKE CONCAT('%', #{param.visibility}, '%') + + + AND a.bt_sign LIKE CONCAT('%', #{param.btSign}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.company_id = #{param.companyId} + + + AND a.user_id = #{param.userId} + + + AND a.user_ids LIKE CONCAT('%', #{param.userIds}, '%') + + + AND a.organization_id = #{param.organizationId} + + + AND a.status LIKE CONCAT('%', #{param.status}, '%') + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.tenant_id = #{param.keywords} + OR a.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.code LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsMysqlMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsMysqlMapper.xml new file mode 100644 index 0000000..98fbbe4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsMysqlMapper.xml @@ -0,0 +1,90 @@ + + + + + + + SELECT a.*, b.short_name AS tenantName,b.company_logo as logo + FROM oa_assets_mysql a + LEFT JOIN gxwebsoft_core.sys_company b ON a.tenant_id = b.tenant_id + + + AND a.mysql_id = #{param.mysqlId} + + + AND a.assets_id = #{param.assetsId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.brand LIKE CONCAT('%', #{param.brand}, '%') + + + AND a.ip LIKE CONCAT('%', #{param.ip}, '%') + + + AND a.port LIKE CONCAT('%', #{param.port}, '%') + + + AND a.account LIKE CONCAT('%', #{param.account}, '%') + + + AND a.password LIKE CONCAT('%', #{param.password}, '%') + + + AND a.price = #{param.price} + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') + + + AND a.is_top LIKE CONCAT('%', #{param.isTop}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.user_ids LIKE CONCAT('%', #{param.userIds}, '%') + + + AND a.status LIKE CONCAT('%', #{param.status}, '%') + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsServerMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsServerMapper.xml new file mode 100644 index 0000000..1e7770e --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsServerMapper.xml @@ -0,0 +1,67 @@ + + + + + + + SELECT a.* + FROM oa_assets_server a + + + AND a.id = #{param.id} + + + AND a.server LIKE CONCAT('%', #{param.server}, '%') + + + AND a.server_url LIKE CONCAT('%', #{param.serverUrl}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.assets_id = #{param.assetsId} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.user_id = #{param.userId} + + + AND a.user_ids LIKE CONCAT('%', #{param.userIds}, '%') + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.tenant_id = #{param.keywords} + OR a.server_url LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsSiteMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsSiteMapper.xml new file mode 100644 index 0000000..4ac42c5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsSiteMapper.xml @@ -0,0 +1,153 @@ + + + + + + + SELECT a.*, b.short_name AS tenantName,b.company_logo as logo + FROM oa_assets_site a + LEFT JOIN gxwebsoft_core.sys_company b ON a.tenant_id = b.tenant_id + + + AND a.website_id = #{param.websiteId} + + + AND a.website_name LIKE CONCAT('%', #{param.websiteName}, '%') + + + AND a.website_code LIKE CONCAT('%', #{param.websiteCode}, '%') + + + AND a.website_icon LIKE CONCAT('%', #{param.websiteIcon}, '%') + + + AND a.website_logo LIKE CONCAT('%', #{param.websiteLogo}, '%') + + + AND a.website_dark_logo LIKE CONCAT('%', #{param.websiteDarkLogo}, '%') + + + AND a.website_type LIKE CONCAT('%', #{param.websiteType}, '%') + + + AND a.keywords LIKE CONCAT('%', #{param.keywords}, '%') + + + AND a.prefix LIKE CONCAT('%', #{param.prefix}, '%') + + + AND a.domain LIKE CONCAT('%', #{param.domain}, '%') + + + AND a.style LIKE CONCAT('%', #{param.style}, '%') + + + AND a.admin_url LIKE CONCAT('%', #{param.adminUrl}, '%') + + + AND a.version = #{param.version} + + + AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') + + + AND a.template_id = #{param.templateId} + + + AND a.industry_parent LIKE CONCAT('%', #{param.industryParent}, '%') + + + AND a.industry_child LIKE CONCAT('%', #{param.industryChild}, '%') + + + AND a.company_id = #{param.companyId} + + + AND a.country LIKE CONCAT('%', #{param.country}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.longitude LIKE CONCAT('%', #{param.longitude}, '%') + + + AND a.latitude LIKE CONCAT('%', #{param.latitude}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.email LIKE CONCAT('%', #{param.email}, '%') + + + AND a.icp_no LIKE CONCAT('%', #{param.icpNo}, '%') + + + AND a.police_no LIKE CONCAT('%', #{param.policeNo}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.status = #{param.status} + + + AND a.status_text LIKE CONCAT('%', #{param.statusText}, '%') + + + AND a.status_close LIKE CONCAT('%', #{param.statusClose}, '%') + + + AND a.styles LIKE CONCAT('%', #{param.styles}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.assets_id = #{param.assetsId} + + + AND a.user_id = #{param.userId} + + + AND a.user_ids LIKE CONCAT('%', #{param.userIds}, '%') + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsSoftwareCertMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsSoftwareCertMapper.xml new file mode 100644 index 0000000..2ac29a1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsSoftwareCertMapper.xml @@ -0,0 +1,84 @@ + + + + + + + SELECT a.*, b.short_name AS tenantName,b.company_logo as logo + FROM oa_assets_software_cert a + LEFT JOIN gxwebsoft_core.sys_company b ON a.tenant_id = b.tenant_id + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.brand LIKE CONCAT('%', #{param.brand}, '%') + + + AND a.price = #{param.price} + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.cert_url LIKE CONCAT('%', #{param.certUrl}, '%') + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') + + + AND a.is_top LIKE CONCAT('%', #{param.isTop}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.user_ids LIKE CONCAT('%', #{param.userIds}, '%') + + + AND a.status LIKE CONCAT('%', #{param.status}, '%') + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsSslMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsSslMapper.xml new file mode 100644 index 0000000..e6563a7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsSslMapper.xml @@ -0,0 +1,98 @@ + + + + + + + SELECT a.*, b.short_name AS tenantName,b.company_logo as logo + FROM oa_assets_ssl a + LEFT JOIN gxwebsoft_core.sys_company b ON a.tenant_id = b.tenant_id + + + AND a.ssl_id = #{param.sslId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.brand LIKE CONCAT('%', #{param.brand}, '%') + + + AND a.price = #{param.price} + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.cert_key LIKE CONCAT('%', #{param.certKey}, '%') + + + AND a.cert_pem LIKE CONCAT('%', #{param.certPem}, '%') + + + AND a.cert_url LIKE CONCAT('%', #{param.certUrl}, '%') + + + AND a.cert_crt LIKE CONCAT('%', #{param.certCrt}, '%') + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') + + + AND a.is_top LIKE CONCAT('%', #{param.isTop}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.user_ids LIKE CONCAT('%', #{param.userIds}, '%') + + + AND a.status LIKE CONCAT('%', #{param.status}, '%') + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.tenant_id = #{param.keywords} + OR a.name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsTrademarkMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsTrademarkMapper.xml new file mode 100644 index 0000000..5028926 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsTrademarkMapper.xml @@ -0,0 +1,84 @@ + + + + + + + SELECT a.*, b.short_name AS tenantName,b.company_logo as logo + FROM oa_assets_trademark a + LEFT JOIN gxwebsoft_core.sys_company b ON a.tenant_id = b.tenant_id + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.brand LIKE CONCAT('%', #{param.brand}, '%') + + + AND a.price = #{param.price} + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.cert_url LIKE CONCAT('%', #{param.certUrl}, '%') + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') + + + AND a.is_top LIKE CONCAT('%', #{param.isTop}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.user_ids LIKE CONCAT('%', #{param.userIds}, '%') + + + AND a.status LIKE CONCAT('%', #{param.status}, '%') + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsUserMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsUserMapper.xml new file mode 100644 index 0000000..0306c98 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsUserMapper.xml @@ -0,0 +1,44 @@ + + + + + + + SELECT a.* + FROM oa_assets_user a + + + AND a.id = #{param.id} + + + AND a.role = #{param.role} + + + AND a.user_id = #{param.userId} + + + AND a.assets_id = #{param.assetsId} + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsVhostMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsVhostMapper.xml new file mode 100644 index 0000000..682f29d --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaAssetsVhostMapper.xml @@ -0,0 +1,93 @@ + + + + + + + SELECT a.*, b.short_name AS tenantName,b.company_logo as logo + FROM oa_assets_vhost a + LEFT JOIN gxwebsoft_core.sys_company b ON a.tenant_id = b.tenant_id + + + AND a.vhost_id = #{param.vhostId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.brand LIKE CONCAT('%', #{param.brand}, '%') + + + AND a.account LIKE CONCAT('%', #{param.account}, '%') + + + AND a.password LIKE CONCAT('%', #{param.password}, '%') + + + AND a.price = #{param.price} + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.ssl LIKE CONCAT('%', #{param.ssl}, '%') + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') + + + AND a.is_top LIKE CONCAT('%', #{param.isTop}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.assets_id = #{param.assetsId} + + + AND a.user_id = #{param.userId} + + + AND a.user_ids LIKE CONCAT('%', #{param.userIds}, '%') + + + AND a.status LIKE CONCAT('%', #{param.status}, '%') + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaCompanyFieldMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaCompanyFieldMapper.xml new file mode 100644 index 0000000..4cdb978 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaCompanyFieldMapper.xml @@ -0,0 +1,50 @@ + + + + + + + SELECT a.* + FROM oa_company_field a + + + AND a.id = #{param.id} + + + AND a.company_id = #{param.companyId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.status = #{param.status} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaCompanyMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaCompanyMapper.xml new file mode 100644 index 0000000..682f772 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaCompanyMapper.xml @@ -0,0 +1,176 @@ + + + + + + + SELECT a.* + FROM oa_company a + + + AND a.company_id = #{param.companyId} + + + AND a.short_name LIKE CONCAT('%', #{param.shortName}, '%') + + + AND a.company_name LIKE CONCAT('%', #{param.companyName}, '%') + + + AND a.company_code LIKE CONCAT('%', #{param.companyCode}, '%') + + + AND a.company_type LIKE CONCAT('%', #{param.companyType}, '%') + + + AND a.company_type_multiple LIKE CONCAT('%', #{param.companyTypeMultiple}, '%') + + + AND a.company_logo LIKE CONCAT('%', #{param.companyLogo}, '%') + + + AND a.app_type LIKE CONCAT('%', #{param.appType}, '%') + + + AND a.domain LIKE CONCAT('%', #{param.domain}, '%') + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.tel LIKE CONCAT('%', #{param.tel}, '%') + + + AND a.email LIKE CONCAT('%', #{param.email}, '%') + + + AND a.Invoice_header LIKE CONCAT('%', #{param.invoiceHeader}, '%') + + + AND a.business_entity LIKE CONCAT('%', #{param.businessEntity}, '%') + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') + + + AND a.version = #{param.version} + + + AND a.members = #{param.members} + + + AND a.users = #{param.users} + + + AND a.industry_parent LIKE CONCAT('%', #{param.industryParent}, '%') + + + AND a.industry_child LIKE CONCAT('%', #{param.industryChild}, '%') + + + AND a.departments = #{param.departments} + + + AND a.storage LIKE CONCAT('%', #{param.storage}, '%') + + + AND a.storage_max LIKE CONCAT('%', #{param.storageMax}, '%') + + + AND a.country LIKE CONCAT('%', #{param.country}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.longitude LIKE CONCAT('%', #{param.longitude}, '%') + + + AND a.latitude LIKE CONCAT('%', #{param.latitude}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.authentication = #{param.authentication} + + + AND a.authoritative = #{param.authoritative} + + + AND a.request_url LIKE CONCAT('%', #{param.requestUrl}, '%') + + + AND a.socket_url LIKE CONCAT('%', #{param.socketUrl}, '%') + + + AND a.server_url LIKE CONCAT('%', #{param.serverUrl}, '%') + + + AND a.modules_url LIKE CONCAT('%', #{param.modulesUrl}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.likes = #{param.likes} + + + AND a.clicks = #{param.clicks} + + + AND a.buys = #{param.buys} + + + AND a.is_tax = #{param.isTax} + + + AND a.plan_id = #{param.planId} + + + AND a.status = #{param.status} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.user_id = #{param.userId} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaCompanyUserMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaCompanyUserMapper.xml new file mode 100644 index 0000000..e4aeb35 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaCompanyUserMapper.xml @@ -0,0 +1,47 @@ + + + + + + + SELECT a.* + FROM oa_company_user a + + + AND a.company_user_id = #{param.companyUserId} + + + AND a.role = #{param.role} + + + AND a.user_id = #{param.userId} + + + AND a.company_id = #{param.companyId} + + + AND a.nickname LIKE CONCAT('%', #{param.nickname}, '%') + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaLinkMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaLinkMapper.xml new file mode 100644 index 0000000..55a4a1e --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaLinkMapper.xml @@ -0,0 +1,71 @@ + + + + + + + SELECT a.* + FROM oa_link a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.icon LIKE CONCAT('%', #{param.icon}, '%') + + + AND a.url LIKE CONCAT('%', #{param.url}, '%') + + + AND a.link_type LIKE CONCAT('%', #{param.linkType}, '%') + + + AND a.app_id = #{param.appId} + + + AND a.category_id = #{param.categoryId} + + + AND a.user_id = #{param.userId} + + + AND a.recommend = #{param.recommend} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaProductMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaProductMapper.xml new file mode 100644 index 0000000..0bca9c6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaProductMapper.xml @@ -0,0 +1,98 @@ + + + + + + + SELECT a.* + FROM oa_product a + + + AND a.product_id = #{param.productId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.logo LIKE CONCAT('%', #{param.logo}, '%') + + + AND a.money = #{param.money} + + + AND a.sales_initial = #{param.salesInitial} + + + AND a.sales_actual = #{param.salesActual} + + + AND a.stock_total = #{param.stockTotal} + + + AND a.background_color LIKE CONCAT('%', #{param.backgroundColor}, '%') + + + AND a.background_image LIKE CONCAT('%', #{param.backgroundImage}, '%') + + + AND a.background_gif LIKE CONCAT('%', #{param.backgroundGif}, '%') + + + AND a.buy_url LIKE CONCAT('%', #{param.buyUrl}, '%') + + + AND a.admin_url LIKE CONCAT('%', #{param.adminUrl}, '%') + + + AND a.files LIKE CONCAT('%', #{param.files}, '%') + + + AND a.company_id = #{param.companyId} + + + AND a.user_id = #{param.userId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaProductTabsMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaProductTabsMapper.xml new file mode 100644 index 0000000..075457c --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaProductTabsMapper.xml @@ -0,0 +1,74 @@ + + + + + + + SELECT a.* + FROM oa_product_tabs a + + + AND a.tab_id = #{param.tabId} + + + AND a.product_id = #{param.productId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.background_color LIKE CONCAT('%', #{param.backgroundColor}, '%') + + + AND a.background_image LIKE CONCAT('%', #{param.backgroundImage}, '%') + + + AND a.files LIKE CONCAT('%', #{param.files}, '%') + + + AND a.company_id = #{param.companyId} + + + AND a.user_id = #{param.userId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaTaskCountMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaTaskCountMapper.xml new file mode 100644 index 0000000..5e5cf81 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaTaskCountMapper.xml @@ -0,0 +1,65 @@ + + + + + + + SELECT a.* + FROM oa_task_count a + + + AND a.task_count_id = #{param.taskCountId} + + + AND a.user_id = #{param.userId} + + + AND a.pending = #{param.pending} + + + AND a.unused = #{param.unused} + + + AND a.completed = #{param.completed} + + + AND a.today = #{param.today} + + + AND a.month = #{param.month} + + + AND a.year = #{param.year} + + + AND a.total = #{param.total} + + + AND a.organization_id = #{param.organizationId} + + + AND a.role_id = #{param.roleId} + + + AND a.role_code LIKE CONCAT('%', #{param.roleCode}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaTaskMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaTaskMapper.xml new file mode 100644 index 0000000..e068988 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaTaskMapper.xml @@ -0,0 +1,128 @@ + + + + + + + SELECT a.* + FROM oa_task a + + + AND a.task_id = #{param.taskId} + + + AND a.task_type LIKE CONCAT('%', #{param.taskType}, '%') + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.files LIKE CONCAT('%', #{param.files}, '%') + + + AND a.promoter = #{param.promoter} + + + AND a.commander = #{param.commander} + + + AND a.progress = #{param.progress} + + + AND a.priority LIKE CONCAT('%', #{param.priority}, '%') + + + AND a.quality LIKE CONCAT('%', #{param.quality}, '%') + + + AND a.day = #{param.day} + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') + + + AND a.overdue_days = #{param.overdueDays} + + + AND a.app_id = #{param.appId} + + + AND a.organization_id = #{param.organizationId} + + + AND a.project_id = #{param.projectId} + + + AND a.customer_id = #{param.customerId} + + + AND a.assets_id = #{param.assetsId} + + + AND a.user_id = #{param.userId} + + + AND a.is_read = #{param.isRead} + + + AND a.last_read_user = #{param.lastReadUser} + + + AND a.nickname LIKE CONCAT('%', #{param.nickname}, '%') + + + AND a.avatar LIKE CONCAT('%', #{param.avatar}, '%') + + + AND a.last_avatar LIKE CONCAT('%', #{param.lastAvatar}, '%') + + + AND a.last_nickname LIKE CONCAT('%', #{param.lastNickname}, '%') + + + AND a.is_settled = #{param.isSettled} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaTaskRecordMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaTaskRecordMapper.xml new file mode 100644 index 0000000..b9bd366 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaTaskRecordMapper.xml @@ -0,0 +1,68 @@ + + + + + + + SELECT a.* + FROM oa_task_record a + + + AND a.task_record_id = #{param.taskRecordId} + + + AND a.parent_id = #{param.parentId} + + + AND a.task_id = #{param.taskId} + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.confidential LIKE CONCAT('%', #{param.confidential}, '%') + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.files LIKE CONCAT('%', #{param.files}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/mapper/xml/OaTaskUserMapper.xml b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaTaskUserMapper.xml new file mode 100644 index 0000000..c620f5c --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/mapper/xml/OaTaskUserMapper.xml @@ -0,0 +1,47 @@ + + + + + + + SELECT a.* + FROM oa_task_user a + + + AND a.task_user_id = #{param.taskUserId} + + + AND a.role = #{param.role} + + + AND a.user_id = #{param.userId} + + + AND a.task_id = #{param.taskId} + + + AND a.nickname LIKE CONCAT('%', #{param.nickname}, '%') + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/oa/param/OaAppFieldParam.java b/src/main/java/com/gxwebsoft/oa/param/OaAppFieldParam.java new file mode 100644 index 0000000..17eb253 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaAppFieldParam.java @@ -0,0 +1,51 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 应用参数查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaAppFieldParam对象", description = "应用参数查询参数") +public class OaAppFieldParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "应用ID") + @QueryField(type = QueryType.EQ) + private Integer appId; + + @Schema(description = "名称") + private String name; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "状态, 0正常, 1删除") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaAppParam.java b/src/main/java/com/gxwebsoft/oa/param/OaAppParam.java new file mode 100644 index 0000000..589b255 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaAppParam.java @@ -0,0 +1,250 @@ +package com.gxwebsoft.oa.param; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.util.Set; + +/** + * 应用查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaAppParam对象", description = "应用查询参数") +public class OaAppParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "应用ID") + @QueryField(type = QueryType.EQ) + private Integer appId; + + @Schema(description = "应用名称") + private String appName; + + @Schema(description = "应用标识") + private String appCode; + + @Schema(description = "应用秘钥") + private String appSecret; + + @Schema(description = "上级id, 0是顶级") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "应用类型") + private String appType; + + @Schema(description = "应用类型") + private String appTypeMultiple; + + @Schema(description = "类型, 0菜单, 1按钮") + @QueryField(type = QueryType.EQ) + private Integer menuType; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "企业名称") + private String companyName; + + @Schema(description = "应用图标") + private String appIcon; + + @Schema(description = "二维码") + private String appQrcode; + + @Schema(description = "链接地址") + private String appUrl; + + @Schema(description = "后台管理地址") + private String adminUrl; + + @Schema(description = "下载地址") + private String downUrl; + + @Schema(description = "链接地址") + private String serverUrl; + + @Schema(description = "文件服务器") + private String fileUrl; + + @Schema(description = "回调地址") + private String callbackUrl; + + @Schema(description = "腾讯文档地址") + private String docsUrl; + + @Schema(description = "代码仓库地址") + private String gitUrl; + + @Schema(description = "原型图地址") + private String prototypeUrl; + + @Schema(description = "IP白名单") + private String ipAddress; + + @Schema(description = "应用截图") + private String images; + + @Schema(description = "应用包名") + private String packageName; + + @Schema(description = "下载次数") + @QueryField(type = QueryType.EQ) + private Integer clicks; + + @Schema(description = "安装次数") + @QueryField(type = QueryType.EQ) + private Integer installs; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "应用介绍") + private String content; + + @Schema(description = "项目需求") + private String requirement; + + @Schema(description = "开发者(个人或公司)") + private String developer; + + @Schema(description = "项目负责人") + private String director; + + @Schema(description = "项目经理") + private String projectDirector; + + @Schema(description = "业务员") + private String salesman; + + @Schema(description = "软件定价") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "划线价格") + @QueryField(type = QueryType.EQ) + private BigDecimal linePrice; + + @Schema(description = "评分") + private String score; + + @Schema(description = "星级") + private String star; + + @Schema(description = "菜单路由地址") + private String path; + + @Schema(description = "菜单组件地址, 目录可为空") + private String component; + + @Schema(description = "权限标识") + private String authority; + + @Schema(description = "打开位置") + private String target; + + @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") + @QueryField(type = QueryType.EQ) + private Integer hide; + + @Schema(description = "禁止搜索,1禁止 0 允许") + @QueryField(type = QueryType.EQ) + private Integer search; + + @Schema(description = "菜单侧栏选中的path") + private String active; + + @Schema(description = "其它路由元信息") + private String meta; + + @Schema(description = "版本,0正式版 1体验版 2开发版") + private String edition; + + @Schema(description = "版本号") + private String version; + + @Schema(description = "是否已安装") + @QueryField(type = QueryType.EQ) + private Integer isUse; + + @Schema(description = "附近1") + private String file1; + + @Schema(description = "附件2") + private String file2; + + @Schema(description = "附件3") + private String file3; + + @Schema(description = "是否显示续费提醒") + @QueryField(type = QueryType.EQ) + private Boolean showExpiration; + + @Schema(description = "是否作为案例展示") + @QueryField(type = QueryType.EQ) + private Boolean showCase; + + @Schema(description = "是否显示在首页") + @QueryField(type = QueryType.EQ) + private Integer showIndex; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "到期时间") + private String expirationTime; + + @Schema(description = "续费金额") + @QueryField(type = QueryType.EQ) + private BigDecimal renewMoney; + + @Schema(description = "应用状态") + private String appStatus; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "机构id") + @QueryField(type = QueryType.EQ) + private Integer organizationId; + + @Schema(description = "租户编号") + private String tenantCode; + + @Schema(description = "按APPID集搜索") + @TableField(exist = false) + private Set appIds; + + @Schema(description = "访问令牌") + @TableField(exist = false) + private String token; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaAppRenewParam.java b/src/main/java/com/gxwebsoft/oa/param/OaAppRenewParam.java new file mode 100644 index 0000000..7a2d2b0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaAppRenewParam.java @@ -0,0 +1,66 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 续费管理查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaAppRenewParam对象", description = "续费管理查询参数") +public class OaAppRenewParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer appRenewId; + + @Schema(description = "应用ID") + @QueryField(type = QueryType.EQ) + private Integer appId; + + @Schema(description = "续费金额") + @QueryField(type = QueryType.EQ) + private BigDecimal money; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "开始时间") + private String startTime; + + @Schema(description = "到期时间") + private String endTime; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "付款凭证") + private String images; + + @Schema(description = "用户姓名") + private String nickname; + + @Schema(description = "状态, 0正常, 1待确认") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaAppUrlParam.java b/src/main/java/com/gxwebsoft/oa/param/OaAppUrlParam.java new file mode 100644 index 0000000..1fd4639 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaAppUrlParam.java @@ -0,0 +1,56 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 项目域名查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaAppUrlParam对象", description = "项目域名查询参数") +public class OaAppUrlParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer appUrlId; + + @Schema(description = "应用ID") + @QueryField(type = QueryType.EQ) + private Integer appId; + + @Schema(description = "域名类型") + private String name; + + @Schema(description = "域名") + private String domain; + + @Schema(description = "账号") + private String account; + + @Schema(description = "密码") + private String password; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1待确认") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaAppUserParam.java b/src/main/java/com/gxwebsoft/oa/param/OaAppUserParam.java new file mode 100644 index 0000000..c4ee26d --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaAppUserParam.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 应用成员查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaAppUserParam对象", description = "应用成员查询参数") +public class OaAppUserParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer appUserId; + + @Schema(description = "角色,10体验成员 20开发者成员 30管理员 ") + @QueryField(type = QueryType.EQ) + private Integer role; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "应用ID") + @QueryField(type = QueryType.EQ) + private Integer appId; + + @Schema(description = "昵称") + private String nickname; + + @Schema(description = "状态, 0正常, 1待确认") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaAssetsCodeParam.java b/src/main/java/com/gxwebsoft/oa/param/OaAssetsCodeParam.java new file mode 100644 index 0000000..2723b78 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaAssetsCodeParam.java @@ -0,0 +1,72 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 代码仓库查询参数 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:01 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaAssetsCodeParam对象", description = "代码仓库查询参数") +public class OaAssetsCodeParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "服务器ID") + @QueryField(type = QueryType.EQ) + private Integer assetsId; + + @Schema(description = "名称") + private String name; + + @Schema(description = "英文标识") + private String code; + + @Schema(description = "仓库地址") + private String gitUrl; + + @Schema(description = "仓库品牌") + private String brand; + + @Schema(description = "置顶状态") + private String isTop; + + @Schema(description = "详情内容") + private String content; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "状态, 0正常, 1冻结") + private String status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaAssetsDomainParam.java b/src/main/java/com/gxwebsoft/oa/param/OaAssetsDomainParam.java new file mode 100644 index 0000000..a33902c --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaAssetsDomainParam.java @@ -0,0 +1,84 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 域名查询参数 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:01 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaAssetsDomainParam对象", description = "域名查询参数") +public class OaAssetsDomainParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer domainId; + + @Schema(description = "服务器ID") + @QueryField(type = QueryType.EQ) + private Integer assetsId; + + @Schema(description = "域名") + private String name; + + @Schema(description = "域名标识") + private String code; + + @Schema(description = "注册厂商") + private String brand; + + @Schema(description = "初始账号") + private String account; + + @Schema(description = "初始密码") + private String password; + + @Schema(description = "价格") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "购买时间") + private String startTime; + + @Schema(description = "到期时间") + private String endTime; + + @Schema(description = "置顶状态") + private String isTop; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "状态, 0正常, 1冻结") + private String status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaAssetsEmailParam.java b/src/main/java/com/gxwebsoft/oa/param/OaAssetsEmailParam.java new file mode 100644 index 0000000..2477a23 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaAssetsEmailParam.java @@ -0,0 +1,83 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 企业邮箱记录表查询参数 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaAssetsEmailParam对象", description = "企业邮箱记录表查询参数") +public class OaAssetsEmailParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer emailId; + + @Schema(description = "邮箱名称") + private String name; + + @Schema(description = "域名标识") + private String code; + + @Schema(description = "邮箱型号") + private String type; + + @Schema(description = "品牌厂商") + private String brand; + + @Schema(description = "初始账号") + private String system; + + @Schema(description = "价格") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "详情内容") + private String content; + + @Schema(description = "购买时间") + private String startTime; + + @Schema(description = "到期时间") + private String endTime; + + @Schema(description = "置顶状态") + private String isTop; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "状态, 0正常, 1冻结") + private String status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaAssetsMysqlParam.java b/src/main/java/com/gxwebsoft/oa/param/OaAssetsMysqlParam.java new file mode 100644 index 0000000..ccbc789 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaAssetsMysqlParam.java @@ -0,0 +1,90 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 云数据库查询参数 + * + * @author 科技小王子 + * @since 2024-10-18 19:00:20 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaAssetsMysqlParam对象", description = "云数据库查询参数") +public class OaAssetsMysqlParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer mysqlId; + + @Schema(description = "服务器ID") + @QueryField(type = QueryType.EQ) + private Integer assetsId; + + @Schema(description = "数据库名") + private String name; + + @Schema(description = "数据库标识") + private String code; + + @Schema(description = "注册厂商") + private String brand; + + @Schema(description = "ip地址") + private String ip; + + @Schema(description = "端口") + private String port; + + @Schema(description = "初始账号") + private String account; + + @Schema(description = "初始密码") + private String password; + + @Schema(description = "价格") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "购买时间") + private String startTime; + + @Schema(description = "到期时间") + private String endTime; + + @Schema(description = "置顶状态") + private String isTop; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "状态, 0正常, 1冻结") + private String status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaAssetsParam.java b/src/main/java/com/gxwebsoft/oa/param/OaAssetsParam.java new file mode 100644 index 0000000..66456d1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaAssetsParam.java @@ -0,0 +1,145 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 云服务器查询参数 + * + * @author 科技小王子 + * @since 2024-10-18 18:34:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaAssetsParam对象", description = "云服务器查询参数") +public class OaAssetsParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "资产ID") + @QueryField(type = QueryType.EQ) + private Integer assetsId; + + @Schema(description = "资产名称") + private String name; + + @Schema(description = "资产标识") + private String code; + + @Schema(description = "资产类型") + private String type; + + @Schema(description = "服务器厂商") + private String brand; + + @Schema(description = "服务器配置") + private String configuration; + + @Schema(description = "初始账号") + private String account; + + @Schema(description = "初始密码") + private String password; + + @Schema(description = "(阿里云/腾讯云)登录账号") + private String brandAccount; + + @Schema(description = "(阿里云/腾讯云)登录密码") + private String brandPassword; + + @Schema(description = "宝塔面板") + private String panel; + + @Schema(description = "宝塔面板账号") + private String panelAccount; + + @Schema(description = "宝塔面板密码") + private String panelPassword; + + @Schema(description = "财务信息-合同金额") + @QueryField(type = QueryType.EQ) + private BigDecimal financeAmount; + + @Schema(description = "购买年限") + @QueryField(type = QueryType.EQ) + private Integer financeYears; + + @Schema(description = "续费金额") + @QueryField(type = QueryType.EQ) + private BigDecimal financeRenew; + + @Schema(description = "客户名称") + private String financeCustomerName; + + @Schema(description = "客户联系人") + private String financeCustomerContact; + + @Schema(description = "客户联系电话") + private String financeCustomerPhone; + + @Schema(description = "客户ID") + @QueryField(type = QueryType.EQ) + private Integer customerId; + + @Schema(description = "客户名称") + private String customerName; + + @Schema(description = "开放端口") + private String openPort; + + @Schema(description = "详情内容") + private String content; + + @Schema(description = "购买时间") + private String startTime; + + @Schema(description = "到期时间") + private String endTime; + + @Schema(description = "置顶状态") + private String isTop; + + @Schema(description = "可见性(public,private,protected)") + private String visibility; + + @Schema(description = "宝塔接口秘钥") + private String btSign; + + @Schema(description = "文章排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "客户ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "机构id") + @QueryField(type = QueryType.EQ) + private Integer organizationId; + + @Schema(description = "状态, 0正常, 1冻结") + private String status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaAssetsServerParam.java b/src/main/java/com/gxwebsoft/oa/param/OaAssetsServerParam.java new file mode 100644 index 0000000..47316f4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaAssetsServerParam.java @@ -0,0 +1,61 @@ +package com.gxwebsoft.oa.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 服务查询参数 + * + * @author 科技小王子 + * @since 2024-10-21 19:15:26 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaAssetsServerParam对象", description = "服务查询参数") +public class OaAssetsServerParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "插件id") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "服务名称") + private String server; + + @Schema(description = "接口地址") + private String serverUrl; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "服务器ID") + @QueryField(type = QueryType.EQ) + private Integer assetsId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 10待审核 20已通过 30已驳回") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaAssetsSiteParam.java b/src/main/java/com/gxwebsoft/oa/param/OaAssetsSiteParam.java new file mode 100644 index 0000000..2b28bea --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaAssetsSiteParam.java @@ -0,0 +1,155 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 网站信息记录表查询参数 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaAssetsSiteParam对象", description = "网站信息记录表查询参数") +public class OaAssetsSiteParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "站点ID") + @QueryField(type = QueryType.EQ) + private Integer websiteId; + + @Schema(description = "网站名称") + private String websiteName; + + @Schema(description = "网站标识") + private String websiteCode; + + @Schema(description = "网站LOGO") + private String websiteIcon; + + @Schema(description = "网站LOGO") + private String websiteLogo; + + @Schema(description = "网站LOGO(深色模式)") + private String websiteDarkLogo; + + @Schema(description = "网站类型") + private String websiteType; + + @Schema(description = "网站关键词") + private String keywords; + + @Schema(description = "域名前缀") + private String prefix; + + @Schema(description = "绑定域名") + private String domain; + + @Schema(description = "全局样式") + private String style; + + @Schema(description = "后台管理地址") + private String adminUrl; + + @Schema(description = "应用版本 10免费版 20授权版 30永久授权") + @QueryField(type = QueryType.EQ) + private Integer version; + + @Schema(description = "服务到期时间") + private String expirationTime; + + @Schema(description = "模版ID") + @QueryField(type = QueryType.EQ) + private Integer templateId; + + @Schema(description = "行业类型(父级)") + private String industryParent; + + @Schema(description = "行业类型(子级)") + private String industryChild; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "联系电话") + private String phone; + + @Schema(description = "电子邮箱") + private String email; + + @Schema(description = "ICP备案号") + private String icpNo; + + @Schema(description = "公安备案") + private String policeNo; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "状态 0未开通 1运行中 2维护中 3已关闭 4已欠费停机 5违规关停") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "维护说明") + private String statusText; + + @Schema(description = "关闭说明") + private String statusClose; + + @Schema(description = "全局样式") + private String styles; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "服务器ID") + @QueryField(type = QueryType.EQ) + private Integer assetsId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaAssetsSoftwareCertParam.java b/src/main/java/com/gxwebsoft/oa/param/OaAssetsSoftwareCertParam.java new file mode 100644 index 0000000..22c7937 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaAssetsSoftwareCertParam.java @@ -0,0 +1,83 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 计算机软件著作权登记查询参数 + * + * @author 科技小王子 + * @since 2024-10-18 19:46:21 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaAssetsSoftwareCertParam对象", description = "计算机软件著作权登记查询参数") +public class OaAssetsSoftwareCertParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "名称") + private String name; + + @Schema(description = "软件著作权标识") + private String code; + + @Schema(description = "证书类型") + private String type; + + @Schema(description = "品牌厂商") + private String brand; + + @Schema(description = "价格") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "详情内容") + private String content; + + @Schema(description = "证书下载地址") + private String certUrl; + + @Schema(description = "购买时间") + private String startTime; + + @Schema(description = "到期时间") + private String endTime; + + @Schema(description = "置顶状态") + private String isTop; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "状态, 0正常, 1冻结") + private String status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaAssetsSslParam.java b/src/main/java/com/gxwebsoft/oa/param/OaAssetsSslParam.java new file mode 100644 index 0000000..a11a568 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaAssetsSslParam.java @@ -0,0 +1,92 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * ssl证书查询参数 + * + * @author 科技小王子 + * @since 2024-10-18 19:25:40 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaAssetsSslParam对象", description = "ssl证书查询参数") +public class OaAssetsSslParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer sslId; + + @Schema(description = "证书名称") + private String name; + + @Schema(description = "证书标识") + private String code; + + @Schema(description = "证书类型") + private String type; + + @Schema(description = "品牌厂商") + private String brand; + + @Schema(description = "价格") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "详情内容") + private String content; + + @Schema(description = "证书key") + private String certKey; + + @Schema(description = "证书pem") + private String certPem; + + @Schema(description = "证书下载地址") + private String certUrl; + + @Schema(description = "证书crt") + private String certCrt; + + @Schema(description = "购买时间") + private String startTime; + + @Schema(description = "到期时间") + private String endTime; + + @Schema(description = "置顶状态") + private String isTop; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaAssetsTrademarkParam.java b/src/main/java/com/gxwebsoft/oa/param/OaAssetsTrademarkParam.java new file mode 100644 index 0000000..fa3b93a --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaAssetsTrademarkParam.java @@ -0,0 +1,83 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 商标注册查询参数 + * + * @author 科技小王子 + * @since 2024-10-18 19:46:21 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaAssetsTrademarkParam对象", description = "商标注册查询参数") +public class OaAssetsTrademarkParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "商标名称") + private String name; + + @Schema(description = "商标标识") + private String code; + + @Schema(description = "商标类型") + private String type; + + @Schema(description = "品牌厂商") + private String brand; + + @Schema(description = "价格") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "详情内容") + private String content; + + @Schema(description = "证书下载") + private String certUrl; + + @Schema(description = "购买时间") + private String startTime; + + @Schema(description = "到期时间") + private String endTime; + + @Schema(description = "置顶状态") + private String isTop; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "状态, 0正常, 1冻结") + private String status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaAssetsUserParam.java b/src/main/java/com/gxwebsoft/oa/param/OaAssetsUserParam.java new file mode 100644 index 0000000..26b3ec7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaAssetsUserParam.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 服务器成员管理查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaAssetsUserParam对象", description = "服务器成员管理查询参数") +public class OaAssetsUserParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "角色,10体验成员 20开发者成员 30管理员 ") + @QueryField(type = QueryType.EQ) + private Integer role; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "应用ID") + @QueryField(type = QueryType.EQ) + private Integer assetsId; + + @Schema(description = "昵称") + private String nickname; + + @Schema(description = "状态, 0正常, 1待确认") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaAssetsVhostParam.java b/src/main/java/com/gxwebsoft/oa/param/OaAssetsVhostParam.java new file mode 100644 index 0000000..2e90dbf --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaAssetsVhostParam.java @@ -0,0 +1,93 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 虚拟主机记录表查询参数 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaAssetsVhostParam对象", description = "虚拟主机记录表查询参数") +public class OaAssetsVhostParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer vhostId; + + @Schema(description = "域名") + private String name; + + @Schema(description = "域名标识") + private String code; + + @Schema(description = "主机型号") + private String type; + + @Schema(description = "品牌厂商") + private String brand; + + @Schema(description = "初始账号") + private String account; + + @Schema(description = "初始密码") + private String password; + + @Schema(description = "价格") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "详情内容") + private String content; + + @Schema(description = "ssl证书") + private String ssl; + + @Schema(description = "购买时间") + private String startTime; + + @Schema(description = "到期时间") + private String endTime; + + @Schema(description = "置顶状态") + private String isTop; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "服务器ID") + @QueryField(type = QueryType.EQ) + private Integer assetsId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "可见用户") + private String userIds; + + @Schema(description = "状态, 0正常, 1冻结") + private String status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaCompanyFieldParam.java b/src/main/java/com/gxwebsoft/oa/param/OaCompanyFieldParam.java new file mode 100644 index 0000000..c81f21b --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaCompanyFieldParam.java @@ -0,0 +1,51 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 企业参数查询参数 + * + * @author 科技小王子 + * @since 2024-09-20 12:33:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaCompanyFieldParam对象", description = "企业参数查询参数") +public class OaCompanyFieldParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "名称") + private String name; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "状态, 0正常, 1删除") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaCompanyParam.java b/src/main/java/com/gxwebsoft/oa/param/OaCompanyParam.java new file mode 100644 index 0000000..c63b531 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaCompanyParam.java @@ -0,0 +1,186 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 企业信息查询参数 + * + * @author 科技小王子 + * @since 2024-09-20 12:33:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaCompanyParam对象", description = "企业信息查询参数") +public class OaCompanyParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "企业id") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "企业简称") + private String shortName; + + @Schema(description = "企业全称") + private String companyName; + + @Schema(description = "企业标识") + private String companyCode; + + @Schema(description = "类型 10企业 20政府单位") + private String companyType; + + @Schema(description = "企业类型多选") + private String companyTypeMultiple; + + @Schema(description = "应用标识") + private String companyLogo; + + @Schema(description = "应用类型") + private String appType; + + @Schema(description = "绑定域名") + private String domain; + + @Schema(description = "联系电话") + private String phone; + + @Schema(description = "座机电话") + private String tel; + + @Schema(description = "邮箱") + private String email; + + @Schema(description = "发票抬头") + private String invoiceHeader; + + @Schema(description = "企业法人") + private String businessEntity; + + @Schema(description = "服务开始时间") + private String startTime; + + @Schema(description = "服务到期时间") + private String expirationTime; + + @Schema(description = "应用版本 10体验版 20授权版 30旗舰版") + @QueryField(type = QueryType.EQ) + private Integer version; + + @Schema(description = "成员数量(人数上限)") + @QueryField(type = QueryType.EQ) + private Integer members; + + @Schema(description = "成员数量(当前)") + @QueryField(type = QueryType.EQ) + private Integer users; + + @Schema(description = "行业类型(父级)") + private String industryParent; + + @Schema(description = "行业类型(子级)") + private String industryChild; + + @Schema(description = "部门数量") + @QueryField(type = QueryType.EQ) + private Integer departments; + + @Schema(description = "存储空间") + private Long storage; + + @Schema(description = "存储空间(上限)") + private Long storageMax; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否实名认证") + @QueryField(type = QueryType.EQ) + private Integer authentication; + + @Schema(description = "企业默认主体") + @QueryField(type = QueryType.EQ) + private Integer authoritative; + + @Schema(description = "request合法域名") + private String requestUrl; + + @Schema(description = "socket合法域名") + private String socketUrl; + + @Schema(description = "主控端域名") + private String serverUrl; + + @Schema(description = "业务域名") + private String modulesUrl; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "点赞数量") + @QueryField(type = QueryType.EQ) + private Integer likes; + + @Schema(description = "点击数量") + @QueryField(type = QueryType.EQ) + private Integer clicks; + + @Schema(description = "购买数量") + @QueryField(type = QueryType.EQ) + private Integer buys; + + @Schema(description = "是否含税, 0不含, 1含") + @QueryField(type = QueryType.EQ) + private Integer isTax; + + @Schema(description = "当前克隆的租户ID") + @QueryField(type = QueryType.EQ) + private Integer planId; + + @Schema(description = "状态") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaCompanyUserParam.java b/src/main/java/com/gxwebsoft/oa/param/OaCompanyUserParam.java new file mode 100644 index 0000000..bcba114 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaCompanyUserParam.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 成员管理查询参数 + * + * @author 科技小王子 + * @since 2024-09-20 12:33:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaCompanyUserParam对象", description = "成员管理查询参数") +public class OaCompanyUserParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer companyUserId; + + @Schema(description = "角色,10体验成员 20开发者成员 30管理员 ") + @QueryField(type = QueryType.EQ) + private Integer role; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "昵称") + private String nickname; + + @Schema(description = "状态, 0正常, 1待确认") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaLinkParam.java b/src/main/java/com/gxwebsoft/oa/param/OaLinkParam.java new file mode 100644 index 0000000..08a965b --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaLinkParam.java @@ -0,0 +1,72 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 常用链接查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaLinkParam对象", description = "常用链接查询参数") +public class OaLinkParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "链接名称") + private String name; + + @Schema(description = "图标") + private String icon; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "链接分类") + private String linkType; + + @Schema(description = "应用ID") + @QueryField(type = QueryType.EQ) + private Integer appId; + + @Schema(description = "所属栏目") + @QueryField(type = QueryType.EQ) + private Integer categoryId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "状态, 0正常, 1待确认") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaProductParam.java b/src/main/java/com/gxwebsoft/oa/param/OaProductParam.java new file mode 100644 index 0000000..f200fe1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaProductParam.java @@ -0,0 +1,103 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 产品记录表查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaProductParam对象", description = "产品记录表查询参数") +public class OaProductParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "产品ID") + @QueryField(type = QueryType.EQ) + private Integer productId; + + @Schema(description = "产品名称") + private String name; + + @Schema(description = "产品标识") + private String code; + + @Schema(description = "产品详情") + private String content; + + @Schema(description = "产品类型") + private String type; + + @Schema(description = "产品图标") + private String logo; + + @Schema(description = "产品金额") + @QueryField(type = QueryType.EQ) + private BigDecimal money; + + @Schema(description = "初始销量") + @QueryField(type = QueryType.EQ) + private Integer salesInitial; + + @Schema(description = "实际销量") + @QueryField(type = QueryType.EQ) + private Integer salesActual; + + @Schema(description = "库存总量(包含所有sku)") + @QueryField(type = QueryType.EQ) + private Integer stockTotal; + + @Schema(description = "背景颜色") + private String backgroundColor; + + @Schema(description = "背景图片") + private String backgroundImage; + + @Schema(description = "背景图片(gif)") + private String backgroundGif; + + @Schema(description = "购买链接") + private String buyUrl; + + @Schema(description = "控制台链接") + private String adminUrl; + + @Schema(description = "附件") + private String files; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0已上架, 1已下架") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaProductTabsParam.java b/src/main/java/com/gxwebsoft/oa/param/OaProductTabsParam.java new file mode 100644 index 0000000..bf42fa9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaProductTabsParam.java @@ -0,0 +1,74 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 产品标签记录表查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaProductTabsParam对象", description = "产品标签记录表查询参数") +public class OaProductTabsParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "产品标签ID") + @QueryField(type = QueryType.EQ) + private Integer tabId; + + @Schema(description = "产品ID") + @QueryField(type = QueryType.EQ) + private Integer productId; + + @Schema(description = "标签名称") + private String name; + + @Schema(description = "标签类型") + private String type; + + @Schema(description = "产品标签详情") + private String content; + + @Schema(description = "背景颜色") + private String backgroundColor; + + @Schema(description = "背景图片") + private String backgroundImage; + + @Schema(description = "附件") + private String files; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0已上架, 1已下架") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaTaskCountParam.java b/src/main/java/com/gxwebsoft/oa/param/OaTaskCountParam.java new file mode 100644 index 0000000..d60bcb4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaTaskCountParam.java @@ -0,0 +1,72 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 数据统计查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaTaskCountParam对象", description = "数据统计查询参数") +public class OaTaskCountParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer taskCountId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "待处理数") + @QueryField(type = QueryType.EQ) + private Integer pending; + + @Schema(description = "闲置的工单(废弃)") + @QueryField(type = QueryType.EQ) + private Integer unused; + + @Schema(description = "已完成数(废弃)") + @QueryField(type = QueryType.EQ) + private Integer completed; + + @Schema(description = "今天处理数") + @QueryField(type = QueryType.EQ) + private Integer today; + + @Schema(description = "本月处理数") + @QueryField(type = QueryType.EQ) + private Integer month; + + @Schema(description = "今年处理数") + @QueryField(type = QueryType.EQ) + private Integer year; + + @Schema(description = "总工单数") + @QueryField(type = QueryType.EQ) + private Integer total; + + @Schema(description = "部门ID") + @QueryField(type = QueryType.EQ) + private Integer organizationId; + + @Schema(description = "角色ID") + @QueryField(type = QueryType.EQ) + private Integer roleId; + + @Schema(description = "角色标识") + private String roleCode; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaTaskParam.java b/src/main/java/com/gxwebsoft/oa/param/OaTaskParam.java new file mode 100644 index 0000000..85129f7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaTaskParam.java @@ -0,0 +1,139 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 任务记录表查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaTaskParam对象", description = "任务记录表查询参数") +public class OaTaskParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "工单ID") + @QueryField(type = QueryType.EQ) + private Integer taskId; + + @Schema(description = "工单类型") + private String taskType; + + @Schema(description = "任务内容") + private String name; + + @Schema(description = "问题描述") + private String content; + + @Schema(description = "工单附件") + private String files; + + @Schema(description = "工单发起人") + @QueryField(type = QueryType.EQ) + private Integer promoter; + + @Schema(description = "受理人") + @QueryField(type = QueryType.EQ) + private Integer commander; + + @Schema(description = "工单状态, 0未开始 1已指派 ") + @QueryField(type = QueryType.EQ) + private Integer progress; + + @Schema(description = "优先级") + private String priority; + + @Schema(description = "品质要求") + private String quality; + + @Schema(description = "时限(天)") + @QueryField(type = QueryType.EQ) + private Integer day; + + @Schema(description = "手机号") + private String phone; + + @Schema(description = "开始时间") + private String startTime; + + @Schema(description = "结束时间") + private String endTime; + + @Schema(description = "逾期天数") + @QueryField(type = QueryType.EQ) + private Integer overdueDays; + + @Schema(description = "项目ID") + @QueryField(type = QueryType.EQ) + private Integer appId; + + @Schema(description = "机构id") + @QueryField(type = QueryType.EQ) + private Integer organizationId; + + @Schema(description = "项目ID") + @QueryField(type = QueryType.EQ) + private Integer projectId; + + @Schema(description = "客户ID") + @QueryField(type = QueryType.EQ) + private Integer customerId; + + @Schema(description = "资产ID") + @QueryField(type = QueryType.EQ) + private Integer assetsId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "是否已查阅") + @QueryField(type = QueryType.EQ) + private Integer isRead; + + @Schema(description = "最后回复人") + @QueryField(type = QueryType.EQ) + private Integer lastReadUser; + + @Schema(description = "发起人昵称") + private String nickname; + + @Schema(description = "发起人头像") + private String avatar; + + @Schema(description = "最后回复人头像") + private String lastAvatar; + + @Schema(description = "最后回复人昵称") + private String lastNickname; + + @Schema(description = "订单是否已结算(0未结算 1已结算)") + @QueryField(type = QueryType.EQ) + private Integer isSettled; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0待处理, 1已完成") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaTaskRecordParam.java b/src/main/java/com/gxwebsoft/oa/param/OaTaskRecordParam.java new file mode 100644 index 0000000..8d5f275 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaTaskRecordParam.java @@ -0,0 +1,68 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 工单回复记录表查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaTaskRecordParam对象", description = "工单回复记录表查询参数") +public class OaTaskRecordParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "回复ID") + @QueryField(type = QueryType.EQ) + private Integer taskRecordId; + + @Schema(description = "上级id, 0是顶级") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "工单ID") + @QueryField(type = QueryType.EQ) + private Integer taskId; + + @Schema(description = "内容") + private String content; + + @Schema(description = "机密信息") + private String confidential; + + @Schema(description = "联系电话") + private String phone; + + @Schema(description = "工单附件") + private String files; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0待处理, 1已完成") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/oa/param/OaTaskUserParam.java b/src/main/java/com/gxwebsoft/oa/param/OaTaskUserParam.java new file mode 100644 index 0000000..3fdfbeb --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/param/OaTaskUserParam.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.oa.param; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 工单成员查询参数 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "OaTaskUserParam对象", description = "工单成员查询参数") +public class OaTaskUserParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer taskUserId; + + @Schema(description = "角色,10体验成员 20开发者成员 30管理员 ") + @QueryField(type = QueryType.EQ) + private Integer role; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "工单ID") + @QueryField(type = QueryType.EQ) + private Integer taskId; + + @Schema(description = "昵称") + private String nickname; + + @Schema(description = "状态, 0待处理, 1已完成") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaAppFieldService.java b/src/main/java/com/gxwebsoft/oa/service/OaAppFieldService.java new file mode 100644 index 0000000..94d905f --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaAppFieldService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaAppField; +import com.gxwebsoft.oa.param.OaAppFieldParam; + +import java.util.List; + +/** + * 应用参数Service + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +public interface OaAppFieldService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaAppFieldParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaAppFieldParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return OaAppField + */ + OaAppField getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaAppRenewService.java b/src/main/java/com/gxwebsoft/oa/service/OaAppRenewService.java new file mode 100644 index 0000000..c41f20f --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaAppRenewService.java @@ -0,0 +1,53 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaAppRenew; +import com.gxwebsoft.oa.param.OaAppRenewParam; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 续费管理Service + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +public interface OaAppRenewService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaAppRenewParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaAppRenewParam param); + + /** + * 根据id查询 + * + * @param appRenewId 自增ID + * @return OaAppRenew + */ + OaAppRenew getByIdRel(Integer appRenewId); + + /** + * 统计金额总和 + * @param wrapper 查询条件 + * @return 金额总和 + */ + BigDecimal sumMoney(LambdaQueryWrapper wrapper); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaAppService.java b/src/main/java/com/gxwebsoft/oa/service/OaAppService.java new file mode 100644 index 0000000..e9c76b2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaAppService.java @@ -0,0 +1,51 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaApp; +import com.gxwebsoft.oa.param.OaAppParam; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 应用Service + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +public interface OaAppService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaAppParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaAppParam param); + + /** + * 根据id查询 + * + * @param appId 应用ID + * @return OaApp + */ + OaApp getByIdRel(Integer appId); + + /** + * 统计金额总和 + * + * @param wrapper 查询条件 + * @return 金额总和 + */ + BigDecimal sumMoney(LambdaQueryWrapper wrapper); +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaAppUrlService.java b/src/main/java/com/gxwebsoft/oa/service/OaAppUrlService.java new file mode 100644 index 0000000..eef2650 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaAppUrlService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaAppUrl; +import com.gxwebsoft.oa.param.OaAppUrlParam; + +import java.util.List; + +/** + * 项目域名Service + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +public interface OaAppUrlService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaAppUrlParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaAppUrlParam param); + + /** + * 根据id查询 + * + * @param appUrlId 自增ID + * @return OaAppUrl + */ + OaAppUrl getByIdRel(Integer appUrlId); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaAppUserService.java b/src/main/java/com/gxwebsoft/oa/service/OaAppUserService.java new file mode 100644 index 0000000..1dd7f82 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaAppUserService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaAppUser; +import com.gxwebsoft.oa.param.OaAppUserParam; + +import java.util.List; + +/** + * 应用成员Service + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +public interface OaAppUserService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaAppUserParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaAppUserParam param); + + /** + * 根据id查询 + * + * @param appUserId 自增ID + * @return OaAppUser + */ + OaAppUser getByIdRel(Integer appUserId); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaAssetsCodeService.java b/src/main/java/com/gxwebsoft/oa/service/OaAssetsCodeService.java new file mode 100644 index 0000000..681ef81 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaAssetsCodeService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaAssetsCode; +import com.gxwebsoft.oa.param.OaAssetsCodeParam; + +import java.util.List; + +/** + * 代码仓库Service + * + * @author 科技小王子 + * @since 2024-10-18 18:27:01 + */ +public interface OaAssetsCodeService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaAssetsCodeParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaAssetsCodeParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return OaAssetsCode + */ + OaAssetsCode getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaAssetsDomainService.java b/src/main/java/com/gxwebsoft/oa/service/OaAssetsDomainService.java new file mode 100644 index 0000000..735df28 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaAssetsDomainService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaAssetsDomain; +import com.gxwebsoft.oa.param.OaAssetsDomainParam; + +import java.util.List; + +/** + * 域名Service + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +public interface OaAssetsDomainService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaAssetsDomainParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaAssetsDomainParam param); + + /** + * 根据id查询 + * + * @param domainId ID + * @return OaAssetsDomain + */ + OaAssetsDomain getByIdRel(Integer domainId); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaAssetsEmailService.java b/src/main/java/com/gxwebsoft/oa/service/OaAssetsEmailService.java new file mode 100644 index 0000000..84c1ab7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaAssetsEmailService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaAssetsEmail; +import com.gxwebsoft.oa.param.OaAssetsEmailParam; + +import java.util.List; + +/** + * 企业邮箱记录表Service + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +public interface OaAssetsEmailService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaAssetsEmailParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaAssetsEmailParam param); + + /** + * 根据id查询 + * + * @param emailId ID + * @return OaAssetsEmail + */ + OaAssetsEmail getByIdRel(Integer emailId); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaAssetsMysqlService.java b/src/main/java/com/gxwebsoft/oa/service/OaAssetsMysqlService.java new file mode 100644 index 0000000..7263afd --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaAssetsMysqlService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaAssetsMysql; +import com.gxwebsoft.oa.param.OaAssetsMysqlParam; + +import java.util.List; + +/** + * 云数据库Service + * + * @author 科技小王子 + * @since 2024-10-18 19:00:20 + */ +public interface OaAssetsMysqlService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaAssetsMysqlParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaAssetsMysqlParam param); + + /** + * 根据id查询 + * + * @param mysqlId ID + * @return OaAssetsMysql + */ + OaAssetsMysql getByIdRel(Integer mysqlId); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaAssetsServerService.java b/src/main/java/com/gxwebsoft/oa/service/OaAssetsServerService.java new file mode 100644 index 0000000..8e1c558 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaAssetsServerService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaAssetsServer; +import com.gxwebsoft.oa.param.OaAssetsServerParam; + +import java.util.List; + +/** + * 服务Service + * + * @author 科技小王子 + * @since 2024-10-21 19:15:26 + */ +public interface OaAssetsServerService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaAssetsServerParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaAssetsServerParam param); + + /** + * 根据id查询 + * + * @param id 插件id + * @return OaAssetsServer + */ + OaAssetsServer getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaAssetsService.java b/src/main/java/com/gxwebsoft/oa/service/OaAssetsService.java new file mode 100644 index 0000000..4142d5f --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaAssetsService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaAssets; +import com.gxwebsoft.oa.param.OaAssetsParam; + +import java.util.List; + +/** + * 云服务器Service + * + * @author 科技小王子 + * @since 2024-10-18 18:34:15 + */ +public interface OaAssetsService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaAssetsParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaAssetsParam param); + + /** + * 根据id查询 + * + * @param assetsId 资产ID + * @return OaAssets + */ + OaAssets getByIdRel(Integer assetsId); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaAssetsSiteService.java b/src/main/java/com/gxwebsoft/oa/service/OaAssetsSiteService.java new file mode 100644 index 0000000..c8ec714 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaAssetsSiteService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaAssetsSite; +import com.gxwebsoft.oa.param.OaAssetsSiteParam; + +import java.util.List; + +/** + * 网站信息记录表Service + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +public interface OaAssetsSiteService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaAssetsSiteParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaAssetsSiteParam param); + + /** + * 根据id查询 + * + * @param websiteId 站点ID + * @return OaAssetsSite + */ + OaAssetsSite getByIdRel(Integer websiteId); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaAssetsSoftwareCertService.java b/src/main/java/com/gxwebsoft/oa/service/OaAssetsSoftwareCertService.java new file mode 100644 index 0000000..039f97d --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaAssetsSoftwareCertService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaAssetsSoftwareCert; +import com.gxwebsoft.oa.param.OaAssetsSoftwareCertParam; + +import java.util.List; + +/** + * 计算机软件著作权登记Service + * + * @author 科技小王子 + * @since 2024-10-18 19:46:21 + */ +public interface OaAssetsSoftwareCertService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaAssetsSoftwareCertParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaAssetsSoftwareCertParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return OaAssetsSoftwareCert + */ + OaAssetsSoftwareCert getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaAssetsSslService.java b/src/main/java/com/gxwebsoft/oa/service/OaAssetsSslService.java new file mode 100644 index 0000000..3d150e7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaAssetsSslService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaAssetsSsl; +import com.gxwebsoft.oa.param.OaAssetsSslParam; + +import java.util.List; + +/** + * ssl证书Service + * + * @author 科技小王子 + * @since 2024-10-18 19:25:40 + */ +public interface OaAssetsSslService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaAssetsSslParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaAssetsSslParam param); + + /** + * 根据id查询 + * + * @param sslId ID + * @return OaAssetsSsl + */ + OaAssetsSsl getByIdRel(Integer sslId); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaAssetsTrademarkService.java b/src/main/java/com/gxwebsoft/oa/service/OaAssetsTrademarkService.java new file mode 100644 index 0000000..838ed04 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaAssetsTrademarkService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaAssetsTrademark; +import com.gxwebsoft.oa.param.OaAssetsTrademarkParam; + +import java.util.List; + +/** + * 商标注册Service + * + * @author 科技小王子 + * @since 2024-10-18 19:46:21 + */ +public interface OaAssetsTrademarkService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaAssetsTrademarkParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaAssetsTrademarkParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return OaAssetsTrademark + */ + OaAssetsTrademark getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaAssetsUserService.java b/src/main/java/com/gxwebsoft/oa/service/OaAssetsUserService.java new file mode 100644 index 0000000..f976095 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaAssetsUserService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaAssetsUser; +import com.gxwebsoft.oa.param.OaAssetsUserParam; + +import java.util.List; + +/** + * 服务器成员管理Service + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +public interface OaAssetsUserService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaAssetsUserParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaAssetsUserParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return OaAssetsUser + */ + OaAssetsUser getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaAssetsVhostService.java b/src/main/java/com/gxwebsoft/oa/service/OaAssetsVhostService.java new file mode 100644 index 0000000..4b54c43 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaAssetsVhostService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaAssetsVhost; +import com.gxwebsoft.oa.param.OaAssetsVhostParam; + +import java.util.List; + +/** + * 虚拟主机记录表Service + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +public interface OaAssetsVhostService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaAssetsVhostParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaAssetsVhostParam param); + + /** + * 根据id查询 + * + * @param vhostId ID + * @return OaAssetsVhost + */ + OaAssetsVhost getByIdRel(Integer vhostId); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaCompanyFieldService.java b/src/main/java/com/gxwebsoft/oa/service/OaCompanyFieldService.java new file mode 100644 index 0000000..66ac876 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaCompanyFieldService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaCompanyField; +import com.gxwebsoft.oa.param.OaCompanyFieldParam; + +import java.util.List; + +/** + * 企业参数Service + * + * @author 科技小王子 + * @since 2024-09-20 12:33:12 + */ +public interface OaCompanyFieldService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaCompanyFieldParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaCompanyFieldParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return OaCompanyField + */ + OaCompanyField getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaCompanyService.java b/src/main/java/com/gxwebsoft/oa/service/OaCompanyService.java new file mode 100644 index 0000000..fb91784 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaCompanyService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaCompany; +import com.gxwebsoft.oa.param.OaCompanyParam; + +import java.util.List; + +/** + * 企业信息Service + * + * @author 科技小王子 + * @since 2024-09-20 12:33:12 + */ +public interface OaCompanyService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaCompanyParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaCompanyParam param); + + /** + * 根据id查询 + * + * @param companyId 企业id + * @return OaCompany + */ + OaCompany getByIdRel(Integer companyId); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaCompanyUserService.java b/src/main/java/com/gxwebsoft/oa/service/OaCompanyUserService.java new file mode 100644 index 0000000..ff2c147 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaCompanyUserService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaCompanyUser; +import com.gxwebsoft.oa.param.OaCompanyUserParam; + +import java.util.List; + +/** + * 成员管理Service + * + * @author 科技小王子 + * @since 2024-09-20 12:33:12 + */ +public interface OaCompanyUserService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaCompanyUserParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaCompanyUserParam param); + + /** + * 根据id查询 + * + * @param companyUserId 自增ID + * @return OaCompanyUser + */ + OaCompanyUser getByIdRel(Integer companyUserId); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaLinkService.java b/src/main/java/com/gxwebsoft/oa/service/OaLinkService.java new file mode 100644 index 0000000..6d8738f --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaLinkService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaLink; +import com.gxwebsoft.oa.param.OaLinkParam; + +import java.util.List; + +/** + * 常用链接Service + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +public interface OaLinkService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaLinkParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaLinkParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return OaLink + */ + OaLink getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaProductService.java b/src/main/java/com/gxwebsoft/oa/service/OaProductService.java new file mode 100644 index 0000000..305cbd2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaProductService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaProduct; +import com.gxwebsoft.oa.param.OaProductParam; + +import java.util.List; + +/** + * 产品记录表Service + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +public interface OaProductService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaProductParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaProductParam param); + + /** + * 根据id查询 + * + * @param productId 产品ID + * @return OaProduct + */ + OaProduct getByIdRel(Integer productId); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaProductTabsService.java b/src/main/java/com/gxwebsoft/oa/service/OaProductTabsService.java new file mode 100644 index 0000000..e1725ff --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaProductTabsService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaProductTabs; +import com.gxwebsoft.oa.param.OaProductTabsParam; + +import java.util.List; + +/** + * 产品标签记录表Service + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +public interface OaProductTabsService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaProductTabsParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaProductTabsParam param); + + /** + * 根据id查询 + * + * @param tabId 产品标签ID + * @return OaProductTabs + */ + OaProductTabs getByIdRel(Integer tabId); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaTaskCountService.java b/src/main/java/com/gxwebsoft/oa/service/OaTaskCountService.java new file mode 100644 index 0000000..903f7cc --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaTaskCountService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaTaskCount; +import com.gxwebsoft.oa.param.OaTaskCountParam; + +import java.util.List; + +/** + * 数据统计Service + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +public interface OaTaskCountService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaTaskCountParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaTaskCountParam param); + + /** + * 根据id查询 + * + * @param taskCountId 自增ID + * @return OaTaskCount + */ + OaTaskCount getByIdRel(Integer taskCountId); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaTaskRecordService.java b/src/main/java/com/gxwebsoft/oa/service/OaTaskRecordService.java new file mode 100644 index 0000000..8045be0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaTaskRecordService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaTaskRecord; +import com.gxwebsoft.oa.param.OaTaskRecordParam; + +import java.util.List; + +/** + * 工单回复记录表Service + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +public interface OaTaskRecordService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaTaskRecordParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaTaskRecordParam param); + + /** + * 根据id查询 + * + * @param taskRecordId 回复ID + * @return OaTaskRecord + */ + OaTaskRecord getByIdRel(Integer taskRecordId); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaTaskService.java b/src/main/java/com/gxwebsoft/oa/service/OaTaskService.java new file mode 100644 index 0000000..4f06f34 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaTaskService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaTask; +import com.gxwebsoft.oa.param.OaTaskParam; + +import java.util.List; + +/** + * 任务记录表Service + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +public interface OaTaskService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaTaskParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaTaskParam param); + + /** + * 根据id查询 + * + * @param taskId 工单ID + * @return OaTask + */ + OaTask getByIdRel(Integer taskId); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/OaTaskUserService.java b/src/main/java/com/gxwebsoft/oa/service/OaTaskUserService.java new file mode 100644 index 0000000..9c33890 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/OaTaskUserService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.oa.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaTaskUser; +import com.gxwebsoft.oa.param.OaTaskUserParam; + +import java.util.List; + +/** + * 工单成员Service + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +public interface OaTaskUserService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(OaTaskUserParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(OaTaskUserParam param); + + /** + * 根据id查询 + * + * @param taskUserId 自增ID + * @return OaTaskUser + */ + OaTaskUser getByIdRel(Integer taskUserId); + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaAppFieldServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaAppFieldServiceImpl.java new file mode 100644 index 0000000..d70ecf7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaAppFieldServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaAppFieldMapper; +import com.gxwebsoft.oa.service.OaAppFieldService; +import com.gxwebsoft.oa.entity.OaAppField; +import com.gxwebsoft.oa.param.OaAppFieldParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 应用参数Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Service +public class OaAppFieldServiceImpl extends ServiceImpl implements OaAppFieldService { + + @Override + public PageResult pageRel(OaAppFieldParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaAppFieldParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaAppField getByIdRel(Integer id) { + OaAppFieldParam param = new OaAppFieldParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaAppRenewServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaAppRenewServiceImpl.java new file mode 100644 index 0000000..682e7e2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaAppRenewServiceImpl.java @@ -0,0 +1,54 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaAppRenewMapper; +import com.gxwebsoft.oa.service.OaAppRenewService; +import com.gxwebsoft.oa.entity.OaAppRenew; +import com.gxwebsoft.oa.param.OaAppRenewParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 续费管理Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Service +public class OaAppRenewServiceImpl extends ServiceImpl implements OaAppRenewService { + + @Override + public PageResult pageRel(OaAppRenewParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaAppRenewParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaAppRenew getByIdRel(Integer appRenewId) { + OaAppRenewParam param = new OaAppRenewParam(); + param.setAppRenewId(appRenewId); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public BigDecimal sumMoney(LambdaQueryWrapper wrapper) { + return baseMapper.selectSumMoney(wrapper); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaAppServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaAppServiceImpl.java new file mode 100644 index 0000000..bdc1596 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaAppServiceImpl.java @@ -0,0 +1,54 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaAppMapper; +import com.gxwebsoft.oa.service.OaAppService; +import com.gxwebsoft.oa.entity.OaApp; +import com.gxwebsoft.oa.param.OaAppParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 应用Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Service +public class OaAppServiceImpl extends ServiceImpl implements OaAppService { + + @Override + public PageResult pageRel(OaAppParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaAppParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaApp getByIdRel(Integer appId) { + OaAppParam param = new OaAppParam(); + param.setAppId(appId); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public BigDecimal sumMoney(LambdaQueryWrapper wrapper) { + return baseMapper.selectSumMoney(wrapper); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaAppUrlServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaAppUrlServiceImpl.java new file mode 100644 index 0000000..1adab2c --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaAppUrlServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaAppUrlMapper; +import com.gxwebsoft.oa.service.OaAppUrlService; +import com.gxwebsoft.oa.entity.OaAppUrl; +import com.gxwebsoft.oa.param.OaAppUrlParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 项目域名Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Service +public class OaAppUrlServiceImpl extends ServiceImpl implements OaAppUrlService { + + @Override + public PageResult pageRel(OaAppUrlParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaAppUrlParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaAppUrl getByIdRel(Integer appUrlId) { + OaAppUrlParam param = new OaAppUrlParam(); + param.setAppUrlId(appUrlId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaAppUserServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaAppUserServiceImpl.java new file mode 100644 index 0000000..9372af0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaAppUserServiceImpl.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaAppUserMapper; +import com.gxwebsoft.oa.service.OaAppUserService; +import com.gxwebsoft.oa.entity.OaAppUser; +import com.gxwebsoft.oa.param.OaAppUserParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 应用成员Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Service +public class OaAppUserServiceImpl extends ServiceImpl implements OaAppUserService { + + @Override + public PageResult pageRel(OaAppUserParam param) { + PageParam page = new PageParam<>(param); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaAppUserParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + return page.sortRecords(list); + } + + @Override + public OaAppUser getByIdRel(Integer appUserId) { + OaAppUserParam param = new OaAppUserParam(); + param.setAppUserId(appUserId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsCodeServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsCodeServiceImpl.java new file mode 100644 index 0000000..5d37730 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsCodeServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaAssetsCodeMapper; +import com.gxwebsoft.oa.service.OaAssetsCodeService; +import com.gxwebsoft.oa.entity.OaAssetsCode; +import com.gxwebsoft.oa.param.OaAssetsCodeParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 代码仓库Service实现 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:01 + */ +@Service +public class OaAssetsCodeServiceImpl extends ServiceImpl implements OaAssetsCodeService { + + @Override + public PageResult pageRel(OaAssetsCodeParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaAssetsCodeParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaAssetsCode getByIdRel(Integer id) { + OaAssetsCodeParam param = new OaAssetsCodeParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsDomainServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsDomainServiceImpl.java new file mode 100644 index 0000000..ac207c6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsDomainServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaAssetsDomainMapper; +import com.gxwebsoft.oa.service.OaAssetsDomainService; +import com.gxwebsoft.oa.entity.OaAssetsDomain; +import com.gxwebsoft.oa.param.OaAssetsDomainParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 域名Service实现 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +@Service +public class OaAssetsDomainServiceImpl extends ServiceImpl implements OaAssetsDomainService { + + @Override + public PageResult pageRel(OaAssetsDomainParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaAssetsDomainParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaAssetsDomain getByIdRel(Integer domainId) { + OaAssetsDomainParam param = new OaAssetsDomainParam(); + param.setDomainId(domainId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsEmailServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsEmailServiceImpl.java new file mode 100644 index 0000000..7c3f4bc --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsEmailServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaAssetsEmailMapper; +import com.gxwebsoft.oa.service.OaAssetsEmailService; +import com.gxwebsoft.oa.entity.OaAssetsEmail; +import com.gxwebsoft.oa.param.OaAssetsEmailParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 企业邮箱记录表Service实现 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +@Service +public class OaAssetsEmailServiceImpl extends ServiceImpl implements OaAssetsEmailService { + + @Override + public PageResult pageRel(OaAssetsEmailParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaAssetsEmailParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaAssetsEmail getByIdRel(Integer emailId) { + OaAssetsEmailParam param = new OaAssetsEmailParam(); + param.setEmailId(emailId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsMysqlServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsMysqlServiceImpl.java new file mode 100644 index 0000000..fc17f9a --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsMysqlServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaAssetsMysqlMapper; +import com.gxwebsoft.oa.service.OaAssetsMysqlService; +import com.gxwebsoft.oa.entity.OaAssetsMysql; +import com.gxwebsoft.oa.param.OaAssetsMysqlParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 云数据库Service实现 + * + * @author 科技小王子 + * @since 2024-10-18 19:00:20 + */ +@Service +public class OaAssetsMysqlServiceImpl extends ServiceImpl implements OaAssetsMysqlService { + + @Override + public PageResult pageRel(OaAssetsMysqlParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaAssetsMysqlParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaAssetsMysql getByIdRel(Integer mysqlId) { + OaAssetsMysqlParam param = new OaAssetsMysqlParam(); + param.setMysqlId(mysqlId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsServerServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsServerServiceImpl.java new file mode 100644 index 0000000..b2e327b --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsServerServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.oa.entity.OaAssetsServer; +import com.gxwebsoft.oa.mapper.OaAssetsServerMapper; +import com.gxwebsoft.oa.param.OaAssetsServerParam; +import com.gxwebsoft.oa.service.OaAssetsServerService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 服务Service实现 + * + * @author 科技小王子 + * @since 2024-10-21 19:15:26 + */ +@Service +public class OaAssetsServerServiceImpl extends ServiceImpl implements OaAssetsServerService { + + @Override + public PageResult pageRel(OaAssetsServerParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaAssetsServerParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaAssetsServer getByIdRel(Integer id) { + OaAssetsServerParam param = new OaAssetsServerParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsServiceImpl.java new file mode 100644 index 0000000..3c64144 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaAssetsMapper; +import com.gxwebsoft.oa.service.OaAssetsService; +import com.gxwebsoft.oa.entity.OaAssets; +import com.gxwebsoft.oa.param.OaAssetsParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 云服务器Service实现 + * + * @author 科技小王子 + * @since 2024-10-18 18:34:15 + */ +@Service +public class OaAssetsServiceImpl extends ServiceImpl implements OaAssetsService { + + @Override + public PageResult pageRel(OaAssetsParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaAssetsParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaAssets getByIdRel(Integer assetsId) { + OaAssetsParam param = new OaAssetsParam(); + param.setAssetsId(assetsId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsSiteServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsSiteServiceImpl.java new file mode 100644 index 0000000..b94667d --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsSiteServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaAssetsSiteMapper; +import com.gxwebsoft.oa.service.OaAssetsSiteService; +import com.gxwebsoft.oa.entity.OaAssetsSite; +import com.gxwebsoft.oa.param.OaAssetsSiteParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 网站信息记录表Service实现 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +@Service +public class OaAssetsSiteServiceImpl extends ServiceImpl implements OaAssetsSiteService { + + @Override + public PageResult pageRel(OaAssetsSiteParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaAssetsSiteParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaAssetsSite getByIdRel(Integer websiteId) { + OaAssetsSiteParam param = new OaAssetsSiteParam(); + param.setWebsiteId(websiteId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsSoftwareCertServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsSoftwareCertServiceImpl.java new file mode 100644 index 0000000..2ac941c --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsSoftwareCertServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaAssetsSoftwareCertMapper; +import com.gxwebsoft.oa.service.OaAssetsSoftwareCertService; +import com.gxwebsoft.oa.entity.OaAssetsSoftwareCert; +import com.gxwebsoft.oa.param.OaAssetsSoftwareCertParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 计算机软件著作权登记Service实现 + * + * @author 科技小王子 + * @since 2024-10-18 19:46:21 + */ +@Service +public class OaAssetsSoftwareCertServiceImpl extends ServiceImpl implements OaAssetsSoftwareCertService { + + @Override + public PageResult pageRel(OaAssetsSoftwareCertParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaAssetsSoftwareCertParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaAssetsSoftwareCert getByIdRel(Integer id) { + OaAssetsSoftwareCertParam param = new OaAssetsSoftwareCertParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsSslServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsSslServiceImpl.java new file mode 100644 index 0000000..c705669 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsSslServiceImpl.java @@ -0,0 +1,55 @@ +package com.gxwebsoft.oa.service.impl; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaAssetsSslMapper; +import com.gxwebsoft.oa.service.OaAssetsSslService; +import com.gxwebsoft.oa.entity.OaAssetsSsl; +import com.gxwebsoft.oa.param.OaAssetsSslParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * ssl证书Service实现 + * + * @author 科技小王子 + * @since 2024-10-18 19:25:40 + */ +@Service +public class OaAssetsSslServiceImpl extends ServiceImpl implements OaAssetsSslService { + + @Override + public PageResult pageRel(OaAssetsSslParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + list.forEach(d -> { + // 即将过期(一周内过期的) + d.setSoon(DateUtil.offsetDay(d.getEndTime(), -7).compareTo(DateUtil.date())); + // 是否过期 -1已过期 大于0 未过期 + d.setStatus(d.getEndTime().compareTo(DateUtil.date())); + }); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaAssetsSslParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaAssetsSsl getByIdRel(Integer sslId) { + OaAssetsSslParam param = new OaAssetsSslParam(); + param.setSslId(sslId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsTrademarkServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsTrademarkServiceImpl.java new file mode 100644 index 0000000..7baede1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsTrademarkServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaAssetsTrademarkMapper; +import com.gxwebsoft.oa.service.OaAssetsTrademarkService; +import com.gxwebsoft.oa.entity.OaAssetsTrademark; +import com.gxwebsoft.oa.param.OaAssetsTrademarkParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 商标注册Service实现 + * + * @author 科技小王子 + * @since 2024-10-18 19:46:21 + */ +@Service +public class OaAssetsTrademarkServiceImpl extends ServiceImpl implements OaAssetsTrademarkService { + + @Override + public PageResult pageRel(OaAssetsTrademarkParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaAssetsTrademarkParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaAssetsTrademark getByIdRel(Integer id) { + OaAssetsTrademarkParam param = new OaAssetsTrademarkParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsUserServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsUserServiceImpl.java new file mode 100644 index 0000000..4869455 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsUserServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaAssetsUserMapper; +import com.gxwebsoft.oa.service.OaAssetsUserService; +import com.gxwebsoft.oa.entity.OaAssetsUser; +import com.gxwebsoft.oa.param.OaAssetsUserParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 服务器成员管理Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:41 + */ +@Service +public class OaAssetsUserServiceImpl extends ServiceImpl implements OaAssetsUserService { + + @Override + public PageResult pageRel(OaAssetsUserParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaAssetsUserParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaAssetsUser getByIdRel(Integer id) { + OaAssetsUserParam param = new OaAssetsUserParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsVhostServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsVhostServiceImpl.java new file mode 100644 index 0000000..87b1a08 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaAssetsVhostServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaAssetsVhostMapper; +import com.gxwebsoft.oa.service.OaAssetsVhostService; +import com.gxwebsoft.oa.entity.OaAssetsVhost; +import com.gxwebsoft.oa.param.OaAssetsVhostParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 虚拟主机记录表Service实现 + * + * @author 科技小王子 + * @since 2024-10-18 18:27:02 + */ +@Service +public class OaAssetsVhostServiceImpl extends ServiceImpl implements OaAssetsVhostService { + + @Override + public PageResult pageRel(OaAssetsVhostParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaAssetsVhostParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaAssetsVhost getByIdRel(Integer vhostId) { + OaAssetsVhostParam param = new OaAssetsVhostParam(); + param.setVhostId(vhostId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaCompanyFieldServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaCompanyFieldServiceImpl.java new file mode 100644 index 0000000..e7b76d6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaCompanyFieldServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaCompanyFieldMapper; +import com.gxwebsoft.oa.service.OaCompanyFieldService; +import com.gxwebsoft.oa.entity.OaCompanyField; +import com.gxwebsoft.oa.param.OaCompanyFieldParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 企业参数Service实现 + * + * @author 科技小王子 + * @since 2024-09-20 12:33:12 + */ +@Service +public class OaCompanyFieldServiceImpl extends ServiceImpl implements OaCompanyFieldService { + + @Override + public PageResult pageRel(OaCompanyFieldParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaCompanyFieldParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaCompanyField getByIdRel(Integer id) { + OaCompanyFieldParam param = new OaCompanyFieldParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaCompanyServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaCompanyServiceImpl.java new file mode 100644 index 0000000..1c53913 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaCompanyServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaCompanyMapper; +import com.gxwebsoft.oa.service.OaCompanyService; +import com.gxwebsoft.oa.entity.OaCompany; +import com.gxwebsoft.oa.param.OaCompanyParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 企业信息Service实现 + * + * @author 科技小王子 + * @since 2024-09-20 12:33:12 + */ +@Service +public class OaCompanyServiceImpl extends ServiceImpl implements OaCompanyService { + + @Override + public PageResult pageRel(OaCompanyParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaCompanyParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaCompany getByIdRel(Integer companyId) { + OaCompanyParam param = new OaCompanyParam(); + param.setCompanyId(companyId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaCompanyUserServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaCompanyUserServiceImpl.java new file mode 100644 index 0000000..43b4230 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaCompanyUserServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaCompanyUserMapper; +import com.gxwebsoft.oa.service.OaCompanyUserService; +import com.gxwebsoft.oa.entity.OaCompanyUser; +import com.gxwebsoft.oa.param.OaCompanyUserParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 成员管理Service实现 + * + * @author 科技小王子 + * @since 2024-09-20 12:33:12 + */ +@Service +public class OaCompanyUserServiceImpl extends ServiceImpl implements OaCompanyUserService { + + @Override + public PageResult pageRel(OaCompanyUserParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaCompanyUserParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaCompanyUser getByIdRel(Integer companyUserId) { + OaCompanyUserParam param = new OaCompanyUserParam(); + param.setCompanyUserId(companyUserId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaLinkServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaLinkServiceImpl.java new file mode 100644 index 0000000..4050f49 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaLinkServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaLinkMapper; +import com.gxwebsoft.oa.service.OaLinkService; +import com.gxwebsoft.oa.entity.OaLink; +import com.gxwebsoft.oa.param.OaLinkParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 常用链接Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Service +public class OaLinkServiceImpl extends ServiceImpl implements OaLinkService { + + @Override + public PageResult pageRel(OaLinkParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaLinkParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaLink getByIdRel(Integer id) { + OaLinkParam param = new OaLinkParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaProductServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaProductServiceImpl.java new file mode 100644 index 0000000..09506a3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaProductServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaProductMapper; +import com.gxwebsoft.oa.service.OaProductService; +import com.gxwebsoft.oa.entity.OaProduct; +import com.gxwebsoft.oa.param.OaProductParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 产品记录表Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Service +public class OaProductServiceImpl extends ServiceImpl implements OaProductService { + + @Override + public PageResult pageRel(OaProductParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaProductParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaProduct getByIdRel(Integer productId) { + OaProductParam param = new OaProductParam(); + param.setProductId(productId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaProductTabsServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaProductTabsServiceImpl.java new file mode 100644 index 0000000..98a4203 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaProductTabsServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaProductTabsMapper; +import com.gxwebsoft.oa.service.OaProductTabsService; +import com.gxwebsoft.oa.entity.OaProductTabs; +import com.gxwebsoft.oa.param.OaProductTabsParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 产品标签记录表Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Service +public class OaProductTabsServiceImpl extends ServiceImpl implements OaProductTabsService { + + @Override + public PageResult pageRel(OaProductTabsParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaProductTabsParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaProductTabs getByIdRel(Integer tabId) { + OaProductTabsParam param = new OaProductTabsParam(); + param.setTabId(tabId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaTaskCountServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaTaskCountServiceImpl.java new file mode 100644 index 0000000..8da15ca --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaTaskCountServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaTaskCountMapper; +import com.gxwebsoft.oa.service.OaTaskCountService; +import com.gxwebsoft.oa.entity.OaTaskCount; +import com.gxwebsoft.oa.param.OaTaskCountParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 数据统计Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Service +public class OaTaskCountServiceImpl extends ServiceImpl implements OaTaskCountService { + + @Override + public PageResult pageRel(OaTaskCountParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaTaskCountParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaTaskCount getByIdRel(Integer taskCountId) { + OaTaskCountParam param = new OaTaskCountParam(); + param.setTaskCountId(taskCountId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaTaskRecordServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaTaskRecordServiceImpl.java new file mode 100644 index 0000000..bdaee94 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaTaskRecordServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaTaskRecordMapper; +import com.gxwebsoft.oa.service.OaTaskRecordService; +import com.gxwebsoft.oa.entity.OaTaskRecord; +import com.gxwebsoft.oa.param.OaTaskRecordParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 工单回复记录表Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Service +public class OaTaskRecordServiceImpl extends ServiceImpl implements OaTaskRecordService { + + @Override + public PageResult pageRel(OaTaskRecordParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaTaskRecordParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaTaskRecord getByIdRel(Integer taskRecordId) { + OaTaskRecordParam param = new OaTaskRecordParam(); + param.setTaskRecordId(taskRecordId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaTaskServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaTaskServiceImpl.java new file mode 100644 index 0000000..1ea3691 --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaTaskServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaTaskMapper; +import com.gxwebsoft.oa.service.OaTaskService; +import com.gxwebsoft.oa.entity.OaTask; +import com.gxwebsoft.oa.param.OaTaskParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 任务记录表Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Service +public class OaTaskServiceImpl extends ServiceImpl implements OaTaskService { + + @Override + public PageResult pageRel(OaTaskParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaTaskParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaTask getByIdRel(Integer taskId) { + OaTaskParam param = new OaTaskParam(); + param.setTaskId(taskId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/oa/service/impl/OaTaskUserServiceImpl.java b/src/main/java/com/gxwebsoft/oa/service/impl/OaTaskUserServiceImpl.java new file mode 100644 index 0000000..c7a15ef --- /dev/null +++ b/src/main/java/com/gxwebsoft/oa/service/impl/OaTaskUserServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.oa.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.oa.mapper.OaTaskUserMapper; +import com.gxwebsoft.oa.service.OaTaskUserService; +import com.gxwebsoft.oa.entity.OaTaskUser; +import com.gxwebsoft.oa.param.OaTaskUserParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 工单成员Service实现 + * + * @author 科技小王子 + * @since 2024-09-10 20:57:42 + */ +@Service +public class OaTaskUserServiceImpl extends ServiceImpl implements OaTaskUserService { + + @Override + public PageResult pageRel(OaTaskUserParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(OaTaskUserParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public OaTaskUser getByIdRel(Integer taskUserId) { + OaTaskUserParam param = new OaTaskUserParam(); + param.setTaskUserId(taskUserId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/payment/constants/PaymentConstants.java b/src/main/java/com/gxwebsoft/payment/constants/PaymentConstants.java new file mode 100644 index 0000000..80f0354 --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/constants/PaymentConstants.java @@ -0,0 +1,244 @@ +package com.gxwebsoft.payment.constants; + +/** + * 支付模块常量类 + * 统一管理支付相关的常量配置 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +public class PaymentConstants { + + /** + * 支付状态常量 + */ + public static class Status { + /** 待支付 */ + public static final String PENDING = "PENDING"; + /** 支付成功 */ + public static final String SUCCESS = "SUCCESS"; + /** 支付失败 */ + public static final String FAILED = "FAILED"; + /** 支付取消 */ + public static final String CANCELLED = "CANCELLED"; + /** 支付超时 */ + public static final String TIMEOUT = "TIMEOUT"; + /** 退款成功 */ + public static final String REFUNDED = "REFUNDED"; + } + + /** + * 微信支付相关常量 + */ + public static class Wechat { + /** 货币类型 */ + public static final String CURRENCY = "CNY"; + /** 金额转换倍数(元转分) */ + public static final int AMOUNT_MULTIPLIER = 100; + + /** 支付状态 */ + public static final String PAY_SUCCESS = "SUCCESS"; + public static final String PAY_REFUND = "REFUND"; + public static final String PAY_NOTPAY = "NOTPAY"; + public static final String PAY_CLOSED = "CLOSED"; + public static final String PAY_REVOKED = "REVOKED"; + public static final String PAY_USERPAYING = "USERPAYING"; + public static final String PAY_PAYERROR = "PAYERROR"; + + /** 回调响应 */ + public static final String NOTIFY_SUCCESS = "SUCCESS"; + public static final String NOTIFY_FAIL = "FAIL"; + + /** 通知类型 */ + public static final String EVENT_PAYMENT = "TRANSACTION.SUCCESS"; + public static final String EVENT_REFUND = "REFUND.SUCCESS"; + + /** HTTP头部 */ + public static final String HEADER_SIGNATURE = "Wechatpay-Signature"; + public static final String HEADER_TIMESTAMP = "Wechatpay-Timestamp"; + public static final String HEADER_NONCE = "Wechatpay-Nonce"; + public static final String HEADER_SERIAL = "Wechatpay-Serial"; + public static final String HEADER_REQUEST_ID = "Request-ID"; + } + + /** + * 支付宝相关常量 + */ + public static class Alipay { + /** 货币类型 */ + public static final String CURRENCY = "CNY"; + + /** 支付状态 */ + public static final String PAY_SUCCESS = "TRADE_SUCCESS"; + public static final String PAY_FINISHED = "TRADE_FINISHED"; + public static final String PAY_CLOSED = "TRADE_CLOSED"; + + /** 回调响应 */ + public static final String NOTIFY_SUCCESS = "success"; + public static final String NOTIFY_FAIL = "failure"; + + /** 产品码 */ + public static final String PRODUCT_CODE_WEB = "FAST_INSTANT_TRADE_PAY"; + public static final String PRODUCT_CODE_WAP = "QUICK_WAP_WAY"; + public static final String PRODUCT_CODE_APP = "QUICK_MSECURITY_PAY"; + } + + /** + * 银联支付相关常量 + */ + public static class UnionPay { + /** 货币类型 */ + public static final String CURRENCY = "156"; // 人民币代码 + + /** 支付状态 */ + public static final String PAY_SUCCESS = "00"; + public static final String PAY_FAILED = "01"; + + /** 交易类型 */ + public static final String TXN_TYPE_CONSUME = "01"; // 消费 + public static final String TXN_TYPE_REFUND = "04"; // 退货 + } + + /** + * 缓存键常量 + */ + public static class CacheKey { + /** 支付配置缓存前缀 */ + public static final String PAYMENT_CONFIG = "payment:config:"; + /** 支付订单缓存前缀 */ + public static final String PAYMENT_ORDER = "payment:order:"; + /** 支付锁前缀 */ + public static final String PAYMENT_LOCK = "payment:lock:"; + /** 回调处理锁前缀 */ + public static final String NOTIFY_LOCK = "payment:notify:lock:"; + } + + /** + * 配置相关常量 + */ + public static class Config { + /** 订单超时时间(分钟) */ + public static final int ORDER_TIMEOUT_MINUTES = 30; + /** 订单描述最大长度 */ + public static final int DESCRIPTION_MAX_LENGTH = 127; + /** 最大重试次数 */ + public static final int MAX_RETRY_COUNT = 3; + /** 重试间隔(毫秒) */ + public static final long RETRY_INTERVAL_MS = 1000; + /** 签名有效期(秒) */ + public static final long SIGNATURE_VALID_SECONDS = 300; + } + + /** + * 错误信息常量 + */ + public static class ErrorMessage { + /** 参数错误 */ + public static final String PARAM_ERROR = "参数错误"; + /** 配置未找到 */ + public static final String CONFIG_NOT_FOUND = "支付配置未找到"; + /** 支付方式不支持 */ + public static final String PAYMENT_TYPE_NOT_SUPPORTED = "支付方式不支持"; + /** 金额错误 */ + public static final String AMOUNT_ERROR = "金额错误"; + /** 订单不存在 */ + public static final String ORDER_NOT_FOUND = "订单不存在"; + /** 订单状态错误 */ + public static final String ORDER_STATUS_ERROR = "订单状态错误"; + /** 签名验证失败 */ + public static final String SIGNATURE_ERROR = "签名验证失败"; + /** 网络请求失败 */ + public static final String NETWORK_ERROR = "网络请求失败"; + /** 系统内部错误 */ + public static final String SYSTEM_ERROR = "系统内部错误"; + /** 余额不足 */ + public static final String INSUFFICIENT_BALANCE = "余额不足"; + /** 支付超时 */ + public static final String PAYMENT_TIMEOUT = "支付超时"; + /** 重复支付 */ + public static final String DUPLICATE_PAYMENT = "重复支付"; + } + + /** + * 日志消息常量 + */ + public static class LogMessage { + /** 支付请求开始 */ + public static final String PAYMENT_START = "开始处理支付请求"; + /** 支付请求成功 */ + public static final String PAYMENT_SUCCESS = "支付请求处理成功"; + /** 支付请求失败 */ + public static final String PAYMENT_FAILED = "支付请求处理失败"; + + /** 回调处理开始 */ + public static final String NOTIFY_START = "开始处理支付回调"; + /** 回调处理成功 */ + public static final String NOTIFY_SUCCESS = "支付回调处理成功"; + /** 回调处理失败 */ + public static final String NOTIFY_FAILED = "支付回调处理失败"; + + /** 退款请求开始 */ + public static final String REFUND_START = "开始处理退款请求"; + /** 退款请求成功 */ + public static final String REFUND_SUCCESS = "退款请求处理成功"; + /** 退款请求失败 */ + public static final String REFUND_FAILED = "退款请求处理失败"; + } + + /** + * 正则表达式常量 + */ + public static class Regex { + /** 订单号格式 */ + public static final String ORDER_NO = "^[a-zA-Z0-9_-]{1,32}$"; + /** 金额格式(分) */ + public static final String AMOUNT = "^[1-9]\\d*$"; + /** 手机号格式 */ + public static final String MOBILE = "^1[3-9]\\d{9}$"; + /** 邮箱格式 */ + public static final String EMAIL = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"; + } + + /** + * 时间相关常量 + */ + public static class Time { + /** 配置缓存有效期(秒) */ + public static final long CONFIG_CACHE_SECONDS = 3600; + /** 订单缓存有效期(秒) */ + public static final long ORDER_CACHE_SECONDS = 1800; + /** 支付锁有效期(秒) */ + public static final long PAYMENT_LOCK_SECONDS = 60; + /** 回调锁有效期(秒) */ + public static final long NOTIFY_LOCK_SECONDS = 30; + } + + /** + * 文件相关常量 + */ + public static class File { + /** 证书文件扩展名 */ + public static final String CERT_EXTENSION = ".pem"; + /** 私钥文件后缀 */ + public static final String PRIVATE_KEY_SUFFIX = "_key.pem"; + /** 公钥文件后缀 */ + public static final String PUBLIC_KEY_SUFFIX = "_cert.pem"; + } + + /** + * 环境相关常量 + */ + public static class Environment { + /** 开发环境 */ + public static final String DEV = "dev"; + /** 测试环境 */ + public static final String TEST = "test"; + /** 生产环境 */ + public static final String PROD = "prod"; + } + + // 私有构造函数,防止实例化 + private PaymentConstants() { + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } +} diff --git a/src/main/java/com/gxwebsoft/payment/constants/WechatPayType.java b/src/main/java/com/gxwebsoft/payment/constants/WechatPayType.java new file mode 100644 index 0000000..68b2d84 --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/constants/WechatPayType.java @@ -0,0 +1,81 @@ +package com.gxwebsoft.payment.constants; + +/** + * 微信支付类型常量 + * 定义微信支付的具体实现方式 + * + * @author 科技小王子 + * @since 2025-08-30 + */ +public class WechatPayType { + + /** + * JSAPI支付 - 小程序/公众号内支付 + * 需要用户的openid + */ + public static final String JSAPI = "JSAPI"; + + /** + * Native支付 - 扫码支付 + * 生成二维码供用户扫描支付 + */ + public static final String NATIVE = "NATIVE"; + + /** + * H5支付 - 手机网页支付 + * 在手机浏览器中调起微信支付 + */ + public static final String H5 = "H5"; + + /** + * APP支付 - 移动应用支付 + * 在APP中调起微信支付 + */ + public static final String APP = "APP"; + + /** + * 根据openid自动选择微信支付类型 + * + * @param openid 用户openid + * @return JSAPI 或 NATIVE + */ + public static String getAutoType(String openid) { + return (openid != null && !openid.trim().isEmpty()) ? JSAPI : NATIVE; + } + + /** + * 检查是否为有效的微信支付类型 + * + * @param payType 支付类型 + * @return true表示有效 + */ + public static boolean isValidType(String payType) { + return JSAPI.equals(payType) || NATIVE.equals(payType) || + H5.equals(payType) || APP.equals(payType); + } + + /** + * 获取支付类型描述 + * + * @param payType 支付类型 + * @return 描述文本 + */ + public static String getDescription(String payType) { + if (payType == null) { + return "未知支付类型"; + } + + switch (payType) { + case JSAPI: + return "小程序/公众号支付"; + case NATIVE: + return "扫码支付"; + case H5: + return "手机网页支付"; + case APP: + return "移动应用支付"; + default: + return "未知支付类型: " + payType; + } + } +} diff --git a/src/main/java/com/gxwebsoft/payment/controller/PaymentController.java b/src/main/java/com/gxwebsoft/payment/controller/PaymentController.java new file mode 100644 index 0000000..0d51551 --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/controller/PaymentController.java @@ -0,0 +1,360 @@ +package com.gxwebsoft.payment.controller; + +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.payment.constants.PaymentConstants; +import com.gxwebsoft.payment.dto.PaymentRequest; +import com.gxwebsoft.payment.dto.PaymentResponse; +import com.gxwebsoft.payment.dto.PaymentStatusUpdateRequest; +import com.gxwebsoft.payment.dto.PaymentWithOrderRequest; +import com.gxwebsoft.payment.enums.PaymentType; +import com.gxwebsoft.payment.exception.PaymentException; +import com.gxwebsoft.payment.service.PaymentService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Positive; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +/** + * 统一支付控制器 + * 提供所有支付方式的统一入口 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +@Slf4j +@Validated +@Tag(name = "统一支付接口", description = "支持所有支付方式的统一支付接口") +@RestController("unifiedPaymentController") +@RequestMapping("/api/payment") +public class PaymentController extends BaseController { + + @Resource(name = "unifiedPaymentServiceImpl") + private PaymentService paymentService; + + @Operation(summary = "创建支付订单", description = "支持微信、支付宝、银联等多种支付方式") + @PostMapping("/create") + public ApiResult createPayment(@Valid @RequestBody PaymentRequest request) { + log.info("收到支付请求: {}", request); + final User loginUser = getLoginUser(); + + if(loginUser == null){ + return fail("请先登录"); + } + + request.setUserId(loginUser.getUserId()); + if(request.getTenantId() == null){ + request.setTenantId(loginUser.getTenantId()); + } + try { + PaymentResponse response = paymentService.createPayment(request); + return this.success("支付订单创建成功", response); + + } catch (PaymentException e) { + log.error("支付订单创建失败: {}", e.getMessage()); + return fail(e.getMessage()); + } catch (Exception e) { + log.error("支付订单创建系统错误: {}", e.getMessage(), e); + return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); + } + } + + @Operation(summary = "创建支付订单(包含订单信息)", description = "统一支付模块:创建订单并发起支付") + @PostMapping("/create-with-order") + public ApiResult createPaymentWithOrder(@Valid @RequestBody PaymentWithOrderRequest request) { + log.info("收到支付与订单创建请求: {}", request); + final User loginUser = getLoginUser(); + + if(loginUser == null){ + return fail("请先登录"); + } + + // 设置用户信息 + if(request.getTenantId() == null){ + request.setTenantId(loginUser.getTenantId()); + } + + try { + PaymentResponse response = paymentService.createPaymentWithOrder(request, loginUser); + return this.success("订单创建并发起支付成功", response); + } catch (PaymentException e) { + log.error("创建支付订单失败: {}", e.getMessage()); + return fail(e.getMessage()); + } catch (Exception e) { + log.error("创建支付订单系统错误: {}", e.getMessage(), e); + return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); + } + } + + @Operation(summary = "查询支付状态", description = "查询指定订单的支付状态") + @GetMapping("/query") + public ApiResult queryPayment( + @Parameter(description = "订单号", required = true) + @RequestParam @NotBlank(message = "订单号不能为空") String orderNo, + + @Parameter(description = "支付类型", required = true) + @RequestParam @NotNull(message = "支付类型不能为空") PaymentType paymentType, + + @Parameter(description = "租户ID", required = true) + @RequestParam @NotNull(message = "租户ID不能为空") @Positive(message = "租户ID必须为正数") Integer tenantId) { + + log.info("查询支付状态: orderNo={}, paymentType={}, tenantId={}", orderNo, paymentType, tenantId); + + // 参数验证 + if (orderNo == null || orderNo.trim().isEmpty()) { + return fail("订单号不能为空"); + } + if (paymentType == null) { + return fail("支付类型不能为空"); + } + if (tenantId == null || tenantId <= 0) { + return fail("租户ID不能为空且必须为正数"); + } + + try { + PaymentResponse response = paymentService.queryPayment(orderNo, paymentType, tenantId); + return this.success("支付状态查询成功", response); + + } catch (PaymentException e) { + log.error("支付状态查询失败: {}", e.getMessage()); + return fail(e.getMessage()); + } catch (Exception e) { + log.error("支付状态查询系统错误: {}", e.getMessage(), e); + return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); + } + } + + @Operation(summary = "申请退款", description = "申请订单退款") + @PostMapping("/refund") + public ApiResult refund( + @Parameter(description = "订单号", required = true) + @RequestParam @NotBlank(message = "订单号不能为空") String orderNo, + + @Parameter(description = "退款单号", required = true) + @RequestParam @NotBlank(message = "退款单号不能为空") String refundNo, + + @Parameter(description = "支付类型", required = true) + @RequestParam @NotNull(message = "支付类型不能为空") PaymentType paymentType, + + @Parameter(description = "订单总金额", required = true) + @RequestParam @NotNull(message = "订单总金额不能为空") @Positive(message = "订单总金额必须大于0") BigDecimal totalAmount, + + @Parameter(description = "退款金额", required = true) + @RequestParam @NotNull(message = "退款金额不能为空") @Positive(message = "退款金额必须大于0") BigDecimal refundAmount, + + @Parameter(description = "退款原因") + @RequestParam(required = false) String reason, + + @Parameter(description = "租户ID", required = true) + @RequestParam @NotNull(message = "租户ID不能为空") @Positive(message = "租户ID必须为正数") Integer tenantId) { + + log.info("申请退款: orderNo={}, refundNo={}, paymentType={}, totalAmount={}, refundAmount={}, tenantId={}", + orderNo, refundNo, paymentType, totalAmount, refundAmount, tenantId); + + try { + PaymentResponse response = paymentService.refund(orderNo, refundNo, paymentType, + totalAmount, refundAmount, reason, tenantId); + return this.success("退款申请成功", response); + + } catch (PaymentException e) { + log.error("退款申请失败: {}", e.getMessage()); + return fail(e.getMessage()); + } catch (Exception e) { + log.error("退款申请系统错误: {}", e.getMessage(), e); + return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); + } + } + + @Operation(summary = "查询退款状态", description = "查询指定退款单的状态") + @GetMapping("/refund/query") + public ApiResult queryRefund( + @Parameter(description = "退款单号", required = true) + @RequestParam @NotBlank(message = "退款单号不能为空") String refundNo, + + @Parameter(description = "支付类型", required = true) + @RequestParam @NotNull(message = "支付类型不能为空") PaymentType paymentType, + + @Parameter(description = "租户ID", required = true) + @RequestParam @NotNull(message = "租户ID不能为空") @Positive(message = "租户ID必须为正数") Integer tenantId) { + + log.info("查询退款状态: refundNo={}, paymentType={}, tenantId={}", refundNo, paymentType, tenantId); + + try { + PaymentResponse response = paymentService.queryRefund(refundNo, paymentType, tenantId); + return this.success("退款状态查询成功", response); + + } catch (PaymentException e) { + log.error("退款状态查询失败: {}", e.getMessage()); + return fail(e.getMessage()); + } catch (Exception e) { + log.error("退款状态查询系统错误: {}", e.getMessage(), e); + return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); + } + } + + @Operation(summary = "关闭订单", description = "关闭未支付的订单") + @PostMapping("/close") + public ApiResult closeOrder( + @Parameter(description = "订单号", required = true) + @RequestParam @NotBlank(message = "订单号不能为空") String orderNo, + + @Parameter(description = "支付类型", required = true) + @RequestParam @NotNull(message = "支付类型不能为空") PaymentType paymentType, + + @Parameter(description = "租户ID", required = true) + @RequestParam @NotNull(message = "租户ID不能为空") @Positive(message = "租户ID必须为正数") Integer tenantId) { + + log.info("关闭订单: orderNo={}, paymentType={}, tenantId={}", orderNo, paymentType, tenantId); + + try { + boolean result = paymentService.closeOrder(orderNo, paymentType, tenantId); + return success(result ? "订单关闭成功" : "订单关闭失败", result); + + } catch (PaymentException e) { + log.error("订单关闭失败: {}", e.getMessage()); + return fail(e.getMessage()); + } catch (Exception e) { + log.error("订单关闭系统错误: {}", e.getMessage(), e); + return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); + } + } + + @Operation(summary = "获取支持的支付类型", description = "获取系统支持的所有支付类型列表") + @GetMapping("/types") + public ApiResult getSupportedPaymentTypes() { + try { + List paymentTypes = paymentService.getSupportedPaymentTypes(); + return this.>success("获取支付类型成功", paymentTypes); + } catch (Exception e) { + log.error("获取支付类型失败: {}", e.getMessage(), e); + return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); + } + } + + @Operation(summary = "获取支付策略信息", description = "获取指定支付类型的策略信息") + @GetMapping("/strategy/{paymentType}") + public ApiResult getPaymentStrategyInfo( + @Parameter(description = "支付类型", required = true) + @PathVariable @NotNull(message = "支付类型不能为空") PaymentType paymentType) { + + try { + Map strategyInfo = paymentService.getPaymentStrategyInfo(paymentType); + if (strategyInfo == null) { + return fail("不支持的支付类型: " + paymentType); + } + return success("获取策略信息成功", strategyInfo); + } catch (Exception e) { + log.error("获取策略信息失败: {}", e.getMessage(), e); + return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); + } + } + + @Operation(summary = "获取所有支付策略信息", description = "获取系统所有支付策略的详细信息") + @GetMapping("/strategies") + public ApiResult getAllPaymentStrategyInfo() { + try { + List> strategiesInfo = paymentService.getAllPaymentStrategyInfo(); + return this.>>success("获取所有策略信息成功", strategiesInfo); + } catch (Exception e) { + log.error("获取所有策略信息失败: {}", e.getMessage(), e); + return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); + } + } + + @Operation(summary = "检查支付类型支持情况", description = "检查指定支付类型的功能支持情况") + @GetMapping("/support/{paymentType}") + public ApiResult checkPaymentTypeSupport( + @Parameter(description = "支付类型", required = true) + @PathVariable @NotNull(message = "支付类型不能为空") PaymentType paymentType) { + + try { + Map support = Map.of( + "supported", paymentService.isPaymentTypeSupported(paymentType), + "refundSupported", paymentService.isRefundSupported(paymentType), + "querySupported", paymentService.isQuerySupported(paymentType), + "closeSupported", paymentService.isCloseSupported(paymentType), + "notifyNeeded", paymentService.isNotifyNeeded(paymentType) + ); + return this.>success("检查支持情况成功", support); + } catch (Exception e) { + log.error("检查支持情况失败: {}", e.getMessage(), e); + return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); + } + } + + @Operation(summary = "手动更新支付状态", description = "用于手动同步支付状态,通常用于异常情况处理") + @PutMapping("/update-status") + public ApiResult updatePaymentStatus(@Valid @RequestBody PaymentStatusUpdateRequest request) { + log.info("收到支付状态更新请求: {}", request); + + try { + // 查询并更新支付状态 + PaymentResponse response = paymentService.queryPayment( + request.getOrderNo(), + PaymentType.WECHAT_NATIVE, + request.getTenantId() + ); + + return this.success("支付状态更新成功", response); + } catch (Exception e) { + log.error("更新支付状态失败: {}", e.getMessage(), e); + return fail("更新支付状态失败: " + e.getMessage()); + } + } + + @Operation(summary = "检查支付配置", description = "检查指定租户的支付配置是否完整") + @GetMapping("/config/check") + public ApiResult checkPaymentConfig( + @Parameter(description = "租户ID", required = true) + @RequestParam @NotNull(message = "租户ID不能为空") @Positive(message = "租户ID必须为正数") Integer tenantId) { + + log.info("检查支付配置,租户ID: {}", tenantId); + + try { + Map configStatus = paymentService.checkPaymentConfig(tenantId); + return this.>success("配置检查完成", configStatus); + } catch (Exception e) { + log.error("检查支付配置失败: {}", e.getMessage(), e); + return fail("检查支付配置失败: " + e.getMessage()); + } + } + + @Operation(summary = "查询用户最近的支付订单", description = "当orderNo缺失时,查询用户最近创建的支付订单") + @GetMapping("/query-recent") + public ApiResult queryRecentPayment( + @Parameter(description = "支付类型", required = true) + @RequestParam @NotNull(message = "支付类型不能为空") PaymentType paymentType, + + @Parameter(description = "租户ID", required = true) + @RequestParam @NotNull(message = "租户ID不能为空") @Positive(message = "租户ID必须为正数") Integer tenantId) { + + log.info("查询用户最近支付订单: paymentType={}, tenantId={}", paymentType, tenantId); + + final User loginUser = getLoginUser(); + if(loginUser == null){ + return fail("请先登录"); + } + + try { + // 这里需要实现查询用户最近订单的逻辑 + // 可以通过用户ID和租户ID查询最近创建的订单 + return fail("此功能需要实现查询用户最近订单的业务逻辑"); + + } catch (Exception e) { + log.error("查询用户最近支付订单失败: {}", e.getMessage(), e); + return fail("查询失败: " + e.getMessage()); + } + } +} diff --git a/src/main/java/com/gxwebsoft/payment/controller/PaymentNotifyController.java b/src/main/java/com/gxwebsoft/payment/controller/PaymentNotifyController.java new file mode 100644 index 0000000..c181514 --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/controller/PaymentNotifyController.java @@ -0,0 +1,188 @@ +package com.gxwebsoft.payment.controller; + +import com.gxwebsoft.payment.constants.PaymentConstants; +import com.gxwebsoft.payment.enums.PaymentType; +import com.gxwebsoft.payment.exception.PaymentException; +import com.gxwebsoft.payment.service.PaymentService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; + +/** + * 统一支付回调控制器 + * 处理所有支付方式的异步通知回调 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +@Slf4j +@Tag(name = "统一支付回调接口", description = "处理所有支付方式的异步通知回调") +@RestController +@RequestMapping("/api/payment/notify") +public class PaymentNotifyController { + + @Resource + private PaymentService paymentService; + + @Operation(summary = "微信支付回调通知", description = "处理微信支付的异步通知") + @PostMapping("/wechat/{tenantId}") + public String wechatNotify( + @Parameter(description = "租户ID", required = true) + @PathVariable("tenantId") Integer tenantId, + @RequestBody String body, + HttpServletRequest request) { + + log.info("收到微信支付回调通知, 租户ID: {}", tenantId); + + try { + // 提取请求头 + Map headers = extractHeaders(request); + + // 处理回调 + String result = paymentService.handlePaymentNotify(PaymentType.WECHAT_NATIVE, headers, body, tenantId); + + log.info("微信支付回调处理完成, 租户ID: {}, 结果: {}", tenantId, result); + return result; + + } catch (PaymentException e) { + log.error("微信支付回调处理失败, 租户ID: {}, 错误: {}", tenantId, e.getMessage()); + return PaymentConstants.Wechat.NOTIFY_FAIL; + } catch (Exception e) { + log.error("微信支付回调系统错误, 租户ID: {}, 错误: {}", tenantId, e.getMessage(), e); + return PaymentConstants.Wechat.NOTIFY_FAIL; + } + } + + @Operation(summary = "支付宝支付回调通知", description = "处理支付宝支付的异步通知") + @PostMapping("/alipay/{tenantId}") + public String alipayNotify( + @Parameter(description = "租户ID", required = true) + @PathVariable("tenantId") Integer tenantId, + @RequestBody String body, + HttpServletRequest request) { + + log.info("收到支付宝支付回调通知, 租户ID: {}", tenantId); + + try { + // 提取请求头 + Map headers = extractHeaders(request); + + // 处理回调 + String result = paymentService.handlePaymentNotify(PaymentType.ALIPAY, headers, body, tenantId); + + log.info("支付宝支付回调处理完成, 租户ID: {}, 结果: {}", tenantId, result); + return result; + + } catch (PaymentException e) { + log.error("支付宝支付回调处理失败, 租户ID: {}, 错误: {}", tenantId, e.getMessage()); + return PaymentConstants.Alipay.NOTIFY_FAIL; + } catch (Exception e) { + log.error("支付宝支付回调系统错误, 租户ID: {}, 错误: {}", tenantId, e.getMessage(), e); + return PaymentConstants.Alipay.NOTIFY_FAIL; + } + } + + @Operation(summary = "银联支付回调通知", description = "处理银联支付的异步通知") + @PostMapping("/unionpay/{tenantId}") + public String unionPayNotify( + @Parameter(description = "租户ID", required = true) + @PathVariable("tenantId") Integer tenantId, + @RequestBody String body, + HttpServletRequest request) { + + log.info("收到银联支付回调通知, 租户ID: {}", tenantId); + + try { + // 提取请求头 + Map headers = extractHeaders(request); + + // 处理回调 + String result = paymentService.handlePaymentNotify(PaymentType.UNION_PAY, headers, body, tenantId); + + log.info("银联支付回调处理完成, 租户ID: {}, 结果: {}", tenantId, result); + return result; + + } catch (PaymentException e) { + log.error("银联支付回调处理失败, 租户ID: {}, 错误: {}", tenantId, e.getMessage()); + return "failure"; + } catch (Exception e) { + log.error("银联支付回调系统错误, 租户ID: {}, 错误: {}", tenantId, e.getMessage(), e); + return "failure"; + } + } + + @Operation(summary = "通用支付回调通知", description = "处理指定支付类型的异步通知") + @PostMapping("/{paymentType}/{tenantId}") + public String genericNotify( + @Parameter(description = "支付类型", required = true) + @PathVariable("paymentType") PaymentType paymentType, + @Parameter(description = "租户ID", required = true) + @PathVariable("tenantId") Integer tenantId, + @RequestBody String body, + HttpServletRequest request) { + + log.info("收到{}支付回调通知, 租户ID: {}", paymentType.getName(), tenantId); + + try { + // 提取请求头 + Map headers = extractHeaders(request); + + // 处理回调 + String result = paymentService.handlePaymentNotify(paymentType, headers, body, tenantId); + + log.info("{}支付回调处理完成, 租户ID: {}, 结果: {}", paymentType.getName(), tenantId, result); + return result; + + } catch (PaymentException e) { + log.error("{}支付回调处理失败, 租户ID: {}, 错误: {}", paymentType.getName(), tenantId, e.getMessage()); + return getFailureResponse(paymentType); + } catch (Exception e) { + log.error("{}支付回调系统错误, 租户ID: {}, 错误: {}", paymentType.getName(), tenantId, e.getMessage(), e); + return getFailureResponse(paymentType); + } + } + + /** + * 提取HTTP请求头 + */ + private Map extractHeaders(HttpServletRequest request) { + Map headers = new HashMap<>(); + + Enumeration headerNames = request.getHeaderNames(); + while (headerNames.hasMoreElements()) { + String headerName = headerNames.nextElement(); + String headerValue = request.getHeader(headerName); + headers.put(headerName, headerValue); + } + + // 记录关键头部信息(不记录敏感信息) + log.debug("提取请求头完成, 头部数量: {}", headers.size()); + + return headers; + } + + /** + * 根据支付类型获取失败响应 + */ + private String getFailureResponse(PaymentType paymentType) { + switch (paymentType) { + case WECHAT: + case WECHAT_NATIVE: + return PaymentConstants.Wechat.NOTIFY_FAIL; + case ALIPAY: + return PaymentConstants.Alipay.NOTIFY_FAIL; + case UNION_PAY: + return "failure"; + default: + return "fail"; + } + } +} diff --git a/src/main/java/com/gxwebsoft/payment/dto/PaymentRequest.java b/src/main/java/com/gxwebsoft/payment/dto/PaymentRequest.java new file mode 100644 index 0000000..241b549 --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/dto/PaymentRequest.java @@ -0,0 +1,207 @@ +package com.gxwebsoft.payment.dto; + +import com.gxwebsoft.payment.enums.PaymentChannel; +import com.gxwebsoft.payment.enums.PaymentType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.*; +import java.math.BigDecimal; +import java.util.Map; + +/** + * 统一支付请求DTO + * 支持所有支付方式的统一请求格式 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +@Data +@Schema(name = "统一支付请求", description = "支持所有支付方式的统一支付请求参数") +public class PaymentRequest { + + @Schema(description = "租户ID", required = true) + @NotNull(message = "租户ID不能为空") + @Positive(message = "租户ID必须为正数") + private Integer tenantId; + + @Schema(description = "用户ID", required = true) + @NotNull(message = "用户ID不能为空") + @Positive(message = "用户ID必须为正数") + private Integer userId; + + @Schema(description = "支付类型", required = true, example = "WECHAT") + @NotNull(message = "支付类型不能为空") + private PaymentType paymentType; + + @Schema(description = "支付渠道", example = "wechat_native") + private PaymentChannel paymentChannel; + + @Schema(description = "支付金额", required = true, example = "0.01") + @NotNull(message = "支付金额不能为空") + @DecimalMin(value = "0.01", message = "支付金额必须大于0.01元") + @DecimalMax(value = "999999.99", message = "支付金额不能超过999999.99元") + @Digits(integer = 6, fraction = 2, message = "支付金额格式不正确,最多6位整数2位小数") + private BigDecimal amount; + + @Schema(description = "订单号(可选,不提供则自动生成)") + @Size(max = 32, message = "订单号不能超过32个字符") + @Pattern(regexp = "^[a-zA-Z0-9_-]*$", message = "订单号只能包含字母、数字、下划线和横线") + private String orderNo; + + @Schema(description = "订单标题", required = true) + @NotBlank(message = "订单标题不能为空") + @Size(max = 127, message = "订单标题不能超过127个字符") + private String subject; + + @Schema(description = "订单描述") + @Size(max = 500, message = "订单描述不能超过500个字符") + private String description; + + @Schema(description = "商品ID") + @Positive(message = "商品ID必须为正数") + private Integer goodsId; + + @Schema(description = "购买数量", example = "1") + @Min(value = 1, message = "购买数量必须大于0") + @Max(value = 9999, message = "购买数量不能超过9999") + private Integer quantity = 1; + + @Schema(description = "订单类型", example = "0") + @Min(value = 0, message = "订单类型不能为负数") + private Integer orderType = 0; + + @Schema(description = "客户端IP地址") + private String clientIp; + + @Schema(description = "用户代理") + private String userAgent; + + @Schema(description = "回调通知URL") + private String notifyUrl; + + @Schema(description = "支付成功跳转URL") + private String returnUrl; + + @Schema(description = "支付取消跳转URL") + private String cancelUrl; + + @Schema(description = "订单超时时间(分钟)", example = "30") + @Min(value = 1, message = "订单超时时间必须大于0分钟") + @Max(value = 1440, message = "订单超时时间不能超过1440分钟(24小时)") + private Integer timeoutMinutes = 30; + + @Schema(description = "买家备注") + @Size(max = 500, message = "买家备注不能超过500个字符") + private String buyerRemarks; + + @Schema(description = "商户备注") + @Size(max = 500, message = "商户备注不能超过500个字符") + private String merchantRemarks; + + @Schema(description = "收货地址ID") + @Positive(message = "收货地址ID必须为正数") + private Integer addressId; + + @Schema(description = "扩展参数") + private Map extraParams; + + // 微信支付特有参数 + @Schema(description = "微信OpenID(JSAPI支付必填)") + private String openId; + + @Schema(description = "微信UnionID") + private String unionId; + + // 支付宝特有参数 + @Schema(description = "支付宝用户ID") + private String alipayUserId; + + @Schema(description = "花呗分期数") + private Integer hbFqNum; + + // 银联支付特有参数 + @Schema(description = "银行卡号") + private String cardNo; + + @Schema(description = "银行代码") + private String bankCode; + + /** + * 获取有效的支付渠道 + */ + public PaymentChannel getEffectivePaymentChannel() { + if (paymentChannel != null) { + return paymentChannel; + } + return PaymentChannel.getDefaultByPaymentType(paymentType); + } + + /** + * 获取有效的订单描述 + */ + public String getEffectiveDescription() { + if (description != null && !description.trim().isEmpty()) { + return description.trim(); + } + return subject; + } + + /** + * 获取格式化的金额字符串 + */ + public String getFormattedAmount() { + if (amount == null) { + return "0.00"; + } + return String.format("%.2f", amount); + } + + /** + * 转换为分(微信支付API需要) + */ + public Integer getAmountInCents() { + if (amount == null) { + return 0; + } + return amount.multiply(new BigDecimal(100)).intValue(); + } + + /** + * 验证必要参数是否完整 + */ + public boolean isValid() { + return tenantId != null && tenantId > 0 + && userId != null && userId > 0 + && paymentType != null + && amount != null && amount.compareTo(BigDecimal.ZERO) > 0 + && subject != null && !subject.trim().isEmpty(); + } + + /** + * 验证微信JSAPI支付参数 + */ + public boolean isValidForWechatJsapi() { + return isValid() && paymentType.isWechatPay() && openId != null && !openId.trim().isEmpty(); + } + + /** + * 验证支付宝支付参数 + */ + public boolean isValidForAlipay() { + return isValid() && paymentType == PaymentType.ALIPAY; + } + + /** + * 获取订单超时时间(秒) + */ + public long getTimeoutSeconds() { + return timeoutMinutes * 60L; + } + + @Override + public String toString() { + return String.format("PaymentRequest{tenantId=%d, userId=%d, paymentType=%s, amount=%s, orderNo='%s', subject='%s'}", + tenantId, userId, paymentType, getFormattedAmount(), orderNo, subject); + } +} diff --git a/src/main/java/com/gxwebsoft/payment/dto/PaymentResponse.java b/src/main/java/com/gxwebsoft/payment/dto/PaymentResponse.java new file mode 100644 index 0000000..dea992f --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/dto/PaymentResponse.java @@ -0,0 +1,294 @@ +package com.gxwebsoft.payment.dto; + +import com.gxwebsoft.payment.enums.PaymentChannel; +import com.gxwebsoft.payment.enums.PaymentStatus; +import com.gxwebsoft.payment.enums.PaymentType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Map; + +/** + * 统一支付响应DTO + * 支持所有支付方式的统一响应格式 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +@Data +@Schema(name = "统一支付响应", description = "支持所有支付方式的统一支付响应") +public class PaymentResponse { + + @Schema(description = "是否成功") + private Boolean success; + + @Schema(description = "错误代码") + private String errorCode; + + @Schema(description = "错误信息") + private String errorMessage; + + @Schema(description = "订单号") + private String orderNo; + + @Schema(description = "第三方交易号") + private String transactionId; + + @Schema(description = "支付类型") + private PaymentType paymentType; + + @Schema(description = "支付渠道") + private PaymentChannel paymentChannel; + + @Schema(description = "支付状态") + private PaymentStatus paymentStatus; + + @Schema(description = "支付金额") + private BigDecimal amount; + + @Schema(description = "实际支付金额") + private BigDecimal paidAmount; + + @Schema(description = "货币类型") + private String currency; + + @Schema(description = "租户ID") + private Integer tenantId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + + @Schema(description = "支付时间") + private LocalDateTime payTime; + + @Schema(description = "过期时间") + private LocalDateTime expireTime; + + // 微信支付特有字段 + @Schema(description = "微信支付二维码URL(Native支付)") + private String codeUrl; + + @Schema(description = "微信支付参数(JSAPI支付)") + private WechatPayParams wechatPayParams; + + @Schema(description = "微信H5支付URL") + private String h5Url; + + // 支付宝特有字段 + @Schema(description = "支付宝支付表单(网页支付)") + private String alipayForm; + + @Schema(description = "支付宝支付URL(手机网站支付)") + private String alipayUrl; + + @Schema(description = "支付宝支付参数(APP支付)") + private String alipayParams; + + // 银联支付特有字段 + @Schema(description = "银联支付表单") + private String unionPayForm; + + @Schema(description = "银联支付URL") + private String unionPayUrl; + + @Schema(description = "扩展参数") + private Map extraParams; + + /** + * 微信支付参数 + */ + @Data + @Schema(name = "微信支付参数", description = "微信JSAPI支付所需参数") + public static class WechatPayParams { + @Schema(description = "应用ID") + private String appId; + + @Schema(description = "时间戳") + private String timeStamp; + + @Schema(description = "随机字符串") + private String nonceStr; + + @Schema(description = "订单详情扩展字符串") + private String packageValue; + + @Schema(description = "签名方式") + private String signType; + + @Schema(description = "签名") + private String paySign; + } + + /** + * 创建成功响应 + */ + public static PaymentResponse success(String orderNo, PaymentType paymentType) { + PaymentResponse response = new PaymentResponse(); + response.setSuccess(true); + response.setOrderNo(orderNo); + response.setPaymentType(paymentType); + response.setPaymentStatus(PaymentStatus.PENDING); + response.setCreateTime(LocalDateTime.now()); + return response; + } + + /** + * 创建失败响应 + */ + public static PaymentResponse failure(String errorCode, String errorMessage) { + PaymentResponse response = new PaymentResponse(); + response.setSuccess(false); + response.setErrorCode(errorCode); + response.setErrorMessage(errorMessage); + return response; + } + + /** + * 创建微信Native支付响应 + */ + public static PaymentResponse wechatNative(String orderNo, String codeUrl, BigDecimal amount, Integer tenantId) { + PaymentResponse response = success(orderNo, PaymentType.WECHAT_NATIVE); + response.setCodeUrl(codeUrl); + response.setPaymentChannel(PaymentChannel.WECHAT_NATIVE); + response.setAmount(amount); + response.setTenantId(tenantId); + response.setCurrency("CNY"); + return response; + } + + /** + * 创建微信JSAPI支付响应 + */ + public static PaymentResponse wechatJsapi(String orderNo, WechatPayParams payParams, BigDecimal amount, Integer tenantId) { + PaymentResponse response = success(orderNo, PaymentType.WECHAT); + response.setWechatPayParams(payParams); + response.setPaymentChannel(PaymentChannel.WECHAT_JSAPI); + response.setAmount(amount); + response.setTenantId(tenantId); + response.setCurrency("CNY"); + return response; + } + + /** + * 创建微信H5支付响应 + */ + public static PaymentResponse wechatH5(String orderNo, String h5Url, BigDecimal amount, Integer tenantId) { + PaymentResponse response = success(orderNo, PaymentType.WECHAT); + response.setH5Url(h5Url); + response.setPaymentChannel(PaymentChannel.WECHAT_H5); + response.setAmount(amount); + response.setTenantId(tenantId); + response.setCurrency("CNY"); + return response; + } + + /** + * 创建支付宝网页支付响应 + */ + public static PaymentResponse alipayWeb(String orderNo, String alipayForm, BigDecimal amount, Integer tenantId) { + PaymentResponse response = success(orderNo, PaymentType.ALIPAY); + response.setAlipayForm(alipayForm); + response.setPaymentChannel(PaymentChannel.ALIPAY_WEB); + response.setAmount(amount); + response.setTenantId(tenantId); + response.setCurrency("CNY"); + return response; + } + + /** + * 创建支付宝手机网站支付响应 + */ + public static PaymentResponse alipayWap(String orderNo, String alipayUrl, BigDecimal amount, Integer tenantId) { + PaymentResponse response = success(orderNo, PaymentType.ALIPAY); + response.setAlipayUrl(alipayUrl); + response.setPaymentChannel(PaymentChannel.ALIPAY_WAP); + response.setAmount(amount); + response.setTenantId(tenantId); + response.setCurrency("CNY"); + return response; + } + + /** + * 创建支付宝APP支付响应 + */ + public static PaymentResponse alipayApp(String orderNo, String alipayParams, BigDecimal amount, Integer tenantId) { + PaymentResponse response = success(orderNo, PaymentType.ALIPAY); + response.setAlipayParams(alipayParams); + response.setPaymentChannel(PaymentChannel.ALIPAY_APP); + response.setAmount(amount); + response.setTenantId(tenantId); + response.setCurrency("CNY"); + return response; + } + + /** + * 创建余额支付响应 + */ + public static PaymentResponse balance(String orderNo, BigDecimal amount, Integer tenantId, Integer userId) { + PaymentResponse response = success(orderNo, PaymentType.BALANCE); + response.setPaymentChannel(PaymentChannel.BALANCE); + response.setPaymentStatus(PaymentStatus.SUCCESS); + response.setAmount(amount); + response.setPaidAmount(amount); + response.setTenantId(tenantId); + response.setUserId(userId); + response.setCurrency("CNY"); + response.setPayTime(LocalDateTime.now()); + return response; + } + + /** + * 判断是否为成功响应 + */ + public boolean isSuccess() { + return Boolean.TRUE.equals(success); + } + + /** + * 判断是否需要用户进一步操作 + */ + public boolean needUserAction() { + return isSuccess() && paymentStatus == PaymentStatus.PENDING; + } + + /** + * 获取支付结果描述 + */ + public String getResultDescription() { + if (!isSuccess()) { + return errorMessage != null ? errorMessage : "支付失败"; + } + + if (paymentStatus == null) { + return "支付状态未知"; + } + + switch (paymentStatus) { + case SUCCESS: + return "支付成功"; + case PENDING: + return "等待支付"; + case PROCESSING: + return "支付处理中"; + case FAILED: + return "支付失败"; + case CANCELLED: + return "支付已取消"; + case TIMEOUT: + return "支付超时"; + default: + return paymentStatus.getName(); + } + } + + @Override + public String toString() { + return String.format("PaymentResponse{success=%s, orderNo='%s', paymentType=%s, paymentStatus=%s, amount=%s}", + success, orderNo, paymentType, paymentStatus, amount); + } +} diff --git a/src/main/java/com/gxwebsoft/payment/dto/PaymentStatusUpdateRequest.java b/src/main/java/com/gxwebsoft/payment/dto/PaymentStatusUpdateRequest.java new file mode 100644 index 0000000..5cee3bc --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/dto/PaymentStatusUpdateRequest.java @@ -0,0 +1,41 @@ +package com.gxwebsoft.payment.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Positive; + +/** + * 支付状态更新请求DTO + * 用于手动更新支付状态的请求参数 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +@Data +@Schema(name = "支付状态更新请求", description = "用于手动更新支付状态") +public class PaymentStatusUpdateRequest { + + @Schema(description = "订单号", required = true, example = "ORDER_1756544921075") + @NotBlank(message = "订单号不能为空") + private String orderNo; + + @Schema(description = "租户ID", required = true, example = "10398") + @NotNull(message = "租户ID不能为空") + @Positive(message = "租户ID必须为正数") + private Integer tenantId; + + @Schema(description = "第三方交易号", example = "4200001234567890123") + private String transactionId; + + @Schema(description = "支付时间", example = "2025-01-26T10:30:00") + private String payTime; + + @Override + public String toString() { + return String.format("PaymentStatusUpdateRequest{orderNo='%s', tenantId=%d, transactionId='%s', payTime='%s'}", + orderNo, tenantId, transactionId, payTime); + } +} diff --git a/src/main/java/com/gxwebsoft/payment/dto/PaymentWithOrderRequest.java b/src/main/java/com/gxwebsoft/payment/dto/PaymentWithOrderRequest.java new file mode 100644 index 0000000..06ee407 --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/dto/PaymentWithOrderRequest.java @@ -0,0 +1,158 @@ +package com.gxwebsoft.payment.dto; + +import com.gxwebsoft.payment.enums.PaymentType; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.math.BigDecimal; +import java.util.List; + +/** + * 支付与订单创建请求DTO + * 用于统一支付模块中的订单创建和支付 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +@Data +@Schema(name = "PaymentWithOrderRequest", description = "支付与订单创建请求") +public class PaymentWithOrderRequest { + + // ========== 支付相关字段 ========== + + @Schema(description = "支付类型", required = true) + @NotNull(message = "支付类型不能为空") + private PaymentType paymentType; + + @Schema(description = "支付金额", required = true) + @NotNull(message = "支付金额不能为空") + @DecimalMin(value = "0.01", message = "支付金额必须大于0") + @Digits(integer = 10, fraction = 2, message = "支付金额格式不正确") + private BigDecimal amount; + + @Schema(description = "订单标题", required = true) + @NotBlank(message = "订单标题不能为空") + @Size(max = 60, message = "订单标题长度不能超过60个字符") + private String subject; + + @Schema(description = "订单描述") + @Size(max = 500, message = "订单描述长度不能超过500个字符") + private String description; + + @Schema(description = "租户ID", required = true) + @NotNull(message = "租户ID不能为空") + @Positive(message = "租户ID必须为正数") + private Integer tenantId; + + // ========== 订单相关字段 ========== + + @Schema(description = "订单信息", required = true) + @Valid + @NotNull(message = "订单信息不能为空") + private OrderInfo orderInfo; + + /** + * 订单信息 + */ + @Data + @Schema(name = "OrderInfo", description = "订单信息") + public static class OrderInfo { + + @Schema(description = "订单类型,0商城订单 1预定订单/外卖 2会员卡") + @NotNull(message = "订单类型不能为空") + @Min(value = 0, message = "订单类型值无效") + @Max(value = 2, message = "订单类型值无效") + private Integer type; + + @Schema(description = "收货人姓名") + @Size(max = 50, message = "收货人姓名长度不能超过50个字符") + private String realName; + + @Schema(description = "收货地址") + @Size(max = 200, message = "收货地址长度不能超过200个字符") + private String address; + + @Schema(description = "关联收货地址ID") + private Integer addressId; + + @Schema(description = "快递/自提,0快递 1自提") + private Integer deliveryType; + + @Schema(description = "下单渠道,0小程序预定 1俱乐部训练场 3活动订场") + private Integer channel; + + @Schema(description = "商户ID") + private Long merchantId; + + @Schema(description = "商户名称") + private String merchantName; + + @Schema(description = "使用的优惠券ID") + private Integer couponId; + + @Schema(description = "备注") + @Size(max = 500, message = "备注长度不能超过500字符") + private String comments; + + @Schema(description = "订单商品列表", required = true) + @Valid + @NotEmpty(message = "订单商品列表不能为空") + private List goodsItems; + } + + /** + * 订单商品项 + */ + @Data + @Schema(name = "OrderGoodsItem", description = "订单商品项") + public static class OrderGoodsItem { + + @Schema(description = "商品ID", required = true) + @NotNull(message = "商品ID不能为空") + @Positive(message = "商品ID必须为正数") + private Integer goodsId; + + @Schema(description = "商品SKU ID") + private Integer skuId; + + @Schema(description = "商品数量", required = true) + @NotNull(message = "商品数量不能为空") + @Min(value = 1, message = "商品数量必须大于0") + private Integer quantity; + + @Schema(description = "规格信息,如:颜色:红色|尺寸:L") + private String specInfo; + } + + /** + * 获取格式化的金额字符串 + */ + public String getFormattedAmount() { + if (amount == null) { + return "0.00"; + } + return String.format("%.2f", amount); + } + + /** + * 验证订单商品总金额是否与支付金额一致 + */ + public boolean isAmountConsistent() { + if (amount == null || orderInfo == null || orderInfo.getGoodsItems() == null) { + return false; + } + + // 这里可以添加商品金额计算逻辑 + // 实际实现时需要查询数据库获取商品价格 + return true; + } + + @Override + public String toString() { + return String.format("PaymentWithOrderRequest{paymentType=%s, amount=%s, subject='%s', tenantId=%d, goodsCount=%d}", + paymentType, getFormattedAmount(), subject, tenantId, + orderInfo != null && orderInfo.getGoodsItems() != null ? orderInfo.getGoodsItems().size() : 0); + } +} diff --git a/src/main/java/com/gxwebsoft/payment/enums/PaymentChannel.java b/src/main/java/com/gxwebsoft/payment/enums/PaymentChannel.java new file mode 100644 index 0000000..f7396a0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/enums/PaymentChannel.java @@ -0,0 +1,159 @@ +package com.gxwebsoft.payment.enums; + +/** + * 支付渠道枚举 + * 定义具体的支付渠道类型 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +public enum PaymentChannel { + + /** 微信JSAPI支付 */ + WECHAT_JSAPI("wechat_jsapi", "微信JSAPI支付", PaymentType.WECHAT), + + /** 微信Native支付 */ + WECHAT_NATIVE("wechat_native", "微信Native支付", PaymentType.WECHAT_NATIVE), + + /** 微信H5支付 */ + WECHAT_H5("wechat_h5", "微信H5支付", PaymentType.WECHAT), + + /** 微信APP支付 */ + WECHAT_APP("wechat_app", "微信APP支付", PaymentType.WECHAT), + + /** 微信小程序支付 */ + WECHAT_MINI("wechat_mini", "微信小程序支付", PaymentType.WECHAT), + + /** 支付宝网页支付 */ + ALIPAY_WEB("alipay_web", "支付宝网页支付", PaymentType.ALIPAY), + + /** 支付宝手机网站支付 */ + ALIPAY_WAP("alipay_wap", "支付宝手机网站支付", PaymentType.ALIPAY), + + /** 支付宝APP支付 */ + ALIPAY_APP("alipay_app", "支付宝APP支付", PaymentType.ALIPAY), + + /** 支付宝小程序支付 */ + ALIPAY_MINI("alipay_mini", "支付宝小程序支付", PaymentType.ALIPAY), + + /** 银联网关支付 */ + UNION_WEB("union_web", "银联网关支付", PaymentType.UNION_PAY), + + /** 银联手机支付 */ + UNION_WAP("union_wap", "银联手机支付", PaymentType.UNION_PAY), + + /** 余额支付 */ + BALANCE("balance", "余额支付", PaymentType.BALANCE), + + /** 现金支付 */ + CASH("cash", "现金支付", PaymentType.CASH), + + /** POS机支付 */ + POS("pos", "POS机支付", PaymentType.POS); + + private final String code; + private final String name; + private final PaymentType paymentType; + + PaymentChannel(String code, String name, PaymentType paymentType) { + this.code = code; + this.name = name; + this.paymentType = paymentType; + } + + public String getCode() { + return code; + } + + public String getName() { + return name; + } + + public PaymentType getPaymentType() { + return paymentType; + } + + /** + * 根据代码获取支付渠道 + */ + public static PaymentChannel getByCode(String code) { + if (code == null) { + return null; + } + for (PaymentChannel channel : values()) { + if (channel.code.equals(code)) { + return channel; + } + } + return null; + } + + /** + * 根据支付类型获取默认渠道 + */ + public static PaymentChannel getDefaultByPaymentType(PaymentType paymentType) { + if (paymentType == null) { + return null; + } + + switch (paymentType) { + case WECHAT: + return WECHAT_JSAPI; + case WECHAT_NATIVE: + return WECHAT_NATIVE; + case ALIPAY: + return ALIPAY_WEB; + case UNION_PAY: + return UNION_WEB; + case BALANCE: + return BALANCE; + case CASH: + return CASH; + case POS: + return POS; + default: + return null; + } + } + + /** + * 是否为微信支付渠道 + */ + public boolean isWechatChannel() { + return paymentType.isWechatPay(); + } + + /** + * 是否为支付宝支付渠道 + */ + public boolean isAlipayChannel() { + return paymentType == PaymentType.ALIPAY; + } + + /** + * 是否为银联支付渠道 + */ + public boolean isUnionPayChannel() { + return paymentType == PaymentType.UNION_PAY; + } + + /** + * 是否为第三方支付渠道 + */ + public boolean isThirdPartyChannel() { + return paymentType.isThirdPartyPay(); + } + + /** + * 是否支持退款 + */ + public boolean supportRefund() { + return isThirdPartyChannel(); + } + + @Override + public String toString() { + return String.format("PaymentChannel{code='%s', name='%s', paymentType=%s}", + code, name, paymentType); + } +} diff --git a/src/main/java/com/gxwebsoft/payment/enums/PaymentStatus.java b/src/main/java/com/gxwebsoft/payment/enums/PaymentStatus.java new file mode 100644 index 0000000..809bd9a --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/enums/PaymentStatus.java @@ -0,0 +1,141 @@ +package com.gxwebsoft.payment.enums; + +/** + * 支付状态枚举 + * 定义支付过程中的各种状态 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +public enum PaymentStatus { + + /** 待支付 */ + PENDING(0, "待支付", "PENDING"), + + /** 支付中 */ + PROCESSING(1, "支付中", "PROCESSING"), + + /** 支付成功 */ + SUCCESS(2, "支付成功", "SUCCESS"), + + /** 支付失败 */ + FAILED(3, "支付失败", "FAILED"), + + /** 支付取消 */ + CANCELLED(4, "支付取消", "CANCELLED"), + + /** 支付超时 */ + TIMEOUT(5, "支付超时", "TIMEOUT"), + + /** 退款中 */ + REFUNDING(6, "退款中", "REFUNDING"), + + /** 退款成功 */ + REFUNDED(7, "退款成功", "REFUNDED"), + + /** 退款失败 */ + REFUND_FAILED(8, "退款失败", "REFUND_FAILED"), + + /** 部分退款 */ + PARTIAL_REFUNDED(9, "部分退款", "PARTIAL_REFUNDED"); + + private final Integer code; + private final String name; + private final String status; + + PaymentStatus(Integer code, String name, String status) { + this.code = code; + this.name = name; + this.status = status; + } + + public Integer getCode() { + return code; + } + + public String getName() { + return name; + } + + public String getStatus() { + return status; + } + + /** + * 根据代码获取支付状态 + */ + public static PaymentStatus getByCode(Integer code) { + if (code == null) { + return null; + } + for (PaymentStatus status : values()) { + if (status.code.equals(code)) { + return status; + } + } + return null; + } + + /** + * 根据状态字符串获取支付状态 + */ + public static PaymentStatus getByStatus(String status) { + if (status == null) { + return null; + } + for (PaymentStatus paymentStatus : values()) { + if (paymentStatus.status.equals(status)) { + return paymentStatus; + } + } + return null; + } + + /** + * 是否为最终状态(不会再变化) + */ + public boolean isFinalStatus() { + return this == SUCCESS || this == FAILED || this == CANCELLED || + this == TIMEOUT || this == REFUNDED || this == REFUND_FAILED; + } + + /** + * 是否为成功状态 + */ + public boolean isSuccessStatus() { + return this == SUCCESS; + } + + /** + * 是否为失败状态 + */ + public boolean isFailedStatus() { + return this == FAILED || this == CANCELLED || this == TIMEOUT || this == REFUND_FAILED; + } + + /** + * 是否为退款相关状态 + */ + public boolean isRefundStatus() { + return this == REFUNDING || this == REFUNDED || this == REFUND_FAILED || this == PARTIAL_REFUNDED; + } + + /** + * 是否可以退款 + */ + public boolean canRefund() { + return this == SUCCESS || this == PARTIAL_REFUNDED; + } + + /** + * 是否可以取消 + */ + public boolean canCancel() { + return this == PENDING || this == PROCESSING; + } + + @Override + public String toString() { + return String.format("PaymentStatus{code=%d, name='%s', status='%s'}", code, name, status); + } +} diff --git a/src/main/java/com/gxwebsoft/payment/enums/PaymentType.java b/src/main/java/com/gxwebsoft/payment/enums/PaymentType.java new file mode 100644 index 0000000..946b7ba --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/enums/PaymentType.java @@ -0,0 +1,224 @@ +package com.gxwebsoft.payment.enums; + +/** + * 支付类型枚举 + * 定义系统支持的所有支付方式 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +public enum PaymentType { + + /** 余额支付 */ + BALANCE(0, "余额支付", "balance"), + + /** 微信支付(包含JSAPI和Native) */ + WECHAT(1, "微信支付", "wechat"), + + /** 支付宝支付 */ + ALIPAY(2, "支付宝支付", "alipay"), + + /** 银联支付 */ + UNION_PAY(3, "银联支付", "union_pay"), + + /** 现金支付 */ + CASH(4, "现金支付", "cash"), + + /** POS机支付 */ + POS(5, "POS机支付", "pos"), + + /** 免费 */ + FREE(6, "免费", "free"), + + /** 积分支付 */ + POINTS(7, "积分支付", "points"), + + // ========== 已废弃的支付方式(保留用于数据兼容) ========== + + /** @deprecated 微信Native支付 - 已合并到WECHAT */ + @Deprecated + WECHAT_NATIVE(102, "微信Native支付", "wechat_native"), + + /** @deprecated 会员卡支付 - 建议使用余额支付 */ + @Deprecated + MEMBER_CARD_OLD(8, "会员卡支付", "member_card"), + + /** @deprecated VIP月卡 - 建议使用余额支付 */ + @Deprecated + VIP_MONTHLY(9, "VIP月卡", "vip_monthly"), + + /** @deprecated VIP年卡 - 建议使用余额支付 */ + @Deprecated + VIP_YEARLY(10, "VIP年卡", "vip_yearly"), + + /** @deprecated VIP次卡 - 建议使用余额支付 */ + @Deprecated + VIP_COUNT(11, "VIP次卡", "vip_count"), + + /** @deprecated 免费(旧编号) - 已迁移到新编号6 */ + @Deprecated + FREE_OLD(12, "免费", "free"), + + /** @deprecated VIP充值卡 - 建议使用余额支付 */ + @Deprecated + VIP_RECHARGE(13, "VIP充值卡", "vip_recharge"), + + /** @deprecated IC充值卡 - 建议使用余额支付 */ + @Deprecated + IC_RECHARGE(14, "IC充值卡", "ic_recharge"), + + /** @deprecated 积分支付(旧编号) - 已迁移到新编号7 */ + @Deprecated + POINTS_OLD(15, "积分支付", "points"), + + /** @deprecated VIP季卡 - 建议使用余额支付 */ + @Deprecated + VIP_QUARTERLY(16, "VIP季卡", "vip_quarterly"), + + /** @deprecated IC月卡 - 建议使用余额支付 */ + @Deprecated + IC_MONTHLY(17, "IC月卡", "ic_monthly"), + + /** @deprecated IC年卡 - 建议使用余额支付 */ + @Deprecated + IC_YEARLY(18, "IC年卡", "ic_yearly"), + + /** @deprecated IC次卡 - 建议使用余额支付 */ + @Deprecated + IC_COUNT(19, "IC次卡", "ic_count"), + + /** @deprecated IC季卡 - 建议使用余额支付 */ + @Deprecated + IC_QUARTERLY(20, "IC季卡", "ic_quarterly"), + + /** @deprecated 代付 - 建议通过业务逻辑实现 */ + @Deprecated + PROXY_PAY(21, "代付", "proxy_pay"), + + /** @deprecated 支付宝(旧编号) - 已迁移到新编号2 */ + @Deprecated + ALIPAY_OLD(22, "支付宝支付", "alipay"), + + /** @deprecated 银联支付(旧编号) - 已迁移到新编号3 */ + @Deprecated + UNION_PAY_OLD(23, "银联支付", "union_pay"); + + private final Integer code; + private final String name; + private final String channel; + + PaymentType(Integer code, String name, String channel) { + this.code = code; + this.name = name; + this.channel = channel; + } + + public Integer getCode() { + return code; + } + + public String getName() { + return name; + } + + public String getChannel() { + return channel; + } + + /** + * 根据代码获取支付类型 + */ + public static PaymentType getByCode(Integer code) { + if (code == null) { + return null; + } + for (PaymentType type : values()) { + if (type.code.equals(code)) { + return type; + } + } + return null; + } + + /** + * 根据渠道获取支付类型 + */ + public static PaymentType getByChannel(String channel) { + if (channel == null) { + return null; + } + for (PaymentType type : values()) { + if (type.channel.equals(channel)) { + return type; + } + } + return null; + } + + /** + * 是否为微信支付类型 + */ + public boolean isWechatPay() { + return this == WECHAT || this == WECHAT_NATIVE; + } + + /** + * 获取微信支付的具体类型 + * @param openid 用户openid + * @return JSAPI 或 NATIVE + */ + public String getWechatPayType(String openid) { + if (!isWechatPay()) { + return null; + } + + // 有openid使用JSAPI,无openid使用Native + return (openid != null && !openid.trim().isEmpty()) ? "JSAPI" : "NATIVE"; + } + + /** + * 是否为第三方支付 + */ + public boolean isThirdPartyPay() { + return isWechatPay() || this == ALIPAY || this == UNION_PAY; + } + + /** + * 是否需要在线支付 + */ + public boolean isOnlinePay() { + return isThirdPartyPay(); + } + + /** + * 是否为卡类支付(已废弃的支付方式) + * @deprecated 卡类支付已废弃,建议使用余额支付 + */ + @Deprecated + public boolean isCardPay() { + return this == MEMBER_CARD_OLD || + this == VIP_MONTHLY || this == VIP_YEARLY || this == VIP_COUNT || this == VIP_QUARTERLY || + this == IC_MONTHLY || this == IC_YEARLY || this == IC_COUNT || this == IC_QUARTERLY || + this == VIP_RECHARGE; + } + + /** + * 是否为推荐使用的核心支付方式 + */ + public boolean isCorePaymentType() { + return this == BALANCE || this == WECHAT || this == ALIPAY || this == UNION_PAY || + this == CASH || this == POS || this == FREE || this == POINTS; + } + + /** + * 是否为已废弃的支付方式 + */ + public boolean isDeprecated() { + return !isCorePaymentType(); + } + + @Override + public String toString() { + return String.format("PaymentType{code=%d, name='%s', channel='%s'}", code, name, channel); + } +} diff --git a/src/main/java/com/gxwebsoft/payment/exception/PaymentException.java b/src/main/java/com/gxwebsoft/payment/exception/PaymentException.java new file mode 100644 index 0000000..35d2ac3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/exception/PaymentException.java @@ -0,0 +1,221 @@ +package com.gxwebsoft.payment.exception; + +import com.gxwebsoft.payment.enums.PaymentType; + +/** + * 支付异常基类 + * 统一处理支付相关的业务异常 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +public class PaymentException extends Exception { + + private static final long serialVersionUID = 1L; + + /** + * 错误代码 + */ + private String errorCode; + + /** + * 支付类型 + */ + private PaymentType paymentType; + + /** + * 租户ID + */ + private Integer tenantId; + + /** + * 订单号 + */ + private String orderNo; + + public PaymentException(String message) { + super(message); + } + + public PaymentException(String message, Throwable cause) { + super(message, cause); + } + + public PaymentException(String errorCode, String message) { + super(message); + this.errorCode = errorCode; + } + + public PaymentException(String errorCode, String message, Throwable cause) { + super(message, cause); + this.errorCode = errorCode; + } + + public PaymentException(String errorCode, String message, PaymentType paymentType) { + super(message); + this.errorCode = errorCode; + this.paymentType = paymentType; + } + + public PaymentException(String errorCode, String message, PaymentType paymentType, Integer tenantId) { + super(message); + this.errorCode = errorCode; + this.paymentType = paymentType; + this.tenantId = tenantId; + } + + public PaymentException(String errorCode, String message, PaymentType paymentType, Integer tenantId, String orderNo) { + super(message); + this.errorCode = errorCode; + this.paymentType = paymentType; + this.tenantId = tenantId; + this.orderNo = orderNo; + } + + // Getters and Setters + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } + + public PaymentType getPaymentType() { + return paymentType; + } + + public void setPaymentType(PaymentType paymentType) { + this.paymentType = paymentType; + } + + public Integer getTenantId() { + return tenantId; + } + + public void setTenantId(Integer tenantId) { + this.tenantId = tenantId; + } + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("PaymentException{"); + if (errorCode != null) { + sb.append("errorCode='").append(errorCode).append("', "); + } + if (paymentType != null) { + sb.append("paymentType=").append(paymentType).append(", "); + } + if (tenantId != null) { + sb.append("tenantId=").append(tenantId).append(", "); + } + if (orderNo != null) { + sb.append("orderNo='").append(orderNo).append("', "); + } + sb.append("message='").append(getMessage()).append("'"); + sb.append("}"); + return sb.toString(); + } + + /** + * 支付错误代码常量 + */ + public static class ErrorCode { + /** 参数错误 */ + public static final String PARAM_ERROR = "PARAM_ERROR"; + /** 配置错误 */ + public static final String CONFIG_ERROR = "CONFIG_ERROR"; + /** 证书错误 */ + public static final String CERTIFICATE_ERROR = "CERTIFICATE_ERROR"; + /** 网络错误 */ + public static final String NETWORK_ERROR = "NETWORK_ERROR"; + /** 签名错误 */ + public static final String SIGNATURE_ERROR = "SIGNATURE_ERROR"; + /** 金额错误 */ + public static final String AMOUNT_ERROR = "AMOUNT_ERROR"; + /** 订单错误 */ + public static final String ORDER_ERROR = "ORDER_ERROR"; + /** 状态错误 */ + public static final String STATUS_ERROR = "STATUS_ERROR"; + /** 余额不足 */ + public static final String INSUFFICIENT_BALANCE = "INSUFFICIENT_BALANCE"; + /** 支付超时 */ + public static final String TIMEOUT_ERROR = "TIMEOUT_ERROR"; + /** 重复支付 */ + public static final String DUPLICATE_PAYMENT = "DUPLICATE_PAYMENT"; + /** 不支持的支付方式 */ + public static final String UNSUPPORTED_PAYMENT = "UNSUPPORTED_PAYMENT"; + /** 系统错误 */ + public static final String SYSTEM_ERROR = "SYSTEM_ERROR"; + } + + // 静态工厂方法 + public static PaymentException paramError(String message) { + return new PaymentException(ErrorCode.PARAM_ERROR, message); + } + + public static PaymentException configError(String message, PaymentType paymentType, Integer tenantId) { + return new PaymentException(ErrorCode.CONFIG_ERROR, message, paymentType, tenantId); + } + + public static PaymentException certificateError(String message, PaymentType paymentType) { + return new PaymentException(ErrorCode.CERTIFICATE_ERROR, message, paymentType); + } + + public static PaymentException networkError(String message, PaymentType paymentType, Throwable cause) { + return new PaymentException(ErrorCode.NETWORK_ERROR, message, cause); + } + + public static PaymentException signatureError(String message, PaymentType paymentType) { + return new PaymentException(ErrorCode.SIGNATURE_ERROR, message, paymentType); + } + + public static PaymentException amountError(String message) { + return new PaymentException(ErrorCode.AMOUNT_ERROR, message); + } + + public static PaymentException orderError(String message, String orderNo) { + PaymentException exception = new PaymentException(ErrorCode.ORDER_ERROR, message); + exception.setOrderNo(orderNo); + return exception; + } + + public static PaymentException statusError(String message, String orderNo) { + PaymentException exception = new PaymentException(ErrorCode.STATUS_ERROR, message); + exception.setOrderNo(orderNo); + return exception; + } + + public static PaymentException insufficientBalance(String message, Integer tenantId) { + return new PaymentException(ErrorCode.INSUFFICIENT_BALANCE, message, PaymentType.BALANCE, tenantId); + } + + public static PaymentException timeoutError(String message, PaymentType paymentType, String orderNo) { + PaymentException exception = new PaymentException(ErrorCode.TIMEOUT_ERROR, message, paymentType); + exception.setOrderNo(orderNo); + return exception; + } + + public static PaymentException duplicatePayment(String message, String orderNo) { + PaymentException exception = new PaymentException(ErrorCode.DUPLICATE_PAYMENT, message); + exception.setOrderNo(orderNo); + return exception; + } + + public static PaymentException unsupportedPayment(String message, PaymentType paymentType) { + return new PaymentException(ErrorCode.UNSUPPORTED_PAYMENT, message, paymentType); + } + + public static PaymentException systemError(String message, Throwable cause) { + return new PaymentException(ErrorCode.SYSTEM_ERROR, message, cause); + } +} diff --git a/src/main/java/com/gxwebsoft/payment/exception/PaymentExceptionHandler.java b/src/main/java/com/gxwebsoft/payment/exception/PaymentExceptionHandler.java new file mode 100644 index 0000000..04c6cda --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/exception/PaymentExceptionHandler.java @@ -0,0 +1,153 @@ +package com.gxwebsoft.payment.exception; + +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.payment.constants.PaymentConstants; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.validation.BindException; +import org.springframework.validation.FieldError; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 统一支付异常处理器 + * 处理所有支付相关的异常和参数验证异常 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +@Slf4j +@RestControllerAdvice(basePackages = {"com.gxwebsoft.payment.controller", "com.gxwebsoft.shop.controller"}) +public class PaymentExceptionHandler extends BaseController { + + /** + * 处理支付业务异常 + */ + @ExceptionHandler(PaymentException.class) + @ResponseStatus(HttpStatus.BAD_REQUEST) + public ApiResult handlePaymentException(PaymentException e) { + log.warn("支付业务异常: {}", e.getMessage()); + + // 记录详细的异常信息 + if (e.getTenantId() != null) { + log.warn("异常租户ID: {}", e.getTenantId()); + } + + if (e.getPaymentType() != null) { + log.warn("异常支付类型: {}", e.getPaymentType()); + } + + if (e.getOrderNo() != null) { + log.warn("异常订单号: {}", e.getOrderNo()); + } + + if (e.getErrorCode() != null) { + log.warn("错误代码: {}", e.getErrorCode()); + } + + return fail(e.getMessage()); + } + + + + /** + * 处理参数验证异常(@Valid注解) + */ + @ExceptionHandler(MethodArgumentNotValidException.class) + @ResponseStatus(HttpStatus.BAD_REQUEST) + public ApiResult handleMethodArgumentNotValidException(MethodArgumentNotValidException e) { + List fieldErrors = e.getBindingResult().getFieldErrors(); + + String errorMessage = fieldErrors.stream() + .map(error -> error.getField() + ": " + error.getDefaultMessage()) + .collect(Collectors.joining("; ")); + + log.warn("参数验证失败: {}", errorMessage); + + return fail(PaymentConstants.ErrorMessage.PARAM_ERROR + ": " + errorMessage); + } + + /** + * 处理绑定异常 + */ + @ExceptionHandler(BindException.class) + @ResponseStatus(HttpStatus.BAD_REQUEST) + public ApiResult handleBindException(BindException e) { + List fieldErrors = e.getBindingResult().getFieldErrors(); + + String errorMessage = fieldErrors.stream() + .map(error -> error.getField() + ": " + error.getDefaultMessage()) + .collect(Collectors.joining("; ")); + + log.warn("数据绑定失败: {}", errorMessage); + + return fail(PaymentConstants.ErrorMessage.PARAM_ERROR + ": " + errorMessage); + } + + /** + * 处理约束违反异常(@Validated注解) + */ + @ExceptionHandler(ConstraintViolationException.class) + @ResponseStatus(HttpStatus.BAD_REQUEST) + public ApiResult handleConstraintViolationException(ConstraintViolationException e) { + Set> violations = e.getConstraintViolations(); + + String errorMessage = violations.stream() + .map(violation -> violation.getPropertyPath() + ": " + violation.getMessage()) + .collect(Collectors.joining("; ")); + + log.warn("约束验证失败: {}", errorMessage); + + return fail(PaymentConstants.ErrorMessage.PARAM_ERROR + ": " + errorMessage); + } + + /** + * 处理非法参数异常 + */ + @ExceptionHandler(IllegalArgumentException.class) + @ResponseStatus(HttpStatus.BAD_REQUEST) + public ApiResult handleIllegalArgumentException(IllegalArgumentException e) { + log.warn("非法参数异常: {}", e.getMessage()); + return fail(PaymentConstants.ErrorMessage.PARAM_ERROR + ": " + e.getMessage()); + } + + /** + * 处理空指针异常 + */ + @ExceptionHandler(NullPointerException.class) + @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) + public ApiResult handleNullPointerException(NullPointerException e) { + log.error("空指针异常", e); + return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); + } + + /** + * 处理其他运行时异常 + */ + @ExceptionHandler(RuntimeException.class) + @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) + public ApiResult handleRuntimeException(RuntimeException e) { + log.error("运行时异常: {}", e.getMessage(), e); + return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); + } + + /** + * 处理其他异常 + */ + @ExceptionHandler(Exception.class) + @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) + public ApiResult handleException(Exception e) { + log.error("未知异常: {}", e.getMessage(), e); + return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); + } +} diff --git a/src/main/java/com/gxwebsoft/payment/service/PaymentService.java b/src/main/java/com/gxwebsoft/payment/service/PaymentService.java new file mode 100644 index 0000000..0f90fd5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/service/PaymentService.java @@ -0,0 +1,182 @@ +package com.gxwebsoft.payment.service; + +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.payment.dto.PaymentRequest; +import com.gxwebsoft.payment.dto.PaymentResponse; +import com.gxwebsoft.payment.dto.PaymentWithOrderRequest; +import com.gxwebsoft.payment.enums.PaymentType; +import com.gxwebsoft.payment.exception.PaymentException; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +/** + * 统一支付服务接口 + * 提供所有支付方式的统一入口 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +public interface PaymentService { + + /** + * 创建支付订单 + * + * @param request 支付请求 + * @return 支付响应 + * @throws PaymentException 支付创建失败时抛出 + */ + PaymentResponse createPayment(PaymentRequest request) throws PaymentException; + + /** + * 创建支付订单(包含订单信息) + * 统一支付模块:先创建订单,再发起支付 + * + * @param request 支付与订单创建请求 + * @param loginUser 当前登录用户 + * @return 支付响应 + * @throws PaymentException 创建失败时抛出 + */ + PaymentResponse createPaymentWithOrder(PaymentWithOrderRequest request, User loginUser) throws PaymentException; + + /** + * 查询支付状态 + * + * @param orderNo 订单号 + * @param paymentType 支付类型 + * @param tenantId 租户ID + * @return 支付响应 + * @throws PaymentException 查询失败时抛出 + */ + PaymentResponse queryPayment(String orderNo, PaymentType paymentType, Integer tenantId) throws PaymentException; + + /** + * 处理支付回调通知 + * + * @param paymentType 支付类型 + * @param headers 请求头 + * @param body 请求体 + * @param tenantId 租户ID + * @return 处理结果,返回给第三方的响应内容 + * @throws PaymentException 处理失败时抛出 + */ + String handlePaymentNotify(PaymentType paymentType, Map headers, String body, Integer tenantId) throws PaymentException; + + /** + * 申请退款 + * + * @param orderNo 订单号 + * @param refundNo 退款单号 + * @param paymentType 支付类型 + * @param totalAmount 订单总金额 + * @param refundAmount 退款金额 + * @param reason 退款原因 + * @param tenantId 租户ID + * @return 退款响应 + * @throws PaymentException 退款申请失败时抛出 + */ + PaymentResponse refund(String orderNo, String refundNo, PaymentType paymentType, + BigDecimal totalAmount, BigDecimal refundAmount, + String reason, Integer tenantId) throws PaymentException; + + /** + * 查询退款状态 + * + * @param refundNo 退款单号 + * @param paymentType 支付类型 + * @param tenantId 租户ID + * @return 退款查询响应 + * @throws PaymentException 查询失败时抛出 + */ + PaymentResponse queryRefund(String refundNo, PaymentType paymentType, Integer tenantId) throws PaymentException; + + /** + * 关闭订单 + * + * @param orderNo 订单号 + * @param paymentType 支付类型 + * @param tenantId 租户ID + * @return 关闭结果 + * @throws PaymentException 关闭失败时抛出 + */ + boolean closeOrder(String orderNo, PaymentType paymentType, Integer tenantId) throws PaymentException; + + /** + * 获取支持的支付类型列表 + * + * @return 支付类型列表 + */ + List getSupportedPaymentTypes(); + + /** + * 检查支付类型是否支持 + * + * @param paymentType 支付类型 + * @return true表示支持 + */ + boolean isPaymentTypeSupported(PaymentType paymentType); + + /** + * 检查支付类型是否支持退款 + * + * @param paymentType 支付类型 + * @return true表示支持退款 + */ + boolean isRefundSupported(PaymentType paymentType); + + /** + * 检查支付类型是否支持查询 + * + * @param paymentType 支付类型 + * @return true表示支持查询 + */ + boolean isQuerySupported(PaymentType paymentType); + + /** + * 检查支付类型是否支持关闭订单 + * + * @param paymentType 支付类型 + * @return true表示支持关闭订单 + */ + boolean isCloseSupported(PaymentType paymentType); + + /** + * 检查支付类型是否需要异步通知 + * + * @param paymentType 支付类型 + * @return true表示需要异步通知 + */ + boolean isNotifyNeeded(PaymentType paymentType); + + /** + * 验证支付请求参数 + * + * @param request 支付请求 + * @throws PaymentException 参数验证失败时抛出 + */ + void validatePaymentRequest(PaymentRequest request) throws PaymentException; + + /** + * 获取支付策略信息 + * + * @param paymentType 支付类型 + * @return 策略信息Map,包含策略名称、描述等 + */ + Map getPaymentStrategyInfo(PaymentType paymentType); + + /** + * 获取所有支付策略信息 + * + * @return 所有策略信息列表 + */ + List> getAllPaymentStrategyInfo(); + + /** + * 检查支付配置 + * + * @param tenantId 租户ID + * @return 配置检查结果 + */ + Map checkPaymentConfig(Integer tenantId); +} diff --git a/src/main/java/com/gxwebsoft/payment/service/WxPayConfigService.java b/src/main/java/com/gxwebsoft/payment/service/WxPayConfigService.java new file mode 100644 index 0000000..a681c3d --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/service/WxPayConfigService.java @@ -0,0 +1,365 @@ +package com.gxwebsoft.payment.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.config.CertificateProperties; +import com.gxwebsoft.common.core.service.CertificateService; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.utils.WxNativeUtil; +import com.gxwebsoft.common.system.entity.Payment; +import com.gxwebsoft.common.system.param.PaymentParam; +import com.gxwebsoft.common.system.service.PaymentService; +import com.gxwebsoft.payment.exception.PaymentException; +import com.gxwebsoft.payment.enums.PaymentType; +import com.wechat.pay.java.core.Config; +import com.wechat.pay.java.core.RSAAutoCertificateConfig; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.io.ClassPathResource; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.concurrent.TimeUnit; + +/** + * 微信支付配置服务 + * 负责管理微信支付的配置信息和证书 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +@Slf4j +@Service +public class WxPayConfigService { + + @Resource + private RedisUtil redisUtil; + + @Resource + private CertificateService certificateService; + + @Resource + private CertificateProperties certificateProperties; + + @Resource + private PaymentService paymentService; + + @Value("${spring.profiles.active:dev}") + private String activeProfile; + + /** + * 获取支付配置信息(Payment对象)- 公开方法 + * + * @param tenantId 租户ID + * @return 支付配置信息 + * @throws PaymentException 配置获取失败时抛出 + */ + public Payment getPaymentConfigForStrategy(Integer tenantId) throws PaymentException { + if (tenantId == null) { + throw PaymentException.paramError("租户ID不能为空"); + } + return getPaymentConfig(tenantId); + } + + /** + * 获取微信支付配置 + * + * @param tenantId 租户ID + * @return 微信支付配置 + * @throws PaymentException 配置获取失败时抛出 + */ + public Config getWxPayConfig(Integer tenantId) throws PaymentException { + if (tenantId == null) { + throw PaymentException.paramError("租户ID不能为空"); + } + + // 先从缓存获取已构建的配置 + Config cachedConfig = WxNativeUtil.getConfig(tenantId); + if (cachedConfig != null) { + log.debug("从缓存获取微信支付配置成功,租户ID: {}", tenantId); + return cachedConfig; + } + + // 构建新的配置 + Config newConfig = buildWxPayConfig(tenantId); + + // 缓存配置 + WxNativeUtil.addConfig(tenantId, newConfig); + log.info("微信支付配置创建并缓存成功,租户ID: {}", tenantId); + + return newConfig; + } + + /** + * 构建微信支付配置 + */ + private Config buildWxPayConfig(Integer tenantId) throws PaymentException { + try { + // 获取支付配置信息 + Payment payment = getPaymentConfig(tenantId); + + // 获取证书文件路径 + String certificatePath = getCertificatePath(tenantId, payment); + + // 创建微信支付配置对象 + return createWxPayConfig(payment, certificatePath); + + } catch (Exception e) { + if (e instanceof PaymentException) { + throw e; + } + throw PaymentException.systemError("构建微信支付配置失败: " + e.getMessage(), e); + } + } + + /** + * 获取支付配置信息 + * 优先从缓存获取,缓存没有则查询数据库,最后兜底到开发环境测试配置 + */ + private Payment getPaymentConfig(Integer tenantId) throws PaymentException { + String cacheKey = "Payment:1:" + tenantId; + Payment payment = redisUtil.get(cacheKey, Payment.class); + System.out.println("payment = " + payment); + if (payment != null) { + log.debug("从缓存获取支付配置成功,租户ID: {}", tenantId); + return payment; + } + + // 缓存中没有,尝试从数据库查询 + try { + final PaymentParam paymentParam = new PaymentParam(); + // 优先使用新的微信支付类型(1 = WECHAT) + paymentParam.setType(PaymentType.WECHAT.getCode()); + paymentParam.setTenantId(tenantId); + + log.debug("查询数据库支付配置,参数: type={}, tenantId={}", paymentParam.getType(), tenantId); + payment = paymentService.getByType(paymentParam); + log.debug("数据库查询结果: {}", payment != null ? "找到配置" : "未找到配置"); + + // 兼容旧数据:如果没有查到,再尝试旧的微信Native类型(102) + if (payment == null) { + paymentParam.setType(PaymentType.WECHAT_NATIVE.getCode()); + log.debug("未找到type=1配置,尝试兼容旧type={}, tenantId={}", paymentParam.getType(), tenantId); + payment = paymentService.getByType(paymentParam); + log.debug("兼容查询结果: {}", payment != null ? "找到配置" : "未找到配置"); + } + + if (payment != null) { + log.info("从数据库获取支付配置成功,租户ID: {},将缓存配置", tenantId); + + // 开发环境下,如果apiclientKey为空,设置默认值 + if ("dev".equals(activeProfile) && + (payment.getApiclientKey() == null || payment.getApiclientKey().trim().isEmpty())) { + log.warn("开发环境:数据库配置中apiclientKey为空,使用默认值,租户ID: {}", tenantId); + payment.setApiclientKey("apiclient_key.pem"); + } + + // 将查询到的配置缓存起来,缓存1天 + redisUtil.set(cacheKey, payment, 1L, TimeUnit.DAYS); + return payment; + } else { + log.warn("数据库中未找到支付配置,租户ID: {},已尝试type=1和type=102", tenantId); + } + } catch (Exception e) { + log.error("从数据库查询支付配置失败,租户ID: {},错误: {}", tenantId, e.getMessage(), e); + // 抛出更详细的异常信息 + throw PaymentException.systemError("查询支付配置失败,租户ID: " + tenantId + ",错误: " + e.getMessage(), e); + } + + // 数据库也没有配置 + if (!"dev".equals(activeProfile)) { + throw PaymentException.systemError("微信支付配置未找到,租户ID: " + tenantId + ",请检查数据库配置", null); + } + + log.debug("开发环境模式,将使用测试配置,租户ID: {}", tenantId); + // 开发环境返回测试Payment配置 + return createDevTestPayment(tenantId); + } + + /** + * 获取证书文件路径 + */ + private String getCertificatePath(Integer tenantId, Payment payment) throws PaymentException { + if ("dev".equals(activeProfile)) { + return getDevCertificatePath(tenantId); + } else { + return getProdCertificatePath(payment); + } + } + + /** + * 获取开发环境证书路径 + */ + private String getDevCertificatePath(Integer tenantId) throws PaymentException { + try { + // 根据租户ID构建证书路径 + String certPath = "dev/wechat/" + tenantId + "/apiclient_key.pem"; + ClassPathResource resource = new ClassPathResource(certPath); + + if (!resource.exists()) { + throw PaymentException.systemError("开发环境微信支付证书文件不存在: " + certPath, null); + } + + String absolutePath = resource.getFile().getAbsolutePath(); + log.debug("开发环境证书路径: {}", absolutePath); + return absolutePath; + + } catch (IOException e) { + throw PaymentException.systemError("获取开发环境证书路径失败: " + e.getMessage(), e); + } + } + + /** + * 获取生产环境证书路径 + */ + private String getProdCertificatePath(Payment payment) throws PaymentException { + if (payment == null || payment.getApiclientKey() == null || payment.getApiclientKey().trim().isEmpty()) { + throw PaymentException.systemError("生产环境支付配置或证书密钥文件为空", null); + } + + try { + // 使用微信支付证书路径 + String certificatePath = certificateService.getWechatPayCertPath(payment.getApiclientKey()); + if (certificatePath == null) { + throw PaymentException.systemError("证书文件路径获取失败,证书文件: " + payment.getApiclientKey(), null); + } + + log.debug("生产环境证书路径: {}", certificatePath); + return certificatePath; + + } catch (Exception e) { + throw PaymentException.systemError("获取生产环境证书路径失败: " + e.getMessage(), e); + } + } + + /** + * 创建微信支付配置对象 + */ + private Config createWxPayConfig(Payment payment, String certificatePath) throws PaymentException { + try { + if ("dev".equals(activeProfile) && payment == null) { + // 开发环境测试配置 + return createDevTestConfig(certificatePath); + } else if (payment != null) { + // 正常配置 + return createNormalConfig(payment, certificatePath); + } else { + throw PaymentException.systemError("无法创建微信支付配置:配置信息不完整", null); + } + } catch (Exception e) { + if (e instanceof PaymentException) { + throw e; + } + throw PaymentException.systemError("创建微信支付配置对象失败: " + e.getMessage(), e); + } + } + + /** + * 创建开发环境测试Payment配置 + */ + private Payment createDevTestPayment(Integer tenantId) { + Payment testPayment = new Payment(); + testPayment.setTenantId(tenantId); + testPayment.setType(102); // Native支付 + testPayment.setAppId("wxa67c676fc445590e"); // 开发环境测试AppID + testPayment.setMchId("1723321338"); // 租户10550的商户号 + testPayment.setMerchantSerialNumber("2B933F7C35014A1C363642623E4A62364B34C4EB"); // 证书序列号 + testPayment.setApiKey(certificateProperties.getWechatPay().getDev().getApiV3Key()); + testPayment.setApiclientKey("apiclient_key.pem"); // 设置证书文件名 + testPayment.setNotifyUrl("http://frps-10550.s209.websoft.top/api/payment/notify"); + testPayment.setName("微信Native支付-开发环境"); + testPayment.setStatus(true); // 启用 + + log.info("创建开发环境测试Payment配置,租户ID: {}, AppID: {}, 商户号: {}", + tenantId, testPayment.getAppId(), testPayment.getMchId()); + + return testPayment; + } + + /** + * 创建开发环境测试配置 + */ + private Config createDevTestConfig(String certificatePath) throws PaymentException { + String testMerchantId = "1723321338"; // 租户10550的商户号 + String testMerchantSerialNumber = "2B933F7C35014A1C363642623E4A62364B34C4EB"; // 证书序列号 + String testApiV3Key = certificateProperties.getWechatPay().getDev().getApiV3Key(); + + if (testApiV3Key == null || testApiV3Key.trim().isEmpty()) { + throw PaymentException.systemError("开发环境APIv3密钥未配置", null); + } + + log.info("使用开发环境测试配置"); + log.info("测试商户号: {}", testMerchantId); + log.info("测试序列号: {}", testMerchantSerialNumber); + log.info("证书路径: {}", certificatePath); + log.info("APIv3密钥长度: {}", testApiV3Key.length()); + + return new RSAAutoCertificateConfig.Builder() + .merchantId(testMerchantId) + .privateKeyFromPath(certificatePath) + .merchantSerialNumber(testMerchantSerialNumber) + .apiV3Key(testApiV3Key) + .build(); + } + + /** + * 创建正常配置 + */ + private Config createNormalConfig(Payment payment, String certificatePath) throws PaymentException { + // 验证配置完整性 + validatePaymentConfig(payment); + + log.info("使用数据库支付配置"); + log.debug("商户号: {}", payment.getMchId()); + + return new RSAAutoCertificateConfig.Builder() + .merchantId(payment.getMchId()) + .privateKeyFromPath(certificatePath) + .merchantSerialNumber(payment.getMerchantSerialNumber()) + .apiV3Key(payment.getApiKey()) + .build(); + } + + /** + * 验证支付配置完整性 + */ + private void validatePaymentConfig(Payment payment) throws PaymentException { + if (payment == null) { + throw PaymentException.systemError("支付配置为空", null); + } + + if (payment.getMchId() == null || payment.getMchId().trim().isEmpty()) { + throw PaymentException.systemError("商户号(mchId)未配置", null); + } + + if (payment.getMerchantSerialNumber() == null || payment.getMerchantSerialNumber().trim().isEmpty()) { + throw PaymentException.systemError("商户证书序列号(merchantSerialNumber)未配置", null); + } + + if (payment.getApiKey() == null || payment.getApiKey().trim().isEmpty()) { + throw PaymentException.systemError("APIv3密钥(apiKey)未配置", null); + } + + // 开发环境下,如果apiclientKey为空,给一个警告但不抛异常 + // 生产环境必须有apiclientKey + if (payment.getApiclientKey() == null || payment.getApiclientKey().trim().isEmpty()) { + if ("dev".equals(activeProfile)) { + log.warn("开发环境:证书文件名(apiclientKey)未配置,将使用默认值"); + } else { + throw PaymentException.systemError("证书文件名(apiclientKey)未配置", null); + } + } + + log.debug("支付配置验证通过,租户ID: {}, 商户号: {}", payment.getTenantId(), payment.getMchId()); + } + + /** + * 清除指定租户的配置缓存 + * + * @param tenantId 租户ID + */ + public void clearConfigCache(Integer tenantId) { + WxNativeUtil.addConfig(tenantId, null); + log.info("清除微信支付配置缓存,租户ID: {}", tenantId); + } +} diff --git a/src/main/java/com/gxwebsoft/payment/service/WxPayNotifyService.java b/src/main/java/com/gxwebsoft/payment/service/WxPayNotifyService.java new file mode 100644 index 0000000..9378dcd --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/service/WxPayNotifyService.java @@ -0,0 +1,366 @@ +package com.gxwebsoft.payment.service; + + +import com.gxwebsoft.payment.constants.PaymentConstants; +import com.gxwebsoft.payment.exception.PaymentException; +import com.gxwebsoft.shop.entity.ShopOrder; +import com.gxwebsoft.shop.service.ShopOrderService; +import com.wechat.pay.java.core.Config; +import com.wechat.pay.java.core.notification.NotificationConfig; +import com.wechat.pay.java.core.notification.NotificationParser; +import com.wechat.pay.java.core.notification.RequestParam; +import com.wechat.pay.java.service.payments.model.Transaction; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.Map; + +/** + * 微信支付回调通知处理服务 + * 负责处理微信支付的异步通知回调 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +@Slf4j +@Service +public class WxPayNotifyService { + + @Resource + private WxPayConfigService wxPayConfigService; + + @Resource + private ShopOrderService shopOrderService; + + /** + * 处理微信支付回调通知 + * + * @param headers 请求头 + * @param body 请求体 + * @param tenantId 租户ID + * @return 处理结果响应 + */ + public String handlePaymentNotify(Map headers, String body, Integer tenantId) { + log.info("{}, 租户ID: {}", PaymentConstants.LogMessage.NOTIFY_START, tenantId); + + try { + // 参数验证 + validateNotifyParams(headers, body, tenantId); + + // 获取微信支付配置 + Config wxPayConfig = wxPayConfigService.getWxPayConfig(tenantId); + + // 解析并验证回调数据 + Transaction transaction = parseAndVerifyNotification(headers, body, wxPayConfig); + + // 处理支付结果 + processPaymentResult(transaction, tenantId); + + log.info("{}, 租户ID: {}, 订单号: {}", + PaymentConstants.LogMessage.NOTIFY_SUCCESS, tenantId, transaction.getOutTradeNo()); + + return "SUCCESS"; + + } catch (Exception e) { + log.error("{}, 租户ID: {}, 错误: {}", + PaymentConstants.LogMessage.NOTIFY_FAILED, tenantId, e.getMessage(), e); + return "FAIL"; + } + } + + /** + * 验证回调通知参数 + */ + private void validateNotifyParams(Map headers, String body, Integer tenantId) throws PaymentException { + if (tenantId == null) { + throw PaymentException.paramError("租户ID不能为空"); + } + + if (headers == null || headers.isEmpty()) { + throw PaymentException.paramError("请求头不能为空"); + } + + if (!StringUtils.hasText(body)) { + throw PaymentException.paramError("请求体不能为空"); + } + + // 验证必要的微信支付头部信息 + String signature = headers.get("Wechatpay-Signature"); + String timestamp = headers.get("Wechatpay-Timestamp"); + String nonce = headers.get("Wechatpay-Nonce"); + String serial = headers.get("Wechatpay-Serial"); + + if (!StringUtils.hasText(signature)) { + throw PaymentException.paramError("微信支付签名不能为空"); + } + + if (!StringUtils.hasText(timestamp)) { + throw PaymentException.paramError("微信支付时间戳不能为空"); + } + + if (!StringUtils.hasText(nonce)) { + throw PaymentException.paramError("微信支付随机数不能为空"); + } + + if (!StringUtils.hasText(serial)) { + throw PaymentException.paramError("微信支付序列号不能为空"); + } + + log.debug("回调通知参数验证通过, 租户ID: {}", tenantId); + } + + /** + * 解析并验证回调通知 + */ + private Transaction parseAndVerifyNotification(Map headers, String body, Config wxPayConfig) throws PaymentException { + if (wxPayConfig == null) { + throw PaymentException.systemError("微信支付配置为空", null); + } + + try { + // 构建请求参数 + RequestParam requestParam = new RequestParam.Builder() + .serialNumber(headers.get("Wechatpay-Serial")) + .nonce(headers.get("Wechatpay-Nonce")) + .signature(headers.get("Wechatpay-Signature")) + .timestamp(headers.get("Wechatpay-Timestamp")) + .body(body) + .build(); + + // 创建通知解析器 + NotificationParser parser = new NotificationParser((NotificationConfig) wxPayConfig); + + // 解析并验证通知 + Transaction transaction = parser.parse(requestParam, Transaction.class); + + if (transaction == null) { + throw PaymentException.systemError("解析回调通知失败:transaction为空", null); + } + + log.debug("回调通知解析成功, 订单号: {}, 交易状态: {}", + transaction.getOutTradeNo(), transaction.getTradeState()); + + return transaction; + + } catch (Exception e) { + if (e instanceof PaymentException) { + throw e; + } + throw PaymentException.systemError("解析回调通知失败: " + e.getMessage(), e); + } + } + + /** + * 处理支付结果 + */ + private void processPaymentResult(Transaction transaction, Integer tenantId) throws PaymentException { + String outTradeNo = transaction.getOutTradeNo(); + String tradeState = String.valueOf(transaction.getTradeState()); + + if (!StringUtils.hasText(outTradeNo)) { + throw PaymentException.paramError("商户订单号不能为空"); + } + + // 查询订单 + ShopOrder order = shopOrderService.getByOutTradeNo(outTradeNo); + if (order == null) { + throw PaymentException.systemError("订单不存在: " + outTradeNo, null); + } + + // 验证租户ID + if (!tenantId.equals(order.getTenantId())) { + throw PaymentException.paramError("订单租户ID不匹配"); + } + + // 验证订单状态 - 使用Boolean类型的payStatus字段 + if (Boolean.TRUE.equals(order.getPayStatus())) { + log.info("订单已支付,跳过处理, 订单号: {}", outTradeNo); + return; + } + + // 根据交易状态处理 + switch (tradeState) { + case "SUCCESS": + handlePaymentSuccess(order, transaction); + break; + case "REFUND": + handlePaymentRefund(order, transaction); + break; + case "CLOSED": + case "REVOKED": + case "PAYERROR": + handlePaymentFailed(order, transaction); + break; + default: + log.warn("未处理的交易状态: {}, 订单号: {}", tradeState, outTradeNo); + break; + } + } + + /** + * 处理支付成功 + */ + private void handlePaymentSuccess(ShopOrder order, Transaction transaction) throws PaymentException { + try { + // 验证金额 + validateAmount(order, transaction); + + // 更新订单状态 + order.setPayStatus(true); // 使用Boolean类型 + order.setTransactionId(transaction.getTransactionId()); + order.setPayTime(LocalDateTime.parse(transaction.getSuccessTime())); + + // 使用专门的更新方法,会触发支付成功后的业务逻辑 + shopOrderService.updateByOutTradeNo(order); + + // 推送支付结果通知 + pushPaymentNotification(order, transaction); + + log.info("支付成功处理完成, 订单号: {}, 微信交易号: {}", + order.getOrderNo(), transaction.getTransactionId()); + + } catch (Exception e) { + throw PaymentException.systemError("处理支付成功回调失败: " + e.getMessage(), e); + } + } + + /** + * 处理支付退款 + */ + private void handlePaymentRefund(ShopOrder order, Transaction transaction) throws PaymentException { + try { + log.info("处理支付退款, 订单号: {}, 微信交易号: {}", + order.getOrderNo(), transaction.getTransactionId()); + + // 这里可以添加退款相关的业务逻辑 + // 例如:更新订单状态、处理库存、发送通知等 + + } catch (Exception e) { + throw PaymentException.systemError("处理支付退款回调失败: " + e.getMessage(), e); + } + } + + /** + * 处理支付失败 + */ + private void handlePaymentFailed(ShopOrder order, Transaction transaction) throws PaymentException { + try { + log.info("处理支付失败, 订单号: {}, 交易状态: {}", + order.getOrderNo(), transaction.getTradeState()); + + // 这里可以添加支付失败相关的业务逻辑 + // 例如:释放库存、发送通知等 + + } catch (Exception e) { + throw PaymentException.systemError("处理支付失败回调失败: " + e.getMessage(), e); + } + } + + /** + * 验证支付金额 + */ + private void validateAmount(ShopOrder order, Transaction transaction) throws PaymentException { + if (transaction.getAmount() == null || transaction.getAmount().getTotal() == null) { + throw PaymentException.amountError("回调通知中金额信息为空"); + } + + // 将订单金额转换为分 + BigDecimal orderAmount = order.getMoney(); + if (orderAmount == null) { + throw PaymentException.amountError("订单金额为空"); + } + + int orderAmountFen = orderAmount.multiply(new BigDecimal(100)).intValue(); + int callbackAmountFen = transaction.getAmount().getTotal(); + + if (orderAmountFen != callbackAmountFen) { + throw PaymentException.amountError( + String.format("订单金额不匹配,订单金额: %d分, 回调金额: %d分", + orderAmountFen, callbackAmountFen)); + } + + log.debug("金额验证通过, 订单号: {}, 金额: {}分", order.getOrderNo(), orderAmountFen); + } + + /** + * 推送支付结果通知 + */ + private void pushPaymentNotification(ShopOrder order, Transaction transaction) { + try { + log.info("开始推送支付成功通知, 订单号: {}, 交易号: {}, 用户ID: {}", + order.getOrderNo(), transaction.getTransactionId(), order.getUserId()); + + // 1. 记录支付成功日志 + logPaymentSuccess(order, transaction); + + // 2. 发送支付成功通知(可扩展) + sendPaymentSuccessNotification(order, transaction); + + // 3. 触发其他业务逻辑(可扩展) + triggerPostPaymentActions(order, transaction); + + log.info("支付结果通知推送完成, 订单号: {}, 交易号: {}", + order.getOrderNo(), transaction.getTransactionId()); + } catch (Exception e) { + log.warn("支付结果通知推送失败, 订单号: {}, 错误: {}", order.getOrderNo(), e.getMessage()); + // 推送失败不影响主流程,只记录日志 + } + } + + /** + * 记录支付成功日志 + */ + private void logPaymentSuccess(ShopOrder order, Transaction transaction) { + try { + log.info("=== 支付成功详细信息 ==="); + log.info("订单号: {}", order.getOrderNo()); + log.info("微信交易号: {}", transaction.getTransactionId()); + log.info("支付金额: {}元", order.getPayPrice()); + log.info("支付时间: {}", transaction.getSuccessTime()); + log.info("用户ID: {}", order.getUserId()); + log.info("租户ID: {}", order.getTenantId()); + log.info("订单标题: {}", order.getTitle()); + log.info("========================"); + } catch (Exception e) { + log.warn("记录支付成功日志失败: {}", e.getMessage()); + } + } + + /** + * 发送支付成功通知 + */ + private void sendPaymentSuccessNotification(ShopOrder order, Transaction transaction) { + try { + // TODO: 实现具体的通知逻辑 + // 1. 发送邮件通知 + // 2. 发送短信通知 + // 3. 站内消息通知 + // 4. 微信模板消息通知 + + log.debug("支付成功通知发送完成, 订单号: {}", order.getOrderNo()); + } catch (Exception e) { + log.warn("发送支付成功通知失败, 订单号: {}, 错误: {}", order.getOrderNo(), e.getMessage()); + } + } + + /** + * 触发支付成功后的其他业务逻辑 + */ + private void triggerPostPaymentActions(ShopOrder order, Transaction transaction) { + try { + // TODO: 根据业务需求实现 + // 1. 开通网站服务 + // 2. 激活会员权益 + // 3. 发放积分奖励 + // 4. 触发营销活动 + + log.debug("支付后业务逻辑触发完成, 订单号: {}", order.getOrderNo()); + } catch (Exception e) { + log.warn("触发支付后业务逻辑失败, 订单号: {}, 错误: {}", order.getOrderNo(), e.getMessage()); + } + } +} diff --git a/src/main/java/com/gxwebsoft/payment/service/WxTransferService.java b/src/main/java/com/gxwebsoft/payment/service/WxTransferService.java new file mode 100644 index 0000000..a8565c9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/service/WxTransferService.java @@ -0,0 +1,304 @@ +package com.gxwebsoft.payment.service; + +import cn.hutool.core.util.StrUtil; +import com.gxwebsoft.common.system.entity.Payment; +import com.gxwebsoft.payment.exception.PaymentException; +import com.wechat.pay.java.core.Config; +import com.wechat.pay.java.core.cipher.PrivacyEncryptor; +import com.wechat.pay.java.core.http.Constant; +import com.wechat.pay.java.core.http.DefaultHttpClientBuilder; +import com.wechat.pay.java.core.http.HttpClient; +import com.wechat.pay.java.core.http.HttpHeaders; +import com.wechat.pay.java.core.http.HttpMethod; +import com.wechat.pay.java.core.http.HttpRequest; +import com.wechat.pay.java.core.http.HttpResponse; +import com.wechat.pay.java.core.http.JsonRequestBody; +import com.wechat.pay.java.core.http.MediaType; +import com.wechat.pay.java.core.exception.ServiceException; +import com.wechat.pay.java.core.util.GsonUtil; +import com.google.gson.annotations.SerializedName; +import com.google.gson.reflect.TypeToken; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.lang.reflect.Type; +import java.util.List; + +/** + * 微信支付-商家转账到零钱封装 + * + * 注意:部分商户号开通了“商家转账(升级版)”后,会被微信侧限制使用旧版“批量转账到零钱”接口(/v3/transfer/batches), + * 需改用升级版接口(/v3/fund-app/mch-transfer/transfer-bills)。 + */ +@Slf4j +@Service +public class WxTransferService { + + // 商家转账(升级版)接口在 fund-app 域下 + private static final String TRANSFER_BILLS_API = + "https://api.mch.weixin.qq.com/v3/fund-app/mch-transfer/transfer-bills"; + // 兼容少数文档/环境差异:如 fund-app 路径不可用时,尝试该路径(仅在 404 时重试) + private static final String TRANSFER_BILLS_API_FALLBACK = + "https://api.mch.weixin.qq.com/v3/transfer/bills"; + + @Resource + private WxPayConfigService wxPayConfigService; + + /** + * 商家转账(升级版)场景ID。直连模式下在“产品中心-商家转账”配置后获得。 + */ + @Value("${wechatpay.transfer.scene-id:1005}") + private String transferSceneId; + + /** + * 转账场景报备信息(升级版必填项之一,内容需与商户平台该 transfer_scene_id 的报备信息对应)。 + * + * 配置示例(YAML): + * wechatpay: + * transfer: + * scene-report-infos-json: '[{"info_type":"...","info_content":"..."}]' + */ + @Value("${wechatpay.transfer.scene-report-infos-json:}") + private String transferSceneReportInfosJson; + + /** + * 发起单笔“商家转账到零钱”(升级版接口 /v3/fund-app/mch-transfer/transfer-bills)。 + * + * 默认:不需要用户在小程序确认页二次确认(直接受理转账)。 + * + * @param tenantId 租户ID(用于获取微信支付配置) + * @param openid 收款用户openid(必须是该appid下的openid) + * @param amountYuan 转账金额(单位:元) + * @param outBillNo 商家单号(字母/数字,商户内唯一) + * @param remark 备注(<=32字符) + * @param userName 收款用户姓名(可选;金额>=2000元时强制要求) + */ + public TransferBillsResponse initiateSingleTransfer(Integer tenantId, + String openid, + BigDecimal amountYuan, + String outBillNo, + String remark, + String userName) throws PaymentException { + return initiateSingleTransferInternal(tenantId, openid, amountYuan, outBillNo, remark, userName); + } + + /** + * 发起单笔“商家转账到零钱(小程序前端拉起收款确认页)”。 + * + * 返回的 response.packageInfo(JSON 字段 package_info)用于小程序端调用 wx.requestMerchantTransfer。 + */ + public TransferBillsResponse initiateSingleTransferWithUserConfirm(Integer tenantId, + String openid, + BigDecimal amountYuan, + String outBillNo, + String remark, + String userName) throws PaymentException { + // 注意:微信侧会严格校验请求体字段,传入未定义字段(如 user_confirm)会直接 400(PARAM_ERROR)。 + // 此处不再向请求体写入 user_confirm,仅保留该方法用于兼容调用方(若微信侧返回 package_info,可供小程序拉起确认页)。 + return initiateSingleTransferInternal(tenantId, openid, amountYuan, outBillNo, remark, userName); + } + + private TransferBillsResponse initiateSingleTransferInternal(Integer tenantId, + String openid, + BigDecimal amountYuan, + String outBillNo, + String remark, + String userName) throws PaymentException { + + if (tenantId == null) { + throw PaymentException.paramError("租户ID不能为空"); + } + if (StrUtil.isBlank(openid)) { + throw PaymentException.paramError("收款用户openid不能为空"); + } + if (amountYuan == null || amountYuan.compareTo(BigDecimal.ZERO) <= 0) { + throw PaymentException.amountError("转账金额必须大于0"); + } + if (StrUtil.isBlank(transferSceneId)) { + throw PaymentException.paramError("transfer_scene_id未配置,无法发起商家转账(升级版)"); + } + if (StrUtil.isBlank(outBillNo) || !outBillNo.matches("^[0-9A-Za-z]+$")) { + throw PaymentException.paramError("outBillNo不合法(仅允许数字/大小写字母)"); + } + // 保守校验:多数微信单号字段限制在 5-32(你此前 out_batch_no 也是 5-32) + if (outBillNo.length() < 5 || outBillNo.length() > 32) { + throw PaymentException.paramError("outBillNo长度不合法(要求 5-32)"); + } + + // 微信要求金额单位为“分”,必须为整数 + long amountFen = amountYuan + .movePointRight(2) + .setScale(0, RoundingMode.HALF_UP) + .longValueExact(); + + if (amountFen <= 0) { + throw PaymentException.amountError("转账金额换算为分后必须大于0"); + } + + // 金额 >= 2000 元时,必须传收款用户姓名;金额 < 0.3 元时,不允许传姓名 + boolean needUserName = amountFen >= 2000L * 100L; + boolean forbidUserName = amountFen < 30L; + if (needUserName && StrUtil.isBlank(userName)) { + throw PaymentException.paramError("转账金额>=2000元时必须提供收款用户姓名"); + } + if (forbidUserName) { + userName = null; + } + + // 升级版接口必填:transfer_scene_report_infos(且必须与 transfer_scene_id 的报备信息一致) + List sceneReportInfos = parseTransferSceneReportInfos(); + if (sceneReportInfos == null + || sceneReportInfos.isEmpty() + || sceneReportInfos.stream().anyMatch(i -> i == null + || StrUtil.isBlank(i.getInfoType()) + || StrUtil.isBlank(i.getInfoContent()))) { + throw PaymentException.paramError( + "未传入完整且对应的转账场景报备信息:请在配置中设置 wechatpay.transfer.scene-report-infos-json(需与 transfer_scene_id=" + + transferSceneId + " 的报备信息一致)"); + } + + Payment paymentConfig = wxPayConfigService.getPaymentConfigForStrategy(tenantId); + Config wxPayConfig = wxPayConfigService.getWxPayConfig(tenantId); + + try { + HttpClient httpClient = new DefaultHttpClientBuilder().config(wxPayConfig).build(); + PrivacyEncryptor encryptor = wxPayConfig.createEncryptor(); + + TransferBillsRequest request = new TransferBillsRequest(); + request.setAppid(paymentConfig.getAppId()); + request.setOutBillNo(outBillNo); + request.setTransferSceneId(transferSceneId); + request.setOpenid(openid); + request.setTransferAmount(amountFen); + request.setTransferRemark(limitLen(remark, 32)); + request.setTransferSceneReportInfos(sceneReportInfos); + log.debug("微信商家转账(升级版)请求参数: tenantId={}, outBillNo={}, transferSceneId={}, sceneReportInfosCount={}", + tenantId, outBillNo, transferSceneId, sceneReportInfos.size()); + + // 可选:转账结果通知地址(必须 https) + if (StrUtil.isNotBlank(paymentConfig.getNotifyUrl()) && paymentConfig.getNotifyUrl().startsWith("https://")) { + request.setNotifyUrl(paymentConfig.getNotifyUrl()); + } + + // 需要姓名时按平台证书加密,并带上 Wechatpay-Serial + if (StrUtil.isNotBlank(userName)) { + request.setUserName(encryptor.encrypt(userName)); + } + + HttpHeaders headers = new HttpHeaders(); + headers.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue()); + headers.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue()); + headers.addHeader(Constant.WECHAT_PAY_SERIAL, encryptor.getWechatpaySerial()); + + HttpRequest httpRequest = buildTransferBillsHttpRequest(TRANSFER_BILLS_API, headers, request); + HttpResponse httpResponse; + try { + httpResponse = httpClient.execute(httpRequest, TransferBillsResponse.class); + } catch (ServiceException se) { + // 404 且无 body 通常意味着接口路径不正确;做一次兜底重试。 + if (se.getHttpStatusCode() == 404) { + log.warn("商家转账接口返回404,尝试fallback路径: tenantId={}, outBillNo={}, url={}", + tenantId, outBillNo, TRANSFER_BILLS_API_FALLBACK); + HttpRequest fallbackReq = buildTransferBillsHttpRequest(TRANSFER_BILLS_API_FALLBACK, headers, request); + httpResponse = httpClient.execute(fallbackReq, TransferBillsResponse.class); + } else if (se.getHttpStatusCode() == 400 + && "PARAM_ERROR".equals(se.getErrorCode()) + && se.getErrorMessage() != null + && se.getErrorMessage().contains("转账场景报备信息")) { + // 常见:升级版商家转账需带 transfer_scene_report_infos,且内容必须与商户平台场景报备一致 + throw PaymentException.paramError( + "未传入完整且对应的转账场景报备信息:请在配置中设置 wechatpay.transfer.scene-report-infos-json(需与 transfer_scene_id=" + + transferSceneId + " 的报备信息一致)"); + } else { + throw se; + } + } + TransferBillsResponse response = httpResponse.getServiceResponse(); + log.info("微信商家转账已受理(升级版): tenantId={}, outBillNo={}, transferBillNo={}, state={}", + tenantId, outBillNo, + response != null ? response.getTransferBillNo() : null, + response != null ? response.getState() : null); + return response; + } catch (PaymentException e) { + // 业务/参数错误保持原样抛出,避免被包装成 systemError + throw e; + } catch (Exception e) { + log.error("微信商家转账失败(升级版): tenantId={}, outBillNo={}, openid={}, amountFen={}, err={}", + tenantId, outBillNo, openid, amountFen, e.getMessage(), e); + throw PaymentException.systemError("微信商家转账失败: " + e.getMessage(), e); + } + } + + private static String limitLen(String s, int maxLen) { + if (s == null) { + return null; + } + if (s.length() <= maxLen) { + return s; + } + return s.substring(0, maxLen); + } + + private static HttpRequest buildTransferBillsHttpRequest(String url, HttpHeaders headers, TransferBillsRequest request) { + return new HttpRequest.Builder() + .httpMethod(HttpMethod.POST) + .url(url) + .headers(headers) + .body(new JsonRequestBody.Builder().body(GsonUtil.toJson(request)).build()) + .build(); + } + + private List parseTransferSceneReportInfos() throws PaymentException { + if (StrUtil.isBlank(transferSceneReportInfosJson)) { + return null; + } + try { + Type t = new TypeToken>() {}.getType(); + return GsonUtil.getGson().fromJson(transferSceneReportInfosJson, t); + } catch (Exception e) { + throw PaymentException.paramError("转账场景报备信息配置解析失败:wechatpay.transfer.scene-report-infos-json"); + } + } + + /** + * 商家转账(升级版)请求体:POST /v3/fund-app/mch-transfer/transfer-bills + * 字段命名使用 GsonUtil 的 lower_case_with_underscores 策略自动转换。 + */ + @lombok.Data + private static class TransferBillsRequest { + private String appid; + private String outBillNo; + private String transferSceneId; + private String openid; + private Long transferAmount; + private String transferRemark; + private String userName; + private String notifyUrl; + private List transferSceneReportInfos; + } + + @lombok.Data + private static class TransferSceneReportInfo { + @SerializedName(value = "info_type", alternate = {"infoType"}) + private String infoType; + @SerializedName(value = "info_content", alternate = {"infoContent"}) + private String infoContent; + } + + /** + * 商家转账(升级版)响应体(按需字段) + */ + @lombok.Data + public static class TransferBillsResponse { + private String outBillNo; + private String transferBillNo; + private String createTime; + private String state; + @SerializedName(value = "package_info", alternate = {"packageInfo"}) + private String packageInfo; + } +} diff --git a/src/main/java/com/gxwebsoft/payment/service/impl/PaymentServiceImpl.java b/src/main/java/com/gxwebsoft/payment/service/impl/PaymentServiceImpl.java new file mode 100644 index 0000000..a01dafe --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/service/impl/PaymentServiceImpl.java @@ -0,0 +1,675 @@ +package com.gxwebsoft.payment.service.impl; + +import cn.hutool.core.util.IdUtil; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.payment.constants.PaymentConstants; +import com.gxwebsoft.payment.dto.PaymentRequest; +import com.gxwebsoft.payment.dto.PaymentResponse; +import com.gxwebsoft.payment.dto.PaymentWithOrderRequest; +import com.gxwebsoft.payment.enums.PaymentType; +import com.gxwebsoft.payment.exception.PaymentException; +import com.gxwebsoft.payment.service.PaymentService; +import com.gxwebsoft.payment.service.WxPayConfigService; +import com.gxwebsoft.payment.strategy.PaymentStrategy; +import com.gxwebsoft.shop.dto.OrderCreateRequest; +import com.gxwebsoft.shop.service.OrderBusinessService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import javax.annotation.PostConstruct; +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; + +/** + * 统一支付服务实现 + * 基于策略模式实现多种支付方式的统一管理 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +@Slf4j +@Service("unifiedPaymentServiceImpl") +public class PaymentServiceImpl implements PaymentService { + + /** + * 支付策略映射表 + */ + private final Map strategyMap = new ConcurrentHashMap<>(); + + /** + * 注入所有支付策略实现 + */ + @Resource + private List paymentStrategies; + + /** + * 订单业务服务 + */ + @Resource + private OrderBusinessService orderBusinessService; + + /** + * 微信支付配置服务 + */ + @Resource + private WxPayConfigService wxPayConfigService; + + /** + * 初始化策略映射 + */ + @PostConstruct + public void initStrategies() { + if (paymentStrategies != null && !paymentStrategies.isEmpty()) { + for (PaymentStrategy strategy : paymentStrategies) { + try { + PaymentType paymentType = strategy.getSupportedPaymentType(); + strategyMap.put(paymentType, strategy); + log.info("注册支付策略: {} -> {}", paymentType.getName(), strategy.getClass().getSimpleName()); + } catch (Exception e) { + log.warn("注册支付策略失败: {}, 错误: {}", strategy.getClass().getSimpleName(), e.getMessage()); + } + } + } + log.info("支付策略初始化完成,共注册 {} 种支付方式", strategyMap.size()); + + if (strategyMap.isEmpty()) { + log.warn("⚠️ 没有可用的支付策略,支付功能将不可用"); + } + } + + @Override + public PaymentResponse createPayment(PaymentRequest request) throws PaymentException { + log.info("{}, 支付类型: {}, 租户ID: {}, 用户ID: {}, 金额: {}", + PaymentConstants.LogMessage.PAYMENT_START, request.getPaymentType(), + request.getTenantId(), request.getUserId(), request.getFormattedAmount()); + + try { + // 基础参数验证 + validatePaymentRequest(request); + + // 获取支付策略 + PaymentStrategy strategy = getPaymentStrategy(request.getPaymentType()); + + // 执行支付 + PaymentResponse response = strategy.createPayment(request); + + log.info("{}, 支付类型: {}, 租户ID: {}, 订单号: {}, 金额: {}", + PaymentConstants.LogMessage.PAYMENT_SUCCESS, request.getPaymentType(), + request.getTenantId(), response.getOrderNo(), request.getFormattedAmount()); + + return response; + + } catch (PaymentException e) { + log.error("{}, 支付类型: {}, 租户ID: {}, 错误: {}", + PaymentConstants.LogMessage.PAYMENT_FAILED, request.getPaymentType(), + request.getTenantId(), e.getMessage()); + throw e; + } catch (Exception e) { + log.error("{}, 支付类型: {}, 租户ID: {}, 系统错误: {}", + PaymentConstants.LogMessage.PAYMENT_FAILED, request.getPaymentType(), + request.getTenantId(), e.getMessage(), e); + throw PaymentException.systemError("支付创建失败: " + e.getMessage(), e); + } + } + + @Override + public PaymentResponse createPaymentWithOrder(PaymentWithOrderRequest request, User loginUser) throws PaymentException { + log.info("开始创建支付订单(包含订单信息), 支付类型: {}, 租户ID: {}, 用户ID: {}, 金额: {}", + request.getPaymentType(), request.getTenantId(), loginUser.getUserId(), request.getFormattedAmount()); + + try { + // 1. 参数验证 + validatePaymentWithOrderRequest(request, loginUser); + + // 2. 转换为订单创建请求 + OrderCreateRequest orderRequest = convertToOrderCreateRequest(request, loginUser); + + // 3. 创建订单(包含商品验证、库存扣减等完整业务逻辑) + Map wxOrderInfo = orderBusinessService.createOrder(orderRequest, loginUser); + + // 4. 构建支付响应(复用现有的微信支付返回格式) + PaymentResponse response = buildPaymentResponseFromWxOrder(wxOrderInfo, request, orderRequest.getOrderNo()); + + log.info("支付订单创建成功(包含订单信息), 支付类型: {}, 租户ID: {}, 订单号: {}, 金额: {}", + request.getPaymentType(), request.getTenantId(), response.getOrderNo(), request.getFormattedAmount()); + + return response; + + } catch (PaymentException e) { + log.error("创建支付订单失败(包含订单信息), 支付类型: {}, 租户ID: {}, 错误: {}", + request.getPaymentType(), request.getTenantId(), e.getMessage()); + throw e; + } catch (Exception e) { + log.error("创建支付订单系统错误(包含订单信息), 支付类型: {}, 租户ID: {}, 系统错误: {}", + request.getPaymentType(), request.getTenantId(), e.getMessage(), e); + throw PaymentException.systemError("支付订单创建失败: " + e.getMessage(), e); + } + } + + @Override + public PaymentResponse queryPayment(String orderNo, PaymentType paymentType, Integer tenantId) throws PaymentException { + log.info("开始查询支付状态, 支付类型: {}, 租户ID: {}, 订单号: {}", + paymentType, tenantId, orderNo); + + try { + // 参数验证 + validateQueryParams(orderNo, paymentType, tenantId); + + // 获取支付策略 + PaymentStrategy strategy = getPaymentStrategy(paymentType); + + // 检查是否支持查询 + if (!strategy.supportQuery()) { + throw PaymentException.unsupportedPayment("该支付方式不支持查询", paymentType); + } + + // 执行查询 + PaymentResponse response = strategy.queryPayment(orderNo, tenantId); + + log.info("支付状态查询成功, 支付类型: {}, 租户ID: {}, 订单号: {}, 状态: {}", + paymentType, tenantId, orderNo, response.getPaymentStatus()); + + return response; + + } catch (PaymentException e) { + log.error("支付状态查询失败, 支付类型: {}, 租户ID: {}, 订单号: {}, 错误: {}", + paymentType, tenantId, orderNo, e.getMessage()); + throw e; + } catch (Exception e) { + log.error("支付状态查询系统错误, 支付类型: {}, 租户ID: {}, 订单号: {}, 错误: {}", + paymentType, tenantId, orderNo, e.getMessage(), e); + throw PaymentException.systemError("支付查询失败: " + e.getMessage(), e); + } + } + + @Override + public String handlePaymentNotify(PaymentType paymentType, Map headers, String body, Integer tenantId) throws PaymentException { + log.info("{}, 支付类型: {}, 租户ID: {}", + PaymentConstants.LogMessage.NOTIFY_START, paymentType, tenantId); + + try { + // 参数验证 + validateNotifyParams(paymentType, headers, body, tenantId); + + // 获取支付策略 + PaymentStrategy strategy = getPaymentStrategy(paymentType); + + // 检查是否需要异步通知 + if (!strategy.needNotify()) { + log.warn("该支付方式不需要异步通知, 支付类型: {}", paymentType); + return PaymentConstants.Wechat.NOTIFY_SUCCESS; + } + + // 处理回调 + String result = strategy.handleNotify(headers, body, tenantId); + + log.info("{}, 支付类型: {}, 租户ID: {}", + PaymentConstants.LogMessage.NOTIFY_SUCCESS, paymentType, tenantId); + + return result; + + } catch (PaymentException e) { + log.error("{}, 支付类型: {}, 租户ID: {}, 错误: {}", + PaymentConstants.LogMessage.NOTIFY_FAILED, paymentType, tenantId, e.getMessage()); + throw e; + } catch (Exception e) { + log.error("{}, 支付类型: {}, 租户ID: {}, 系统错误: {}", + PaymentConstants.LogMessage.NOTIFY_FAILED, paymentType, tenantId, e.getMessage(), e); + throw PaymentException.systemError("支付回调处理失败: " + e.getMessage(), e); + } + } + + @Override + public PaymentResponse refund(String orderNo, String refundNo, PaymentType paymentType, + BigDecimal totalAmount, BigDecimal refundAmount, + String reason, Integer tenantId) throws PaymentException { + log.info("{}, 支付类型: {}, 租户ID: {}, 订单号: {}, 退款单号: {}, 退款金额: {}", + PaymentConstants.LogMessage.REFUND_START, paymentType, tenantId, orderNo, refundNo, refundAmount); + + try { + // 参数验证 + validateRefundParams(orderNo, refundNo, paymentType, totalAmount, refundAmount, tenantId); + + // 获取支付策略 + PaymentStrategy strategy = getPaymentStrategy(paymentType); + + // 检查是否支持退款 + if (!strategy.supportRefund()) { + throw PaymentException.unsupportedPayment("该支付方式不支持退款", paymentType); + } + + // 执行退款 + PaymentResponse response = strategy.refund(orderNo, refundNo, totalAmount, refundAmount, reason, tenantId); + + log.info("{}, 支付类型: {}, 租户ID: {}, 订单号: {}, 退款单号: {}, 退款金额: {}", + PaymentConstants.LogMessage.REFUND_SUCCESS, paymentType, tenantId, orderNo, refundNo, refundAmount); + + return response; + + } catch (PaymentException e) { + log.error("{}, 支付类型: {}, 租户ID: {}, 订单号: {}, 退款单号: {}, 错误: {}", + PaymentConstants.LogMessage.REFUND_FAILED, paymentType, tenantId, orderNo, refundNo, e.getMessage()); + throw e; + } catch (Exception e) { + log.error("{}, 支付类型: {}, 租户ID: {}, 订单号: {}, 退款单号: {}, 系统错误: {}", + PaymentConstants.LogMessage.REFUND_FAILED, paymentType, tenantId, orderNo, refundNo, e.getMessage(), e); + throw PaymentException.systemError("退款申请失败: " + e.getMessage(), e); + } + } + + @Override + public PaymentResponse queryRefund(String refundNo, PaymentType paymentType, Integer tenantId) throws PaymentException { + log.info("开始查询退款状态, 支付类型: {}, 租户ID: {}, 退款单号: {}", + paymentType, tenantId, refundNo); + + try { + // 参数验证 + validateRefundQueryParams(refundNo, paymentType, tenantId); + + // 获取支付策略 + PaymentStrategy strategy = getPaymentStrategy(paymentType); + + // 检查是否支持退款查询 + if (!strategy.supportRefund()) { + throw PaymentException.unsupportedPayment("该支付方式不支持退款查询", paymentType); + } + + // 执行查询 + PaymentResponse response = strategy.queryRefund(refundNo, tenantId); + + log.info("退款状态查询成功, 支付类型: {}, 租户ID: {}, 退款单号: {}, 状态: {}", + paymentType, tenantId, refundNo, response.getPaymentStatus()); + + return response; + + } catch (PaymentException e) { + log.error("退款状态查询失败, 支付类型: {}, 租户ID: {}, 退款单号: {}, 错误: {}", + paymentType, tenantId, refundNo, e.getMessage()); + throw e; + } catch (Exception e) { + log.error("退款状态查询系统错误, 支付类型: {}, 租户ID: {}, 退款单号: {}, 错误: {}", + paymentType, tenantId, refundNo, e.getMessage(), e); + throw PaymentException.systemError("退款查询失败: " + e.getMessage(), e); + } + } + + @Override + public boolean closeOrder(String orderNo, PaymentType paymentType, Integer tenantId) throws PaymentException { + log.info("开始关闭订单, 支付类型: {}, 租户ID: {}, 订单号: {}", + paymentType, tenantId, orderNo); + + try { + // 参数验证 + validateCloseParams(orderNo, paymentType, tenantId); + + // 获取支付策略 + PaymentStrategy strategy = getPaymentStrategy(paymentType); + + // 检查是否支持关闭订单 + if (!strategy.supportClose()) { + throw PaymentException.unsupportedPayment("该支付方式不支持关闭订单", paymentType); + } + + // 执行关闭 + boolean result = strategy.closeOrder(orderNo, tenantId); + + log.info("订单关闭{}, 支付类型: {}, 租户ID: {}, 订单号: {}", + result ? "成功" : "失败", paymentType, tenantId, orderNo); + + return result; + + } catch (PaymentException e) { + log.error("订单关闭失败, 支付类型: {}, 租户ID: {}, 订单号: {}, 错误: {}", + paymentType, tenantId, orderNo, e.getMessage()); + throw e; + } catch (Exception e) { + log.error("订单关闭系统错误, 支付类型: {}, 租户ID: {}, 订单号: {}, 错误: {}", + paymentType, tenantId, orderNo, e.getMessage(), e); + throw PaymentException.systemError("订单关闭失败: " + e.getMessage(), e); + } + } + + @Override + public List getSupportedPaymentTypes() { + return new ArrayList<>(strategyMap.keySet()); + } + + @Override + public boolean isPaymentTypeSupported(PaymentType paymentType) { + return strategyMap.containsKey(paymentType); + } + + @Override + public boolean isRefundSupported(PaymentType paymentType) { + PaymentStrategy strategy = strategyMap.get(paymentType); + return strategy != null && strategy.supportRefund(); + } + + @Override + public boolean isQuerySupported(PaymentType paymentType) { + PaymentStrategy strategy = strategyMap.get(paymentType); + return strategy != null && strategy.supportQuery(); + } + + @Override + public boolean isCloseSupported(PaymentType paymentType) { + PaymentStrategy strategy = strategyMap.get(paymentType); + return strategy != null && strategy.supportClose(); + } + + @Override + public boolean isNotifyNeeded(PaymentType paymentType) { + PaymentStrategy strategy = strategyMap.get(paymentType); + return strategy != null && strategy.needNotify(); + } + + @Override + public void validatePaymentRequest(PaymentRequest request) throws PaymentException { + if (request == null) { + throw PaymentException.paramError("支付请求不能为空"); + } + + if (request.getPaymentType() == null) { + throw PaymentException.paramError("支付类型不能为空"); + } + + if (request.getTenantId() == null || request.getTenantId() <= 0) { + throw PaymentException.paramError("租户ID不能为空且必须大于0"); + } + + if (request.getUserId() == null || request.getUserId() <= 0) { + throw PaymentException.paramError("用户ID不能为空且必须大于0"); + } + + if (request.getAmount() == null || request.getAmount().compareTo(BigDecimal.ZERO) <= 0) { + throw PaymentException.amountError("支付金额必须大于0"); + } + + if (!StringUtils.hasText(request.getSubject())) { + throw PaymentException.paramError("订单标题不能为空"); + } + + // 检查支付类型是否支持 + if (!isPaymentTypeSupported(request.getPaymentType())) { + throw PaymentException.unsupportedPayment("不支持的支付类型: " + request.getPaymentType(), request.getPaymentType()); + } + } + + @Override + public Map getPaymentStrategyInfo(PaymentType paymentType) { + PaymentStrategy strategy = strategyMap.get(paymentType); + if (strategy == null) { + return null; + } + + Map info = new HashMap<>(); + info.put("paymentType", paymentType); + info.put("strategyName", strategy.getStrategyName()); + info.put("strategyDescription", strategy.getStrategyDescription()); + info.put("supportRefund", strategy.supportRefund()); + info.put("supportQuery", strategy.supportQuery()); + info.put("supportClose", strategy.supportClose()); + info.put("needNotify", strategy.needNotify()); + return info; + } + + @Override + public List> getAllPaymentStrategyInfo() { + return strategyMap.keySet().stream() + .map(this::getPaymentStrategyInfo) + .collect(Collectors.toList()); + } + + @Override + public Map checkPaymentConfig(Integer tenantId) { + Map result = new HashMap<>(); + result.put("tenantId", tenantId); + + try { + // 检查微信支付配置 + wxPayConfigService.getPaymentConfigForStrategy(tenantId); + result.put("wechatConfigExists", true); + result.put("wechatConfigError", null); + } catch (Exception e) { + result.put("wechatConfigExists", false); + result.put("wechatConfigError", e.getMessage()); + } + + try { + // 检查微信支付Config构建 + wxPayConfigService.getWxPayConfig(tenantId); + result.put("wechatConfigValid", true); + result.put("wechatConfigValidError", null); + } catch (Exception e) { + result.put("wechatConfigValid", false); + result.put("wechatConfigValidError", e.getMessage()); + } + + return result; + } + + /** + * 获取支付策略 + */ + private PaymentStrategy getPaymentStrategy(PaymentType paymentType) throws PaymentException { + // 如果是WECHAT支付类型,转换为WECHAT_NATIVE + // 因为WECHAT是一个通用类型,实际的支付策略是WECHAT_NATIVE + PaymentType actualPaymentType = paymentType; + if (paymentType == PaymentType.WECHAT) { + actualPaymentType = PaymentType.WECHAT_NATIVE; + } + + PaymentStrategy strategy = strategyMap.get(actualPaymentType); + if (strategy == null) { + throw PaymentException.unsupportedPayment("不支持的支付类型: " + paymentType, paymentType); + } + return strategy; + } + + /** + * 验证查询参数 + */ + private void validateQueryParams(String orderNo, PaymentType paymentType, Integer tenantId) throws PaymentException { + if (!StringUtils.hasText(orderNo)) { + throw PaymentException.paramError("订单号不能为空"); + } + if (paymentType == null) { + throw PaymentException.paramError("支付类型不能为空"); + } + if (tenantId == null || tenantId <= 0) { + throw PaymentException.paramError("租户ID不能为空且必须大于0"); + } + } + + /** + * 验证回调参数 + */ + private void validateNotifyParams(PaymentType paymentType, Map headers, String body, Integer tenantId) throws PaymentException { + if (paymentType == null) { + throw PaymentException.paramError("支付类型不能为空"); + } + if (headers == null || headers.isEmpty()) { + throw PaymentException.paramError("请求头不能为空"); + } + if (!StringUtils.hasText(body)) { + throw PaymentException.paramError("请求体不能为空"); + } + if (tenantId == null || tenantId <= 0) { + throw PaymentException.paramError("租户ID不能为空且必须大于0"); + } + } + + /** + * 验证退款参数 + */ + private void validateRefundParams(String orderNo, String refundNo, PaymentType paymentType, + BigDecimal totalAmount, BigDecimal refundAmount, Integer tenantId) throws PaymentException { + if (!StringUtils.hasText(orderNo)) { + throw PaymentException.paramError("订单号不能为空"); + } + if (!StringUtils.hasText(refundNo)) { + throw PaymentException.paramError("退款单号不能为空"); + } + if (paymentType == null) { + throw PaymentException.paramError("支付类型不能为空"); + } + if (totalAmount == null || totalAmount.compareTo(BigDecimal.ZERO) <= 0) { + throw PaymentException.amountError("订单总金额必须大于0"); + } + if (refundAmount == null || refundAmount.compareTo(BigDecimal.ZERO) <= 0) { + throw PaymentException.amountError("退款金额必须大于0"); + } + if (refundAmount.compareTo(totalAmount) > 0) { + throw PaymentException.amountError("退款金额不能大于订单总金额"); + } + if (tenantId == null || tenantId <= 0) { + throw PaymentException.paramError("租户ID不能为空且必须大于0"); + } + } + + /** + * 验证退款查询参数 + */ + private void validateRefundQueryParams(String refundNo, PaymentType paymentType, Integer tenantId) throws PaymentException { + if (!StringUtils.hasText(refundNo)) { + throw PaymentException.paramError("退款单号不能为空"); + } + if (paymentType == null) { + throw PaymentException.paramError("支付类型不能为空"); + } + if (tenantId == null || tenantId <= 0) { + throw PaymentException.paramError("租户ID不能为空且必须大于0"); + } + } + + /** + * 验证关闭订单参数 + */ + private void validateCloseParams(String orderNo, PaymentType paymentType, Integer tenantId) throws PaymentException { + if (!StringUtils.hasText(orderNo)) { + throw PaymentException.paramError("订单号不能为空"); + } + if (paymentType == null) { + throw PaymentException.paramError("支付类型不能为空"); + } + if (tenantId == null || tenantId <= 0) { + throw PaymentException.paramError("租户ID不能为空且必须大于0"); + } + } + + /** + * 验证支付与订单创建请求参数 + */ + private void validatePaymentWithOrderRequest(PaymentWithOrderRequest request, User loginUser) throws PaymentException { + if (request == null) { + throw PaymentException.paramError("请求参数不能为空"); + } + if (loginUser == null) { + throw PaymentException.paramError("用户未登录"); + } + if (request.getPaymentType() == null) { + throw PaymentException.paramError("支付类型不能为空"); + } + if (request.getAmount() == null || request.getAmount().compareTo(BigDecimal.ZERO) <= 0) { + throw PaymentException.amountError("支付金额必须大于0"); + } + if (!StringUtils.hasText(request.getSubject())) { + throw PaymentException.paramError("订单标题不能为空"); + } + if (request.getTenantId() == null || request.getTenantId() <= 0) { + throw PaymentException.paramError("租户ID不能为空且必须大于0"); + } + if (request.getOrderInfo() == null) { + throw PaymentException.paramError("订单信息不能为空"); + } + if (request.getOrderInfo().getGoodsItems() == null || request.getOrderInfo().getGoodsItems().isEmpty()) { + throw PaymentException.paramError("订单商品列表不能为空"); + } + } + + /** + * 转换为订单创建请求 + */ + private OrderCreateRequest convertToOrderCreateRequest(PaymentWithOrderRequest request, User loginUser) { + OrderCreateRequest orderRequest = new OrderCreateRequest(); + + // 生成订单号(使用雪花算法保证全局唯一) + String orderNo = Long.toString(IdUtil.getSnowflakeNextId()); + orderRequest.setOrderNo(orderNo); + log.info("为订单创建请求生成订单号(雪花算法): {}", orderNo); + + // 设置基本信息 + orderRequest.setType(request.getOrderInfo().getType()); + orderRequest.setTitle(request.getSubject()); + orderRequest.setComments(request.getOrderInfo().getComments()); + orderRequest.setTenantId(request.getTenantId()); + + // 设置收货信息 + orderRequest.setRealName(request.getOrderInfo().getRealName()); + orderRequest.setAddress(request.getOrderInfo().getAddress()); + orderRequest.setAddressId(request.getOrderInfo().getAddressId()); + orderRequest.setDeliveryType(request.getOrderInfo().getDeliveryType()); + + // 设置商户信息 + orderRequest.setMerchantId(request.getOrderInfo().getMerchantId()); + orderRequest.setMerchantName(request.getOrderInfo().getMerchantName()); + + // 设置支付信息 + orderRequest.setPayType(request.getPaymentType().getCode()); + orderRequest.setTotalPrice(request.getAmount()); + orderRequest.setPayPrice(request.getAmount()); + + // 设置优惠券 + orderRequest.setCouponId(request.getOrderInfo().getCouponId()); + + // 转换商品列表 + List goodsItems = request.getOrderInfo().getGoodsItems().stream() + .map(this::convertToOrderGoodsItem) + .collect(java.util.stream.Collectors.toList()); + orderRequest.setGoodsItems(goodsItems); + + return orderRequest; + } + + /** + * 转换商品项 + */ + private OrderCreateRequest.OrderGoodsItem convertToOrderGoodsItem(PaymentWithOrderRequest.OrderGoodsItem item) { + OrderCreateRequest.OrderGoodsItem orderItem = new OrderCreateRequest.OrderGoodsItem(); + orderItem.setGoodsId(item.getGoodsId()); + orderItem.setSkuId(item.getSkuId()); + orderItem.setQuantity(item.getQuantity()); + orderItem.setSpecInfo(item.getSpecInfo()); + return orderItem; + } + + /** + * 从微信订单信息构建支付响应 + */ + private PaymentResponse buildPaymentResponseFromWxOrder(Map wxOrderInfo, + PaymentWithOrderRequest request, + String orderNo) { + PaymentResponse response = PaymentResponse.wechatNative( + orderNo, + wxOrderInfo.get("codeUrl"), + request.getAmount(), + request.getTenantId() + ); + + // 设置额外信息 + response.setSuccess(true); + // 确保orderNo被正确设置 + response.setOrderNo(orderNo); + + // 调试日志 + log.info("构建支付响应成功, 订单号: {}, 二维码URL: {}, 响应中的orderNo: {}", + orderNo, wxOrderInfo.get("codeUrl"), response.getOrderNo()); + + return response; + } +} diff --git a/src/main/java/com/gxwebsoft/payment/strategy/PaymentStrategy.java b/src/main/java/com/gxwebsoft/payment/strategy/PaymentStrategy.java new file mode 100644 index 0000000..560c365 --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/strategy/PaymentStrategy.java @@ -0,0 +1,153 @@ +package com.gxwebsoft.payment.strategy; + +import com.gxwebsoft.payment.dto.PaymentRequest; +import com.gxwebsoft.payment.dto.PaymentResponse; +import com.gxwebsoft.payment.enums.PaymentType; +import com.gxwebsoft.payment.exception.PaymentException; + +import java.util.Map; + +/** + * 支付策略接口 + * 定义所有支付方式的统一接口 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +public interface PaymentStrategy { + + /** + * 获取支持的支付类型 + * + * @return 支付类型 + */ + PaymentType getSupportedPaymentType(); + + /** + * 验证支付请求参数 + * + * @param request 支付请求 + * @throws PaymentException 参数验证失败时抛出 + */ + void validateRequest(PaymentRequest request) throws PaymentException; + + /** + * 创建支付订单 + * + * @param request 支付请求 + * @return 支付响应 + * @throws PaymentException 支付创建失败时抛出 + */ + PaymentResponse createPayment(PaymentRequest request) throws PaymentException; + + /** + * 查询支付状态 + * + * @param orderNo 订单号 + * @param tenantId 租户ID + * @return 支付响应 + * @throws PaymentException 查询失败时抛出 + */ + PaymentResponse queryPayment(String orderNo, Integer tenantId) throws PaymentException; + + /** + * 处理支付回调通知 + * + * @param headers 请求头 + * @param body 请求体 + * @param tenantId 租户ID + * @return 处理结果,返回给第三方的响应内容 + * @throws PaymentException 处理失败时抛出 + */ + String handleNotify(Map headers, String body, Integer tenantId) throws PaymentException; + + /** + * 申请退款 + * + * @param orderNo 订单号 + * @param refundNo 退款单号 + * @param totalAmount 订单总金额 + * @param refundAmount 退款金额 + * @param reason 退款原因 + * @param tenantId 租户ID + * @return 退款响应 + * @throws PaymentException 退款申请失败时抛出 + */ + PaymentResponse refund(String orderNo, String refundNo, + java.math.BigDecimal totalAmount, java.math.BigDecimal refundAmount, + String reason, Integer tenantId) throws PaymentException; + + /** + * 查询退款状态 + * + * @param refundNo 退款单号 + * @param tenantId 租户ID + * @return 退款查询响应 + * @throws PaymentException 查询失败时抛出 + */ + PaymentResponse queryRefund(String refundNo, Integer tenantId) throws PaymentException; + + /** + * 关闭订单 + * + * @param orderNo 订单号 + * @param tenantId 租户ID + * @return 关闭结果 + * @throws PaymentException 关闭失败时抛出 + */ + boolean closeOrder(String orderNo, Integer tenantId) throws PaymentException; + + /** + * 是否支持退款 + * + * @return true表示支持退款 + */ + default boolean supportRefund() { + return false; + } + + /** + * 是否支持查询 + * + * @return true表示支持查询 + */ + default boolean supportQuery() { + return false; + } + + /** + * 是否支持关闭订单 + * + * @return true表示支持关闭订单 + */ + default boolean supportClose() { + return false; + } + + /** + * 是否需要异步通知 + * + * @return true表示需要异步通知 + */ + default boolean needNotify() { + return false; + } + + /** + * 获取策略名称 + * + * @return 策略名称 + */ + default String getStrategyName() { + return getSupportedPaymentType().getName(); + } + + /** + * 获取策略描述 + * + * @return 策略描述 + */ + default String getStrategyDescription() { + return getSupportedPaymentType().getName() + "支付策略"; + } +} diff --git a/src/main/java/com/gxwebsoft/payment/strategy/WechatNativeStrategy.java b/src/main/java/com/gxwebsoft/payment/strategy/WechatNativeStrategy.java new file mode 100644 index 0000000..e5d6b1d --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/strategy/WechatNativeStrategy.java @@ -0,0 +1,668 @@ +package com.gxwebsoft.payment.strategy; + +import cn.hutool.core.util.IdUtil; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.system.entity.Payment; +import com.gxwebsoft.payment.constants.PaymentConstants; +import com.gxwebsoft.payment.dto.PaymentRequest; +import com.gxwebsoft.payment.dto.PaymentResponse; +import com.gxwebsoft.payment.enums.PaymentStatus; +import com.gxwebsoft.payment.enums.PaymentType; +import com.gxwebsoft.payment.exception.PaymentException; +import com.gxwebsoft.payment.service.WxPayConfigService; +import com.gxwebsoft.payment.service.WxPayNotifyService; +import com.wechat.pay.java.core.Config; +import com.wechat.pay.java.service.payments.nativepay.NativePayService; +import com.wechat.pay.java.service.payments.nativepay.model.Amount; +import com.wechat.pay.java.service.payments.nativepay.model.PrepayRequest; +import com.wechat.pay.java.service.payments.nativepay.model.PrepayResponse; +import com.wechat.pay.java.service.payments.nativepay.model.QueryOrderByOutTradeNoRequest; +import com.wechat.pay.java.service.payments.model.Transaction; +import com.wechat.pay.java.service.refund.RefundService; +import com.wechat.pay.java.service.refund.model.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.Map; + +/** + * 微信Native支付策略实现 + * 处理微信Native扫码支付 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +@Slf4j +@Component +public class WechatNativeStrategy implements PaymentStrategy { + + @Resource + private WxPayConfigService wxPayConfigService; + + @Resource + private WxPayNotifyService wxPayNotifyService; + + @Override + public PaymentType getSupportedPaymentType() { + return PaymentType.WECHAT_NATIVE; + } + + @Override + public void validateRequest(PaymentRequest request) throws PaymentException { + if (request == null) { + throw PaymentException.paramError("支付请求不能为空"); + } + + if (request.getTenantId() == null) { + throw PaymentException.paramError("租户ID不能为空"); + } + + if (request.getUserId() == null) { + throw PaymentException.paramError("用户ID不能为空"); + } + + if (request.getAmount() == null || request.getAmount().compareTo(BigDecimal.ZERO) <= 0) { + throw PaymentException.amountError("支付金额必须大于0"); + } + + if (!StringUtils.hasText(request.getSubject())) { + throw PaymentException.paramError("订单标题不能为空"); + } + + // 验证金额范围 + if (request.getAmount().compareTo(new BigDecimal("0.01")) < 0) { + throw PaymentException.amountError("支付金额不能小于0.01元"); + } + + if (request.getAmount().compareTo(new BigDecimal("999999.99")) > 0) { + throw PaymentException.amountError("支付金额不能超过999999.99元"); + } + + // 验证订单标题长度 + if (request.getSubject().length() > PaymentConstants.Config.DESCRIPTION_MAX_LENGTH) { + throw PaymentException.paramError("订单标题长度不能超过" + PaymentConstants.Config.DESCRIPTION_MAX_LENGTH + "个字符"); + } + + log.debug("微信Native支付请求参数验证通过, 租户ID: {}, 金额: {}", + request.getTenantId(), request.getFormattedAmount()); + } + + @Override + public PaymentResponse createPayment(PaymentRequest request) throws PaymentException { + log.info("{}, 支付类型: {}, 租户ID: {}, 金额: {}", + PaymentConstants.LogMessage.PAYMENT_START, getSupportedPaymentType(), + request.getTenantId(), request.getFormattedAmount()); + + try { + // 验证请求参数 + validateRequest(request); + + // 生成订单号 + String orderNo = generateOrderNo(request); + log.info("生成的订单号: {}", orderNo); + + // 获取Native支付的Payment配置(包含appId等信息) + Payment paymentConfig = wxPayConfigService.getPaymentConfigForStrategy(request.getTenantId()); + + // 获取微信支付配置 + Config wxPayConfig = wxPayConfigService.getWxPayConfig(request.getTenantId()); + + // 构建预支付请求 + PrepayRequest prepayRequest = buildPrepayRequest(request, orderNo, paymentConfig); + + // 调用微信支付API + PrepayResponse prepayResponse = callWechatPayApi(prepayRequest, wxPayConfig); + + // 构建响应 + PaymentResponse response = PaymentResponse.wechatNative( + orderNo, prepayResponse.getCodeUrl(), request.getAmount(), request.getTenantId()); + response.setUserId(request.getUserId()); + + // 确保orderNo被正确设置 + response.setOrderNo(orderNo); + + // 调试日志:检查响应对象的orderNo + log.info("构建的响应对象 - orderNo: {}, codeUrl: {}, success: {}", + response.getOrderNo(), response.getCodeUrl(), response.getSuccess()); + + log.info("{}, 支付类型: {}, 租户ID: {}, 订单号: {}, 金额: {}", + PaymentConstants.LogMessage.PAYMENT_SUCCESS, getSupportedPaymentType(), + request.getTenantId(), orderNo, request.getFormattedAmount()); + + return response; + + } catch (PaymentException e) { + log.error("{}, 支付类型: {}, 租户ID: {}, 错误: {}", + PaymentConstants.LogMessage.PAYMENT_FAILED, getSupportedPaymentType(), + request.getTenantId(), e.getMessage()); + throw e; + } catch (Exception e) { + log.error("{}, 支付类型: {}, 租户ID: {}, 系统错误: {}", + PaymentConstants.LogMessage.PAYMENT_FAILED, getSupportedPaymentType(), + request.getTenantId(), e.getMessage(), e); + throw PaymentException.systemError("微信Native支付创建失败: " + e.getMessage(), e); + } + } + + @Override + public PaymentResponse queryPayment(String orderNo, Integer tenantId) throws PaymentException { + log.info("开始查询微信Native支付状态, 订单号: {}, 租户ID: {}", orderNo, tenantId); + + try { + // 参数验证 + if (!StringUtils.hasText(orderNo)) { + throw PaymentException.paramError("订单号不能为空"); + } + if (tenantId == null) { + throw PaymentException.paramError("租户ID不能为空"); + } + + // 获取支付配置(包含商户号等信息) + Payment paymentConfig = wxPayConfigService.getPaymentConfigForStrategy(tenantId); + + // 获取微信支付配置 + Config wxPayConfig = wxPayConfigService.getWxPayConfig(tenantId); + + // 调用微信支付查询API + return queryWechatPaymentStatus(orderNo, tenantId, paymentConfig, wxPayConfig); + + } catch (Exception e) { + if (e instanceof PaymentException) { + throw e; + } + log.error("查询微信Native支付状态失败, 订单号: {}, 租户ID: {}, 错误: {}", + orderNo, tenantId, e.getMessage(), e); + throw PaymentException.systemError("查询微信支付状态失败: " + e.getMessage(), e); + } + } + + @Override + public String handleNotify(Map headers, String body, Integer tenantId) throws PaymentException { + log.info("{}, 支付类型: {}, 租户ID: {}", + PaymentConstants.LogMessage.NOTIFY_START, getSupportedPaymentType(), tenantId); + + try { + // 委托给专门的回调处理服务 + return wxPayNotifyService.handlePaymentNotify(headers, body, tenantId); + } catch (Exception e) { + log.error("{}, 支付类型: {}, 租户ID: {}, 错误: {}", + PaymentConstants.LogMessage.NOTIFY_FAILED, getSupportedPaymentType(), + tenantId, e.getMessage(), e); + throw PaymentException.systemError("微信支付回调处理失败: " + e.getMessage(), e); + } + } + + @Override + public PaymentResponse refund(String orderNo, String refundNo, BigDecimal totalAmount, + BigDecimal refundAmount, String reason, Integer tenantId) throws PaymentException { + log.info("{}, 支付类型: {}, 订单号: {}, 退款单号: {}, 退款金额: {}, 租户ID: {}", + PaymentConstants.LogMessage.REFUND_START, getSupportedPaymentType(), + orderNo, refundNo, refundAmount, tenantId); + + try { + // 参数验证 + validateRefundRequest(orderNo, refundNo, totalAmount, refundAmount, tenantId); + + // 获取支付配置 + Payment paymentConfig = wxPayConfigService.getPaymentConfigForStrategy(tenantId); + Config wxPayConfig = wxPayConfigService.getWxPayConfig(tenantId); + + // 构建退款请求 + CreateRequest refundRequest = buildRefundRequest( + orderNo, refundNo, totalAmount, refundAmount, reason, paymentConfig); + + // 调用微信退款API + Refund refundResult = callWechatRefundApi(refundRequest, wxPayConfig); + + // 构建响应 + PaymentResponse response = buildRefundResponse(refundResult, orderNo, refundNo, tenantId); + + log.info("{}, 支付类型: {}, 订单号: {}, 退款单号: {}, 微信退款单号: {}", + PaymentConstants.LogMessage.REFUND_SUCCESS, getSupportedPaymentType(), + orderNo, refundNo, refundResult.getRefundId()); + + return response; + + } catch (PaymentException e) { + log.error("{}, 支付类型: {}, 订单号: {}, 退款单号: {}, 错误: {}", + PaymentConstants.LogMessage.REFUND_FAILED, getSupportedPaymentType(), + orderNo, refundNo, e.getMessage()); + throw e; + } catch (Exception e) { + log.error("{}, 支付类型: {}, 订单号: {}, 退款单号: {}, 系统错误: {}", + PaymentConstants.LogMessage.REFUND_FAILED, getSupportedPaymentType(), + orderNo, refundNo, e.getMessage(), e); + throw PaymentException.systemError("微信支付退款失败: " + e.getMessage(), e); + } + } + + @Override + public PaymentResponse queryRefund(String refundNo, Integer tenantId) throws PaymentException { + log.info("开始查询微信退款状态, 退款单号: {}, 租户ID: {}", refundNo, tenantId); + + try { + // 参数验证 + if (!StringUtils.hasText(refundNo)) { + throw PaymentException.paramError("退款单号不能为空"); + } + if (tenantId == null) { + throw PaymentException.paramError("租户ID不能为空"); + } + + // 获取支付配置 + Config wxPayConfig = wxPayConfigService.getWxPayConfig(tenantId); + + // 调用微信退款查询API + Refund refundResult = queryWechatRefundStatus(refundNo, wxPayConfig); + + // 构建响应 + PaymentResponse response = buildRefundQueryResponse(refundResult, tenantId); + + log.info("微信退款状态查询成功, 退款单号: {}, 状态: {}, 微信退款单号: {}", + refundNo, refundResult.getStatus(), refundResult.getRefundId()); + + return response; + + } catch (PaymentException e) { + throw e; + } catch (Exception e) { + log.error("查询微信退款状态失败, 退款单号: {}, 租户ID: {}, 错误: {}", + refundNo, tenantId, e.getMessage(), e); + throw PaymentException.systemError("查询微信退款状态失败: " + e.getMessage(), e); + } + } + + @Override + public boolean closeOrder(String orderNo, Integer tenantId) throws PaymentException { + // TODO: 实现微信订单关闭逻辑 + throw PaymentException.unsupportedPayment("暂不支持微信订单关闭", PaymentType.WECHAT_NATIVE); + } + + @Override + public boolean supportRefund() { + return true; + } + + @Override + public boolean supportQuery() { + return true; + } + + @Override + public boolean supportClose() { + return true; + } + + @Override + public boolean needNotify() { + return true; + } + + /** + * 生成订单号(使用雪花算法保证全局唯一) + */ + private String generateOrderNo(PaymentRequest request) { + if (StringUtils.hasText(request.getOrderNo())) { + return request.getOrderNo(); + } + return Long.toString(IdUtil.getSnowflakeNextId()); + } + + + + /** + * 构建微信预支付请求 + */ + private PrepayRequest buildPrepayRequest(PaymentRequest request, String orderNo, Payment paymentConfig) { + PrepayRequest prepayRequest = new PrepayRequest(); + + // 设置应用ID和商户号(关键修复) + prepayRequest.setAppid(paymentConfig.getAppId()); + prepayRequest.setMchid(paymentConfig.getMchId()); + + // 设置金额 + Amount amount = new Amount(); + amount.setTotal(request.getAmountInCents()); + amount.setCurrency(PaymentConstants.Wechat.CURRENCY); + prepayRequest.setAmount(amount); + + // 设置基本信息 + prepayRequest.setOutTradeNo(orderNo); + prepayRequest.setDescription(request.getEffectiveDescription()); + + log.info("创建微信支付订单 - 订单号: {}, 商户号: {}, 金额: {}分", + orderNo, paymentConfig.getMchId(), request.getAmountInCents()); + + // 设置回调URL(必填字段) + String notifyUrl = null; + if (StringUtils.hasText(request.getNotifyUrl())) { + // 优先使用请求中的回调URL + notifyUrl = request.getNotifyUrl(); + } else if (StringUtils.hasText(paymentConfig.getNotifyUrl())) { + // 使用配置中的回调URL + notifyUrl = paymentConfig.getNotifyUrl(); + } else { + // 如果都没有,抛出异常 + throw new RuntimeException("回调通知地址不能为空,请在支付请求中设置notifyUrl或在支付配置中设置notifyUrl"); + } + prepayRequest.setNotifyUrl(notifyUrl); + + log.debug("构建微信预支付请求完成, 订单号: {}, 金额: {}分, AppID: {}, 商户号: {}, 回调URL: {}", + orderNo, request.getAmountInCents(), paymentConfig.getAppId(), paymentConfig.getMchId(), notifyUrl); + + return prepayRequest; + } + + /** + * 查询微信支付状态 + */ + private PaymentResponse queryWechatPaymentStatus(String orderNo, Integer tenantId, Payment paymentConfig, Config wxPayConfig) throws PaymentException { + try { + log.info("开始查询微信支付状态 - 订单号: {}, 商户号: {}, 租户ID: {}", + orderNo, paymentConfig.getMchId(), tenantId); + + // 构建查询请求 + QueryOrderByOutTradeNoRequest queryRequest = new QueryOrderByOutTradeNoRequest(); + queryRequest.setOutTradeNo(orderNo); + queryRequest.setMchid(paymentConfig.getMchId()); + + // 构建服务 + NativePayService service = new NativePayService.Builder().config(wxPayConfig).build(); + + // 调用查询接口 + Transaction transaction = service.queryOrderByOutTradeNo(queryRequest); + + if (transaction == null) { + throw PaymentException.systemError("微信支付查询返回空结果", null); + } + + // 转换支付状态 + PaymentStatus paymentStatus = convertWechatPaymentStatus(transaction.getTradeState()); + + // 构建响应 + PaymentResponse response = new PaymentResponse(); + response.setSuccess(true); + response.setOrderNo(orderNo); + response.setPaymentStatus(paymentStatus); + response.setTenantId(tenantId); + response.setPaymentType(PaymentType.WECHAT_NATIVE); + + if (transaction.getAmount() != null) { + // 微信返回的金额是分,需要转换为元 + BigDecimal amount = new BigDecimal(transaction.getAmount().getTotal()).divide(new BigDecimal("100")); + response.setAmount(amount); + } + + if (transaction.getTransactionId() != null) { + response.setTransactionId(transaction.getTransactionId()); + } + + log.info("微信Native支付状态查询成功, 订单号: {}, 状态: {}, 微信交易号: {}", + orderNo, paymentStatus, transaction.getTransactionId()); + + return response; + + } catch (Exception e) { + if (e instanceof PaymentException) { + throw e; + } + log.error("查询微信支付状态失败, 订单号: {}, 错误: {}", orderNo, e.getMessage(), e); + throw PaymentException.networkError("查询微信支付状态失败: " + e.getMessage(), PaymentType.WECHAT_NATIVE, e); + } + } + + /** + * 转换微信支付状态 + */ + private PaymentStatus convertWechatPaymentStatus(Transaction.TradeStateEnum tradeState) { + if (tradeState == null) { + return PaymentStatus.PENDING; + } + + switch (tradeState) { + case SUCCESS: + return PaymentStatus.SUCCESS; + case REFUND: + return PaymentStatus.REFUNDED; + case NOTPAY: + return PaymentStatus.PENDING; + case CLOSED: + return PaymentStatus.CANCELLED; + case REVOKED: + return PaymentStatus.CANCELLED; + case USERPAYING: + return PaymentStatus.PROCESSING; + case PAYERROR: + return PaymentStatus.FAILED; + default: + return PaymentStatus.PENDING; + } + } + + /** + * 调用微信支付API + */ + private PrepayResponse callWechatPayApi(PrepayRequest request, Config wxPayConfig) throws PaymentException { + try { + // 构建服务 + NativePayService service = new NativePayService.Builder().config(wxPayConfig).build(); + + // 调用预支付接口 + PrepayResponse response = service.prepay(request); + + if (response == null || !StringUtils.hasText(response.getCodeUrl())) { + throw PaymentException.networkError("微信支付API返回数据异常", PaymentType.WECHAT_NATIVE, null); + } + + log.debug("微信支付API调用成功, 订单号: {}", request.getOutTradeNo()); + return response; + + } catch (Exception e) { + if (e instanceof PaymentException) { + throw e; + } + throw PaymentException.networkError("调用微信支付API失败: " + e.getMessage(), PaymentType.WECHAT_NATIVE, e); + } + } + + /** + * 验证退款请求参数 + */ + private void validateRefundRequest(String orderNo, String refundNo, BigDecimal totalAmount, + BigDecimal refundAmount, Integer tenantId) throws PaymentException { + if (!StringUtils.hasText(orderNo)) { + throw PaymentException.paramError("订单号不能为空"); + } + if (!StringUtils.hasText(refundNo)) { + throw PaymentException.paramError("退款单号不能为空"); + } + if (tenantId == null) { + throw PaymentException.paramError("租户ID不能为空"); + } + if (totalAmount == null || totalAmount.compareTo(BigDecimal.ZERO) <= 0) { + throw PaymentException.amountError("订单总金额必须大于0"); + } + if (refundAmount == null || refundAmount.compareTo(BigDecimal.ZERO) <= 0) { + throw PaymentException.amountError("退款金额必须大于0"); + } + if (refundAmount.compareTo(totalAmount) > 0) { + throw PaymentException.amountError("退款金额不能大于订单总金额"); + } + + log.debug("退款请求参数验证通过, 订单号: {}, 退款单号: {}, 订单总额: {}, 退款金额: {}", + orderNo, refundNo, totalAmount, refundAmount); + } + + /** + * 构建微信退款请求 + */ + private CreateRequest buildRefundRequest(String orderNo, String refundNo, BigDecimal totalAmount, + BigDecimal refundAmount, String reason, Payment paymentConfig) { + CreateRequest refundRequest = new CreateRequest(); + + // 设置订单号和退款单号 + refundRequest.setOutTradeNo(orderNo); + refundRequest.setOutRefundNo(refundNo); + + // 设置金额信息(微信支付金额单位为分) + AmountReq amountReq = new AmountReq(); + amountReq.setTotal(totalAmount.multiply(new BigDecimal("100")).longValue()); + amountReq.setRefund(refundAmount.multiply(new BigDecimal("100")).longValue()); + amountReq.setCurrency(PaymentConstants.Wechat.CURRENCY); + refundRequest.setAmount(amountReq); + + // 设置退款原因(可选,但建议填写) + if (StringUtils.hasText(reason)) { + // 退款原因最多80个字符 + String effectiveReason = reason.length() > 80 ? reason.substring(0, 80) : reason; + refundRequest.setReason(effectiveReason); + } else { + refundRequest.setReason("用户申请退款"); + } + + log.info("构建微信退款请求完成 - 订单号: {}, 退款单号: {}, 订单总额: {}分, 退款金额: {}分", + orderNo, refundNo, amountReq.getTotal(), amountReq.getRefund()); + + return refundRequest; + } + + /** + * 调用微信退款API + */ + private Refund callWechatRefundApi(CreateRequest refundRequest, Config wxPayConfig) throws PaymentException { + try { + // 构建退款服务 + RefundService refundService = new RefundService.Builder().config(wxPayConfig).build(); + + // 调用退款接口 + Refund refund = refundService.create(refundRequest); + + if (refund == null) { + throw PaymentException.networkError("微信退款API返回数据异常", PaymentType.WECHAT_NATIVE, null); + } + + log.debug("微信退款API调用成功, 退款单号: {}, 微信退款单号: {}, 状态: {}", + refundRequest.getOutRefundNo(), refund.getRefundId(), refund.getStatus()); + + return refund; + + } catch (Exception e) { + if (e instanceof PaymentException) { + throw e; + } + log.error("调用微信退款API失败: {}", e.getMessage(), e); + throw PaymentException.networkError("调用微信退款API失败: " + e.getMessage(), PaymentType.WECHAT_NATIVE, e); + } + } + + /** + * 构建退款响应 + */ + private PaymentResponse buildRefundResponse(Refund refund, String orderNo, String refundNo, Integer tenantId) { + PaymentResponse response = new PaymentResponse(); + response.setSuccess(true); + response.setOrderNo(orderNo); + response.setTransactionId(refund.getRefundId()); // 使用微信退款单号 + response.setPaymentType(PaymentType.WECHAT_NATIVE); + response.setTenantId(tenantId); + + // 转换退款状态 + String statusStr = refund.getStatus() != null ? refund.getStatus().name() : null; + PaymentStatus paymentStatus = convertWechatRefundStatus(statusStr); + response.setPaymentStatus(paymentStatus); + + // 设置退款金额(微信返回的金额是分,需要转换为元) + if (refund.getAmount() != null && refund.getAmount().getRefund() != null) { + BigDecimal refundAmount = new BigDecimal(refund.getAmount().getRefund()).divide(new BigDecimal("100")); + response.setAmount(refundAmount); + } + + log.debug("构建退款响应完成 - 订单号: {}, 退款单号: {}, 微信退款单号: {}, 状态: {}", + orderNo, refundNo, refund.getRefundId(), paymentStatus); + + return response; + } + + /** + * 查询微信退款状态 + */ + private Refund queryWechatRefundStatus(String refundNo, Config wxPayConfig) throws PaymentException { + try { + // 构建退款服务 + RefundService refundService = new RefundService.Builder().config(wxPayConfig).build(); + + // 构建查询请求 + QueryByOutRefundNoRequest queryRequest = new QueryByOutRefundNoRequest(); + queryRequest.setOutRefundNo(refundNo); + + // 调用查询接口 + Refund refund = refundService.queryByOutRefundNo(queryRequest); + + if (refund == null) { + throw PaymentException.systemError("微信退款查询返回空结果", null); + } + + log.debug("微信退款查询成功, 退款单号: {}, 微信退款单号: {}, 状态: {}", + refundNo, refund.getRefundId(), refund.getStatus()); + + return refund; + + } catch (Exception e) { + if (e instanceof PaymentException) { + throw e; + } + log.error("查询微信退款状态失败, 退款单号: {}, 错误: {}", refundNo, e.getMessage(), e); + throw PaymentException.networkError("查询微信退款状态失败: " + e.getMessage(), PaymentType.WECHAT_NATIVE, e); + } + } + + /** + * 构建退款查询响应 + */ + private PaymentResponse buildRefundQueryResponse(Refund refund, Integer tenantId) { + PaymentResponse response = new PaymentResponse(); + response.setSuccess(true); + response.setOrderNo(refund.getOutTradeNo()); + response.setTransactionId(refund.getRefundId()); + response.setPaymentType(PaymentType.WECHAT_NATIVE); + response.setTenantId(tenantId); + + // 转换退款状态 + String statusStr = refund.getStatus() != null ? refund.getStatus().name() : null; + PaymentStatus paymentStatus = convertWechatRefundStatus(statusStr); + response.setPaymentStatus(paymentStatus); + + // 设置退款金额 + if (refund.getAmount() != null && refund.getAmount().getRefund() != null) { + BigDecimal refundAmount = new BigDecimal(refund.getAmount().getRefund()).divide(new BigDecimal("100")); + response.setAmount(refundAmount); + } + + return response; + } + + /** + * 转换微信退款状态 + */ + private PaymentStatus convertWechatRefundStatus(String refundStatus) { + if (refundStatus == null) { + return PaymentStatus.REFUNDING; + } + + switch (refundStatus) { + case "SUCCESS": + return PaymentStatus.REFUNDED; + case "CLOSED": + return PaymentStatus.REFUND_FAILED; + case "PROCESSING": + return PaymentStatus.REFUNDING; + case "ABNORMAL": + return PaymentStatus.REFUND_FAILED; + default: + return PaymentStatus.REFUNDING; + } + } +} diff --git a/src/main/java/com/gxwebsoft/payment/utils/PaymentTypeCompatibilityUtil.java b/src/main/java/com/gxwebsoft/payment/utils/PaymentTypeCompatibilityUtil.java new file mode 100644 index 0000000..682bfef --- /dev/null +++ b/src/main/java/com/gxwebsoft/payment/utils/PaymentTypeCompatibilityUtil.java @@ -0,0 +1,165 @@ +package com.gxwebsoft.payment.utils; + +import com.gxwebsoft.payment.enums.PaymentType; +import lombok.extern.slf4j.Slf4j; + +import java.util.HashMap; +import java.util.Map; + +/** + * 支付方式兼容性处理工具类 + * 处理废弃支付方式到核心支付方式的映射转换 + * + * @author 科技小王子 + * @since 2025-08-30 + */ +@Slf4j +public class PaymentTypeCompatibilityUtil { + + /** + * 废弃支付方式到核心支付方式的映射表 + */ + private static final Map DEPRECATED_TO_CORE_MAPPING = new HashMap<>(); + + static { + // 旧编号到新编号的映射 + DEPRECATED_TO_CORE_MAPPING.put(3, 2); // 支付宝(旧3) -> 支付宝(新2) + DEPRECATED_TO_CORE_MAPPING.put(12, 6); // 免费(旧12) -> 免费(新6) + DEPRECATED_TO_CORE_MAPPING.put(15, 7); // 积分支付(旧15) -> 积分支付(新7) + DEPRECATED_TO_CORE_MAPPING.put(19, 3); // 银联支付(旧19) -> 银联支付(新3) + + // 会员卡类支付 -> 余额支付 + DEPRECATED_TO_CORE_MAPPING.put(2, 0); // 会员卡支付 -> 余额支付 + DEPRECATED_TO_CORE_MAPPING.put(6, 0); // VIP月卡 -> 余额支付 + DEPRECATED_TO_CORE_MAPPING.put(7, 0); // VIP年卡 -> 余额支付 + DEPRECATED_TO_CORE_MAPPING.put(8, 0); // VIP次卡 -> 余额支付 + DEPRECATED_TO_CORE_MAPPING.put(9, 0); // IC月卡 -> 余额支付 + DEPRECATED_TO_CORE_MAPPING.put(10, 0); // IC年卡 -> 余额支付 + DEPRECATED_TO_CORE_MAPPING.put(11, 0); // IC次卡 -> 余额支付 + DEPRECATED_TO_CORE_MAPPING.put(13, 0); // VIP充值卡 -> 余额支付 + DEPRECATED_TO_CORE_MAPPING.put(14, 0); // IC充值卡 -> 余额支付 + DEPRECATED_TO_CORE_MAPPING.put(16, 0); // VIP季卡 -> 余额支付 + DEPRECATED_TO_CORE_MAPPING.put(17, 0); // IC季卡 -> 余额支付 + + // 微信Native -> 微信支付 + DEPRECATED_TO_CORE_MAPPING.put(102, 1); // 微信Native -> 微信支付 + + // 代付 -> 微信支付(默认) + DEPRECATED_TO_CORE_MAPPING.put(18, 1); // 代付 -> 微信支付 + } + + /** + * 将废弃的支付方式转换为核心支付方式 + * + * @param originalPayType 原始支付方式代码 + * @return 转换后的核心支付方式代码 + */ + public static Integer convertToCore(Integer originalPayType) { + if (originalPayType == null) { + return null; + } + + // 检查是否为废弃的支付方式 + if (DEPRECATED_TO_CORE_MAPPING.containsKey(originalPayType)) { + Integer corePayType = DEPRECATED_TO_CORE_MAPPING.get(originalPayType); + log.warn("检测到废弃的支付方式: {} -> {},建议升级到核心支付方式", + originalPayType, corePayType); + return corePayType; + } + + // 如果是核心支付方式,直接返回 + return originalPayType; + } + + /** + * 检查支付方式是否已废弃 + * + * @param payType 支付方式代码 + * @return true表示已废弃 + */ + public static boolean isDeprecated(Integer payType) { + return payType != null && DEPRECATED_TO_CORE_MAPPING.containsKey(payType); + } + + /** + * 获取支付方式的迁移说明 + * + * @param payType 支付方式代码 + * @return 迁移说明文本 + */ + public static String getMigrationMessage(Integer payType) { + if (payType == null || !isDeprecated(payType)) { + return null; + } + + PaymentType originalType = PaymentType.getByCode(payType); + PaymentType coreType = PaymentType.getByCode(convertToCore(payType)); + + if (originalType != null && coreType != null) { + return String.format("支付方式 %s(%d) 已废弃,建议使用 %s(%d)", + originalType.getName(), payType, + coreType.getName(), coreType.getCode()); + } + + return "该支付方式已废弃,请使用核心支付方式"; + } + + /** + * 获取所有核心支付方式代码 + * + * @return 核心支付方式代码数组 + */ + public static Integer[] getCorePaymentTypeCodes() { + return new Integer[]{0, 1, 2, 3, 4, 5, 6, 7}; + } + + /** + * 检查是否为核心支付方式 + * + * @param payType 支付方式代码 + * @return true表示是核心支付方式 + */ + public static boolean isCorePaymentType(Integer payType) { + if (payType == null) { + return false; + } + + for (Integer coreType : getCorePaymentTypeCodes()) { + if (coreType.equals(payType)) { + return true; + } + } + return false; + } + + /** + * 生成支付方式迁移报告 + * + * @return 迁移报告文本 + */ + public static String generateMigrationReport() { + StringBuilder report = new StringBuilder(); + report.append("=== 支付方式迁移报告 ===\n"); + report.append("核心支付方式(8种):\n"); + + for (Integer coreType : getCorePaymentTypeCodes()) { + PaymentType type = PaymentType.getByCode(coreType); + if (type != null) { + report.append(String.format(" %d - %s\n", coreType, type.getName())); + } + } + + report.append("\n废弃支付方式映射:\n"); + for (Map.Entry entry : DEPRECATED_TO_CORE_MAPPING.entrySet()) { + PaymentType originalType = PaymentType.getByCode(entry.getKey()); + PaymentType coreType = PaymentType.getByCode(entry.getValue()); + if (originalType != null && coreType != null) { + report.append(String.format(" %d(%s) -> %d(%s)\n", + entry.getKey(), originalType.getName(), + entry.getValue(), coreType.getName())); + } + } + + return report.toString(); + } +} diff --git a/src/main/java/com/gxwebsoft/project/controller/ProjectCollectionController.java b/src/main/java/com/gxwebsoft/project/controller/ProjectCollectionController.java new file mode 100644 index 0000000..1a61c7c --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/controller/ProjectCollectionController.java @@ -0,0 +1,128 @@ +package com.gxwebsoft.project.controller; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.project.service.ProjectCollectionService; +import com.gxwebsoft.project.entity.ProjectCollection; +import com.gxwebsoft.project.param.ProjectCollectionParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 我的收藏控制器 + * + * @author 科技小王子 + * @since 2025-03-16 12:12:13 + */ +@Tag(name = "我的收藏管理") +@RestController +@RequestMapping("/api/project/project-collection") +public class ProjectCollectionController extends BaseController { + @Resource + private ProjectCollectionService projectCollectionService; + + @Operation(summary = "分页查询我的收藏") + @GetMapping("/page") + public ApiResult> page(ProjectCollectionParam param) { + // 使用关联查询 + return success(projectCollectionService.pageRel(param)); + } + + @Operation(summary = "查询全部我的收藏") + @GetMapping() + public ApiResult> list(ProjectCollectionParam param) { + // 使用关联查询 + return success(projectCollectionService.listRel(param)); + } + + @Operation(summary = "是否收藏") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + final ProjectCollection projectCollection = projectCollectionService.getOne(new LambdaQueryWrapper().eq(ProjectCollection::getAppId, id).eq(ProjectCollection::getUserId, getLoginUserId()).last("limit 1")); + if(ObjectUtil.isNotEmpty(projectCollection)){ + return success(true); + } + return success(false); + } + + @OperationLog + @Operation(summary = "加入收藏") + @PostMapping() + public ApiResult save(@RequestBody ProjectCollection projectCollection) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + projectCollection.setUserId(loginUser.getUserId()); + } + if (projectCollectionService.save(projectCollection)) { + return success("收藏成功"); + } + return fail("操作失败"); + } + + @OperationLog + @Operation(summary = "修改我的收藏") + @PutMapping() + public ApiResult update(@RequestBody ProjectCollection projectCollection) { + if (projectCollectionService.updateById(projectCollection)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @OperationLog + @Operation(summary = "取消收藏") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (projectCollectionService.remove(new LambdaQueryWrapper().eq(ProjectCollection::getAppId,id).eq(ProjectCollection::getUserId,getLoginUserId()))) { + return success("已取消收藏"); + } + return fail("操作失败"); + } + + @PreAuthorize("hasAuthority('project:projectCollection:save')") + @OperationLog + @Operation(summary = "批量添加我的收藏") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (projectCollectionService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('project:projectCollection:update')") + @OperationLog + @Operation(summary = "批量修改我的收藏") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(projectCollectionService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('project:projectCollection:remove')") + @OperationLog + @Operation(summary = "批量删除我的收藏") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (projectCollectionService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/project/controller/ProjectController.java b/src/main/java/com/gxwebsoft/project/controller/ProjectController.java new file mode 100644 index 0000000..ae031dd --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/controller/ProjectController.java @@ -0,0 +1,297 @@ +package com.gxwebsoft.project.controller; + +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.cms.entity.CmsWebsite; +import com.gxwebsoft.cms.param.CmsWebsiteParam; +import com.gxwebsoft.cms.service.CmsWebsiteService; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.Role; +import com.gxwebsoft.project.entity.ProjectUser; +import com.gxwebsoft.project.service.ProjectService; +import com.gxwebsoft.project.entity.Project; +import com.gxwebsoft.project.param.ProjectParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.project.service.ProjectUserService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 应用控制器 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Tag(name = "应用管理") +@RestController +@RequestMapping("/api/project/project") +public class ProjectController extends BaseController { + @Resource + private ProjectService projectService; + @Resource + private ProjectUserService projectUserService; + @Resource + private CmsWebsiteService cmsWebsiteService; + + @PreAuthorize("hasAuthority('project:project:list')") + @Operation(summary = "分页查询应用") + @GetMapping("/page") + public ApiResult> page(ProjectParam param) { + final User loginUser = getLoginUser(); + if (loginUser != null) { + param.setLoginUserId(loginUser.getUserId()); + final List roles = loginUser.getRoles(); + if (!CommonUtil.hasRole(roles, "admin") && !CommonUtil.hasRole(roles, "superAdmin")) { + final List projectUsers = projectUserService.list(new LambdaQueryWrapper().eq(ProjectUser::getUserId, loginUser.getUserId())); + final Set appIds = projectUsers.stream().map(ProjectUser::getAppId).collect(Collectors.toSet()); + param.setAppIds(appIds); + } + final PageResult result = projectService.pageRel(param); + final CmsWebsiteParam websiteParam = new CmsWebsiteParam(); + final List projects = result.getList(); + if(!CollectionUtils.isEmpty(projects)){ + final Set collectByProject = projects.stream().map(Project::getWebsiteId).collect(Collectors.toSet()); + websiteParam.setWebsiteIds(collectByProject); + final PageResult websitePageResult = cmsWebsiteService.pageRelAll(websiteParam); + if (!CollectionUtils.isEmpty(websitePageResult.getList())) { + final Map> collectByWebsite = websitePageResult.getList().stream().collect(Collectors.groupingBy(CmsWebsite::getWebsiteId)); + result.getList().forEach(item -> { + final List cmsWebsites = collectByWebsite.get(item.getWebsiteId()); + if (!CollectionUtils.isEmpty(cmsWebsites)) { + final CmsWebsite website = cmsWebsites.get(0); + item.setAppUrl(website.getDomain()); + item.setAdminUrl(website.getAdminUrl()); + item.setAppIcon(website.getWebsiteLogo()); + item.setAppType(website.getWebsiteType()); + item.setSuperAdminPhone(website.getSuperAdminPhone()); + } + }); + } + } + return success(result); + } + return fail("获取失败",null); + } + + @PreAuthorize("hasAuthority('project:project:list')") + @Operation(summary = "查询全部应用") + @GetMapping() + public ApiResult> list(ProjectParam param) { + // 使用关联查询 + return success(projectService.listRel(param)); + } + + @PreAuthorize("hasAuthority('project:project:list')") + @Operation(summary = "根据id查询应用") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(projectService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('project:project:save')") + @OperationLog + @Operation(summary = "添加应用") + @PostMapping() + public ApiResult save(@RequestBody Project project) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + project.setUserId(loginUser.getUserId()); + final Project one = projectService.getOne(new LambdaQueryWrapper().eq(Project::getAppCode, project.getAppCode()).last("limit 1")); + if (!ObjectUtil.isEmpty(one)) { + return fail("应用标识已存在"); + } + if (projectService.save(project)) { + final ProjectUser user = new ProjectUser(); + user.setUserId(loginUser.getUserId()); + user.setAppId(project.getAppId()); + user.setRole(30); + user.setNickname(loginUser.getNickname()); + projectUserService.save(user); + return success("添加成功"); + } + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('project:project:update')") + @OperationLog + @Operation(summary = "修改应用") + @PutMapping() + public ApiResult update(@RequestBody Project project) { + if(project.getAppStatus() != null && project.getAppStatus().equals("已上架")){ + project.setProgress(100); + } + if (projectService.updateById(project)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('project:project:remove')") + @OperationLog + @Operation(summary = "删除应用") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (projectService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('project:project:save')") + @OperationLog + @Operation(summary = "批量添加应用") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (projectService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('project:project:update')") + @OperationLog + @Operation(summary = "批量修改应用") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(projectService, "app_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('project:project:remove')") + @OperationLog + @Operation(summary = "批量删除应用") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (projectService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + + @Operation(summary = "统计信息") + @GetMapping("/data") + public ApiResult> data() { + Map data = new HashMap<>(); + final LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + final User loginUser = getLoginUser(); + if(loginUser != null){ + + final List roles = loginUser.getRoles(); + if (!CommonUtil.hasRole(roles, "admin") && !CommonUtil.hasRole(roles, "superAdmin")) { + final List projectUsers = projectUserService.list(new LambdaQueryWrapper().eq(ProjectUser::getUserId, loginUser.getUserId())); + final Set userIds = projectUsers.stream().map(ProjectUser::getAppId).collect(Collectors.toSet()); + wrapper.in(Project::getUserId,userIds); + } + + Integer totalNum = Math.toIntExact(projectService.count(wrapper)); + + wrapper.eq(Project::getAppStatus, "开发中"); + Integer totalNum2 = Math.toIntExact(projectService.count(wrapper)); + + wrapper.clear(); + wrapper.eq(Project::getAppStatus,"已上架"); + Integer totalNum3 = Math.toIntExact(projectService.count(wrapper)); + + wrapper.clear(); + wrapper.eq(Project::getAppStatus,"已上架").eq(Project::getShowExpiration,true); + Integer totalNum4 = Math.toIntExact(projectService.count(wrapper)); + + wrapper.clear(); + wrapper.eq(Project::getAppStatus, "已下架"); + Integer totalNum5 = Math.toIntExact(projectService.count(wrapper)); + + wrapper.clear(); + wrapper.eq(Project::getShowCase,true); + Integer totalNum6 = Math.toIntExact(projectService.count(wrapper)); + + wrapper.clear(); + wrapper.eq(Project::getShowIndex,true); + Integer totalNum7 = Math.toIntExact(projectService.count(wrapper)); + + data.put("totalNum", totalNum); + data.put("totalNum2", totalNum2); + data.put("totalNum3", totalNum3); + data.put("totalNum4", totalNum4); + data.put("totalNum5", totalNum5); + data.put("totalNum6", totalNum6); + data.put("totalNum7", totalNum7); + } + return success(data); + } + + @Operation(summary = "统计信息") + @GetMapping("/count") + public ApiResult> count() { + Map data = new HashMap<>(); + final User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("请先登录", null); + } + + // 今天日期 + DateTime date = DateUtil.date(); + // 获取当前年份的起止时间 + LocalDateTime startOfYear = LocalDateTime.now().withMonth(1).withDayOfMonth(1) + .withHour(0).withMinute(0).withSecond(0); + LocalDateTime endOfYear = startOfYear.plusYears(1).minusNanos(1); + // 去年的起止时间 + LocalDateTime startOfLastYear = LocalDateTime.now().minusYears(1).withMonth(1).withDayOfMonth(1) + .withHour(0).withMinute(0).withSecond(0); + LocalDateTime endOfLastYear = startOfLastYear.plusYears(1).minusNanos(1); + + // TODO 近30天可催收的续费总额 + // 下个月的今天 + final DateTime nextMonth = DateUtil.nextMonth(); + final BigDecimal totalPrice30 = projectService.sumMoney(new LambdaQueryWrapper() + .lt(Project::getExpirationTime, nextMonth) + .gt(Project::getExpirationTime, date) + .eq(Project::getDeleted, 0) + ); + data.put("totalPrice30", totalPrice30); + + + // TODO 今年已收续费总额 + BigDecimal yearTotalPrice = projectService.sumMoney(new LambdaQueryWrapper() + .between(Project::getUpdateTime, startOfYear, endOfYear) + .eq(Project::getDeleted, 0) + ); + data.put("yearTotalPrice", yearTotalPrice); + + // TODO 去年已收续费总额 + BigDecimal lastTotalPrice = projectService.sumMoney(new LambdaQueryWrapper() + .between(Project::getUpdateTime, startOfLastYear, endOfLastYear) + .eq(Project::getDeleted, 0) + .eq(Project::getDeleted,0) + ); + // 去年已收续费总额 + data.put("lastTotalPrice", lastTotalPrice); + + return success(data); + } + +} diff --git a/src/main/java/com/gxwebsoft/project/controller/ProjectFieldController.java b/src/main/java/com/gxwebsoft/project/controller/ProjectFieldController.java new file mode 100644 index 0000000..d1cf3d5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/controller/ProjectFieldController.java @@ -0,0 +1,134 @@ +package com.gxwebsoft.project.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.project.service.ProjectFieldService; +import com.gxwebsoft.project.entity.ProjectField; +import com.gxwebsoft.project.param.ProjectFieldParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 应用参数控制器 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Tag(name = "应用参数管理") +@RestController +@RequestMapping("/api/project/project-field") +public class ProjectFieldController extends BaseController { + @Resource + private ProjectFieldService projectFieldService; + + @PreAuthorize("hasAuthority('project:project:list')") + @Operation(summary = "分页查询应用参数") + @GetMapping("/page") + public ApiResult> page(ProjectFieldParam param) { + // 使用关联查询 + return success(projectFieldService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('project:project:list')") + @Operation(summary = "查询全部应用参数") + @GetMapping() + public ApiResult> list(ProjectFieldParam param) { + // 使用关联查询 + return success(projectFieldService.listRel(param)); + } + + @PreAuthorize("hasAuthority('project:project:list')") + @Operation(summary = "根据id查询应用参数") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(projectFieldService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('project:project:save')") + @OperationLog + @Operation(summary = "添加应用参数") + @PostMapping() + public ApiResult save(@RequestBody ProjectField projectField) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + projectField.setUserId(loginUser.getUserId()); + } + if (projectFieldService.save(projectField)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('project:project:update')") + @OperationLog + @Operation(summary = "修改应用参数") + @PutMapping() + public ApiResult update(@RequestBody ProjectField projectField) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + projectField.setUpdateUserId(loginUser.getUserId()); + } + if (projectFieldService.updateById(projectField)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('project:project:remove')") + @OperationLog + @Operation(summary = "删除应用参数") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (projectFieldService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('project:project:save')") + @OperationLog + @Operation(summary = "批量添加应用参数") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (projectFieldService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('project:project:update')") + @OperationLog + @Operation(summary = "批量修改应用参数") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(projectFieldService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('project:project:remove')") + @OperationLog + @Operation(summary = "批量删除应用参数") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (projectFieldService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/project/controller/ProjectRenewController.java b/src/main/java/com/gxwebsoft/project/controller/ProjectRenewController.java new file mode 100644 index 0000000..8910d02 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/controller/ProjectRenewController.java @@ -0,0 +1,290 @@ +package com.gxwebsoft.project.controller; + +import cn.hutool.core.date.DateField; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.project.entity.Project; +import com.gxwebsoft.project.param.ProjectParam; +import com.gxwebsoft.project.service.ProjectRenewService; +import com.gxwebsoft.project.entity.ProjectRenew; +import com.gxwebsoft.project.param.ProjectRenewParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.project.service.ProjectService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.*; + +/** + * 续费管理控制器 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Tag(name = "续费管理管理") +@RestController +@RequestMapping("/api/project/project-renew") +public class ProjectRenewController extends BaseController { + @Resource + private ProjectRenewService projectRenewService; + @Resource + private ProjectService projectService; + + @PreAuthorize("hasAuthority('project:projectRenew:list')") + @Operation(summary = "分页查询续费管理") + @GetMapping("/page") + public ApiResult> page(ProjectRenewParam param) { + return success(projectRenewService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('project:projectRenew:list')") + @Operation(summary = "查询全部续费管理") + @GetMapping() + public ApiResult> list(ProjectRenewParam param) { + // 使用关联查询 + return success(projectRenewService.listRel(param)); + } + + @PreAuthorize("hasAuthority('project:projectRenew:list')") + @Operation(summary = "根据id查询续费管理") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(projectRenewService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('project:projectRenew:save')") + @OperationLog + @Operation(summary = "添加续费管理") + @PostMapping() + public ApiResult save(@RequestBody ProjectRenew projectRenew) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + projectRenew.setUserId(loginUser.getUserId()); + } + // 更新项目状态 + if (projectRenewService.save(projectRenew)) { + projectService.updateByRenew(projectRenew); + return success("操作成功"); + } + return fail("操作失败"); + } + + @PreAuthorize("hasAuthority('project:projectRenew:update')") + @OperationLog + @Operation(summary = "修改续费管理") + @PutMapping() + public ApiResult update(@RequestBody ProjectRenew projectRenew) { + if (projectRenewService.updateById(projectRenew)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('project:projectRenew:remove')") + @OperationLog + @Operation(summary = "删除续费管理") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + // 撤销操作 + final ProjectRenew renew = projectRenewService.getByIdRel(id); + if (ObjectUtil.isNotEmpty(renew)) { + final Project project = projectService.getOne(new LambdaQueryWrapper().eq(Project::getAppId, renew.getAppId())); + if (renew.getDays() > 0) { + // 按天续费 + project.setExpirationTime(project.getExpirationTime().minusDays(renew.getDays())); + } else { + // 按年续费 + project.setExpirationTime(project.getExpirationTime().minusMonths(12 * renew.getDuration())); + // 回退上一年的续费金额 + final List renews = projectRenewService.list(new LambdaQueryWrapper().eq(ProjectRenew::getAppId, renew.getAppId()).orderByDesc(ProjectRenew::getAppRenewId).last("limit 2")); + if(renews.size() > 1){ + final ProjectRenew projectRenew = renews.get(1); + project.setRenewMoney(projectRenew.getPayPrice()); + } + projectService.updateById(project); + } + // 保存到期时间所在的年月日 + final LocalDateTime expirationTime = project.getExpirationTime(); + LocalDate localDate = expirationTime.toLocalDate(); + int year = localDate.getYear(); + int month = localDate.getMonthValue(); // 获取月份,范围是1到12 + int day = localDate.getDayOfMonth(); // 获取日,范围是1到31 + project.setYear(year); + project.setMonth(month); + project.setDay(day); + } + + if (projectRenewService.removeById(id)) { + return success("该笔续费操作已撤销"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('project:projectRenew:save')") + @OperationLog + @Operation(summary = "批量添加续费管理") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (projectRenewService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('project:projectRenew:update')") + @OperationLog + @Operation(summary = "批量修改续费管理") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(projectRenewService, "app_renew_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('project:projectRenew:remove')") + @OperationLog + @Operation(summary = "批量删除续费管理") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (projectRenewService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + + @Operation(summary = "统计信息") + @GetMapping("/data") + public ApiResult> data(ProjectParam param) { + Map data = new HashMap<>(); + final User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("请先登录", null); + } + + // 今天日期 + DateTime date = DateUtil.date(); + // 获取当前年份的起止时间 + LocalDateTime startOfYear = LocalDateTime.now().withMonth(1).withDayOfMonth(1) + .withHour(0).withMinute(0).withSecond(0); + LocalDateTime endOfYear = startOfYear.plusYears(1).minusNanos(1); + // 去年的起止时间 + LocalDateTime startOfLastYear = LocalDateTime.now().minusYears(1).withMonth(1).withDayOfMonth(1) + .withHour(0).withMinute(0).withSecond(0); + LocalDateTime endOfLastYear = startOfLastYear.plusYears(1).minusNanos(1); + // 本月起止时间 + LocalDateTime startOfMonth = LocalDateTime.now().withDayOfMonth(1) + .withHour(0).withMinute(0).withSecond(0); + LocalDateTime endOfMonth = startOfMonth.plusMonths(1).minusNanos(1); + + + // TODO 近30天可催收的续费总额 + // 下个月的今天 + final DateTime nextMonth = DateUtil.nextMonth(); + BigDecimal totalPrice30 = projectService.sumMoney(new LambdaQueryWrapper() + .lt(Project::getExpirationTime, nextMonth) + .gt(Project::getExpirationTime, date) + .lt(Project::getCreateTime, date) + .eq(Project::getShowExpiration, true) + .eq(Project::getAppStatus, "已上架") + .eq(Project::getDeleted, 0) + ); + data.put("totalPrice30", totalPrice30); + + // TODO 按所属月份查询续费总金额 + if(param.getMonth() != null){ + BigDecimal currentQueryTotalPrice = projectService.sumMoney(new LambdaQueryWrapper() + .eq(Project::getMonth, param.getMonth()) + .eq(Project::getShowExpiration, true) + .eq(Project::getAppStatus, "已上架") + .eq(Project::getDeleted, 0) + ); + data.put("currentQueryTotalPrice", currentQueryTotalPrice); + } + + // TODO 有效的续费总金额 + final BigDecimal effectiveTotalPrice = projectService.sumMoney(new LambdaQueryWrapper() + .eq(Project::getDeleted, 0) + .eq(Project::getShowExpiration, true) + .eq(Project::getAppStatus, "已上架") + .gt(Project::getExpirationTime, date)); + data.put("effectiveTotalPrice", effectiveTotalPrice); + + // TODO 已超过催收时间的续费总额 + final BigDecimal expiredPrice = projectService.sumMoney(new LambdaQueryWrapper() + .eq(Project::getDeleted, 0) + .eq(Project::getShowExpiration, true) + .eq(Project::getAppStatus, "已上架") + .lt(Project::getExpirationTime, date)); + data.put("expiredPrice", expiredPrice); + + // TODO 计算每年可收续费总额 + final BigDecimal totalRenewPrice = projectService.sumMoney(new LambdaQueryWrapper() + .eq(Project::getDeleted, 0) + .eq(Project::getShowExpiration, true) + .eq(Project::getAppStatus, "已上架") + ); + + // TODO 本月已收续费总额 + final BigDecimal monthTotalPrice = projectRenewService.sumMoney(new LambdaQueryWrapper() + .between(ProjectRenew::getCreateTime, startOfMonth, endOfMonth) + .eq(ProjectRenew::getDeleted, 0) + ); + data.put("monthTotalPrice", monthTotalPrice); + + // TODO 今年已收续费总额 + BigDecimal yearTotalPrice = projectRenewService.sumMoney(new LambdaQueryWrapper() + .between(ProjectRenew::getCreateTime, startOfYear, endOfYear) + .eq(ProjectRenew::getDeleted, 0) + ); + data.put("yearTotalPrice", yearTotalPrice); + + // TODO 去年已收续费总额 + BigDecimal lastTotalPrice = projectRenewService.sumMoney(new LambdaQueryWrapper() + .eq(ProjectRenew::getDeleted, 0) + .between(ProjectRenew::getEndTime, startOfLastYear, endOfLastYear)); + // 去年已收续费总额 + data.put("lastTotalPrice", lastTotalPrice); + + data.put("totalRenewPrice", totalRenewPrice); + + return success(data); + } + + @Operation(summary = "统计每个月的续费总金额") + @GetMapping("/listMonthRenewPrice") + public ApiResult> listMonthRenewPrice() { + final User loginUser = getLoginUser(); + if (loginUser != null) { + final LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + List monthPrice = new ArrayList<>(); + for (int i = 1; i < 13; i++) { + wrapper.clear(); + wrapper.eq(Project::getDeleted, 0) + .eq(Project::getShowExpiration, true) + .eq(Project::getAppStatus, "已上架"); + monthPrice.add(projectService.sumMoney(wrapper.eq(Project::getMonth,i))); + } + return success(monthPrice); + } + return fail("请先登录", null); + } + +} diff --git a/src/main/java/com/gxwebsoft/project/controller/ProjectUrlController.java b/src/main/java/com/gxwebsoft/project/controller/ProjectUrlController.java new file mode 100644 index 0000000..4300e9f --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/controller/ProjectUrlController.java @@ -0,0 +1,124 @@ +package com.gxwebsoft.project.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.project.service.ProjectUrlService; +import com.gxwebsoft.project.entity.ProjectUrl; +import com.gxwebsoft.project.param.ProjectUrlParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 项目域名控制器 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Tag(name = "项目域名管理") +@RestController +@RequestMapping("/api/project/project-url") +public class ProjectUrlController extends BaseController { + @Resource + private ProjectUrlService projectUrlService; + + @PreAuthorize("hasAuthority('project:projectUrl:list')") + @Operation(summary = "分页查询项目域名") + @GetMapping("/page") + public ApiResult> page(ProjectUrlParam param) { + // 使用关联查询 + return success(projectUrlService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('project:projectUrl:list')") + @Operation(summary = "查询全部项目域名") + @GetMapping() + public ApiResult> list(ProjectUrlParam param) { + // 使用关联查询 + return success(projectUrlService.listRel(param)); + } + + @PreAuthorize("hasAuthority('project:projectUrl:list')") + @Operation(summary = "根据id查询项目域名") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(projectUrlService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('project:projectUrl:save')") + @OperationLog + @Operation(summary = "添加项目域名") + @PostMapping() + public ApiResult save(@RequestBody ProjectUrl projectUrl) { + if (projectUrlService.save(projectUrl)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('project:projectUrl:update')") + @OperationLog + @Operation(summary = "修改项目域名") + @PutMapping() + public ApiResult update(@RequestBody ProjectUrl projectUrl) { + if (projectUrlService.updateById(projectUrl)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('project:projectUrl:remove')") + @OperationLog + @Operation(summary = "删除项目域名") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (projectUrlService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('project:projectUrl:save')") + @OperationLog + @Operation(summary = "批量添加项目域名") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (projectUrlService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('project:projectUrl:update')") + @OperationLog + @Operation(summary = "批量修改项目域名") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(projectUrlService, "app_url_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('project:projectUrl:remove')") + @OperationLog + @Operation(summary = "批量删除项目域名") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (projectUrlService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/project/controller/ProjectUserController.java b/src/main/java/com/gxwebsoft/project/controller/ProjectUserController.java new file mode 100644 index 0000000..0697174 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/controller/ProjectUserController.java @@ -0,0 +1,124 @@ +package com.gxwebsoft.project.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.project.service.ProjectUserService; +import com.gxwebsoft.project.entity.ProjectUser; +import com.gxwebsoft.project.param.ProjectUserParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 应用成员控制器 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Tag(name = "应用成员管理") +@RestController +@RequestMapping("/api/project/project-user") +public class ProjectUserController extends BaseController { + @Resource + private ProjectUserService projectUserService; + + @PreAuthorize("hasAuthority('project:projectUser:list')") + @Operation(summary = "分页查询应用成员") + @GetMapping("/page") + public ApiResult> page(ProjectUserParam param) { + // 使用关联查询 + return success(projectUserService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('project:projectUser:list')") + @Operation(summary = "查询全部应用成员") + @GetMapping() + public ApiResult> list(ProjectUserParam param) { + // 使用关联查询 + return success(projectUserService.listRel(param)); + } + + @PreAuthorize("hasAuthority('project:projectUser:list')") + @Operation(summary = "根据id查询应用成员") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(projectUserService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('project:projectUser:save')") + @OperationLog + @Operation(summary = "添加应用成员") + @PostMapping() + public ApiResult save(@RequestBody ProjectUser projectUser) { + if (projectUserService.save(projectUser)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('project:projectUser:update')") + @OperationLog + @Operation(summary = "修改应用成员") + @PutMapping() + public ApiResult update(@RequestBody ProjectUser projectUser) { + if (projectUserService.updateById(projectUser)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('project:projectUser:remove')") + @OperationLog + @Operation(summary = "删除应用成员") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (projectUserService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('project:projectUser:save')") + @OperationLog + @Operation(summary = "批量添加应用成员") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (projectUserService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('project:projectUser:update')") + @OperationLog + @Operation(summary = "批量修改应用成员") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(projectUserService, "app_user_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('project:projectUser:remove')") + @OperationLog + @Operation(summary = "批量删除应用成员") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (projectUserService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/project/entity/Project.java b/src/main/java/com/gxwebsoft/project/entity/Project.java new file mode 100644 index 0000000..55ad688 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/entity/Project.java @@ -0,0 +1,287 @@ +package com.gxwebsoft.project.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.List; +import java.util.Set; + +import com.gxwebsoft.cms.entity.CmsWebsite; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 应用 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "Project对象", description = "应用") +public class Project implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "应用ID") + @TableId(value = "app_id", type = IdType.AUTO) + private Integer appId; + + @Schema(description = "应用名称") + private String appName; + + @Schema(description = "应用标识") + private String appCode; + + @Schema(description = "应用秘钥") + private String appSecret; + + @Schema(description = "上级id, 0是顶级") + private Integer parentId; + + @Schema(description = "应用类型") + private String appType; + + @Schema(description = "应用类型") + private String appTypeMultiple; + + @Schema(description = "类型, 0菜单, 1按钮") + private Integer menuType; + + @Schema(description = "企业(存用户ID)") + private Integer companyId; + + @Schema(description = "企业名称") + @TableField(exist = false) + private String companyName; + + @Schema(description = "超管账号") + @TableField(exist = false) + private String superAdminPhone; + + @Schema(description = "应用图标") + private String appIcon; + + @Schema(description = "二维码") + private String appQrcode; + + @Schema(description = "链接地址") + private String appUrl; + + @Schema(description = "后台管理地址") + private String adminUrl; + + @Schema(description = "下载地址") + private String downUrl; + + @Schema(description = "链接地址") + private String serverUrl; + + @Schema(description = "文件服务器") + private String fileUrl; + + @Schema(description = "回调地址") + private String callbackUrl; + + @Schema(description = "腾讯文档地址") + private String docsUrl; + + @Schema(description = "代码仓库地址") + private String gitUrl; + + @Schema(description = "原型图地址") + private String prototypeUrl; + + @Schema(description = "IP白名单") + private String ipAddress; + + @Schema(description = "应用截图") + private String images; + + @Schema(description = "应用包名") + private String packageName; + + @Schema(description = "下载次数") + private Integer clicks; + + @Schema(description = "安装次数") + private Integer installs; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "应用介绍") + private String content; + + @Schema(description = "项目需求") + private String requirement; + + @Schema(description = "开发者(个人或公司)") + private String developer; + + @Schema(description = "项目负责人") + private String director; + + @Schema(description = "项目经理") + private String projectDirector; + + @Schema(description = "业务员") + private String salesman; + + @Schema(description = "软件定价") + private BigDecimal price; + + @Schema(description = "划线价格") + private BigDecimal linePrice; + + @Schema(description = "评分") + private String score; + + @Schema(description = "星级") + private String star; + + @Schema(description = "菜单路由地址") + private String path; + + @Schema(description = "菜单组件地址, 目录可为空") + private String component; + + @Schema(description = "权限标识") + private String authority; + + @Schema(description = "打开位置") + private String target; + + @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") + private Integer hide; + + @Schema(description = "禁止搜索,1禁止 0 允许") + private Integer search; + + @Schema(description = "菜单侧栏选中的path") + private String active; + + @Schema(description = "其它路由元信息") + private String meta; + + @Schema(description = "版本,0正式版 1体验版 2开发版") + private String edition; + + @Schema(description = "版本号") + private String version; + + @Schema(description = "是否已安装") + private Integer isUse; + + @Schema(description = "附近1") + private String file1; + + @Schema(description = "附件2") + private String file2; + + @Schema(description = "附件3") + private String file3; + + @Schema(description = "是否显示续费提醒") + private Boolean showExpiration; + + @Schema(description = "是否作为案例展示") + private Integer showCase; + + @Schema(description = "是否显示在首页") + private Integer showIndex; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime expirationTime; + + @Schema(description = "所属年份") + private Integer year; + + @Schema(description = "所属月份") + private Integer month; + + @Schema(description = "所属日期") + private Integer day; + + @Schema(description = "状态, 0正常, 1 即将过期") + private Integer soon; + + @Schema(description = "是否过期") + @TableField(exist = false) + private Integer expired; + + @Schema(description = "剩余天数") + @TableField(exist = false) + private Long expiredDays; + + @Schema(description = "续费金额") + private BigDecimal renewMoney; + + @Schema(description = "续费总金额") + @TableField(exist = false) + private BigDecimal totalRenewMoney; + + @Schema(description = "续费次数") + private Long renewCount; + + @Schema(description = "应用状态") + private String appStatus; + + @Schema(description = "开发进度") + private Integer progress; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "网站id") + private Integer websiteId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "是否收藏") + @TableField(exist = false) + private Boolean collection; + + @Schema(description = "应用成员") + @TableField(exist = false) + private List projectUsers; + +} diff --git a/src/main/java/com/gxwebsoft/project/entity/ProjectCollection.java b/src/main/java/com/gxwebsoft/project/entity/ProjectCollection.java new file mode 100644 index 0000000..bf80392 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/entity/ProjectCollection.java @@ -0,0 +1,44 @@ +package com.gxwebsoft.project.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 我的收藏 + * + * @author 科技小王子 + * @since 2025-03-16 12:12:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ProjectCollection对象", description = "我的收藏") +public class ProjectCollection implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "应用ID") + private Integer appId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/project/entity/ProjectField.java b/src/main/java/com/gxwebsoft/project/entity/ProjectField.java new file mode 100644 index 0000000..c3944ec --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/entity/ProjectField.java @@ -0,0 +1,83 @@ +package com.gxwebsoft.project.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 应用参数 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ProjectField对象", description = "应用参数") +public class ProjectField implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "应用ID") + private Integer appId; + + @Schema(description = "类型") + private String type; + + @Schema(description = "名称") + private String name; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "用户昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "用户头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "最后修改人") + private Integer updateUserId; + + @Schema(description = "最后修改人") + @TableField(exist = false) + private String updateUserName; + + @Schema(description = "最后修改人") + @TableField(exist = false) + private String updateUserAvatar; + + @Schema(description = "状态, 0正常, 1删除") + private Integer status; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/project/entity/ProjectRenew.java b/src/main/java/com/gxwebsoft/project/entity/ProjectRenew.java new file mode 100644 index 0000000..cd3336b --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/entity/ProjectRenew.java @@ -0,0 +1,127 @@ +package com.gxwebsoft.project.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 续费管理 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ProjectRenew对象", description = "续费管理") +public class ProjectRenew implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "app_renew_id", type = IdType.AUTO) + private Integer appRenewId; + + @Schema(description = "应用ID") + private Integer appId; + + @Schema(description = "类型, 0续费, 1新购") + private Integer type; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "应用名称") + @TableField(exist = false) + private String appName; + + @Schema(description = "应用图标") + @TableField(exist = false) + private String appIcon; + + @Schema(description = "续费金额") + private BigDecimal money; + + @Schema(description = "订单总额") + private BigDecimal totalPrice; + + @Schema(description = "实际付款") + private BigDecimal payPrice; + + @Schema(description = "优惠金额") + private BigDecimal reducePrice; + + @Schema(description = "续费时长(按年)") + private Integer duration; + + @Schema(description = "续费时长(按天)") + private Integer days; + + @Schema(description = "支付方式, 0余额, 1微信,102微信Native, 3支付宝, 4现金") + private Integer payType; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "开始时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime startTime; + + @Schema(description = "到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime endTime; + + @Schema(description = "到期时间") + @TableField(exist = false) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime expirationTime; + + @Schema(description = "状态, 0正常, 1 即将过期") + private Integer soon; + + @Schema(description = "客户(用户ID)") + @TableField(exist = false) + private Integer customerId; + + @Schema(description = "客户名称") + @TableField(exist = false) + private String customerName; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "付款凭证") + private String images; + + @Schema(description = "操作员姓名") + @TableField(exist = false) + private String nickname; + + @Schema(description = "操作员头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "状态, 0正常, 1待确认") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/project/entity/ProjectUrl.java b/src/main/java/com/gxwebsoft/project/entity/ProjectUrl.java new file mode 100644 index 0000000..6e7b177 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/entity/ProjectUrl.java @@ -0,0 +1,62 @@ +package com.gxwebsoft.project.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 项目域名 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ProjectUrl对象", description = "项目域名") +public class ProjectUrl implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "app_url_id", type = IdType.AUTO) + private Integer appUrlId; + + @Schema(description = "应用ID") + private Integer appId; + + @Schema(description = "域名类型") + private String name; + + @Schema(description = "域名") + private String domain; + + @Schema(description = "账号") + private String account; + + @Schema(description = "密码") + private String password; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1待确认") + private Integer status; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "租户id") + private Integer tenantId; + +} diff --git a/src/main/java/com/gxwebsoft/project/entity/ProjectUser.java b/src/main/java/com/gxwebsoft/project/entity/ProjectUser.java new file mode 100644 index 0000000..455099f --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/entity/ProjectUser.java @@ -0,0 +1,58 @@ +package com.gxwebsoft.project.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Set; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 应用成员 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ProjectUser对象", description = "应用成员") +public class ProjectUser implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "app_user_id", type = IdType.AUTO) + private Integer appUserId; + + @Schema(description = "角色,10体验成员 20开发者成员 30管理员 ") + private Integer role; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "应用ID") + private Integer appId; + + @Schema(description = "昵称") + private String nickname; + + @Schema(description = "头像") + private String avatar; + + @Schema(description = "状态, 0正常, 1待确认") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/project/mapper/ProjectCollectionMapper.java b/src/main/java/com/gxwebsoft/project/mapper/ProjectCollectionMapper.java new file mode 100644 index 0000000..c16dc51 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/mapper/ProjectCollectionMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.project.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.project.entity.ProjectCollection; +import com.gxwebsoft.project.param.ProjectCollectionParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 我的收藏Mapper + * + * @author 科技小王子 + * @since 2025-03-16 12:12:13 + */ +public interface ProjectCollectionMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ProjectCollectionParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ProjectCollectionParam param); + +} diff --git a/src/main/java/com/gxwebsoft/project/mapper/ProjectFieldMapper.java b/src/main/java/com/gxwebsoft/project/mapper/ProjectFieldMapper.java new file mode 100644 index 0000000..a8fc6b5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/mapper/ProjectFieldMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.project.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.project.entity.ProjectField; +import com.gxwebsoft.project.param.ProjectFieldParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 应用参数Mapper + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +public interface ProjectFieldMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ProjectFieldParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ProjectFieldParam param); + +} diff --git a/src/main/java/com/gxwebsoft/project/mapper/ProjectMapper.java b/src/main/java/com/gxwebsoft/project/mapper/ProjectMapper.java new file mode 100644 index 0000000..f7f080e --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/mapper/ProjectMapper.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.project.mapper; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.project.entity.Project; +import com.gxwebsoft.project.param.ProjectParam; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 应用Mapper + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +public interface ProjectMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ProjectParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ProjectParam param); + + + /** + * 统计金额总和 + * + * @param wrapper 查询条件 + * @return 金额总和 + */ + BigDecimal selectSumMoney(@Param("ew") Wrapper wrapper); +} diff --git a/src/main/java/com/gxwebsoft/project/mapper/ProjectRenewMapper.java b/src/main/java/com/gxwebsoft/project/mapper/ProjectRenewMapper.java new file mode 100644 index 0000000..4881b00 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/mapper/ProjectRenewMapper.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.project.mapper; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.project.entity.ProjectRenew; +import com.gxwebsoft.project.param.ProjectRenewParam; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 续费管理Mapper + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +public interface ProjectRenewMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ProjectRenewParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ProjectRenewParam param); + + + /** + * 统计金额总和 + * + * @param wrapper 查询条件 + * @return 金额总和 + */ + BigDecimal selectSumMoney(@Param("ew") Wrapper wrapper); + +} diff --git a/src/main/java/com/gxwebsoft/project/mapper/ProjectUrlMapper.java b/src/main/java/com/gxwebsoft/project/mapper/ProjectUrlMapper.java new file mode 100644 index 0000000..22ba4e2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/mapper/ProjectUrlMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.project.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.project.entity.ProjectUrl; +import com.gxwebsoft.project.param.ProjectUrlParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 项目域名Mapper + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +public interface ProjectUrlMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ProjectUrlParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ProjectUrlParam param); + +} diff --git a/src/main/java/com/gxwebsoft/project/mapper/ProjectUserMapper.java b/src/main/java/com/gxwebsoft/project/mapper/ProjectUserMapper.java new file mode 100644 index 0000000..aa29153 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/mapper/ProjectUserMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.project.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.project.entity.ProjectUser; +import com.gxwebsoft.project.param.ProjectUserParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 应用成员Mapper + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +public interface ProjectUserMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ProjectUserParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ProjectUserParam param); + +} diff --git a/src/main/java/com/gxwebsoft/project/mapper/xml/ProjectCollectionMapper.xml b/src/main/java/com/gxwebsoft/project/mapper/xml/ProjectCollectionMapper.xml new file mode 100644 index 0000000..74d6f66 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/mapper/xml/ProjectCollectionMapper.xml @@ -0,0 +1,42 @@ + + + + + + + SELECT a.* + FROM project_collection a + + + AND a.id = #{param.id} + + + AND a.user_id = #{param.userId} + + + AND a.app_id = #{param.appId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/project/mapper/xml/ProjectFieldMapper.xml b/src/main/java/com/gxwebsoft/project/mapper/xml/ProjectFieldMapper.xml new file mode 100644 index 0000000..39af3c1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/mapper/xml/ProjectFieldMapper.xml @@ -0,0 +1,60 @@ + + + + + + + SELECT a.*, b.avatar AS avatar, b.nickname, c.nickname as updateUserName, c.avatar as updateUserAvatar + FROM project_field a + LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id + LEFT JOIN gxwebsoft_core.sys_user c ON a.update_user_id = c.user_id + + + AND a.id = #{param.id} + + + AND a.app_id = #{param.appId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.user_id = #{param.userId} + + + AND c.update_user_id = #{param.updateUserId} + + + AND a.status = #{param.status} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/project/mapper/xml/ProjectMapper.xml b/src/main/java/com/gxwebsoft/project/mapper/xml/ProjectMapper.xml new file mode 100644 index 0000000..51b6c85 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/mapper/xml/ProjectMapper.xml @@ -0,0 +1,275 @@ + + + + + + + SELECT a.*, b.real_name as nickname, b.avatar,c.website_type as appType, u.real_name as companyName, u.phone as superAdminPhone + FROM project a + LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id + LEFT JOIN cms_website c ON a.website_id = c.website_id + LEFT JOIN gxwebsoft_core.sys_user u ON a.company_id = u.user_id + + + AND a.app_id = #{param.appId} + + + AND a.app_name LIKE CONCAT('%', #{param.appName}, '%') + + + AND a.app_code LIKE CONCAT('%', #{param.appCode}, '%') + + + AND a.app_secret LIKE CONCAT('%', #{param.appSecret}, '%') + + + AND a.parent_id = #{param.parentId} + + + AND a.website_id = #{param.websiteId} + + + AND a.app_type LIKE CONCAT('%', #{param.appType}, '%') + + + AND a.app_type_multiple LIKE CONCAT('%', #{param.appTypeMultiple}, '%') + + + AND a.menu_type = #{param.menuType} + + + AND a.company_id = #{param.companyId} + + + AND a.company_name LIKE CONCAT('%', #{param.companyName}, '%') + + + AND u.phone = #{param.loginPhone} + + + AND a.app_icon LIKE CONCAT('%', #{param.appIcon}, '%') + + + AND a.app_qrcode LIKE CONCAT('%', #{param.appQrcode}, '%') + + + AND a.app_url LIKE CONCAT('%', #{param.appUrl}, '%') + + + AND a.admin_url LIKE CONCAT('%', #{param.adminUrl}, '%') + + + AND a.down_url LIKE CONCAT('%', #{param.downUrl}, '%') + + + AND a.server_url LIKE CONCAT('%', #{param.serverUrl}, '%') + + + AND a.file_url LIKE CONCAT('%', #{param.fileUrl}, '%') + + + AND a.callback_url LIKE CONCAT('%', #{param.callbackUrl}, '%') + + + AND a.docs_url LIKE CONCAT('%', #{param.docsUrl}, '%') + + + AND a.git_url LIKE CONCAT('%', #{param.gitUrl}, '%') + + + AND a.prototype_url LIKE CONCAT('%', #{param.prototypeUrl}, '%') + + + AND a.ip_address LIKE CONCAT('%', #{param.ipAddress}, '%') + + + AND a.images LIKE CONCAT('%', #{param.images}, '%') + + + AND a.package_name LIKE CONCAT('%', #{param.packageName}, '%') + + + AND a.clicks = #{param.clicks} + + + AND a.installs = #{param.installs} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.requirement LIKE CONCAT('%', #{param.requirement}, '%') + + + AND a.developer LIKE CONCAT('%', #{param.developer}, '%') + + + AND a.director LIKE CONCAT('%', #{param.director}, '%') + + + AND a.project_director LIKE CONCAT('%', #{param.projectDirector}, '%') + + + AND a.salesman LIKE CONCAT('%', #{param.salesman}, '%') + + + AND a.price = #{param.price} + + + AND a.line_price = #{param.linePrice} + + + AND a.score LIKE CONCAT('%', #{param.score}, '%') + + + AND a.star LIKE CONCAT('%', #{param.star}, '%') + + + AND a.year = #{param.year} + + + AND a.month = #{param.month} + + + AND a.day = #{param.day} + + + AND a.path LIKE CONCAT('%', #{param.path}, '%') + + + AND a.component LIKE CONCAT('%', #{param.component}, '%') + + + AND a.authority LIKE CONCAT('%', #{param.authority}, '%') + + + AND a.target LIKE CONCAT('%', #{param.target}, '%') + + + AND a.hide = #{param.hide} + + + AND a.search = #{param.search} + + + AND a.active LIKE CONCAT('%', #{param.active}, '%') + + + AND a.meta LIKE CONCAT('%', #{param.meta}, '%') + + + AND a.edition LIKE CONCAT('%', #{param.edition}, '%') + + + AND a.version LIKE CONCAT('%', #{param.version}, '%') + + + AND a.is_use = #{param.isUse} + + + AND a.file1 LIKE CONCAT('%', #{param.file1}, '%') + + + AND a.file2 LIKE CONCAT('%', #{param.file2}, '%') + + + AND a.file3 LIKE CONCAT('%', #{param.file3}, '%') + + + AND a.show_expiration = #{param.showExpiration} + + + AND a.show_case = #{param.showCase} + + + AND a.show_index = #{param.showIndex} + + + AND a.recommend = #{param.recommend} + + + AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') + + + AND a.soon = #{param.soon} + + + AND a.renew_money = #{param.renewMoney} + + + AND a.app_status LIKE CONCAT('%', #{param.appStatus}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.organization_id = #{param.organizationId} + + + AND a.tenant_code LIKE CONCAT('%', #{param.tenantCode}, '%') + + + AND a.expiration_time >= #{param.expirationTimeStart} + + + AND a.expiration_time <= #{param.expirationTimeEnd} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND a.app_id IN + + #{item} + + + + AND (a.app_name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.app_id = #{param.keywords} + OR a.app_code = #{param.keywords} + OR a.app_name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/project/mapper/xml/ProjectRenewMapper.xml b/src/main/java/com/gxwebsoft/project/mapper/xml/ProjectRenewMapper.xml new file mode 100644 index 0000000..54a7e29 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/mapper/xml/ProjectRenewMapper.xml @@ -0,0 +1,104 @@ + + + + + + + SELECT a.*, b.app_icon, b.app_name, b.expiration_time,c.real_name as nickname + FROM project_renew a + LEFT JOIN project b ON a.app_id = b.app_id + LEFT JOIN gxwebsoft_core.sys_user c ON a.user_id = c.user_id + + + AND a.app_renew_id = #{param.appRenewId} + + + AND a.app_id = #{param.appId} + + + AND a.type = #{param.type} + + + AND a.order_no = #{param.} + + + AND a.money = #{param.money} + + + AND a.duration = #{param.duration} + + + AND a.days = #{param.days} + + + AND a.pay_type = #{param.payType} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') + + + AND a.soon = #{param.soon} + + + AND a.renew_count = #{param.renewCount} + + + AND a.user_id = #{param.userId} + + + AND a.images LIKE CONCAT('%', #{param.images}, '%') + + + AND a.nickname LIKE CONCAT('%', #{param.nickname}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (b.app_name LIKE CONCAT('%', #{param.keywords}, '%') + OR b.app_id = #{param.keywords} + OR b.app_code = #{param.keywords} + ) + + + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/project/mapper/xml/ProjectUrlMapper.xml b/src/main/java/com/gxwebsoft/project/mapper/xml/ProjectUrlMapper.xml new file mode 100644 index 0000000..9e16161 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/mapper/xml/ProjectUrlMapper.xml @@ -0,0 +1,60 @@ + + + + + + + SELECT a.* + FROM project_url a + + + AND a.app_url_id = #{param.appUrlId} + + + AND a.app_id = #{param.appId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.domain LIKE CONCAT('%', #{param.domain}, '%') + + + AND a.account LIKE CONCAT('%', #{param.account}, '%') + + + AND a.password LIKE CONCAT('%', #{param.password}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/project/mapper/xml/ProjectUserMapper.xml b/src/main/java/com/gxwebsoft/project/mapper/xml/ProjectUserMapper.xml new file mode 100644 index 0000000..ffdd4bc --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/mapper/xml/ProjectUserMapper.xml @@ -0,0 +1,57 @@ + + + + + + + SELECT a.* + FROM project_user a + + + AND a.app_user_id = #{param.appUserId} + + + AND a.role = #{param.role} + + + AND a.user_id = #{param.userId} + + + AND a.app_id = #{param.appId} + + + AND a.nickname LIKE CONCAT('%', #{param.nickname}, '%') + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND a.app_id IN + + #{item} + + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/project/param/ProjectCollectionParam.java b/src/main/java/com/gxwebsoft/project/param/ProjectCollectionParam.java new file mode 100644 index 0000000..073b886 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/param/ProjectCollectionParam.java @@ -0,0 +1,38 @@ +package com.gxwebsoft.project.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 我的收藏查询参数 + * + * @author 科技小王子 + * @since 2025-03-16 12:12:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ProjectCollectionParam对象", description = "我的收藏查询参数") +public class ProjectCollectionParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "应用ID") + @QueryField(type = QueryType.EQ) + private Integer appId; + +} diff --git a/src/main/java/com/gxwebsoft/project/param/ProjectFieldParam.java b/src/main/java/com/gxwebsoft/project/param/ProjectFieldParam.java new file mode 100644 index 0000000..50b8068 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/param/ProjectFieldParam.java @@ -0,0 +1,60 @@ +package com.gxwebsoft.project.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 应用参数查询参数 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ProjectFieldParam对象", description = "应用参数查询参数") +public class ProjectFieldParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "类型") + @QueryField(type = QueryType.EQ) + private String type; + + @Schema(description = "应用ID") + @QueryField(type = QueryType.EQ) + private Integer appId; + + @Schema(description = "名称") + private String name; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "最后更新用户ID") + @QueryField(type = QueryType.EQ) + private Integer updateUserId; + + @Schema(description = "状态, 0正常, 1删除") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + +} diff --git a/src/main/java/com/gxwebsoft/project/param/ProjectParam.java b/src/main/java/com/gxwebsoft/project/param/ProjectParam.java new file mode 100644 index 0000000..7b430c2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/param/ProjectParam.java @@ -0,0 +1,285 @@ +package com.gxwebsoft.project.param; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Set; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 应用查询参数 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ProjectParam对象", description = "应用查询参数") +public class ProjectParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "应用ID") + @QueryField(type = QueryType.EQ) + private Integer appId; + + @Schema(description = "应用名称") + private String appName; + + @Schema(description = "应用标识") + private String appCode; + + @Schema(description = "应用秘钥") + private String appSecret; + + @Schema(description = "上级id, 0是顶级") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "应用类型") + private String appType; + + @Schema(description = "应用类型") + private String appTypeMultiple; + + @Schema(description = "类型, 0菜单, 1按钮") + @QueryField(type = QueryType.EQ) + private Integer menuType; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "企业名称") + private String companyName; + + @Schema(description = "应用图标") + private String appIcon; + + @Schema(description = "二维码") + private String appQrcode; + + @Schema(description = "链接地址") + private String appUrl; + + @Schema(description = "后台管理地址") + private String adminUrl; + + @Schema(description = "下载地址") + private String downUrl; + + @Schema(description = "链接地址") + private String serverUrl; + + @Schema(description = "文件服务器") + private String fileUrl; + + @Schema(description = "回调地址") + private String callbackUrl; + + @Schema(description = "腾讯文档地址") + private String docsUrl; + + @Schema(description = "代码仓库地址") + private String gitUrl; + + @Schema(description = "原型图地址") + private String prototypeUrl; + + @Schema(description = "IP白名单") + private String ipAddress; + + @Schema(description = "应用截图") + private String images; + + @Schema(description = "应用包名") + private String packageName; + + @Schema(description = "下载次数") + @QueryField(type = QueryType.EQ) + private Integer clicks; + + @Schema(description = "安装次数") + @QueryField(type = QueryType.EQ) + private Integer installs; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "应用介绍") + private String content; + + @Schema(description = "项目需求") + private String requirement; + + @Schema(description = "开发者(个人或公司)") + private String developer; + + @Schema(description = "项目负责人") + private String director; + + @Schema(description = "项目经理") + private String projectDirector; + + @Schema(description = "业务员") + private String salesman; + + @Schema(description = "软件定价") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "划线价格") + @QueryField(type = QueryType.EQ) + private BigDecimal linePrice; + + @Schema(description = "评分") + private String score; + + @Schema(description = "星级") + private String star; + + @Schema(description = "菜单路由地址") + private String path; + + @Schema(description = "菜单组件地址, 目录可为空") + private String component; + + @Schema(description = "权限标识") + private String authority; + + @Schema(description = "打开位置") + private String target; + + @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") + @QueryField(type = QueryType.EQ) + private Integer hide; + + @Schema(description = "禁止搜索,1禁止 0 允许") + @QueryField(type = QueryType.EQ) + private Integer search; + + @Schema(description = "菜单侧栏选中的path") + private String active; + + @Schema(description = "其它路由元信息") + private String meta; + + @Schema(description = "版本,0正式版 1体验版 2开发版") + private String edition; + + @Schema(description = "版本号") + private String version; + + @Schema(description = "是否已安装") + @QueryField(type = QueryType.EQ) + private Integer isUse; + + @Schema(description = "附近1") + private String file1; + + @Schema(description = "附件2") + private String file2; + + @Schema(description = "附件3") + private String file3; + + @Schema(description = "是否显示续费提醒") + @QueryField(type = QueryType.EQ) + private Boolean showExpiration; + + @Schema(description = "是否作为案例展示") + @QueryField(type = QueryType.EQ) + private Integer showCase; + + @Schema(description = "是否显示在首页") + @QueryField(type = QueryType.EQ) + private Integer showIndex; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "到期时间") + private String expirationTime; + + @Schema(description = "所属年份") + @QueryField(type = QueryType.EQ) + private Integer year; + + @Schema(description = "所属月份") + @QueryField(type = QueryType.EQ) + private Integer month; + + @Schema(description = "所属日期") + @QueryField(type = QueryType.EQ) + private Integer day; + + @Schema(description = "状态, 0正常, 1 即将过期") + @QueryField(type = QueryType.EQ) + private Integer soon; + + @Schema(description = "续费金额") + @QueryField(type = QueryType.EQ) + private BigDecimal renewMoney; + + @Schema(description = "应用状态") + private String appStatus; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "ID集合") + @QueryField(type = QueryType.IN) + private Set appIds; + + @Schema(description = "机构id") + @QueryField(type = QueryType.EQ) + private Integer organizationId; + + @Schema(description = "租户编号") + private String tenantCode; + + @Schema(description = "登录用户ID") + @QueryField(type = QueryType.EQ) + private Integer loginUserId; + + @Schema(description = "登录手机号") + @QueryField(type = QueryType.EQ) + private String loginPhone; + + @Schema(description = "网站id") + @QueryField(type = QueryType.EQ) + private Integer websiteId; + + @QueryField(value = "expiration_time", type = QueryType.GE) + @TableField(exist = false) + @Schema(description = "到期时间起始值") + private String expirationTimeStart; + + @QueryField(value = "expiration_time", type = QueryType.LE) + @TableField(exist = false) + @Schema(description = "到期时间结束值") + private String expirationTimeEnd; + + +} diff --git a/src/main/java/com/gxwebsoft/project/param/ProjectRenewParam.java b/src/main/java/com/gxwebsoft/project/param/ProjectRenewParam.java new file mode 100644 index 0000000..04fd922 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/param/ProjectRenewParam.java @@ -0,0 +1,111 @@ +package com.gxwebsoft.project.param; + +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 续费管理查询参数 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ProjectRenewParam对象", description = "续费管理查询参数") +public class ProjectRenewParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer appRenewId; + + @Schema(description = "应用ID") + @QueryField(type = QueryType.EQ) + private Integer appId; + + @Schema(description = "类型, 0续费, 1新购") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "订单编号") + @QueryField(type = QueryType.EQ) + private String orderNo; + + @Schema(description = "续费金额") + @QueryField(type = QueryType.EQ) + private BigDecimal money; + + @Schema(description = "订单总额") + @QueryField(type = QueryType.EQ) + private BigDecimal totalPrice; + + @Schema(description = "实际付款") + @QueryField(type = QueryType.EQ) + private BigDecimal payPrice; + + @Schema(description = "优惠金额") + @QueryField(type = QueryType.EQ) + private BigDecimal reducePrice; + + @Schema(description = "续费时长") + @QueryField(type = QueryType.EQ) + private BigDecimal duration; + + @Schema(description = "续费时长(按天)") + @QueryField(type = QueryType.EQ) + private Integer days; + + @Schema(description = "支付方式") + @QueryField(type = QueryType.EQ) + private Integer payType; + + @Schema(description = "续费次数") + @QueryField(type = QueryType.EQ) + private Integer renewCount; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "开始时间") + private String startTime; + + @Schema(description = "到期时间") + private String endTime; + + @Schema(description = "状态, 0正常, 1 即将过期") + @QueryField(type = QueryType.EQ) + private Integer soon; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "付款凭证") + private String images; + + @Schema(description = "用户姓名") + private String nickname; + + @Schema(description = "状态, 0正常, 1待确认") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/project/param/ProjectUrlParam.java b/src/main/java/com/gxwebsoft/project/param/ProjectUrlParam.java new file mode 100644 index 0000000..766a4ba --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/param/ProjectUrlParam.java @@ -0,0 +1,57 @@ +package com.gxwebsoft.project.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 项目域名查询参数 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ProjectUrlParam对象", description = "项目域名查询参数") +public class ProjectUrlParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer appUrlId; + + @Schema(description = "应用ID") + @QueryField(type = QueryType.EQ) + private Integer appId; + + @Schema(description = "域名类型") + private String name; + + @Schema(description = "域名") + private String domain; + + @Schema(description = "账号") + private String account; + + @Schema(description = "密码") + private String password; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1待确认") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/project/param/ProjectUserParam.java b/src/main/java/com/gxwebsoft/project/param/ProjectUserParam.java new file mode 100644 index 0000000..b3c08e6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/param/ProjectUserParam.java @@ -0,0 +1,55 @@ +package com.gxwebsoft.project.param; + +import java.math.BigDecimal; +import java.util.Set; + +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 应用成员查询参数 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ProjectUserParam对象", description = "应用成员查询参数") +public class ProjectUserParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer appUserId; + + @Schema(description = "角色,10体验成员 20开发者成员 30管理员 ") + @QueryField(type = QueryType.EQ) + private Integer role; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "应用ID") + @QueryField(type = QueryType.EQ) + private Integer appId; + + @Schema(description = "应用ID集合") + @QueryField(type = QueryType.IN) + private Set appIds; + + @Schema(description = "昵称") + private String nickname; + + @Schema(description = "状态, 0正常, 1待确认") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/project/service/ProjectCollectionService.java b/src/main/java/com/gxwebsoft/project/service/ProjectCollectionService.java new file mode 100644 index 0000000..fe1afba --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/service/ProjectCollectionService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.project.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.project.entity.ProjectCollection; +import com.gxwebsoft.project.param.ProjectCollectionParam; + +import java.util.List; + +/** + * 我的收藏Service + * + * @author 科技小王子 + * @since 2025-03-16 12:12:13 + */ +public interface ProjectCollectionService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ProjectCollectionParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ProjectCollectionParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return ProjectCollection + */ + ProjectCollection getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/project/service/ProjectFieldService.java b/src/main/java/com/gxwebsoft/project/service/ProjectFieldService.java new file mode 100644 index 0000000..1fd2a5a --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/service/ProjectFieldService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.project.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.project.entity.ProjectField; +import com.gxwebsoft.project.param.ProjectFieldParam; + +import java.util.List; + +/** + * 应用参数Service + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +public interface ProjectFieldService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ProjectFieldParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ProjectFieldParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return ProjectField + */ + ProjectField getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/project/service/ProjectRenewService.java b/src/main/java/com/gxwebsoft/project/service/ProjectRenewService.java new file mode 100644 index 0000000..a607ddd --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/service/ProjectRenewService.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.project.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.project.entity.ProjectRenew; +import com.gxwebsoft.project.param.ProjectRenewParam; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 续费管理Service + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +public interface ProjectRenewService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ProjectRenewParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ProjectRenewParam param); + + /** + * 根据id查询 + * + * @param appRenewId 自增ID + * @return ProjectRenew + */ + ProjectRenew getByIdRel(Integer appRenewId); + + BigDecimal sumMoney(LambdaQueryWrapper between); +} diff --git a/src/main/java/com/gxwebsoft/project/service/ProjectService.java b/src/main/java/com/gxwebsoft/project/service/ProjectService.java new file mode 100644 index 0000000..7438170 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/service/ProjectService.java @@ -0,0 +1,50 @@ +package com.gxwebsoft.project.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.project.entity.Project; +import com.gxwebsoft.project.entity.ProjectRenew; +import com.gxwebsoft.project.param.ProjectParam; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 应用Service + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +public interface ProjectService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ProjectParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ProjectParam param); + + /** + * 根据id查询 + * + * @param appId 应用ID + * @return Project + */ + Project getByIdRel(Integer appId); + + BigDecimal sumMoney(LambdaQueryWrapper between); + + void updateByRenew(ProjectRenew projectRenew); + + +} diff --git a/src/main/java/com/gxwebsoft/project/service/ProjectUrlService.java b/src/main/java/com/gxwebsoft/project/service/ProjectUrlService.java new file mode 100644 index 0000000..f67069a --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/service/ProjectUrlService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.project.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.project.entity.ProjectUrl; +import com.gxwebsoft.project.param.ProjectUrlParam; + +import java.util.List; + +/** + * 项目域名Service + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +public interface ProjectUrlService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ProjectUrlParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ProjectUrlParam param); + + /** + * 根据id查询 + * + * @param appUrlId 自增ID + * @return ProjectUrl + */ + ProjectUrl getByIdRel(Integer appUrlId); + +} diff --git a/src/main/java/com/gxwebsoft/project/service/ProjectUserService.java b/src/main/java/com/gxwebsoft/project/service/ProjectUserService.java new file mode 100644 index 0000000..5e8407e --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/service/ProjectUserService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.project.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.project.entity.ProjectUser; +import com.gxwebsoft.project.param.ProjectUserParam; + +import java.util.List; + +/** + * 应用成员Service + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +public interface ProjectUserService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ProjectUserParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ProjectUserParam param); + + /** + * 根据id查询 + * + * @param appUserId 自增ID + * @return ProjectUser + */ + ProjectUser getByIdRel(Integer appUserId); + +} diff --git a/src/main/java/com/gxwebsoft/project/service/impl/ProjectCollectionServiceImpl.java b/src/main/java/com/gxwebsoft/project/service/impl/ProjectCollectionServiceImpl.java new file mode 100644 index 0000000..7cd076d --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/service/impl/ProjectCollectionServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.project.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.project.mapper.ProjectCollectionMapper; +import com.gxwebsoft.project.service.ProjectCollectionService; +import com.gxwebsoft.project.entity.ProjectCollection; +import com.gxwebsoft.project.param.ProjectCollectionParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 我的收藏Service实现 + * + * @author 科技小王子 + * @since 2025-03-16 12:12:13 + */ +@Service +public class ProjectCollectionServiceImpl extends ServiceImpl implements ProjectCollectionService { + + @Override + public PageResult pageRel(ProjectCollectionParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ProjectCollectionParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ProjectCollection getByIdRel(Integer id) { + ProjectCollectionParam param = new ProjectCollectionParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/project/service/impl/ProjectFieldServiceImpl.java b/src/main/java/com/gxwebsoft/project/service/impl/ProjectFieldServiceImpl.java new file mode 100644 index 0000000..081c013 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/service/impl/ProjectFieldServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.project.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.project.mapper.ProjectFieldMapper; +import com.gxwebsoft.project.service.ProjectFieldService; +import com.gxwebsoft.project.entity.ProjectField; +import com.gxwebsoft.project.param.ProjectFieldParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 应用参数Service实现 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Service +public class ProjectFieldServiceImpl extends ServiceImpl implements ProjectFieldService { + + @Override + public PageResult pageRel(ProjectFieldParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ProjectFieldParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public ProjectField getByIdRel(Integer id) { + ProjectFieldParam param = new ProjectFieldParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/project/service/impl/ProjectRenewServiceImpl.java b/src/main/java/com/gxwebsoft/project/service/impl/ProjectRenewServiceImpl.java new file mode 100644 index 0000000..98665c4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/service/impl/ProjectRenewServiceImpl.java @@ -0,0 +1,155 @@ +package com.gxwebsoft.project.service.impl; + +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import com.gxwebsoft.oa.entity.OaAppRenew; +import com.gxwebsoft.project.entity.Project; +import com.gxwebsoft.project.mapper.ProjectRenewMapper; +import com.gxwebsoft.project.param.ProjectParam; +import com.gxwebsoft.project.service.ProjectRenewService; +import com.gxwebsoft.project.entity.ProjectRenew; +import com.gxwebsoft.project.param.ProjectRenewParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.project.service.ProjectService; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 续费管理Service实现 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Service +public class ProjectRenewServiceImpl extends ServiceImpl implements ProjectRenewService { + @Resource + private ProjectService projectService; + + @Override + public PageResult pageRel(ProjectRenewParam param) { + final String sceneType = param.getSceneType(); + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + + // TODO 默认查询条件:读取符合续费条件的项目 + if (sceneType == null) { + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + + + // 特殊场景查询 + List list = null; + DateTime date = DateUtil.date(); + final DateTime nextMonth = DateUtil.nextMonth(); + // 获取当前年份的起止时间 + LocalDateTime startOfYear = LocalDateTime.now().withMonth(1).withDayOfMonth(1) + .withHour(0).withMinute(0).withSecond(0); + LocalDateTime endOfYear = startOfYear.plusYears(1).minusNanos(1); + // 去年的起止时间 + LocalDateTime startOfLastYear = LocalDateTime.now().minusYears(1).withMonth(1).withDayOfMonth(1) + .withHour(0).withMinute(0).withSecond(0); + LocalDateTime endOfLastYear = startOfLastYear.plusYears(1).minusNanos(1); + // 本月起止时间 + LocalDateTime startOfMonth = LocalDateTime.now().withDayOfMonth(1) + .withHour(0).withMinute(0).withSecond(0); + LocalDateTime endOfMonth = startOfMonth.plusMonths(1).minusNanos(1); + + if (StrUtil.isNotBlank(sceneType)) { + // TODO 近30天可催收的续费总额 + if (sceneType.equals("totalPrice30")) { + list = list(new LambdaQueryWrapper() + .lt(ProjectRenew::getEndTime, nextMonth) + .gt(ProjectRenew::getEndTime, date) + .lt(ProjectRenew::getCreateTime, date) + .eq(ProjectRenew::getDeleted, 0) + .orderByAsc(ProjectRenew::getEndTime) + ); + } + + // TODO 本月已收续费总额 + if (sceneType.equals("monthTotalPrice")) { + list = list(new LambdaQueryWrapper() + .between(ProjectRenew::getCreateTime, startOfYear, endOfMonth) + .eq(ProjectRenew::getDeleted, 0) + .orderByDesc(ProjectRenew::getEndTime) + ); + } + + // TODO 今年已收续费总额 + if (sceneType.equals("yearTotalPrice")) { + list = list(new LambdaQueryWrapper() + .between(ProjectRenew::getCreateTime, startOfMonth, endOfYear) + .eq(ProjectRenew::getDeleted, 0) + .orderByDesc(ProjectRenew::getEndTime) + ); + } + + // TODO 去年已收续费列表 + if (sceneType.equals("lastTotalPrice")) { + list = list(new LambdaQueryWrapper() + .between(ProjectRenew::getCreateTime, startOfLastYear, endOfLastYear) + .eq(ProjectRenew::getDeleted, 0) + .orderByDesc(ProjectRenew::getEndTime) + ); + } + } + + // TODO 获取项目名称 + assert list != null; + final Set collectByAppIds = list.stream().map(ProjectRenew::getAppId).collect(Collectors.toSet()); + final ProjectParam projectParam = new ProjectParam(); + projectParam.setAppIds(collectByAppIds); + final List projects = projectService.listRel(projectParam); + + final Map> collect = projects.stream().collect(Collectors.groupingBy(Project::getAppId)); + list.forEach(d -> { + final List projectsItem = collect.get(d.getAppId()); + if (!CollectionUtils.isEmpty(projectsItem)) { + final Project project = projectsItem.get(0); + d.setAppName(project.getAppName()); + d.setNickname(project.getNickname()); + d.setAvatar(project.getAvatar()); + d.setCustomerId(project.getCompanyId()); + d.setCustomerName(project.getCompanyName()); + } + }); + return new PageResult<>(list, (long) list.size()); + } + + @Override + public List listRel(ProjectRenewParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public ProjectRenew getByIdRel(Integer appRenewId) { + ProjectRenewParam param = new ProjectRenewParam(); + param.setAppRenewId(appRenewId); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public BigDecimal sumMoney(LambdaQueryWrapper wrapper) { + return baseMapper.selectSumMoney(wrapper); + } + +} diff --git a/src/main/java/com/gxwebsoft/project/service/impl/ProjectServiceImpl.java b/src/main/java/com/gxwebsoft/project/service/impl/ProjectServiceImpl.java new file mode 100644 index 0000000..fee93fb --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/service/impl/ProjectServiceImpl.java @@ -0,0 +1,269 @@ +package com.gxwebsoft.project.service.impl; + +import cn.hutool.core.date.DateField; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.cms.entity.CmsWebsite; +import com.gxwebsoft.cms.service.CmsWebsiteService; +import com.gxwebsoft.project.entity.*; +import com.gxwebsoft.project.mapper.ProjectMapper; +import com.gxwebsoft.project.param.ProjectUserParam; +import com.gxwebsoft.project.service.ProjectCollectionService; +import com.gxwebsoft.project.service.ProjectRenewService; +import com.gxwebsoft.project.service.ProjectService; +import com.gxwebsoft.project.param.ProjectParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.project.service.ProjectUserService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.Instant; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 应用Service实现 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Service +public class ProjectServiceImpl extends ServiceImpl implements ProjectService { + + @Resource + private ProjectService projectService; + @Resource + private ProjectUserService projectUserService; + @Resource + private ProjectCollectionService projectCollectionService; + @Resource + private ProjectRenewService projectRenewService; + @Resource + private CmsWebsiteService cmsWebsiteService; + + @Override + public PageResult pageRel(ProjectParam param) { + final String sceneType = param.getSceneType(); + + // TODO 特殊场景查询 + if (sceneType != null) { + param.setUserId(null); + param.setAppStatus(null); + param.setAppIds(null); + + List list = null; + DateTime date = DateUtil.date(); + final DateTime nextMonth = DateUtil.nextMonth(); + // 获取当前年份的起止时间 + LocalDateTime startOfYear = LocalDateTime.now().withMonth(1).withDayOfMonth(1) + .withHour(0).withMinute(0).withSecond(0); + LocalDateTime endOfYear = startOfYear.plusYears(1).minusNanos(1); + // 去年的起止时间 + LocalDateTime startOfLastYear = LocalDateTime.now().minusYears(1).withMonth(1).withDayOfMonth(1) + .withHour(0).withMinute(0).withSecond(0); + LocalDateTime endOfLastYear = startOfLastYear.plusYears(1).minusNanos(1); + + // TODO 我的项目 + if (sceneType.equals("myProject")) { + param.setUserId(param.getLoginUserId()); + list = listRel(param); + } + + // TODO 我的参与 + if (sceneType.equals("involved")) { + final List projectUsers = projectUserService.list(new LambdaQueryWrapper().eq(ProjectUser::getUserId, param.getLoginUserId())); + final Set collect = projectUsers.stream().map(ProjectUser::getAppId).collect(Collectors.toSet()); + param.setAppIds(collect); + list = listRel(param); + } + // TODO 我的收藏 + if (sceneType.equals("collection")) { + final List projectCollections = projectCollectionService.list(new LambdaQueryWrapper().eq(ProjectCollection::getUserId, param.getLoginUserId())); + final Set collect = projectCollections.stream().map(ProjectCollection::getAppId).collect(Collectors.toSet()); + param.setAppIds(collect); + param.setUserId(null); + list = listRel(param); + list.forEach(d -> { + d.setCollection(true); + }); + } + + if (param.getAppStatus() != null && param.getAppStatus().equals("全部")) { + param.setAppStatus(null); + } + + + // TODO 近30天可催收的续费总额 + if (sceneType.equals("totalPrice30")) { + list = list(new LambdaQueryWrapper() + .lt(Project::getExpirationTime, nextMonth) + .gt(Project::getExpirationTime, date) + .eq(Project::getDeleted, 0) + .orderByAsc(Project::getExpirationTime) + ); + } + + // TODO 今年已收续费总额 + if (sceneType.equals("yearTotalPrice")) { + list = list(new LambdaQueryWrapper() + .between(Project::getUpdateTime, startOfYear, endOfYear) + .eq(Project::getDeleted, 0) + .orderByDesc(Project::getCreateTime) + ); + } + + // TODO 去年已收续费列表 + if (sceneType.equals("lastTotalPrice")) { + list = list(new LambdaQueryWrapper() + .between(Project::getUpdateTime, startOfLastYear, endOfLastYear) + .eq(Project::getDeleted, 0) + .orderByDesc(Project::getCreateTime) + ); + } + + // TODO 已流失的续费总额 + if(sceneType.equals("Expired")){ + list = list(new LambdaQueryWrapper() + .lt(Project::getExpirationTime, date) + .eq(Project::getDeleted, 0) + .eq(Project::getAppStatus,"已上架") + .eq(Project::getShowExpiration,true) + .orderByAsc(Project::getExpirationTime) + ); + } + + // TODO 有效续费总金额 + if (sceneType.equals("effectiveTotalPrice")) { + list = list(new LambdaQueryWrapper() + .gt(Project::getExpirationTime, date) + .eq(Project::getDeleted, 0) + .eq(Project::getAppStatus,"已上架") + .eq(Project::getShowExpiration,true) + .orderByAsc(Project::getExpirationTime) + ); + } + + // TODO 全部续费总额 + if (sceneType.equals("AllRenewPrice")) { + list = list(new LambdaQueryWrapper() + .eq(Project::getDeleted, 0) + .eq(Project::getAppStatus,"已上架") + .eq(Project::getShowExpiration,true) + .orderByAsc(Project::getExpirationTime) + ); + } + + assert list != null; + return new PageResult<>(getProjectList(list, param.getLoginUserId()), (long) list.size()); + } + + // 常规搜索 + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + + return new PageResult<>(getProjectList(list, param.getLoginUserId()), page.getTotal()); + } + + @Override + public List listRel(ProjectParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public Project getByIdRel(Integer appId) { + ProjectParam param = new ProjectParam(); + param.setAppId(appId); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public BigDecimal sumMoney(LambdaQueryWrapper wrapper) { + return baseMapper.selectSumMoney(wrapper); + } + + @Override + public void updateByRenew(ProjectRenew projectRenew) { + final Project project = projectService.getByIdRel(projectRenew.getAppId()); + if(project.getExpirationTime() != null){ + if (projectRenew.getDays() != null) { + // 按天续费 + project.setExpirationTime(project.getExpirationTime().plusDays(projectRenew.getDays())); + } else { + // 按年续费 + project.setExpirationTime(project.getExpirationTime().plusMonths(12 * projectRenew.getDuration().intValue())); + // 更新下一年的续费金额 + project.setRenewMoney(projectRenew.getPayPrice()); + project.setShowExpiration(true); + } + project.setRenewCount(project.getRenewCount() + 1); + + // 保存到期时间所在的年月日 + final LocalDateTime expirationTime = project.getExpirationTime(); + LocalDate localDate = expirationTime.toLocalDate(); + int year = localDate.getYear(); + int month = localDate.getMonthValue(); // 获取月份,范围是1到12 + int day = localDate.getDayOfMonth(); // 获取日,范围是1到31 + project.setYear(year); + project.setMonth(month); + project.setDay(day); + projectService.updateById(project); + // 更新明细的到期时间 + projectRenew.setStartTime(expirationTime); + projectRenew.setEndTime(expirationTime); + // 同步网站状态 + if (!project.getWebsiteId().equals(0)) { + final CmsWebsite website = new CmsWebsite(); + website.setVersion(20); + // 将LocalDateTime转换为Date + Date expirationDate = Date.from(expirationTime.atZone(ZoneId.systemDefault()).toInstant()); + website.setExpirationTime(expirationDate); + website.setWebsiteId(project.getWebsiteId()); + cmsWebsiteService.updateByIdAll(website); + } + } + projectRenewService.updateById(projectRenew); + } + + /** + * 整理列表数据并返回 + * @return List + */ + private List getProjectList(List list, Integer loginUserId) { + + final List projectCollections = projectCollectionService.list(new LambdaQueryWrapper().eq(ProjectCollection::getUserId, loginUserId)); + final Set collect = projectCollections.stream().map(ProjectCollection::getAppId).collect(Collectors.toSet()); + + list.forEach(d -> { + // 收藏状态 + if (collect.contains(d.getAppId())) { + d.setCollection(true); + } + // 应用成员 + d.setProjectUsers(projectUserService.list(new LambdaQueryWrapper().eq(ProjectUser::getAppId, d.getAppId()))); + LocalDateTime now = LocalDateTime.now(); + // 即将过期(30天内过期的) + d.setSoon(d.getExpirationTime().minusDays(30).compareTo(now)); + // 是否过期 -1已过期 大于0 未过期 + d.setExpired(d.getExpirationTime().compareTo(now)); + // 剩余天数 + d.setExpiredDays(java.time.temporal.ChronoUnit.DAYS.between(now, d.getExpirationTime())); + // 续费次数 + d.setRenewCount((long) projectRenewService.count(new LambdaQueryWrapper().eq(ProjectRenew::getAppId, d.getAppId()).eq(ProjectRenew::getDeleted, 0))); + }); + return list; + } + +} diff --git a/src/main/java/com/gxwebsoft/project/service/impl/ProjectUrlServiceImpl.java b/src/main/java/com/gxwebsoft/project/service/impl/ProjectUrlServiceImpl.java new file mode 100644 index 0000000..462e04d --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/service/impl/ProjectUrlServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.project.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.project.mapper.ProjectUrlMapper; +import com.gxwebsoft.project.service.ProjectUrlService; +import com.gxwebsoft.project.entity.ProjectUrl; +import com.gxwebsoft.project.param.ProjectUrlParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 项目域名Service实现 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Service +public class ProjectUrlServiceImpl extends ServiceImpl implements ProjectUrlService { + + @Override + public PageResult pageRel(ProjectUrlParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ProjectUrlParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ProjectUrl getByIdRel(Integer appUrlId) { + ProjectUrlParam param = new ProjectUrlParam(); + param.setAppUrlId(appUrlId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/project/service/impl/ProjectUserServiceImpl.java b/src/main/java/com/gxwebsoft/project/service/impl/ProjectUserServiceImpl.java new file mode 100644 index 0000000..223cb38 --- /dev/null +++ b/src/main/java/com/gxwebsoft/project/service/impl/ProjectUserServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.project.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.project.mapper.ProjectUserMapper; +import com.gxwebsoft.project.service.ProjectUserService; +import com.gxwebsoft.project.entity.ProjectUser; +import com.gxwebsoft.project.param.ProjectUserParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 应用成员Service实现 + * + * @author 科技小王子 + * @since 2025-03-14 16:21:11 + */ +@Service +public class ProjectUserServiceImpl extends ServiceImpl implements ProjectUserService { + + @Override + public PageResult pageRel(ProjectUserParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time asc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ProjectUserParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time asc"); + return page.sortRecords(list); + } + + @Override + public ProjectUser getByIdRel(Integer appUserId) { + ProjectUserParam param = new ProjectUserParam(); + param.setAppUserId(appUserId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/pwl/controller/PwlProjectController.java b/src/main/java/com/gxwebsoft/pwl/controller/PwlProjectController.java new file mode 100644 index 0000000..f871a4c --- /dev/null +++ b/src/main/java/com/gxwebsoft/pwl/controller/PwlProjectController.java @@ -0,0 +1,243 @@ +package com.gxwebsoft.pwl.controller; + +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.cms.entity.CmsArticle; +import com.gxwebsoft.cms.entity.CmsArticleContent; +import com.gxwebsoft.cms.param.CmsArticleImportParam; +import com.gxwebsoft.common.core.utils.CommonUtil; +import com.gxwebsoft.common.core.utils.JSONUtil; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.Role; +import com.gxwebsoft.common.system.service.UserService; +import com.gxwebsoft.project.entity.ProjectUser; +import com.gxwebsoft.pwl.param.PwlProjectImportParam; +import com.gxwebsoft.pwl.service.PwlProjectService; +import com.gxwebsoft.pwl.entity.PwlProject; +import com.gxwebsoft.pwl.param.PwlProjectParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 卫兰的项目项目系统控制器 + * + * @author 科技小王子 + * @since 2025-03-22 14:34:35 + */ +@Tag(name = "卫兰的项目项目系统管理") +@RestController +@RequestMapping("/api/pwl/pwl-project") +public class PwlProjectController extends BaseController { + @Resource + private PwlProjectService pwlProjectService; + + @PreAuthorize("hasAuthority('pwl:pwlProject:list')") + @Operation(summary = "分页查询卫兰的项目项目系统") + @GetMapping("/page") + public ApiResult> page(PwlProjectParam param) { + final User loginUser = getLoginUser(); + if (loginUser != null) { + param.setLoginUserId(loginUser.getUserId()); + final List roles = loginUser.getRoles(); + if (!CommonUtil.hasRole(roles, "admin") && !CommonUtil.hasRole(roles, "superAdmin")) { + final List projectUsers = pwlProjectService.list(new LambdaQueryWrapper() + .like(PwlProject::getUserIds, loginUser.getUserId()) + .or() + .eq(PwlProject::getUserId, loginUser.getUserId()) + ); + if (!CollectionUtils.isEmpty(projectUsers)) { + final Set appIds = projectUsers.stream().map(PwlProject::getId).collect(Collectors.toSet()); + param.setProjectIds(appIds); + } else { + param.setUserId(loginUser.getUserId()); + } + } + } + return success(pwlProjectService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('pwl:pwlProject:list')") + @Operation(summary = "查询全部卫兰的项目项目系统") + @GetMapping() + public ApiResult> list(PwlProjectParam param) { + // 使用关联查询 + return success(pwlProjectService.listRel(param)); + } + + @PreAuthorize("hasAuthority('pwl:pwlProject:list')") + @Operation(summary = "根据id查询卫兰的项目项目系统") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(pwlProjectService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('pwl:pwlProject:save')") + @OperationLog + @Operation(summary = "添加卫兰的项目项目系统") + @PostMapping() + public ApiResult save(@RequestBody PwlProject pwlProject) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + pwlProject.setUserId(loginUser.getUserId()); + } + if (pwlProject.getCode() != null) { + final PwlProject one = pwlProjectService.getOne(new LambdaQueryWrapper().eq(PwlProject::getCode, pwlProject.getCode())); + if (ObjectUtil.isNotEmpty(one)) { + return fail("报告编号不能重复"); + } + } + if (pwlProjectService.save(pwlProject)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('pwl:pwlProject:update')") + @OperationLog + @Operation(summary = "修改卫兰的项目项目系统") + @PutMapping() + public ApiResult update(@RequestBody PwlProject pwlProject) { + if (pwlProjectService.updateById(pwlProject)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('pwl:pwlProject:remove')") + @OperationLog + @Operation(summary = "删除卫兰的项目项目系统") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (pwlProjectService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('pwl:pwlProject:save')") + @OperationLog + @Operation(summary = "批量添加卫兰的项目项目系统") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (pwlProjectService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('pwl:pwlProject:update')") + @OperationLog + @Operation(summary = "批量修改卫兰的项目项目系统") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(pwlProjectService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('pwl:pwlProject:remove')") + @OperationLog + @Operation(summary = "批量删除卫兰的项目项目系统") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (pwlProjectService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('pwl:pwlProject:save')") + @Operation(summary = "批量导入项目") + @Transactional(rollbackFor = {Exception.class}) + @PostMapping("/import") + public ApiResult> importBatch(MultipartFile file) { + ImportParams importParams = new ImportParams(); + importParams.setHeadRows(2); + importParams.setTitleRows(1); + importParams.setSheetNum(1); + try { + List list = ExcelImportUtil.importExcel(file.getInputStream(), PwlProjectImportParam.class, importParams); + list.forEach(d -> { + PwlProject item = JSONUtil.parseObject(JSONUtil.toJSONString(d), PwlProject.class); + assert item != null; + if (ObjectUtil.isNotEmpty(item)) { + if (item.getStatus() == null) { + item.setStatus(0); + item.setUserId(getLoginUserId()); + } + if (item.getName() != null) { + pwlProjectService.save(item); + } + } + }); + return success("成功导入" + list.size() + "条", null); + } catch (Exception e) { + e.printStackTrace(); + } + return fail("导入失败", null); + } + + @Operation(summary = "统计项目完成情况") + @GetMapping("/count") + public ApiResult count() { + final User loginUser = getLoginUser(); + if (loginUser != null) { + final List list = pwlProjectService.listByCount(); + list.forEach(d -> { + // 已完成项目数量 + final long completed = pwlProjectService.count(new LambdaQueryWrapper() + .like(PwlProject::getDraftUserId, d.getUserId()) + .and( + i -> i.eq(PwlProject::getStatus, 0) + .isNotNull(PwlProject::getDraftUserId) + ) + ); + d.setBalance(new BigDecimal(completed)); + // 未完成项目数量 + final long incomplete = pwlProjectService.count(new LambdaQueryWrapper() + .like(PwlProject::getDraftUserId, d.getUserId()) + .and( + i -> i.eq(PwlProject::getStatus, 1) + .isNotNull(PwlProject::getDraftUserId) + ) + ); + // 签字会计数量 + final long signUsers = pwlProjectService.count(new LambdaQueryWrapper() + .like(PwlProject::getSignUserId, d.getUserId()) + .and( + i -> i.eq(PwlProject::getStatus, 1) + .isNotNull(PwlProject::getSignUserId) + ) + ); + d.setPoints(Math.toIntExact(incomplete)); + d.setFans(Math.toIntExact(signUsers)); + }); + return success(list); + } + return fail("没有找到结果", null); + } + +} diff --git a/src/main/java/com/gxwebsoft/pwl/entity/PwlProject.java b/src/main/java/com/gxwebsoft/pwl/entity/PwlProject.java new file mode 100644 index 0000000..20b3335 --- /dev/null +++ b/src/main/java/com/gxwebsoft/pwl/entity/PwlProject.java @@ -0,0 +1,204 @@ +package com.gxwebsoft.pwl.entity; + +import java.math.BigDecimal; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import com.gxwebsoft.common.core.utils.JSONUtil; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 卫兰的项目项目系统 + * + * @author 科技小王子 + * @since 2025-03-22 14:34:35 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "PwlProject对象", description = "卫兰的项目项目系统") +public class PwlProject implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "项目名称") + private String name; + + @Schema(description = "项目标识") + private String code; + + @Schema(description = "上级id, 0是顶级") + private Integer parentId; + + @Schema(description = "项目类型") + private String type; + + @Schema(description = "项目图标") + private String image; + + @Schema(description = "二维码") + private String qrcode; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "应用截图") + private String images; + + @Schema(description = "底稿情况") + private String files; + + @Schema(description = "应用介绍") + private String content; + + @Schema(description = "年末资产总额(万元)") + private BigDecimal totalAssets; + + @Schema(description = "合同金额") + private BigDecimal contractPrice; + + @Schema(description = "实收金额") + private BigDecimal payPrice; + + @Schema(description = "软件定价") + private BigDecimal price; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "到期时间") + private String expirationTime; + + @Schema(description = "项目信息-开票单位/汇款人") + private String itemName; + + @Schema(description = "项目信息-年度") + private String itemYear; + + @Schema(description = "项目信息-类型") + private String itemType; + + @Schema(description = "项目信息-审计意见") + private String itemOpinion; + + @Schema(description = "到账信息-银行名称") + private String bankName; + + @Schema(description = "到账日期") + private String bankPayTime; + + @Schema(description = "到账金额") + private BigDecimal bankPrice; + + @Schema(description = "发票类型") + private String invoiceType; + + @Schema(description = "发票类型") + @TableField(exist = false) + private String invoiceTypeName; + + @Schema(description = "开票日期") + private String invoiceTime; + + @Schema(description = "开票金额") + private BigDecimal invoicePrice; + + @Schema(description = "报告份数") + private String reportNum; + + @Schema(description = "底稿人员") + private String draftUserId; + + @Schema(description = "底稿人员") + private String draftUser; + + @Schema(description = "参与成员") + private String userIds; + + @Schema(description = "参与成员") + private String users; + + @Schema(description = "签字注会") + private String signUserId; + + @Schema(description = "签字注会") + private String signUser; + + @Schema(description = "展业人员") + private String saleUserId; + + @Schema(description = "展业人员") + private String saleUser; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "纸质底稿完成情况") + private Integer paper; + + @Schema(description = "电子底稿完成情况") + private Integer electron; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "客户ID") + private Integer userId; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "手机号") + @TableField(exist = false) + private String phone; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +// public Object getDraftUser() { +// return JSON.parse(draftUser); +// } +// public Object getUsers() { +// return JSON.parse(users); +// } +// public Object getSignUser() { +// return JSON.parse(signUser); +// } +// public Object getSaleUser() { +// return JSON.parse(saleUser); +// } +// public Object setDraftUser() { +// return JSON.toJSON(draftUser); +// } +} diff --git a/src/main/java/com/gxwebsoft/pwl/mapper/PwlProjectMapper.java b/src/main/java/com/gxwebsoft/pwl/mapper/PwlProjectMapper.java new file mode 100644 index 0000000..138b719 --- /dev/null +++ b/src/main/java/com/gxwebsoft/pwl/mapper/PwlProjectMapper.java @@ -0,0 +1,40 @@ +package com.gxwebsoft.pwl.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.pwl.entity.PwlProject; +import com.gxwebsoft.pwl.param.PwlProjectParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 卫兰的项目项目系统Mapper + * + * @author 科技小王子 + * @since 2025-03-22 14:34:35 + */ +public interface PwlProjectMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") PwlProjectParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") PwlProjectParam param); + + + List listByCount(); +} diff --git a/src/main/java/com/gxwebsoft/pwl/mapper/xml/PwlProjectMapper.xml b/src/main/java/com/gxwebsoft/pwl/mapper/xml/PwlProjectMapper.xml new file mode 100644 index 0000000..f24fc7f --- /dev/null +++ b/src/main/java/com/gxwebsoft/pwl/mapper/xml/PwlProjectMapper.xml @@ -0,0 +1,163 @@ + + + + + + + SELECT a.*, u.real_name as realName, u.phone, u.avatar, dt.dict_data_name as invoiceTypeName + FROM pwl_project a + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + LEFT JOIN gxwebsoft_core.sys_dict_data dt ON a.invoice_type = dt.dict_data_id + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.parent_id = #{param.parentId} + + + AND a.type = #{param.type} + + + AND a.avatar LIKE CONCAT('%', #{param.avatar}, '%') + + + AND a.qrcode LIKE CONCAT('%', #{param.qrcode}, '%') + + + AND a.url LIKE CONCAT('%', #{param.url}, '%') + + + AND a.images LIKE CONCAT('%', #{param.images}, '%') + + + AND a.files LIKE CONCAT('%', #{param.files}, '%') + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.total_assets = #{param.totalAssets} + + + AND a.contract_price = #{param.contractPrice} + + + AND a.pay_price = #{param.payPrice} + + + AND a.price = #{param.price} + + + AND a.recommend = #{param.recommend} + + + AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') + + + AND a.item_name LIKE CONCAT('%', #{param.itemName}, '%') + + + AND a.expiration_time LIKE CONCAT('%', #{param.itemYear}, '%') + + + AND a.item_type LIKE CONCAT('%', #{param.itemType}, '%') + + + AND a.item_opinion LIKE CONCAT('%', #{param.itemOpinion}, '%') + + + AND a.bank_name LIKE CONCAT('%', #{param.bankName}, '%') + + + AND a.bank_pay_time LIKE CONCAT('%', #{param.bankPayTime}, '%') + + + AND a.bank_price = #{param.bankPrice} + + + AND a.invoice_type LIKE CONCAT('%', #{param.invoiceType}, '%') + + + AND a.invoice_time LIKE CONCAT('%', #{param.invoiceTime}, '%') + + + AND a.invoice_price = #{param.invoicePrice} + + + AND a.report_num = #{param.reportNum} + + + AND a.draft_user_id = #{param.draftUserId} + + + AND a.user_ids LIKE CONCAT('%', #{param.userIds}, '%') + + + AND a.sign_user_id = #{param.signUserId} + + + AND a.sale_user_id = #{param.saleUserId} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND a.id IN + + #{item} + + + + AND (a.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.id = #{param.keywords} + OR a.code = #{param.keywords} + ) + + + + + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/pwl/param/PwlProjectImportParam.java b/src/main/java/com/gxwebsoft/pwl/param/PwlProjectImportParam.java new file mode 100644 index 0000000..b0b2517 --- /dev/null +++ b/src/main/java/com/gxwebsoft/pwl/param/PwlProjectImportParam.java @@ -0,0 +1,76 @@ +package com.gxwebsoft.pwl.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 用户导入参数 + * + * @author WebSoft + * @since 2011-10-15 17:33:34 + */ +@Data +public class PwlProjectImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "报告时间") + @JsonFormat(pattern = "yyyy.MM.dd", timezone = "GMT+8") + private String expirationTime; + + @Excel(name = "报告编号") + private String code; + + @Excel(name = "审计单位") + private String name; + + @Excel(name = "开项目信息") + private String itemName; + + @Excel(name = "所属年度") + private String itemYear; + + @Excel(name = "类型") + private String itemType; + + @Excel(name = "审计意见") + private String itemOpinion; + + @Excel(name = "年末资产总额(万元)") + private String totalAssets; + + @Excel(name = "合同金额") + private String contractPrice; + + @Excel(name = "实收金额") + private String payPrice; + + @Excel(name = "到账银行") + private String bankName; + + @Excel(name = "到账日期") + @JsonFormat(pattern = "yyyy.MM.dd", timezone = "GMT+8") + private String bankPayTime; + + @Excel(name = "到账金额") + private String bankPrice; + + @Excel(name = "日期") + @JsonFormat(pattern = "yyyy.MM.dd", timezone = "GMT+8") + private String invoiceTime; + + @Excel(name = "金额") + private String invoicePrice; + + @Excel(name = "发票类型") + private String invoiceType; + + @Excel(name = "报告份数") + private String reportNum; + + +} diff --git a/src/main/java/com/gxwebsoft/pwl/param/PwlProjectParam.java b/src/main/java/com/gxwebsoft/pwl/param/PwlProjectParam.java new file mode 100644 index 0000000..875eca7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/pwl/param/PwlProjectParam.java @@ -0,0 +1,167 @@ +package com.gxwebsoft.pwl.param; + +import java.math.BigDecimal; +import java.util.Set; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 卫兰的项目项目系统查询参数 + * + * @author 科技小王子 + * @since 2025-03-22 14:34:35 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "PwlProjectParam对象", description = "卫兰的项目项目系统查询参数") +public class PwlProjectParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "项目名称") + private String name; + + @Schema(description = "项目标识") + private String code; + + @Schema(description = "上级id, 0是顶级") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "项目类型") + @QueryField(type = QueryType.EQ) + private String type; + + @Schema(description = "项目图标") + private String avatar; + + @Schema(description = "二维码") + private String qrcode; + + @Schema(description = "链接地址") + private String url; + + @Schema(description = "应用截图") + private String images; + + @Schema(description = "底稿情况") + private String files; + + @Schema(description = "应用介绍") + private String content; + + @Schema(description = "年末资产总额(万元)") + @QueryField(type = QueryType.EQ) + private BigDecimal totalAssets; + + @Schema(description = "合同金额") + @QueryField(type = QueryType.EQ) + private BigDecimal contractPrice; + + @Schema(description = "实收金额") + @QueryField(type = QueryType.EQ) + private BigDecimal payPrice; + + @Schema(description = "软件定价") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "到期时间") + private String expirationTime; + + @Schema(description = "项目信息-开票单位/汇款人") + private String itemName; + + @Schema(description = "项目信息-年度") + private String itemYear; + + @Schema(description = "项目信息-类型") + private String itemType; + + @Schema(description = "项目信息-审计意见") + private String itemOpinion; + + @Schema(description = "到账信息-银行名称") + private String bankName; + + @Schema(description = "到账日期") + private String bankPayTime; + + @Schema(description = "到账金额") + @QueryField(type = QueryType.EQ) + private BigDecimal bankPrice; + + @Schema(description = "发票类型") + private String invoiceType; + + @Schema(description = "开票日期") + private String invoiceTime; + + @Schema(description = "开票金额") + @QueryField(type = QueryType.EQ) + private BigDecimal invoicePrice; + + @Schema(description = "报告份数") + @QueryField(type = QueryType.EQ) + private String reportNum; + + @Schema(description = "底稿人员") + @QueryField(type = QueryType.EQ) + private Integer draftUserId; + + @Schema(description = "参与成员") + private String userIds; + + @Schema(description = "签字注会") + @QueryField(type = QueryType.EQ) + private Integer signUserId; + + @Schema(description = "展业人员") + @QueryField(type = QueryType.EQ) + private Integer saleUserId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "客户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "当前登录用户") + @TableField(exist = false) + private Integer loginUserId; + + @Schema(description = "项目ID集合") + @TableField(exist = false) + private Set projectIds; + +} diff --git a/src/main/java/com/gxwebsoft/pwl/service/PwlProjectService.java b/src/main/java/com/gxwebsoft/pwl/service/PwlProjectService.java new file mode 100644 index 0000000..3261ec1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/pwl/service/PwlProjectService.java @@ -0,0 +1,44 @@ +package com.gxwebsoft.pwl.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.pwl.entity.PwlProject; +import com.gxwebsoft.pwl.param.PwlProjectParam; + +import java.util.List; + +/** + * 卫兰的项目项目系统Service + * + * @author 科技小王子 + * @since 2025-03-22 14:34:35 + */ +public interface PwlProjectService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(PwlProjectParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(PwlProjectParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return PwlProject + */ + PwlProject getByIdRel(Integer id); + + List listByCount(); +} diff --git a/src/main/java/com/gxwebsoft/pwl/service/impl/PwlProjectServiceImpl.java b/src/main/java/com/gxwebsoft/pwl/service/impl/PwlProjectServiceImpl.java new file mode 100644 index 0000000..01a3b00 --- /dev/null +++ b/src/main/java/com/gxwebsoft/pwl/service/impl/PwlProjectServiceImpl.java @@ -0,0 +1,58 @@ +package com.gxwebsoft.pwl.service.impl; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.service.UserService; +import com.gxwebsoft.pwl.mapper.PwlProjectMapper; +import com.gxwebsoft.pwl.service.PwlProjectService; +import com.gxwebsoft.pwl.entity.PwlProject; +import com.gxwebsoft.pwl.param.PwlProjectParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; + +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Arrays; +import java.util.List; + +/** + * 卫兰的项目项目系统Service实现 + * + * @author 科技小王子 + * @since 2025-03-22 14:34:35 + */ +@Service +public class PwlProjectServiceImpl extends ServiceImpl implements PwlProjectService { + @Override + public PageResult pageRel(PwlProjectParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(PwlProjectParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public PwlProject getByIdRel(Integer id) { + PwlProjectParam param = new PwlProjectParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public List listByCount() { + return baseMapper.listByCount(); + } + +} diff --git a/src/main/java/com/gxwebsoft/sdy/controller/PushTemplateMessageController.java b/src/main/java/com/gxwebsoft/sdy/controller/PushTemplateMessageController.java new file mode 100644 index 0000000..d4c179c --- /dev/null +++ b/src/main/java/com/gxwebsoft/sdy/controller/PushTemplateMessageController.java @@ -0,0 +1,209 @@ +package com.gxwebsoft.sdy.controller; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.entity.UserVerify; +import com.gxwebsoft.common.system.param.UserParam; +import com.gxwebsoft.common.system.service.UserService; +import com.gxwebsoft.hjm.dto.TemplateMessageRequest; +import com.gxwebsoft.hjm.entity.HjmCar; +import com.gxwebsoft.hjm.entity.HjmCourses; +import com.gxwebsoft.hjm.service.HjmCarService; +import com.gxwebsoft.hjm.service.WxNotificationService; +import com.gxwebsoft.pwl.entity.PwlProject; +import com.gxwebsoft.shop.entity.ShopDealerUser; +import com.gxwebsoft.shop.entity.ShopDealerWithdraw; +import com.gxwebsoft.shop.service.ShopDealerUserService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.HashMap; + +/** + * 定时任务 + * + * @author 科技小王子 + * @since 2022-12-15 19:11:07 + */ +@Tag(name = "定时任务") +@RestController +@RequestMapping("/api/sdy/sdy-template-message") +public class PushTemplateMessageController extends BaseController { + @Resource + private UserService userService; + @Resource + private WxNotificationService wxNotificationService; + @Resource + private ShopDealerUserService shopDealerUserService; + + + final static Integer tenantId = 10560; + final static String appId = "wx51962d6ac21f2ed2"; + final static String toUser = "oKGr42It8OcS1Bl-KpiQj7MM43o8"; + + @Operation(summary = "升级为管理员") + @GetMapping("/{id}") + public ApiResult pushByUpdateAdmin(@PathVariable("id") Integer id) { + // 发送模板消息 + boolean success = updateToAdmin(); + System.out.println("success = " + success); +// try { +// // 查询分销商用户信息 +// final ShopDealerUser dealerUser = shopDealerUserService.getByUserIdRel(id); +// +// // 判断用户是否存在 +// if (ObjectUtil.isEmpty(dealerUser)) { +//// return fail("用户不存在"); +// } +// +// // 发送模板消息 +// boolean success = updateToAdmin(dealerUser); +// +// if (success) { +// return success("模板消息发送成功"); +// } else { +// return fail("模板消息发送失败"); +// } +// +// } catch (Exception e) { +// System.err.println("发送升级管理员通知失败: " + e.getMessage()); +// e.printStackTrace(); +// return fail("发送失败:" + e.getMessage()); +// } + return success("模板消息发送成功",success); + } + + /** + * 升级为管理员 + * + * @return 发送是否成功 + */ + public boolean updateToAdmin() { + try { + // 发送模板消息 + final TemplateMessageRequest templateMessageRequest = new TemplateMessageRequest(); + templateMessageRequest.setToUser(toUser); + templateMessageRequest.setTemplateId("KxGoeBpHW60QFUIU7Vo3c_48g_3V55tWWr23tUUl8gI"); +// templateMessageRequest.setUrl("https://mp.websoft.top"); + final TemplateMessageRequest.MiniProgram miniProgram = new TemplateMessageRequest.MiniProgram(); + miniProgram.setAppid(appId); + miniProgram.setPagepath("pages/index/index"); + templateMessageRequest.setMiniprogram(miniProgram); + HashMap map = new HashMap<>(); + map.put("thing1", new TemplateMessageRequest.TemplateDataItem("唐任节")); + map.put("thing2", new TemplateMessageRequest.TemplateDataItem("升级为管理员")); + templateMessageRequest.setData(map); + System.out.println("发送升级管理员通知,数据: " + map); + + // 调用微信通知服务发送模板消息 + return wxNotificationService.sendTemplateMessage(tenantId, templateMessageRequest); + + } catch (Exception e) { + System.err.println("发送模板消息异常: " + e.getMessage()); + e.printStackTrace(); + return false; + } + } + + @Operation(summary = "发送实名审核提醒") + @PostMapping("/pushReviewReminder") + public ApiResult pushReviewReminder(@RequestBody UserVerify userVerify) { + try { + // 发送模板消息 + final TemplateMessageRequest templateMessageRequest = new TemplateMessageRequest(); + templateMessageRequest.setToUser(toUser); + templateMessageRequest.setTemplateId("0FBKFCWXe8WyjReYXwSDEXf1-pxYKQXE0quZre3GYIM"); + final TemplateMessageRequest.MiniProgram miniProgram = new TemplateMessageRequest.MiniProgram(); + miniProgram.setAppid(appId); + miniProgram.setPagepath("admin/userVerify/index"); + templateMessageRequest.setMiniprogram(miniProgram); + HashMap map = new HashMap<>(); + map.put("thing5", new TemplateMessageRequest.TemplateDataItem(userVerify.getRealName())); + // 当前日期 + map.put("time6", new TemplateMessageRequest.TemplateDataItem(new SimpleDateFormat("yyyy-MM-dd").format(System.currentTimeMillis()))); + templateMessageRequest.setData(map); + System.out.println("map = " + map); + // 调用微信通知服务发送模板消息 + wxNotificationService.sendTemplateMessage(tenantId, templateMessageRequest); + return success("发送成功"); + + } catch (Exception e) { + System.err.println("发送模板消息异常: " + e.getMessage()); + e.printStackTrace(); + return fail("发送失败:" + e.getMessage()); + } + } + + @Operation(summary = "提现审核提醒") + @PostMapping("/pushWithdrawalReviewReminder") + public ApiResult pushWithdrawalReviewReminder(@RequestBody ShopDealerWithdraw shopDealerWithdraw) { + try { + // 发送模板消息 + final TemplateMessageRequest templateMessageRequest = new TemplateMessageRequest(); + templateMessageRequest.setToUser(toUser); + templateMessageRequest.setTemplateId("fJOb0ZPs_HCQO6tdqPRTfaELGgjH5s8a6Vm9X9Hxgrk"); + final TemplateMessageRequest.MiniProgram miniProgram = new TemplateMessageRequest.MiniProgram(); + miniProgram.setAppid(appId); + miniProgram.setPagepath("dealer/withdraw/admin"); +// miniProgram.setPagepath("pages/index/index"); + templateMessageRequest.setMiniprogram(miniProgram); + HashMap map = new HashMap<>(); + map.put("amount1", new TemplateMessageRequest.TemplateDataItem(shopDealerWithdraw.getMoney().toString())); + map.put("thing7", new TemplateMessageRequest.TemplateDataItem(shopDealerWithdraw.getBankAccount())); + templateMessageRequest.setData(map); + System.out.println("map = " + map); + // 调用微信通知服务发送模板消息 + wxNotificationService.sendTemplateMessage(tenantId, templateMessageRequest); + return success("发送成功"); + + } catch (Exception e) { + System.err.println("发送模板消息异常: " + e.getMessage()); + e.printStackTrace(); + return fail("发送失败:" + e.getMessage()); + } + } + + + @Operation(summary = "提现到账通知提醒") + @PostMapping("/pushNoticeOfWithdrawalToAccount") + public ApiResult pushNoticeOfWithdrawalToAccount(@RequestBody ShopDealerWithdraw shopDealerWithdraw) { + if (StrUtil.isBlank(shopDealerWithdraw.getOfficeOpenid())) { + return fail("请传入公众号openid"); + } + try { + // 发送模板消息 + final TemplateMessageRequest templateMessageRequest = new TemplateMessageRequest(); + templateMessageRequest.setToUser(shopDealerWithdraw.getOfficeOpenid()); + templateMessageRequest.setTemplateId("QnmEjyEBmodtfnDsflDwVS1mmh4v_hql-TCDxi2ADs8"); + final TemplateMessageRequest.MiniProgram miniProgram = new TemplateMessageRequest.MiniProgram(); + miniProgram.setAppid(appId); + miniProgram.setPagepath("dealer/withdraw/admin"); + templateMessageRequest.setMiniprogram(miniProgram); + HashMap map = new HashMap<>(); + map.put("thing13", new TemplateMessageRequest.TemplateDataItem(shopDealerWithdraw.getBankAccount())); + map.put("amount4", new TemplateMessageRequest.TemplateDataItem(shopDealerWithdraw.getMoney().toString())); + map.put("amount5", new TemplateMessageRequest.TemplateDataItem(shopDealerWithdraw.getMoney().subtract(new BigDecimal(3)).toString())); + map.put("amount9", new TemplateMessageRequest.TemplateDataItem(new BigDecimal(3).toString())); + + templateMessageRequest.setData(map); + System.out.println("map = " + map); + // 调用微信通知服务发送模板消息 + wxNotificationService.sendTemplateMessage(tenantId, templateMessageRequest); + return success("发送成功"); + + } catch (Exception e) { + System.err.println("发送模板消息异常: " + e.getMessage()); + e.printStackTrace(); + return fail("发送失败:" + e.getMessage()); + } + } + +} diff --git a/src/main/java/com/gxwebsoft/sdy/controller/SdyDealerOrderController.java b/src/main/java/com/gxwebsoft/sdy/controller/SdyDealerOrderController.java new file mode 100644 index 0000000..aceb01b --- /dev/null +++ b/src/main/java/com/gxwebsoft/sdy/controller/SdyDealerOrderController.java @@ -0,0 +1,193 @@ +package com.gxwebsoft.sdy.controller; + +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.sdy.param.SdyDealerOrderImportParam; +import com.gxwebsoft.shop.entity.*; +import com.gxwebsoft.shop.service.*; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + * 售电云分销订单控制器 + * + * @author 科技小王子 + * @since 2025-08-12 11:55:18 + */ +@Tag(name = "售电云分销订单管理") +@RestController +@RequestMapping("/api/sdy/sdy-dealer-order") +public class SdyDealerOrderController extends BaseController { + @Resource + private ShopDealerOrderService shopDealerOrderService; + @Resource + private ShopDealerApplyService shopDealerApplyService; + @Resource + private ShopDealerRefereeService shopDealerRefereeService; + @Resource + private ShopDealerCapitalService shopDealerCapitalService; + @Resource + private ShopDealerUserService shopDealerUserService; + + /** + * excel批量导入售电云分销订单 + */ + @PreAuthorize("hasAuthority('shop:shopDealerOrder:save')") + @OperationLog + @Operation(summary = "批量导入售电云分销订单") + @Transactional(rollbackFor = {Exception.class}) + @PostMapping("/import") + public ApiResult> importBatch(MultipartFile file) { + ImportParams importParams = new ImportParams(); + try { + System.out.println("开始导入数据..."); + System.out.println("文件大小: " + (file != null ? file.getSize() : "null")); + + // 导入XLS文件的内容 + List list = ExcelImportUtil.importExcel(file.getInputStream(), SdyDealerOrderImportParam.class, importParams); + + // 打印导入的数据条数用于调试 + System.out.println("导入数据条数: " + (list != null ? list.size() : 0)); + + // 打印第一条数据用于调试 + if (list != null && !list.isEmpty()) { + SdyDealerOrderImportParam first = list.get(0); + System.out.println("第一条数据: " + first); + System.out.println("title: " + first.getTitle()); + System.out.println("userId: " + first.getUserId()); + } + + if (list == null || list.isEmpty()) { + return fail("未读取到任何数据,请检查Excel文件格式和数据行位置", null); + } + + int importedCount = 0; + + for (SdyDealerOrderImportParam d : list) { + // 检查是否已存在相同的记录(根据comments字段和未结算状态) + com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper queryWrapper = new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<>(); + queryWrapper.eq(ShopDealerOrder::getTitle, d.getTitle()); // 使用comments字段 + queryWrapper.eq(ShopDealerOrder::getIsSettled, 0); // 未结算状态 + + if (shopDealerOrderService.count(queryWrapper) == 0) { + // 不存在相同记录,可以导入 + ShopDealerOrder item = new ShopDealerOrder(); + + // 生成订单号 + String orderNo = Long.toString(IdUtil.getSnowflakeNextId()); + + // 手动映射字段 + item.setUserId(d.getUserId()); + item.setOrderNo(orderNo); + item.setOrderPrice(d.getOrderPrice()); + item.setDegreePrice(d.getOrderPrice().multiply(new BigDecimal(1000))); + item.setFirstUserId(d.getFirstUserId()); + item.setSecondUserId(d.getSecondUserId()); + item.setThirdUserId(d.getThirdUserId()); + item.setFirstMoney(d.getFirstMoney()); + item.setSecondMoney(d.getSecondMoney()); + item.setThirdMoney(d.getThirdMoney()); + item.setTenantId(d.getTenantId()); + item.setTitle(d.getTitle()); + item.setComments(d.getComments()); + // 假设d.getPrice()返回的BigDecimal未设置精度 + item.setPrice(d.getPrice()); + item.setSettledPrice(d.getSettledPrice()); + item.setPayPrice(d.getPayPrice()); + item.setRate(d.getRate()); + item.setMonth(d.getMonth()); + item.setIsInvalid(0); + item.setIsSettled(0); // 新导入的数据设为未结算 + + System.out.println("准备导入数据: " + item); + if (ObjectUtil.isNotEmpty(item)) { + shopDealerOrderService.save(item); + importedCount++; + } + } else { + System.out.println("跳过重复数据: " + d.getComments()); + } + } + return success("成功导入" + importedCount + "条,重复或已存在" + (list.size() - importedCount) + "条", null); + } catch (Exception e) { + e.printStackTrace(); + return fail("导入失败: " + e.getMessage(), null); + } + } + + @PreAuthorize("hasAuthority('shop:shopDealerOrder:update')") + @Operation(summary = "结算订单") + @PutMapping() + public ApiResult saveSettled(@RequestBody ShopDealerOrder shopDealerOrder) { + shopDealerOrder.setSettleTime(LocalDateTime.now()); + shopDealerOrder.setIsSettled(1); + if (shopDealerOrderService.updateById(shopDealerOrder)) { + + // 一级分成 + ShopDealerUser dealerUser = shopDealerUserService.getByUserIdRel(shopDealerOrder.getFirstUserId()); + dealerUser.setMoney(dealerUser.getMoney().add(shopDealerOrder.getFirstMoney())); + if(shopDealerUserService.updateById(dealerUser)){ + System.out.println("一级分成 = 1"); + ShopDealerCapital shopDealerCapital = new ShopDealerCapital(); + shopDealerCapital.setUserId(shopDealerOrder.getFirstUserId()); + shopDealerCapital.setOrderNo(shopDealerOrder.getOrderNo()); + shopDealerCapital.setMoney(shopDealerOrder.getFirstMoney()); + shopDealerCapital.setMonth(shopDealerOrder.getMonth()); + shopDealerCapital.setComments("分销订单结算"); + shopDealerCapital.setToUserId(shopDealerOrder.getUserId()); + shopDealerCapitalService.save(shopDealerCapital); + } + + // 二级分成 + ShopDealerUser dealerUser2 = shopDealerUserService.getByUserIdRel(shopDealerOrder.getSecondUserId()); + if(ObjectUtil.isNotEmpty(dealerUser2)){ + dealerUser2.setMoney(dealerUser2.getMoney().add(shopDealerOrder.getSecondMoney())); + if (shopDealerUserService.updateById(dealerUser2)) { + System.out.println("二级分成 = 2"); + ShopDealerCapital shopDealerCapital2 = new ShopDealerCapital(); + shopDealerCapital2.setUserId(shopDealerOrder.getSecondUserId()); + shopDealerCapital2.setOrderNo(shopDealerOrder.getOrderNo()); + shopDealerCapital2.setMoney(shopDealerOrder.getSecondMoney()); + shopDealerCapital2.setMonth(shopDealerOrder.getMonth()); + shopDealerCapital2.setComments("分销订单结算"); + shopDealerCapital2.setToUserId(shopDealerOrder.getUserId()); + shopDealerCapitalService.save(shopDealerCapital2); + } + } + + // 三级分成 + ShopDealerUser dealerUser3 = shopDealerUserService.getByUserIdRel(shopDealerOrder.getThirdUserId()); + if(ObjectUtil.isNotEmpty(dealerUser3)){ + dealerUser3.setMoney(dealerUser3.getMoney().add(shopDealerOrder.getThirdMoney())); + if (shopDealerUserService.updateById(dealerUser3)) { + System.out.println("三级分成 = 3"); + ShopDealerCapital shopDealerCapital3 = new ShopDealerCapital(); + shopDealerCapital3.setUserId(shopDealerOrder.getThirdUserId()); + shopDealerCapital3.setOrderNo(shopDealerOrder.getOrderNo()); + shopDealerCapital3.setMoney(shopDealerOrder.getThirdMoney()); + shopDealerCapital3.setMonth(shopDealerOrder.getMonth()); + shopDealerCapital3.setComments("分销订单结算"); + shopDealerCapital3.setToUserId(shopDealerOrder.getUserId()); + shopDealerCapitalService.save(shopDealerCapital3); + } + } + + return success("结算成功"); + } + return fail("结算失败"); + } +} diff --git a/src/main/java/com/gxwebsoft/sdy/param/SdyDealerOrderImportParam.java b/src/main/java/com/gxwebsoft/sdy/param/SdyDealerOrderImportParam.java new file mode 100644 index 0000000..4f66cae --- /dev/null +++ b/src/main/java/com/gxwebsoft/sdy/param/SdyDealerOrderImportParam.java @@ -0,0 +1,75 @@ +package com.gxwebsoft.sdy.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * 售电云分销订单导入参数 + * + * @author 科技小王子 + * @since 2025-08-12 11:55:18 + */ +@Data +public class SdyDealerOrderImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "业务员ID") + private Integer userId; + + @Excel(name = "公司名称") + private String title; + + @Excel(name = "订单编号") + private String orderNo; + + @Excel(name = "结算电量") + private BigDecimal orderPrice; + + @Excel(name = "换算成度") + private BigDecimal degreePrice; + + @Excel(name = "结算金额") + private BigDecimal settledPrice; + + @Excel(name = "实发金额") + private BigDecimal payPrice; + + @Excel(name = "结算单价") + private BigDecimal price; + + @Excel(name = "税费") + private BigDecimal rate; + + @Excel(name = "月份") + private String month; + + @Excel(name = "一级分销商ID") + private Integer firstUserId; + + @Excel(name = "二级分销商ID") + private Integer secondUserId; + + @Excel(name = "三级分销商ID") + private Integer thirdUserId; + + @Excel(name = "一级佣金30%") + private BigDecimal firstMoney; + + @Excel(name = "二级佣金10%") + private BigDecimal secondMoney; + + @Excel(name = "三级佣金60%") + private BigDecimal thirdMoney; + + @Excel(name = "备注") + private String comments; + + @Excel(name = "租户ID") + private Integer tenantId; +} diff --git a/src/main/java/com/gxwebsoft/shop/config/OrderConfigProperties.java b/src/main/java/com/gxwebsoft/shop/config/OrderConfigProperties.java new file mode 100644 index 0000000..887db88 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/config/OrderConfigProperties.java @@ -0,0 +1,235 @@ +package com.gxwebsoft.shop.config; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 订单相关配置属性 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +@Data +@Component +@ConfigurationProperties(prefix = "shop.order") +public class OrderConfigProperties { + + /** + * 测试账号配置 + */ + private TestAccount testAccount = new TestAccount(); + + /** + * 租户特殊规则配置 + */ + private List tenantRules; + + /** + * 默认订单配置 + */ + private DefaultConfig defaultConfig = new DefaultConfig(); + + /** + * 订单自动取消配置 + */ + private AutoCancel autoCancel = new AutoCancel(); + + /** + * 错误信息配置 + */ + private ErrorMessages errorMessages = new ErrorMessages(); + + @Data + public static class TestAccount { + /** + * 测试手机号列表 + */ + private List phoneNumbers; + + /** + * 测试支付金额 + */ + private BigDecimal testPayAmount = new BigDecimal("0.01"); + + /** + * 是否启用测试模式 + */ + private boolean enabled = false; + } + + @Data + public static class TenantRule { + /** + * 租户ID + */ + private Integer tenantId; + + /** + * 租户名称 + */ + private String tenantName; + + /** + * 最小金额限制 + */ + private BigDecimal minAmount; + + /** + * 金额限制提示信息 + */ + private String minAmountMessage; + + /** + * 是否启用 + */ + private boolean enabled = true; + } + + @Data + public static class DefaultConfig { + + /** + * 默认标题 + */ + private String defaultTitle = "订单标题"; + + /** + * 默认备注 + */ + private String defaultComments = "暂无"; + + /** + * 最小订单金额 + */ + private BigDecimal minOrderAmount = BigDecimal.ZERO; + + /** + * 订单超时时间(分钟) + */ + private Integer orderTimeoutMinutes = 30; + } + + /** + * 检查是否为测试账号 + */ + public boolean isTestAccount(String phone) { + return testAccount.isEnabled() && + testAccount.getPhoneNumbers() != null && + testAccount.getPhoneNumbers().contains(phone); + } + + @Data + public static class AutoCancel { + /** + * 是否启用自动取消功能 + */ + private boolean enabled = true; + + /** + * 默认超时时间(分钟) + */ + private Integer defaultTimeoutMinutes = 30; + + /** + * 定时任务检查间隔(分钟) + */ + private Integer checkIntervalMinutes = 5; + + /** + * 批量处理大小 + */ + private Integer batchSize = 100; + + /** + * 租户特殊配置 + */ + private List tenantConfigs; + } + + @Data + public static class TenantCancelConfig { + /** + * 租户ID + */ + private Integer tenantId; + + /** + * 租户名称 + */ + private String tenantName; + + /** + * 超时时间(分钟) + */ + private Integer timeoutMinutes; + + /** + * 是否启用 + */ + private boolean enabled = true; + } + + /** + * 获取指定租户的超时时间 + */ + public Integer getTimeoutMinutes(Integer tenantId) { + if (autoCancel.getTenantConfigs() != null) { + for (TenantCancelConfig config : autoCancel.getTenantConfigs()) { + if (config.isEnabled() && config.getTenantId().equals(tenantId)) { + return config.getTimeoutMinutes(); + } + } + } + return autoCancel.getDefaultTimeoutMinutes(); + } + + /** + * 获取租户规则 + */ + public TenantRule getTenantRule(Integer tenantId) { + if (tenantRules == null) { + return null; + } + return tenantRules.stream() + .filter(rule -> rule.isEnabled() && rule.getTenantId().equals(tenantId)) + .findFirst() + .orElse(null); + } + + @Data + public static class ErrorMessages { + /** + * 订单金额计算错误信息 + */ + private String amountCalculationError = "订单金额计算错误,请刷新重试"; + + /** + * 商品不存在错误信息 + */ + private String goodsNotFound = "商品不存在"; + + /** + * 商品已下架错误信息 + */ + private String goodsOffline = "商品已下架"; + + /** + * 库存不足错误信息 + */ + private String stockInsufficient = "商品库存不足"; + + /** + * 购买数量超限错误信息 + */ + private String quantityExceeded = "商品购买数量超过限制"; + + /** + * 商品价格异常错误信息 + */ + private String priceAbnormal = "商品价格异常"; + } +} diff --git a/src/main/java/com/gxwebsoft/shop/constants/WxPayConstants.java b/src/main/java/com/gxwebsoft/shop/constants/WxPayConstants.java new file mode 100644 index 0000000..1618dd8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/constants/WxPayConstants.java @@ -0,0 +1,200 @@ +package com.gxwebsoft.shop.constants; + +/** + * 微信支付常量类 + * 管理微信支付相关的常量配置 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +public class WxPayConstants { + + /** + * 微信支付类型 + */ + public static class PayType { + /** Native支付 */ + public static final String NATIVE = "NATIVE"; + /** JSAPI支付 */ + public static final String JSAPI = "JSAPI"; + /** H5支付 */ + public static final String MWEB = "MWEB"; + /** APP支付 */ + public static final String APP = "APP"; + } + + /** + * 支付状态 + */ + public static class PayStatus { + /** 支付成功 */ + public static final String SUCCESS = "SUCCESS"; + /** 转入退款 */ + public static final String REFUND = "REFUND"; + /** 未支付 */ + public static final String NOTPAY = "NOTPAY"; + /** 已关闭 */ + public static final String CLOSED = "CLOSED"; + /** 已撤销(付款码支付) */ + public static final String REVOKED = "REVOKED"; + /** 用户支付中(付款码支付) */ + public static final String USERPAYING = "USERPAYING"; + /** 支付失败(其他原因,如银行返回失败) */ + public static final String PAYERROR = "PAYERROR"; + } + + /** + * 回调通知相关 + */ + public static class Notify { + /** 成功响应 */ + public static final String SUCCESS_RESPONSE = "SUCCESS"; + /** 失败响应 */ + public static final String FAIL_RESPONSE = "FAIL"; + + /** 通知类型 - 支付成功 */ + public static final String EVENT_TYPE_PAYMENT = "TRANSACTION.SUCCESS"; + /** 通知类型 - 退款成功 */ + public static final String EVENT_TYPE_REFUND = "REFUND.SUCCESS"; + } + + /** + * 缓存键前缀 + */ + public static class CacheKey { + /** 支付配置缓存键前缀 */ + public static final String PAYMENT_CONFIG_PREFIX = "Payment:wxPay:"; + /** 微信小程序配置缓存键 */ + public static final String MP_WEIXIN_CONFIG = "mp-weixin"; + } + + /** + * 配置相关 + */ + public static class Config { + /** 货币类型 - 人民币 */ + public static final String CURRENCY_CNY = "CNY"; + /** 金额转换倍数(元转分) */ + public static final int AMOUNT_MULTIPLIER = 100; + + /** 开发环境标识 */ + public static final String PROFILE_DEV = "dev"; + /** 生产环境标识 */ + public static final String PROFILE_PROD = "prod"; + } + + /** + * 订单相关 + */ + public static class Order { + /** 订单超时时间(分钟) */ + public static final int TIMEOUT_MINUTES = 30; + /** 订单描述最大长度 */ + public static final int DESCRIPTION_MAX_LENGTH = 127; + } + + /** + * HTTP头部相关 + */ + public static class Header { + /** 微信支付签名 */ + public static final String WECHATPAY_SIGNATURE = "Wechatpay-Signature"; + /** 微信支付时间戳 */ + public static final String WECHATPAY_TIMESTAMP = "Wechatpay-Timestamp"; + /** 微信支付随机数 */ + public static final String WECHATPAY_NONCE = "Wechatpay-Nonce"; + /** 微信支付序列号 */ + public static final String WECHATPAY_SERIAL = "Wechatpay-Serial"; + /** 请求ID */ + public static final String REQUEST_ID = "Request-ID"; + } + + /** + * 错误信息 + */ + public static class ErrorMessage { + /** 配置未找到 */ + public static final String CONFIG_NOT_FOUND = "微信支付配置未找到"; + /** 证书文件不存在 */ + public static final String CERTIFICATE_NOT_FOUND = "微信支付证书文件不存在"; + /** 参数验证失败 */ + public static final String PARAM_VALIDATION_FAILED = "参数验证失败"; + /** 签名验证失败 */ + public static final String SIGNATURE_VERIFICATION_FAILED = "签名验证失败"; + /** 订单不存在 */ + public static final String ORDER_NOT_FOUND = "订单不存在"; + /** 订单状态异常 */ + public static final String ORDER_STATUS_INVALID = "订单状态异常"; + /** 金额不匹配 */ + public static final String AMOUNT_MISMATCH = "订单金额不匹配"; + /** 网络请求失败 */ + public static final String NETWORK_REQUEST_FAILED = "网络请求失败"; + /** 系统内部错误 */ + public static final String SYSTEM_INTERNAL_ERROR = "系统内部错误"; + } + + /** + * 日志相关 + */ + public static class LogMessage { + /** 支付请求开始 */ + public static final String PAY_REQUEST_START = "开始处理微信支付请求"; + /** 支付请求成功 */ + public static final String PAY_REQUEST_SUCCESS = "微信支付请求处理成功"; + /** 支付请求失败 */ + public static final String PAY_REQUEST_FAILED = "微信支付请求处理失败"; + + /** 回调处理开始 */ + public static final String CALLBACK_START = "开始处理微信支付回调"; + /** 回调处理成功 */ + public static final String CALLBACK_SUCCESS = "微信支付回调处理成功"; + /** 回调处理失败 */ + public static final String CALLBACK_FAILED = "微信支付回调处理失败"; + + /** 配置加载成功 */ + public static final String CONFIG_LOADED = "微信支付配置加载成功"; + /** 配置加载失败 */ + public static final String CONFIG_LOAD_FAILED = "微信支付配置加载失败"; + } + + /** + * 正则表达式 + */ + public static class Regex { + /** 商户号格式 */ + public static final String MERCHANT_ID = "^\\d{10}$"; + /** 订单号格式 */ + public static final String ORDER_NO = "^[a-zA-Z0-9_-]{1,32}$"; + /** 金额格式(分) */ + public static final String AMOUNT = "^[1-9]\\d*$"; + } + + /** + * 时间相关 + */ + public static class Time { + /** 签名有效期(秒) */ + public static final long SIGNATURE_VALID_SECONDS = 300; + /** 配置缓存有效期(秒) */ + public static final long CONFIG_CACHE_SECONDS = 3600; + } + + /** + * 文件相关 + */ + public static class File { + /** 证书文件扩展名 */ + public static final String CERT_EXTENSION = ".pem"; + /** 私钥文件名 */ + public static final String PRIVATE_KEY_FILE = "apiclient_key.pem"; + /** 商户证书文件名 */ + public static final String MERCHANT_CERT_FILE = "apiclient_cert.pem"; + /** 平台证书文件名 */ + public static final String PLATFORM_CERT_FILE = "wechatpay_cert.pem"; + } + + // 私有构造函数,防止实例化 + private WxPayConstants() { + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/CouponStatusController.java b/src/main/java/com/gxwebsoft/shop/controller/CouponStatusController.java new file mode 100644 index 0000000..ded942f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/CouponStatusController.java @@ -0,0 +1,189 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.entity.ShopUserCoupon; +import com.gxwebsoft.shop.service.CouponStatusService; +import com.gxwebsoft.shop.service.CouponStatusService.CouponStatusResult; +import com.gxwebsoft.shop.service.CouponStatusService.CouponValidationResult; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 优惠券状态管理控制器 + * + * @author WebSoft + * @since 2025-01-15 + */ +@Slf4j +@Tag(name = "优惠券状态管理") +@RestController +@RequestMapping("/api/shop/coupon-status") +public class CouponStatusController extends BaseController { + + @Autowired + private CouponStatusService couponStatusService; + + @Operation(summary = "获取当前用户可用优惠券") + @GetMapping("/available") + public ApiResult> getAvailableCoupons() { + try { + List coupons = couponStatusService.getAvailableCoupons(getLoginUserId()); + return success("获取成功", coupons); + } catch (Exception e) { + log.error("获取可用优惠券失败", e); + return fail("获取失败",null); + } + } + + @Operation(summary = "获取当前用户已使用优惠券") + @GetMapping("/used") + public ApiResult> getUsedCoupons() { + try { + List coupons = couponStatusService.getUsedCoupons(getLoginUserId()); + return success("获取成功", coupons); + } catch (Exception e) { + log.error("获取已使用优惠券失败", e); + return fail("获取失败",null); + } + } + + @Operation(summary = "获取当前用户已过期优惠券") + @GetMapping("/expired") + public ApiResult> getExpiredCoupons() { + try { + List coupons = couponStatusService.getExpiredCoupons(getLoginUserId()); + return success("获取成功", coupons); + } catch (Exception e) { + log.error("获取已过期优惠券失败", e); + return fail("获取失败",null); + } + } + + @Operation(summary = "获取当前用户所有优惠券(按状态分类)") + @GetMapping("/all-grouped") + public ApiResult getAllCouponsGrouped() { + try { + CouponStatusResult result = couponStatusService.getUserCouponsGroupByStatus(getLoginUserId()); + return success("获取成功", result); + } catch (Exception e) { + log.error("获取优惠券分类失败", e); + return fail("获取失败",null); + } + } + + @Operation(summary = "验证优惠券是否可用于订单") + @PostMapping("/validate") + public ApiResult validateCouponForOrder( + @Parameter(description = "用户优惠券ID") @RequestParam Long userCouponId, + @Parameter(description = "订单总金额") @RequestParam BigDecimal totalAmount, + @Parameter(description = "商品ID列表") @RequestBody List goodsIds) { + try { + CouponValidationResult result = couponStatusService.validateCouponForOrder( + userCouponId, totalAmount, goodsIds); + return success(result.getMessage(), result); + } catch (Exception e) { + log.error("验证优惠券失败", e); + return fail("验证失败",null); + } + } + + @Operation(summary = "使用优惠券") + @PostMapping("/use") + public ApiResult useCoupon( + @Parameter(description = "用户优惠券ID") @RequestParam Long userCouponId, + @Parameter(description = "订单ID") @RequestParam Integer orderId, + @Parameter(description = "订单号") @RequestParam String orderNo) { + try { + boolean success = couponStatusService.useCoupon(userCouponId, orderId, orderNo); + if (success) { + return success("使用成功"); + } else { + return fail("使用失败"); + } + } catch (Exception e) { + log.error("使用优惠券失败", e); + return fail("使用失败"); + } + } + + @Operation(summary = "退还优惠券(订单取消时)") + @PostMapping("/return/{orderId}") + public ApiResult returnCoupon( + @Parameter(description = "订单ID") @PathVariable Integer orderId) { + try { + boolean success = couponStatusService.returnCoupon(orderId); + if (success) { + return success("退还成功"); + } else { + return fail("退还失败"); + } + } catch (Exception e) { + log.error("退还优惠券失败", e); + return fail("退还失败"); + } + } + + @PreAuthorize("hasAuthority('shop:coupon:manage')") + @Operation(summary = "批量更新过期优惠券状态(管理员)") + @PostMapping("/update-expired") + public ApiResult updateExpiredCoupons() { + try { + int updatedCount = couponStatusService.updateExpiredCoupons(); + return success("更新完成,共更新 " + updatedCount + " 张优惠券"); + } catch (Exception e) { + log.error("批量更新过期优惠券失败", e); + return fail("更新失败"); + } + } + + @Operation(summary = "获取优惠券状态统计") + @GetMapping("/statistics") + public ApiResult getCouponStatistics() { + try { + CouponStatusResult result = couponStatusService.getUserCouponsGroupByStatus(getLoginUserId()); + + CouponStatistics statistics = new CouponStatistics(); + statistics.setAvailableCount(result.getAvailableCoupons().size()); + statistics.setUsedCount(result.getUsedCoupons().size()); + statistics.setExpiredCount(result.getExpiredCoupons().size()); + statistics.setTotalCount(result.getTotalCount()); + + return success("获取成功", statistics); + } catch (Exception e) { + log.error("获取优惠券统计失败", e); + return fail("获取失败",null); + } + } + + /** + * 优惠券统计信息 + */ + public static class CouponStatistics { + private int availableCount; // 可用数量 + private int usedCount; // 已使用数量 + private int expiredCount; // 已过期数量 + private int totalCount; // 总数量 + + // Getters and Setters + public int getAvailableCount() { return availableCount; } + public void setAvailableCount(int availableCount) { this.availableCount = availableCount; } + + public int getUsedCount() { return usedCount; } + public void setUsedCount(int usedCount) { this.usedCount = usedCount; } + + public int getExpiredCount() { return expiredCount; } + public void setExpiredCount(int expiredCount) { this.expiredCount = expiredCount; } + + public int getTotalCount() { return totalCount; } + public void setTotalCount(int totalCount) { this.totalCount = totalCount; } + } +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopArticleController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopArticleController.java new file mode 100644 index 0000000..d882ba2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopArticleController.java @@ -0,0 +1,129 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopArticleService; +import com.gxwebsoft.shop.entity.ShopArticle; +import com.gxwebsoft.shop.param.ShopArticleParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 商品文章控制器 + * + * @author 科技小王子 + * @since 2025-08-13 05:14:53 + */ +@Tag(name = "商品文章管理") +@RestController +@RequestMapping("/api/shop/shop-article") +public class ShopArticleController extends BaseController { + @Resource + private ShopArticleService shopArticleService; + + @PreAuthorize("hasAuthority('shop:shopArticle:list')") + @Operation(summary = "分页查询商品文章") + @GetMapping("/page") + public ApiResult> page(ShopArticleParam param) { + // 使用关联查询 + return success(shopArticleService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopArticle:list')") + @Operation(summary = "查询全部商品文章") + @GetMapping() + public ApiResult> list(ShopArticleParam param) { + // 使用关联查询 + return success(shopArticleService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopArticle:list')") + @Operation(summary = "根据id查询商品文章") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopArticleService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopArticle:save')") + @OperationLog + @Operation(summary = "添加商品文章") + @PostMapping() + public ApiResult save(@RequestBody ShopArticle shopArticle) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopArticle.setUserId(loginUser.getUserId()); + } + if (shopArticleService.save(shopArticle)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopArticle:update')") + @OperationLog + @Operation(summary = "修改商品文章") + @PutMapping() + public ApiResult update(@RequestBody ShopArticle shopArticle) { + if (shopArticleService.updateById(shopArticle)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopArticle:remove')") + @OperationLog + @Operation(summary = "删除商品文章") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopArticleService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopArticle:save')") + @OperationLog + @Operation(summary = "批量添加商品文章") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopArticleService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopArticle:update')") + @OperationLog + @Operation(summary = "批量修改商品文章") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopArticleService, "article_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopArticle:remove')") + @OperationLog + @Operation(summary = "批量删除商品文章") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopArticleService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopBrandController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopBrandController.java new file mode 100644 index 0000000..ec2c25c --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopBrandController.java @@ -0,0 +1,110 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopBrandService; +import com.gxwebsoft.shop.entity.ShopBrand; +import com.gxwebsoft.shop.param.ShopBrandParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 品牌控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "品牌管理") +@RestController +@RequestMapping("/api/shop/shop-brand") +public class ShopBrandController extends BaseController { + @Resource + private ShopBrandService shopBrandService; + + @Operation(summary = "分页查询品牌") + @GetMapping("/page") + public ApiResult> page(ShopBrandParam param) { + // 使用关联查询 + return success(shopBrandService.pageRel(param)); + } + + @Operation(summary = "查询全部品牌") + @GetMapping() + public ApiResult> list(ShopBrandParam param) { + // 使用关联查询 + return success(shopBrandService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopBrand:list')") + @Operation(summary = "根据id查询品牌") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopBrandService.getByIdRel(id)); + } + + @Operation(summary = "添加品牌") + @PostMapping() + public ApiResult save(@RequestBody ShopBrand shopBrand) { + if (shopBrandService.save(shopBrand)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改品牌") + @PutMapping() + public ApiResult update(@RequestBody ShopBrand shopBrand) { + if (shopBrandService.updateById(shopBrand)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除品牌") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopBrandService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加品牌") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopBrandService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改品牌") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopBrandService, "brand_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除品牌") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopBrandService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopCartController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopCartController.java new file mode 100644 index 0000000..22ada86 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopCartController.java @@ -0,0 +1,115 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopCartService; +import com.gxwebsoft.shop.entity.ShopCart; +import com.gxwebsoft.shop.param.ShopCartParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 购物车控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "购物车管理") +@RestController +@RequestMapping("/api/shop/shop-cart") +public class ShopCartController extends BaseController { + @Resource + private ShopCartService shopCartService; + + @Operation(summary = "分页查询购物车") + @GetMapping("/page") + public ApiResult> page(ShopCartParam param) { + // 使用关联查询 + return success(shopCartService.pageRel(param)); + } + + @Operation(summary = "查询全部购物车") + @GetMapping() + public ApiResult> list(ShopCartParam param) { + // 使用关联查询 + return success(shopCartService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopCart:list')") + @Operation(summary = "根据id查询购物车") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Long id) { + // 使用关联查询 + return success(shopCartService.getByIdRel(id)); + } + + @Operation(summary = "添加购物车") + @PostMapping() + public ApiResult save(@RequestBody ShopCart shopCart) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopCart.setUserId(loginUser.getUserId()); + } + if (shopCartService.save(shopCart)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改购物车") + @PutMapping() + public ApiResult update(@RequestBody ShopCart shopCart) { + if (shopCartService.updateById(shopCart)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除购物车") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopCartService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加购物车") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopCartService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改购物车") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopCartService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除购物车") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopCartService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopCategoryController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopCategoryController.java new file mode 100644 index 0000000..bcffdea --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopCategoryController.java @@ -0,0 +1,126 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopCategoryService; +import com.gxwebsoft.shop.entity.ShopCategory; +import com.gxwebsoft.shop.param.ShopCategoryParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 商品分类控制器 + * + * @author 科技小王子 + * @since 2025-04-24 20:52:13 + */ +@Tag(name = "商品分类管理") +@RestController +@RequestMapping("/api/shop/shop-category") +public class ShopCategoryController extends BaseController { + @Resource + private ShopCategoryService shopCategoryService; + + @Operation(summary = "分页查询商品分类") + @GetMapping("/page") + public ApiResult> page(ShopCategoryParam param) { + // 使用关联查询 + return success(shopCategoryService.pageRel(param)); + } + + @Operation(summary = "查询全部商品分类") + @GetMapping() + public ApiResult> list(ShopCategoryParam param) { + // 使用关联查询 + return success(shopCategoryService.listRel(param)); + } + + @Operation(summary = "根据id查询商品分类") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopCategoryService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopCategory:save')") + @OperationLog + @Operation(summary = "添加商品分类") + @PostMapping() + public ApiResult save(@RequestBody ShopCategory shopCategory) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopCategory.setUserId(loginUser.getUserId()); + } + if (shopCategoryService.save(shopCategory)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCategory:update')") + @OperationLog + @Operation(summary = "修改商品分类") + @PutMapping() + public ApiResult update(@RequestBody ShopCategory shopCategory) { + if (shopCategoryService.updateById(shopCategory)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCategory:remove')") + @OperationLog + @Operation(summary = "删除商品分类") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopCategoryService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCategory:save')") + @OperationLog + @Operation(summary = "批量添加商品分类") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopCategoryService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCategory:update')") + @OperationLog + @Operation(summary = "批量修改商品分类") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopCategoryService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCategory:remove')") + @OperationLog + @Operation(summary = "批量删除商品分类") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopCategoryService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopChatConversationController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopChatConversationController.java new file mode 100644 index 0000000..7e84a9d --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopChatConversationController.java @@ -0,0 +1,113 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopChatConversationService; +import com.gxwebsoft.shop.entity.ShopChatConversation; +import com.gxwebsoft.shop.param.ShopChatConversationParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 聊天会话表控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "聊天会话表管理") +@RestController +@RequestMapping("/api/shop/shop-chat-conversation") +public class ShopChatConversationController extends BaseController { + @Resource + private ShopChatConversationService shopChatConversationService; + + @Operation(summary = "分页查询聊天会话表") + @GetMapping("/page") + public ApiResult> page(ShopChatConversationParam param) { + // 使用关联查询 + return success(shopChatConversationService.pageRel(param)); + } + + @Operation(summary = "查询全部聊天会话表") + @GetMapping() + public ApiResult> list(ShopChatConversationParam param) { + // 使用关联查询 + return success(shopChatConversationService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopChatConversation:list')") + @Operation(summary = "根据id查询聊天会话表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopChatConversationService.getByIdRel(id)); + } + + @Operation(summary = "添加聊天会话表") + @PostMapping() + public ApiResult save(@RequestBody ShopChatConversation shopChatConversation) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopChatConversation.setUserId(loginUser.getUserId()); + } + if (shopChatConversationService.save(shopChatConversation)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改聊天会话表") + @PutMapping() + public ApiResult update(@RequestBody ShopChatConversation shopChatConversation) { + if (shopChatConversationService.updateById(shopChatConversation)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除聊天会话表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopChatConversationService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加聊天会话表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopChatConversationService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改聊天会话表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopChatConversationService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除聊天会话表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopChatConversationService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopChatMessageController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopChatMessageController.java new file mode 100644 index 0000000..5e7109f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopChatMessageController.java @@ -0,0 +1,123 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopChatMessageService; +import com.gxwebsoft.shop.entity.ShopChatMessage; +import com.gxwebsoft.shop.param.ShopChatMessageParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 聊天消息表控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "聊天消息表管理") +@RestController +@RequestMapping("/api/shop/shop-chat-message") +public class ShopChatMessageController extends BaseController { + @Resource + private ShopChatMessageService shopChatMessageService; + + @PreAuthorize("hasAuthority('shop:shopChatMessage:list')") + @Operation(summary = "分页查询聊天消息表") + @GetMapping("/page") + public ApiResult> page(ShopChatMessageParam param) { + // 使用关联查询 + return success(shopChatMessageService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopChatMessage:list')") + @Operation(summary = "查询全部聊天消息表") + @GetMapping() + public ApiResult> list(ShopChatMessageParam param) { + // 使用关联查询 + return success(shopChatMessageService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopChatMessage:list')") + @Operation(summary = "根据id查询聊天消息表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopChatMessageService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopChatMessage:save')") + @Operation(summary = "添加聊天消息表") + @PostMapping() + public ApiResult save(@RequestBody ShopChatMessage shopChatMessage) { + // 获取当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopChatMessage.setFormUserId(loginUser.getUserId()); + } + if (shopChatMessageService.save(shopChatMessage)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopChatMessage:update')") + @Operation(summary = "修改聊天消息表") + @PutMapping() + public ApiResult update(@RequestBody ShopChatMessage shopChatMessage) { + if (shopChatMessageService.updateById(shopChatMessage)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopChatMessage:remove')") + @Operation(summary = "删除聊天消息表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopChatMessageService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopChatMessage:save')") + @Operation(summary = "批量添加聊天消息表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopChatMessageService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopChatMessage:update')") + @Operation(summary = "批量修改聊天消息表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopChatMessageService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopChatMessage:remove')") + @Operation(summary = "批量删除聊天消息表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopChatMessageService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopCommissionRoleController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopCommissionRoleController.java new file mode 100644 index 0000000..f6aa5ad --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopCommissionRoleController.java @@ -0,0 +1,121 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopCommissionRoleService; +import com.gxwebsoft.shop.entity.ShopCommissionRole; +import com.gxwebsoft.shop.param.ShopCommissionRoleParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 分红角色控制器 + * + * @author 科技小王子 + * @since 2025-05-01 10:01:15 + */ +@Tag(name = "分红角色管理") +@RestController +@RequestMapping("/api/shop/shop-commission-role") +public class ShopCommissionRoleController extends BaseController { + @Resource + private ShopCommissionRoleService shopCommissionRoleService; + + @Operation(summary = "分页查询分红角色") + @GetMapping("/page") + public ApiResult> page(ShopCommissionRoleParam param) { + // 使用关联查询 + return success(shopCommissionRoleService.pageRel(param)); + } + + @Operation(summary = "查询全部分红角色") + @GetMapping() + public ApiResult> list(ShopCommissionRoleParam param) { + // 使用关联查询 + return success(shopCommissionRoleService.listRel(param)); + } + + @Operation(summary = "根据id查询分红角色") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopCommissionRoleService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopCommissionRole:save')") + @OperationLog + @Operation(summary = "添加分红角色") + @PostMapping() + public ApiResult save(@RequestBody ShopCommissionRole shopCommissionRole) { + if (shopCommissionRoleService.save(shopCommissionRole)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCommissionRole:update')") + @OperationLog + @Operation(summary = "修改分红角色") + @PutMapping() + public ApiResult update(@RequestBody ShopCommissionRole shopCommissionRole) { + if (shopCommissionRoleService.updateById(shopCommissionRole)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCommissionRole:remove')") + @OperationLog + @Operation(summary = "删除分红角色") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopCommissionRoleService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCommissionRole:save')") + @OperationLog + @Operation(summary = "批量添加分红角色") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopCommissionRoleService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCommissionRole:update')") + @OperationLog + @Operation(summary = "批量修改分红角色") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopCommissionRoleService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCommissionRole:remove')") + @OperationLog + @Operation(summary = "批量删除分红角色") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopCommissionRoleService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopCommunityController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopCommunityController.java new file mode 100644 index 0000000..cdd3dbe --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopCommunityController.java @@ -0,0 +1,120 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopCommunityService; +import com.gxwebsoft.shop.entity.ShopCommunity; +import com.gxwebsoft.shop.param.ShopCommunityParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 小区控制器 + * + * @author 科技小王子 + * @since 2026-01-29 20:48:32 + */ +@Tag(name = "小区管理") +@RestController +@RequestMapping("/api/shop/shop-community") +public class ShopCommunityController extends BaseController { + @Resource + private ShopCommunityService shopCommunityService; + + @Operation(summary = "分页查询小区") + @GetMapping("/page") + public ApiResult> page(ShopCommunityParam param) { + // 使用关联查询 + return success(shopCommunityService.pageRel(param)); + } + + @Operation(summary = "查询全部小区") + @GetMapping() + public ApiResult> list(ShopCommunityParam param) { + // 使用关联查询 + return success(shopCommunityService.listRel(param)); + } + + @Operation(summary = "根据id查询小区") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopCommunityService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopCommunity:save')") + @OperationLog + @Operation(summary = "添加小区") + @PostMapping() + public ApiResult save(@RequestBody ShopCommunity shopCommunity) { + if (shopCommunityService.save(shopCommunity)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCommunity:update')") + @OperationLog + @Operation(summary = "修改小区") + @PutMapping() + public ApiResult update(@RequestBody ShopCommunity shopCommunity) { + if (shopCommunityService.updateById(shopCommunity)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCommunity:remove')") + @OperationLog + @Operation(summary = "删除小区") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopCommunityService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCommunity:save')") + @OperationLog + @Operation(summary = "批量添加小区") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopCommunityService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCommunity:update')") + @OperationLog + @Operation(summary = "批量修改小区") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopCommunityService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCommunity:remove')") + @OperationLog + @Operation(summary = "批量删除小区") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopCommunityService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopCountController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopCountController.java new file mode 100644 index 0000000..3664a24 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopCountController.java @@ -0,0 +1,110 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopCountService; +import com.gxwebsoft.shop.entity.ShopCount; +import com.gxwebsoft.shop.param.ShopCountParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 商城销售统计表控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "商城销售统计表管理") +@RestController +@RequestMapping("/api/shop/shop-count") +public class ShopCountController extends BaseController { + @Resource + private ShopCountService shopCountService; + + @Operation(summary = "分页查询商城销售统计表") + @GetMapping("/page") + public ApiResult> page(ShopCountParam param) { + // 使用关联查询 + return success(shopCountService.pageRel(param)); + } + + @Operation(summary = "查询全部商城销售统计表") + @GetMapping() + public ApiResult> list(ShopCountParam param) { + // 使用关联查询 + return success(shopCountService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopCount:list')") + @Operation(summary = "根据id查询商城销售统计表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopCountService.getByIdRel(id)); + } + + @Operation(summary = "添加商城销售统计表") + @PostMapping() + public ApiResult save(@RequestBody ShopCount shopCount) { + if (shopCountService.save(shopCount)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改商城销售统计表") + @PutMapping() + public ApiResult update(@RequestBody ShopCount shopCount) { + if (shopCountService.updateById(shopCount)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除商城销售统计表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopCountService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加商城销售统计表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopCountService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改商城销售统计表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopCountService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除商城销售统计表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopCountService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopCouponApplyCateController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopCouponApplyCateController.java new file mode 100644 index 0000000..ada1a79 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopCouponApplyCateController.java @@ -0,0 +1,124 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopCouponApplyCateService; +import com.gxwebsoft.shop.entity.ShopCouponApplyCate; +import com.gxwebsoft.shop.param.ShopCouponApplyCateParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 优惠券可用分类控制器 + * + * @author 科技小王子 + * @since 2025-08-11 12:47:49 + */ +@Tag(name = "优惠券可用分类管理") +@RestController +@RequestMapping("/api/shop/shop-coupon-apply-cate") +public class ShopCouponApplyCateController extends BaseController { + @Resource + private ShopCouponApplyCateService shopCouponApplyCateService; + + @PreAuthorize("hasAuthority('shop:shopCouponApplyCate:list')") + @Operation(summary = "分页查询优惠券可用分类") + @GetMapping("/page") + public ApiResult> page(ShopCouponApplyCateParam param) { + // 使用关联查询 + return success(shopCouponApplyCateService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopCouponApplyCate:list')") + @Operation(summary = "查询全部优惠券可用分类") + @GetMapping() + public ApiResult> list(ShopCouponApplyCateParam param) { + // 使用关联查询 + return success(shopCouponApplyCateService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopCouponApplyCate:list')") + @Operation(summary = "根据id查询优惠券可用分类") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopCouponApplyCateService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopCouponApplyCate:save')") + @OperationLog + @Operation(summary = "添加优惠券可用分类") + @PostMapping() + public ApiResult save(@RequestBody ShopCouponApplyCate shopCouponApplyCate) { + if (shopCouponApplyCateService.save(shopCouponApplyCate)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCouponApplyCate:update')") + @OperationLog + @Operation(summary = "修改优惠券可用分类") + @PutMapping() + public ApiResult update(@RequestBody ShopCouponApplyCate shopCouponApplyCate) { + if (shopCouponApplyCateService.updateById(shopCouponApplyCate)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCouponApplyCate:remove')") + @OperationLog + @Operation(summary = "删除优惠券可用分类") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopCouponApplyCateService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCouponApplyCate:save')") + @OperationLog + @Operation(summary = "批量添加优惠券可用分类") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopCouponApplyCateService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCouponApplyCate:update')") + @OperationLog + @Operation(summary = "批量修改优惠券可用分类") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopCouponApplyCateService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCouponApplyCate:remove')") + @OperationLog + @Operation(summary = "批量删除优惠券可用分类") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopCouponApplyCateService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopCouponApplyItemController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopCouponApplyItemController.java new file mode 100644 index 0000000..02091c9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopCouponApplyItemController.java @@ -0,0 +1,125 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopCouponApplyItemService; +import com.gxwebsoft.shop.entity.ShopCouponApplyItem; +import com.gxwebsoft.shop.param.ShopCouponApplyItemParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 优惠券可用分类控制器 + * + * @author 科技小王子 + * @since 2025-08-11 12:47:49 + */ +@Tag(name = "优惠券可用分类管理") +@RestController +@RequestMapping("/api/shop/shop-coupon-apply-item") +public class ShopCouponApplyItemController extends BaseController { + @Resource + private ShopCouponApplyItemService shopCouponApplyItemService; + + @PreAuthorize("hasAuthority('shop:shopCouponApplyItem:list')") + @Operation(summary = "分页查询优惠券可用分类") + @GetMapping("/page") + public ApiResult> page(ShopCouponApplyItemParam param) { + // 使用关联查询 + return success(shopCouponApplyItemService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopCouponApplyItem:list')") + @Operation(summary = "查询全部优惠券可用分类") + @GetMapping() + public ApiResult> list(ShopCouponApplyItemParam param) { + // 使用关联查询 + return success(shopCouponApplyItemService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopCouponApplyItem:list')") + @Operation(summary = "根据id查询优惠券可用分类") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopCouponApplyItemService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopCouponApplyItem:save')") + @OperationLog + @Operation(summary = "添加优惠券可用分类") + @PostMapping() + public ApiResult save(@RequestBody ShopCouponApplyItem shopCouponApplyItem) { + + if (shopCouponApplyItemService.save(shopCouponApplyItem)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCouponApplyItem:update')") + @OperationLog + @Operation(summary = "修改优惠券可用分类") + @PutMapping() + public ApiResult update(@RequestBody ShopCouponApplyItem shopCouponApplyItem) { + if (shopCouponApplyItemService.updateById(shopCouponApplyItem)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCouponApplyItem:remove')") + @OperationLog + @Operation(summary = "删除优惠券可用分类") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopCouponApplyItemService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCouponApplyItem:save')") + @OperationLog + @Operation(summary = "批量添加优惠券可用分类") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopCouponApplyItemService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCouponApplyItem:update')") + @OperationLog + @Operation(summary = "批量修改优惠券可用分类") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopCouponApplyItemService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCouponApplyItem:remove')") + @OperationLog + @Operation(summary = "批量删除优惠券可用分类") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopCouponApplyItemService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopCouponController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopCouponController.java new file mode 100644 index 0000000..1328aa9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopCouponController.java @@ -0,0 +1,217 @@ +package com.gxwebsoft.shop.controller; + +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson2.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.entity.ShopCouponApplyCate; +import com.gxwebsoft.shop.entity.ShopCouponApplyItem; +import com.gxwebsoft.shop.entity.ShopUserCoupon; +import com.gxwebsoft.shop.service.ShopCouponApplyCateService; +import com.gxwebsoft.shop.service.ShopCouponApplyItemService; +import com.gxwebsoft.shop.service.ShopCouponService; +import com.gxwebsoft.shop.entity.ShopCoupon; +import com.gxwebsoft.shop.param.ShopCouponParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.shop.service.ShopUserCouponService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +/** + * 优惠券控制器 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:24 + */ +@Tag(name = "优惠券管理") +@RestController +@RequestMapping("/api/shop/shop-coupon") +public class ShopCouponController extends BaseController { + @Resource + private ShopCouponService shopCouponService; + @Resource + private ShopUserCouponService userCouponService; + @Resource + private ShopCouponService couponService; + @Resource + private ShopCouponApplyItemService couponApplyItemService; + @Resource + private ShopCouponApplyCateService couponApplyCateService; + + @Operation(summary = "可领取优惠券列表") + @PostMapping("/list") + public ApiResult> page() { + Integer uid = getLoginUserId(); + // 用户已经领取的优惠券 + List userCouponList = userCouponService.userList(uid); + List hasTakeCouponIdList = new ArrayList<>(); + for (ShopUserCoupon userCoupon : userCouponList) { + hasTakeCouponIdList.add(userCoupon.getCouponId()); + } + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); +// if (!hasTakeCouponIdList.isEmpty()) queryWrapper.notIn(Coupon::getCouponId, hasTakeCouponIdList); + queryWrapper.eq(ShopCoupon::getStatus, 0); + queryWrapper.apply("(expire_type = 0 OR (expire_type = 1 AND end_time > '" + + DateUtil.date() + "'))"); + queryWrapper.orderByAsc(ShopCoupon::getSortNumber); + List couponList = couponService.list(queryWrapper); + for (ShopCoupon coupon : couponList) { + coupon.setCouponApplyItemList(couponApplyItemService.list( + new LambdaQueryWrapper().eq(ShopCouponApplyItem::getCouponId, coupon.getId()) + )); + coupon.setCouponApplyCateList(couponApplyCateService.list( + new LambdaQueryWrapper().eq(ShopCouponApplyCate::getCouponId, coupon.getId()) + )); + boolean hasTake = hasTakeCouponIdList.contains(coupon.getId()); + coupon.setHasTake(hasTake); + if (hasTake) { + int userUseNum = 0; + List userCouponList1 = userCouponService.list( + new LambdaQueryWrapper() + .eq(ShopUserCoupon::getCouponId, coupon.getId()) + ); + coupon.setUserTakeNum(userCouponList1.size()); + for (ShopUserCoupon userCoupon : userCouponList1) { + if (userCoupon.getIsUse().equals(1)) userUseNum++; + } + coupon.setUserUseNum(userUseNum); + } + } + return success(couponList); + } + + + @Operation(summary = "分页查询优惠券") + @GetMapping("/page") + public ApiResult> page(ShopCouponParam param) { + // 使用关联查询 + return success(shopCouponService.pageRel(param)); + } + + @Operation(summary = "查询全部优惠券") + @GetMapping() + public ApiResult> list(ShopCouponParam param) { + // 使用关联查询 + return success(shopCouponService.listRel(param)); + } + + @Operation(summary = "根据id查询优惠券") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopCouponService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopCoupon:save')") + @OperationLog + @Operation(summary = "添加优惠券") + @PostMapping() + public ApiResult save(@RequestBody ShopCoupon shopCoupon) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopCoupon.setUserId(loginUser.getUserId()); + } + if (shopCouponService.save(shopCoupon)) { + if (shopCoupon.getCouponApplyCateList() != null && !shopCoupon.getCouponApplyCateList().isEmpty()) { + for (ShopCouponApplyCate couponApplyCate : shopCoupon.getCouponApplyCateList()) { + couponApplyCate.setCouponId(shopCoupon.getId()); + } + couponApplyCateService.saveBatch(shopCoupon.getCouponApplyCateList()); + } + + if (shopCoupon.getCouponApplyItemList() != null && !shopCoupon.getCouponApplyItemList().isEmpty()) { + for (ShopCouponApplyItem couponApplyItem : shopCoupon.getCouponApplyItemList()) { + couponApplyItem.setCouponId(shopCoupon.getId()); + } + couponApplyItemService.saveBatch(shopCoupon.getCouponApplyItemList()); + } + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCoupon:update')") + @OperationLog + @Operation(summary = "修改优惠券") + @PutMapping() + public ApiResult update(@RequestBody ShopCoupon shopCoupon) { + if (shopCouponService.updateById(shopCoupon)) { + couponApplyCateService.removeByCouponId(shopCoupon.getId()); + if (shopCoupon.getCouponApplyCateList() != null && !shopCoupon.getCouponApplyCateList().isEmpty()) { + for (ShopCouponApplyCate couponApplyCate : shopCoupon.getCouponApplyCateList()) { + couponApplyCate.setCouponId(shopCoupon.getId()); + } + couponApplyCateService.saveBatch(shopCoupon.getCouponApplyCateList()); + } + + couponApplyItemService.removeByCouponId(shopCoupon.getId()); + if (shopCoupon.getCouponApplyItemList() != null && !shopCoupon.getCouponApplyItemList().isEmpty()) { + for (ShopCouponApplyItem couponApplyItem : shopCoupon.getCouponApplyItemList()) { + couponApplyItem.setCouponId(shopCoupon.getId()); + } + couponApplyItemService.saveBatch(shopCoupon.getCouponApplyItemList()); + } + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCoupon:remove')") + @OperationLog + @Operation(summary = "删除优惠券") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopCouponService.removeById(id)) { + couponApplyCateService.removeByCouponId(id); + couponApplyItemService.removeByCouponId(id); + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCoupon:save')") + @OperationLog + @Operation(summary = "批量添加优惠券") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopCouponService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCoupon:update')") + @OperationLog + @Operation(summary = "批量修改优惠券") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopCouponService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopCoupon:remove')") + @OperationLog + @Operation(summary = "批量删除优惠券") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopCouponService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopDealerApplyController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerApplyController.java new file mode 100644 index 0000000..1148f57 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerApplyController.java @@ -0,0 +1,357 @@ +package com.gxwebsoft.shop.controller; + +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.afterturn.easypoi.excel.entity.ExportParams; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.entity.ShopDealerUser; +import com.gxwebsoft.shop.service.ShopDealerApplyService; +import com.gxwebsoft.shop.entity.ShopDealerApply; +import com.gxwebsoft.shop.param.ShopDealerApplyParam; +import com.gxwebsoft.shop.param.ShopDealerApplyImportParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.shop.service.ShopDealerUserService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.List; + +/** + * 分销商申请记录表控制器 + * + * @author 科技小王子 + * @since 2025-08-11 23:50:19 + */ +@Tag(name = "分销商申请记录表管理") +@RestController +@RequestMapping("/api/shop/shop-dealer-apply") +public class ShopDealerApplyController extends BaseController { + @Resource + private ShopDealerApplyService shopDealerApplyService; + @Resource + private ShopDealerUserService shopDealerUserService; + + @PreAuthorize("hasAuthority('shop:shopDealerApply:list')") + @Operation(summary = "分页查询分销商申请记录表") + @GetMapping("/page") + public ApiResult> page(ShopDealerApplyParam param) { + // 使用关联查询 + return success(shopDealerApplyService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerApply:list')") + @Operation(summary = "查询全部分销商申请记录表") + @GetMapping() + public ApiResult> list(ShopDealerApplyParam param) { + // 使用关联查询 + return success(shopDealerApplyService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerApply:list')") + @Operation(summary = "根据id查询分销商申请记录表") + @GetMapping("/{id}") + public ApiResult getById(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopDealerApplyService.getById(id)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerApply:list')") + @Operation(summary = "根据userId查询分销商申请记录表") + @GetMapping("/getByUserId/{id}") + public ApiResult getByUserId(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopDealerApplyService.getByUserIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerApply:save')") + @OperationLog + @Operation(summary = "添加分销商申请记录表") + @PostMapping() + public ApiResult save(@RequestBody ShopDealerApply shopDealerApply) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopDealerApply.setApplyTime(LocalDateTime.now()); + if(shopDealerApply.getUserId() == null) { + shopDealerApply.setUserId(loginUser.getUserId()); + } + } + if (shopDealerApply.getRefereeId() != null) { + if(shopDealerUserService.getByIdRel(shopDealerApply.getRefereeId()) == null){ + return fail("推荐人不存在"); + } + } + + if (shopDealerApplyService.save(shopDealerApply)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerApply:update')") + @OperationLog + @Operation(summary = "修改分销商申请记录表") + @PutMapping() + public ApiResult update(@RequestBody ShopDealerApply shopDealerApply) { + shopDealerApply.setAuditTime(null); + if(shopDealerApply.getRate() != null){ + final ShopDealerUser dealerUser = new ShopDealerUser(); + dealerUser.setRate(shopDealerApply.getRate()); + shopDealerUserService.update(dealerUser, new LambdaQueryWrapper().eq(ShopDealerUser::getUserId, shopDealerApply.getUserId())); + } + if (shopDealerApplyService.updateById(shopDealerApply)) { + if (shopDealerApply.getApplyStatus().equals(20)) { + LocalDateTime now = LocalDateTime.now(); + shopDealerApply.setAuditTime(now); + shopDealerApplyService.updateById(shopDealerApply); + // 同步添加经销商 + if (shopDealerUserService.count(new LambdaQueryWrapper().eq(ShopDealerUser::getUserId, shopDealerApply.getUserId())) == 0) { + final ShopDealerUser dealerUser = new ShopDealerUser(); + dealerUser.setUserId(shopDealerApply.getUserId()); + dealerUser.setRealName(shopDealerApply.getRealName()); + dealerUser.setMobile(shopDealerApply.getMobile()); + dealerUser.setRefereeId(shopDealerApply.getRefereeId()); + shopDealerUserService.save(dealerUser); + } + } + return success("保存成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerApply:remove')") + @OperationLog + @Operation(summary = "删除分销商申请记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopDealerApplyService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerApply:save')") + @OperationLog + @Operation(summary = "批量添加分销商申请记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopDealerApplyService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerApply:update')") + @OperationLog + @Operation(summary = "批量修改分销商申请记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopDealerApplyService, "apply_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerApply:remove')") + @OperationLog + @Operation(summary = "批量删除分销商申请记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopDealerApplyService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * excel批量导入分销商申请记录 + * Excel表头格式:类型、用户ID、姓名、分销商名称、分销商编码、手机号、合同金额、详细地址、社区、楼栋号、单元号、房号、推荐人用户ID、申请方式、审核状态、合同时间、驳回原因、商城ID + */ + @PreAuthorize("hasAuthority('shop:shopDealerApply:save')") + @Transactional(rollbackFor = {Exception.class}) + @Operation(summary = "批量导入分销商申请记录") + @PostMapping("/import") + public ApiResult> importBatch(MultipartFile file) { + ImportParams importParams = new ImportParams(); + // 设置标题行,跳过第一行表头 + importParams.setTitleRows(1); + importParams.setHeadRows(1); + List errorMessages = new ArrayList<>(); + int successCount = 0; + + try { + List list = ExcelImportUtil.importExcel(file.getInputStream(), ShopDealerApplyImportParam.class, importParams); + + // 获取当前登录用户 + User loginUser = getLoginUser(); + Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; + + for (int i = 0; i < list.size(); i++) { + ShopDealerApplyImportParam param = list.get(i); + try { + // 手动转换对象,避免JSON序列化问题 + ShopDealerApply item = convertImportParamToEntity(param); + + // 设置必填字段的默认值 + if (item.getUserId() == null && currentUserId != null) { + item.setUserId(currentUserId); + } + if (item.getApplyStatus() == null) { + item.setApplyStatus(10); // 默认状态为待审核 + } + if (item.getApplyType() == null) { + item.setApplyType(10); // 默认需要后台审核 + } + if (item.getType() == null) { + item.setType(0); // 默认类型为经销商 + } + + // 设置申请时间 + item.setApplyTime(LocalDateTime.now()); + + // 验证必填字段 + if (item.getRealName() == null || item.getRealName().trim().isEmpty()) { + errorMessages.add("第" + (i + 1) + "行:姓名不能为空"); + continue; + } + if (item.getDealerName() == null || item.getDealerName().trim().isEmpty()) { + errorMessages.add("第" + (i + 1) + "行:企业名称不能为空"); + continue; + } + if (item.getMobile() == null || item.getMobile().trim().isEmpty()) { + errorMessages.add("第" + (i + 1) + "行:手机号不能为空"); + continue; + } + + // 验证推荐人是否存在 + if (item.getRefereeId() != null) { + if (shopDealerUserService.getByIdRel(item.getRefereeId()) == null) { + errorMessages.add("第" + (i + 1) + "行:推荐人不存在"); + continue; + } + } + + // 保存数据 + if (shopDealerApplyService.save(item)) { + successCount++; + } else { + errorMessages.add("第" + (i + 1) + "行:保存失败"); + } + + } catch (Exception e) { + errorMessages.add("第" + (i + 1) + "行:" + e.getMessage()); + System.err.println("导入第" + (i + 1) + "行数据失败: " + e.getMessage()); + e.printStackTrace(); + } + } + + // 返回结果 + if (errorMessages.isEmpty()) { + return success("成功导入" + successCount + "条数据", null); + } else { + return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); + } + + } catch (Exception e) { + System.err.println("批量导入分销商申请记录失败: " + e.getMessage()); + e.printStackTrace(); + return fail("导入失败:" + e.getMessage(), null); + } + } + + /** + * 下载分销商申请记录导入模板 + */ + @Operation(summary = "下载分销商申请记录导入模板") + @GetMapping("/import/template") + public void downloadTemplate(HttpServletResponse response) throws IOException { + // 创建空的导入参数列表作为模板 + List templateList = new ArrayList<>(); + + // 添加一行示例数据 + ShopDealerApplyImportParam example = new ShopDealerApplyImportParam(); + example.setType(0); + example.setRealName("宗馥莉"); + example.setDealerName("娃哈哈有限公司"); + example.setDealerCode("WaHaHa"); + example.setMobile("13800138000"); + example.setApplyType(10); + example.setApplyStatus(10); + example.setContractTime("2025-09-05 10:00:00"); + example.setCommunity("xx社区"); + example.setBuildingNumber("1"); + example.setUnitNumber("2"); + example.setRoomNumber("302"); + templateList.add(example); + + // 设置导出参数 + ExportParams exportParams = new ExportParams("分销商申请记录导入模板", "分销商申请记录"); + + // 生成Excel + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, ShopDealerApplyImportParam.class, templateList); + + // 设置响应头 + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename=shop_dealer_apply_import_template.xlsx"); + + // 输出到响应流 + workbook.write(response.getOutputStream()); + workbook.close(); + } + + /** + * 将ShopDealerApplyImportParam转换为ShopDealerApply实体 + */ + private ShopDealerApply convertImportParamToEntity(ShopDealerApplyImportParam param) { + ShopDealerApply entity = new ShopDealerApply(); + + // 基本字段转换 + entity.setType(param.getType()); + entity.setUserId(param.getUserId()); + entity.setRealName(param.getRealName()); + entity.setDealerName(param.getDealerName()); + entity.setDealerCode(param.getDealerCode()); + entity.setMobile(param.getMobile()); + entity.setMoney(param.getMoney()); + entity.setAddress(param.getAddress()); + entity.setCommunity(param.getCommunity()); + entity.setBuildingNumber(param.getBuildingNumber()); + entity.setUnitNumber(param.getUnitNumber()); + entity.setRoomNumber(param.getRoomNumber()); + entity.setRefereeId(param.getRefereeId()); + entity.setApplyType(param.getApplyType()); + entity.setApplyStatus(param.getApplyStatus()); + entity.setRejectReason(param.getRejectReason()); + entity.setTenantId(param.getTenantId()); + + // 处理合同时间 + if (param.getContractTime() != null && !param.getContractTime().trim().isEmpty()) { + try { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + entity.setContractTime(LocalDateTime.parse(param.getContractTime(), formatter)); + } catch (Exception e) { + System.err.println("合同时间格式错误: " + param.getContractTime()); + } + } + + return entity; + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopDealerBankController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerBankController.java new file mode 100644 index 0000000..a05c0c4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerBankController.java @@ -0,0 +1,138 @@ + package com.gxwebsoft.shop.controller; + + import com.gxwebsoft.common.core.annotation.OperationLog; + import com.gxwebsoft.common.core.web.ApiResult; + import com.gxwebsoft.common.core.web.BaseController; + import com.gxwebsoft.common.core.web.BatchParam; + import com.gxwebsoft.common.core.web.PageResult; + import com.gxwebsoft.common.system.entity.User; + import com.gxwebsoft.shop.entity.ShopDealerBank; + import com.gxwebsoft.shop.param.ShopDealerBankParam; + import com.gxwebsoft.shop.service.ShopDealerBankService; + import io.swagger.v3.oas.annotations.Operation; + import io.swagger.v3.oas.annotations.tags.Tag; + import org.springframework.security.access.prepost.PreAuthorize; + import org.springframework.web.bind.annotation.*; + + import javax.annotation.Resource; + import java.util.List; + + /** + * 分销商提现银行卡控制器 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ + @Tag(name = "分销商提现银行卡管理") + @RestController + @RequestMapping("/api/shop/shop-dealer-bank") + public class ShopDealerBankController extends BaseController { + @Resource + private ShopDealerBankService shopDealerBankService; + + @Operation(summary = "分页查询分销商提现银行卡") + @GetMapping("/page") + public ApiResult> page(ShopDealerBankParam param) { + final User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("请先登录", null); + } + param.setUserId(loginUser.getUserId()); + return success(shopDealerBankService.pageRel(param)); + } + + @Operation(summary = "查询全部分销商提现银行卡") + @GetMapping() + public ApiResult> list(ShopDealerBankParam param) { + final User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("请先登录", null); + } + param.setUserId(loginUser.getUserId()); + return success(shopDealerBankService.listRel(param)); + } + + @Operation(summary = "根据id查询分销商提现银行卡") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopDealerBankService.getByIdRel(id)); + } + + @OperationLog + @Operation(summary = "添加分销商提现银行卡") + @PostMapping() + public ApiResult save(@RequestBody ShopDealerBank shopDealerBank) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopDealerBank.setUserId(loginUser.getUserId()); + } + if (shopDealerBankService.save(shopDealerBank)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @OperationLog + @Operation(summary = "修改分销商提现银行卡") + @PutMapping() + public ApiResult update(@RequestBody ShopDealerBank shopDealerBank) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopDealerBank.setUserId(loginUser.getUserId()); + if (shopDealerBankService.updateById(shopDealerBank)) { + return success("修改成功"); + } + } + return fail("修改失败"); + } + + @Operation(summary = "删除分销商提现银行卡") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + final User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("请先登录", null); + } + if (shopDealerBankService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerBank:save')") + @OperationLog + @Operation(summary = "批量添加分销商提现银行卡") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopDealerBankService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerBank:update')") + @OperationLog + @Operation(summary = "批量修改分销商提现银行卡") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopDealerBankService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerBank:remove')") + @OperationLog + @Operation(summary = "批量删除分销商提现银行卡") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopDealerBankService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + } diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopDealerCapitalController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerCapitalController.java new file mode 100644 index 0000000..d7ccaf1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerCapitalController.java @@ -0,0 +1,129 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopDealerCapitalService; +import com.gxwebsoft.shop.entity.ShopDealerCapital; +import com.gxwebsoft.shop.param.ShopDealerCapitalParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 分销商资金明细表控制器 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Tag(name = "分销商资金明细表管理") +@RestController +@RequestMapping("/api/shop/shop-dealer-capital") +public class ShopDealerCapitalController extends BaseController { + @Resource + private ShopDealerCapitalService shopDealerCapitalService; + + @PreAuthorize("hasAuthority('shop:shopDealerCapital:list')") + @Operation(summary = "分页查询分销商资金明细表") + @GetMapping("/page") + public ApiResult> page(ShopDealerCapitalParam param) { + // 使用关联查询 + return success(shopDealerCapitalService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerCapital:list')") + @Operation(summary = "查询全部分销商资金明细表") + @GetMapping() + public ApiResult> list(ShopDealerCapitalParam param) { + // 使用关联查询 + return success(shopDealerCapitalService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerCapital:list')") + @Operation(summary = "根据id查询分销商资金明细表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopDealerCapitalService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerCapital:save')") + @OperationLog + @Operation(summary = "添加分销商资金明细表") + @PostMapping() + public ApiResult save(@RequestBody ShopDealerCapital shopDealerCapital) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopDealerCapital.setUserId(loginUser.getUserId()); + } + if (shopDealerCapitalService.save(shopDealerCapital)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerCapital:update')") + @OperationLog + @Operation(summary = "修改分销商资金明细表") + @PutMapping() + public ApiResult update(@RequestBody ShopDealerCapital shopDealerCapital) { + if (shopDealerCapitalService.updateById(shopDealerCapital)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerCapital:remove')") + @OperationLog + @Operation(summary = "删除分销商资金明细表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopDealerCapitalService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerCapital:save')") + @OperationLog + @Operation(summary = "批量添加分销商资金明细表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopDealerCapitalService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerCapital:update')") + @OperationLog + @Operation(summary = "批量修改分销商资金明细表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopDealerCapitalService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerCapital:remove')") + @OperationLog + @Operation(summary = "批量删除分销商资金明细表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopDealerCapitalService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopDealerOrderController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerOrderController.java new file mode 100644 index 0000000..2ecc05e --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerOrderController.java @@ -0,0 +1,171 @@ +package com.gxwebsoft.shop.controller; + +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopDealerOrderService; +import com.gxwebsoft.shop.entity.ShopDealerOrder; +import com.gxwebsoft.shop.param.ShopDealerOrderParam; +import com.gxwebsoft.shop.param.ShopDealerOrderImportParam; +import com.gxwebsoft.common.core.utils.JSONUtil; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 分销商订单记录表控制器 + * + * @author 科技小王子 + * @since 2025-08-12 11:55:18 + */ +@Tag(name = "分销商订单记录表管理") +@RestController +@RequestMapping("/api/shop/shop-dealer-order") +public class ShopDealerOrderController extends BaseController { + @Resource + private ShopDealerOrderService shopDealerOrderService; + + @PreAuthorize("hasAuthority('shop:shopDealerOrder:list')") + @Operation(summary = "分页查询分销商订单记录表") + @GetMapping("/page") + public ApiResult> page(ShopDealerOrderParam param) { + // 使用关联查询 + return success(shopDealerOrderService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerOrder:list')") + @Operation(summary = "查询全部分销商订单记录表") + @GetMapping() + public ApiResult> list(ShopDealerOrderParam param) { + // 使用关联查询 + return success(shopDealerOrderService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerOrder:list')") + @Operation(summary = "根据id查询分销商订单记录表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopDealerOrderService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerOrder:save')") + @OperationLog + @Operation(summary = "添加分销商订单记录表") + @PostMapping() + public ApiResult save(@RequestBody ShopDealerOrder shopDealerOrder) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopDealerOrder.setUserId(loginUser.getUserId()); + } + if (shopDealerOrderService.save(shopDealerOrder)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerOrder:update')") + @OperationLog + @Operation(summary = "修改分销商订单记录表") + @PutMapping() + public ApiResult update(@RequestBody ShopDealerOrder shopDealerOrder) { + if (shopDealerOrderService.updateById(shopDealerOrder)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerOrder:remove')") + @OperationLog + @Operation(summary = "删除分销商订单记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopDealerOrderService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerOrder:save')") + @OperationLog + @Operation(summary = "批量添加分销商订单记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopDealerOrderService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerOrder:update')") + @OperationLog + @Operation(summary = "批量修改分销商订单记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopDealerOrderService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerOrder:remove')") + @OperationLog + @Operation(summary = "批量删除分销商订单记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopDealerOrderService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + /** + * excel批量导入分销商订单记录表 + */ + @PreAuthorize("hasAuthority('shop:shopDealerOrder:save')") + @OperationLog + @Operation(summary = "批量导入分销商订单记录表") + @Transactional(rollbackFor = {Exception.class}) + @PostMapping("/import") + public ApiResult> importBatch(MultipartFile file) { + ImportParams importParams = new ImportParams(); + try { + + // 第三步:导入XLS文件的内容 + List list = ExcelImportUtil.importExcel(file.getInputStream(), ShopDealerOrderImportParam.class, importParams); + list.forEach(d -> { + ShopDealerOrder item = JSONUtil.parseObject(JSONUtil.toJSONString(d), ShopDealerOrder.class); + assert item != null; + if (ObjectUtil.isNotEmpty(item)) { + // 设置默认值 + if (item.getIsInvalid() == null) { + item.setIsInvalid(0); // 新导入的数据isInvalid设为0(未失效) + } + if (item.getIsSettled() == null) { + item.setIsSettled(0); // 新导入的数据isSettled设为0(未结算) + } + shopDealerOrderService.save(item); + } + }); + return success("成功导入" + list.size() + "条", null); + } catch (Exception e) { + e.printStackTrace(); + } + return fail("导入失败", null); + } +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopDealerRecordController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerRecordController.java new file mode 100644 index 0000000..44b2c22 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerRecordController.java @@ -0,0 +1,125 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.shop.entity.ShopDealerRecord; +import com.gxwebsoft.shop.param.ShopDealerRecordParam; +import com.gxwebsoft.shop.service.ShopDealerRecordService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 客户跟进情况控制器 + * + * @author 科技小王子 + * @since 2025-10-02 12:21:50 + */ +@Tag(name = "客户跟进情况管理") +@RestController +@RequestMapping("/api/shop/shop-dealer-record") +public class ShopDealerRecordController extends BaseController { + @Resource + private ShopDealerRecordService shopDealerRecordService; + + @Operation(summary = "分页查询客户跟进情况") + @GetMapping("/page") + public ApiResult> page(ShopDealerRecordParam param) { + // 使用关联查询 + return success(shopDealerRecordService.pageRel(param)); + } + + @Operation(summary = "查询全部客户跟进情况") + @GetMapping() + public ApiResult> list(ShopDealerRecordParam param) { + // 使用关联查询 + return success(shopDealerRecordService.listRel(param)); + } + + @Operation(summary = "根据id查询客户跟进情况") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopDealerRecordService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerApply:save')") + @OperationLog + @Operation(summary = "添加客户跟进情况") + @PostMapping() + public ApiResult save(@RequestBody ShopDealerRecord shopDealerRecord) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopDealerRecord.setUserId(loginUser.getUserId()); + } + if (shopDealerRecordService.save(shopDealerRecord)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerApply:update')") + @OperationLog + @Operation(summary = "修改客户跟进情况") + @PutMapping() + public ApiResult update(@RequestBody ShopDealerRecord shopDealerRecord) { + if (shopDealerRecordService.updateById(shopDealerRecord)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerApply:remove')") + @OperationLog + @Operation(summary = "删除客户跟进情况") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopDealerRecordService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerApply:save')") + @OperationLog + @Operation(summary = "批量添加客户跟进情况") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopDealerRecordService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerApply:update')") + @OperationLog + @Operation(summary = "批量修改客户跟进情况") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopDealerRecordService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerApply:remove')") + @OperationLog + @Operation(summary = "批量删除客户跟进情况") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopDealerRecordService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopDealerRefereeController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerRefereeController.java new file mode 100644 index 0000000..60a363f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerRefereeController.java @@ -0,0 +1,151 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.Constants; +import com.gxwebsoft.common.core.exception.BusinessException; +import com.gxwebsoft.shop.service.ShopDealerRefereeService; +import com.gxwebsoft.shop.entity.ShopDealerReferee; +import com.gxwebsoft.shop.param.ShopDealerRefereeParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 分销商推荐关系表控制器 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Tag(name = "分销商推荐关系表管理") +@RestController +@RequestMapping("/api/shop/shop-dealer-referee") +public class ShopDealerRefereeController extends BaseController { + @Resource + private ShopDealerRefereeService shopDealerRefereeService; + + @PreAuthorize("hasAuthority('shop:shopDealerReferee:list')") + @Operation(summary = "分页查询分销商推荐关系表") + @GetMapping("/page") + public ApiResult> page(ShopDealerRefereeParam param) { + // 使用关联查询 + return success(shopDealerRefereeService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerReferee:list')") + @Operation(summary = "查询全部分销商推荐关系表") + @GetMapping() + public ApiResult> list(ShopDealerRefereeParam param) { + // 使用关联查询 + return success(shopDealerRefereeService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerReferee:list')") + @Operation(summary = "根据id查询分销商推荐关系表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopDealerRefereeService.getByIdRel(id)); + } + + @Operation(summary = "根据userId查询推荐人信息") + @GetMapping("/getByUserId/{userId}") + public ApiResult getByUserId(@PathVariable("userId") Integer userId) { + // 使用关联查询 + return success(shopDealerRefereeService.getByUserIdRel(userId)); + } + + @OperationLog + @Operation(summary = "绑定分销商推荐关系(一级,幂等)") + @PostMapping() + public ApiResult save(@RequestBody ShopDealerReferee shopDealerReferee) { + User loginUser = getLoginUser(); + if (loginUser == null) { + throw new BusinessException(Constants.UNAUTHENTICATED_CODE, Constants.UNAUTHENTICATED_MSG); + } + + // 安全:仅信任token中的userId;若body.userId存在且不一致则拒绝 + if (shopDealerReferee.getUserId() != null && !shopDealerReferee.getUserId().equals(loginUser.getUserId())) { + throw new BusinessException("非法userId参数"); + } + + Integer tenantId = getTenantId(); + if (tenantId == null) { + throw new BusinessException("TenantId不能为空"); + } + + boolean created = shopDealerRefereeService.bindFirstLevel( + shopDealerReferee.getDealerId(), + loginUser.getUserId(), + tenantId, + shopDealerReferee.getSource(), + shopDealerReferee.getScene() + ); + return success(created ? "绑定成功" : "已绑定"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerReferee:update')") + @OperationLog + @Operation(summary = "修改分销商推荐关系表") + @PutMapping() + public ApiResult update(@RequestBody ShopDealerReferee shopDealerReferee) { + if (shopDealerRefereeService.updateById(shopDealerReferee)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerReferee:remove')") + @OperationLog + @Operation(summary = "删除分销商推荐关系表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopDealerRefereeService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerReferee:save')") + @OperationLog + @Operation(summary = "批量添加分销商推荐关系表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopDealerRefereeService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerReferee:update')") + @OperationLog + @Operation(summary = "批量修改分销商推荐关系表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopDealerRefereeService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerReferee:remove')") + @OperationLog + @Operation(summary = "批量删除分销商推荐关系表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopDealerRefereeService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopDealerSettingController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerSettingController.java new file mode 100644 index 0000000..c8891d1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerSettingController.java @@ -0,0 +1,155 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopDealerSettingService; +import com.gxwebsoft.shop.entity.ShopDealerSetting; +import com.gxwebsoft.shop.param.ShopDealerSettingParam; +import com.gxwebsoft.shop.param.ShopDealerSettingSaveParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 分销商设置表控制器 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Tag(name = "分销商设置表管理") +@RestController +@RequestMapping("/api/shop/shop-dealer-setting") +public class ShopDealerSettingController extends BaseController { + @Resource + private ShopDealerSettingService shopDealerSettingService; + + @PreAuthorize("hasAuthority('shop:shopDealerSetting:list')") + @Operation(summary = "分页查询分销商设置表") + @GetMapping("/page") + public ApiResult> page(ShopDealerSettingParam param) { + // 使用关联查询 + return success(shopDealerSettingService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerSetting:list')") + @Operation(summary = "查询全部分销商设置表") + @GetMapping() + public ApiResult> list(ShopDealerSettingParam param) { + // 使用关联查询 + return success(shopDealerSettingService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerSetting:list')") + @Operation(summary = "根据id查询分销商设置表") + @GetMapping("/{key}") + public ApiResult get(@PathVariable("key") String key) { + // 使用关联查询 + return success(shopDealerSettingService.getByIdRel(key)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerSetting:save')") + @OperationLog + @Operation(summary = "添加分销商设置表") + @PostMapping() + public ApiResult save(@RequestBody ShopDealerSettingSaveParam param) { + ShopDealerSetting shopDealerSetting = buildEntity(param); + if (shopDealerSettingService.saveOrUpdateByKey(shopDealerSetting)) { + return success("保存成功"); + } + return fail("保存失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerSetting:update')") + @OperationLog + @Operation(summary = "修改分销商设置表") + @PutMapping() + public ApiResult update(@RequestBody ShopDealerSettingSaveParam param) { + ShopDealerSetting shopDealerSetting = buildEntity(param); + if (shopDealerSetting.getKey() == null) { + return fail("修改失败"); + } + if (shopDealerSettingService.saveOrUpdateByKey(shopDealerSetting)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + private ShopDealerSetting buildEntity(ShopDealerSettingSaveParam param) { + ShopDealerSetting shopDealerSetting = new ShopDealerSetting(); + shopDealerSetting.setKey(param.getKey()); + shopDealerSetting.setDescribe(param.getDescribe()); + shopDealerSetting.setValues(param.getValues()); + Integer tenantId = param.getTenantId(); + if (tenantId == null) { + tenantId = getTenantId(); + } + shopDealerSetting.setTenantId(tenantId); + shopDealerSetting.setUpdateTime(normalizeUpdateTime(param.getUpdateTime())); + return shopDealerSetting; + } + + private Integer normalizeUpdateTime(Long updateTime) { + long value = updateTime != null ? updateTime : System.currentTimeMillis(); + if (value > Integer.MAX_VALUE) { + value = value / 1000; + } + if (value > Integer.MAX_VALUE) { + return Integer.MAX_VALUE; + } + return (int) value; + } + + @PreAuthorize("hasAuthority('shop:shopDealerSetting:remove')") + @OperationLog + @Operation(summary = "删除分销商设置表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopDealerSettingService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerSetting:save')") + @OperationLog + @Operation(summary = "批量添加分销商设置表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopDealerSettingService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerSetting:update')") + @OperationLog + @Operation(summary = "批量修改分销商设置表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopDealerSettingService, "key")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerSetting:remove')") + @OperationLog + @Operation(summary = "批量删除分销商设置表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopDealerSettingService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopDealerUserController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerUserController.java new file mode 100644 index 0000000..9d5d469 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerUserController.java @@ -0,0 +1,181 @@ +package com.gxwebsoft.shop.controller; + +import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.utils.JSONUtil; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopDealerUserService; +import com.gxwebsoft.shop.entity.ShopDealerUser; +import com.gxwebsoft.shop.param.ShopDealerUserParam; +import com.gxwebsoft.shop.param.ShopDealerUserImportParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 分销商用户记录表控制器 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Tag(name = "分销商用户记录表管理") +@RestController +@RequestMapping("/api/shop/shop-dealer-user") +public class ShopDealerUserController extends BaseController { + @Resource + private ShopDealerUserService shopDealerUserService; + + @Operation(summary = "分页查询分销商用户记录表") + @GetMapping("/page") + public ApiResult> page(ShopDealerUserParam param) { + // 使用关联查询 + return success(shopDealerUserService.pageRel(param)); + } + + @Operation(summary = "查询全部分销商用户记录表") + @GetMapping() + public ApiResult> list(ShopDealerUserParam param) { + // 使用关联查询 + return success(shopDealerUserService.listRel(param)); + } + + @Operation(summary = "根据userId查询分销商用户") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopDealerUserService.getByIdRel(id)); + } + + @Operation(summary = "添加分销商用户记录表") + @PostMapping() + public ApiResult save(@RequestBody ShopDealerUser shopDealerUser) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopDealerUser.setUserId(loginUser.getUserId()); + } + // 排重 + if (shopDealerUserService.count(new LambdaQueryWrapper().eq(ShopDealerUser::getMobile, shopDealerUser.getMobile())) > 0) { + return fail("添加失败,手机号码已存在!"); + } + if (shopDealerUserService.save(shopDealerUser)) { + return success("添加成功", shopDealerUser); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerUser:update')") + @Operation(summary = "修改分销商用户记录表") + @PutMapping() + public ApiResult update(@RequestBody ShopDealerUser shopDealerUser) { + if (shopDealerUserService.updateById(shopDealerUser)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('sys:user:update')") + @Operation(summary = "修改分销商用户记录表") + @PutMapping("/updateByUserId") + public ApiResult updateByUserId(@RequestBody ShopDealerUser shopDealerUser) { + if (shopDealerUserService.updateByUserId(shopDealerUser)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerUser:remove')") + @OperationLog + @Operation(summary = "删除分销商用户记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopDealerUserService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerUser:save')") + @OperationLog + @Operation(summary = "批量添加分销商用户记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopDealerUserService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerUser:update')") + @OperationLog + @Operation(summary = "批量修改分销商用户记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopDealerUserService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerUser:remove')") + @OperationLog + @Operation(summary = "批量删除分销商用户记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopDealerUserService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerUser:save')") + @Operation(summary = "批量导入分销商用户") + @Transactional(rollbackFor = {Exception.class}) + @PostMapping("/import") + public ApiResult> importBatch(MultipartFile file) { + ImportParams importParams = new ImportParams(); + try { + List list = ExcelImportUtil.importExcel(file.getInputStream(), ShopDealerUserImportParam.class, importParams); + list.forEach(d -> { + ShopDealerUser item = JSONUtil.parseObject(JSONUtil.toJSONString(d), ShopDealerUser.class); + assert item != null; + if (ObjectUtil.isNotEmpty(item)) { + // 设置默认值 + if (item.getIsDelete() == null) { + item.setIsDelete(0); + } + if (item.getSortNumber() == null) { + item.setSortNumber(0); + } + // 记录当前登录用户id(如果没有指定userId) + if (item.getUserId() == null) { + User loginUser = getLoginUser(); + if (loginUser != null) { + item.setUserId(loginUser.getUserId()); + } + } + shopDealerUserService.save(item); + } + }); + return success("成功导入" + list.size() + "条", null); + } catch (Exception e) { + e.printStackTrace(); + } + return fail("导入失败", null); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopDealerWithdrawController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerWithdrawController.java new file mode 100644 index 0000000..081c7e6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopDealerWithdrawController.java @@ -0,0 +1,347 @@ +package com.gxwebsoft.shop.controller; + +import cn.hutool.core.util.StrUtil; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.entity.ShopDealerUser; +import com.gxwebsoft.shop.service.ShopDealerUserService; +import com.gxwebsoft.shop.service.ShopDealerWithdrawService; +import com.gxwebsoft.shop.entity.ShopDealerWithdraw; +import com.gxwebsoft.shop.param.ShopDealerWithdrawParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.payment.exception.PaymentException; +import com.gxwebsoft.payment.service.WxTransferService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.interceptor.TransactionAspectSupport; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 分销商提现明细表控制器 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Tag(name = "分销商提现明细表管理") +@RestController +@RequestMapping("/api/shop/shop-dealer-withdraw") +public class ShopDealerWithdrawController extends BaseController { + @Resource + private ShopDealerWithdrawService shopDealerWithdrawService; + @Resource + private ShopDealerUserService shopDealerUserService; + @Resource + private WxTransferService wxTransferService; + + @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:list')") + @Operation(summary = "分页查询分销商提现明细表") + @GetMapping("/page") + public ApiResult> page(ShopDealerWithdrawParam param) { + // 使用关联查询 + return success(shopDealerWithdrawService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:list')") + @Operation(summary = "查询全部分销商提现明细表") + @GetMapping() + public ApiResult> list(ShopDealerWithdrawParam param) { + // 使用关联查询 + return success(shopDealerWithdrawService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:list')") + @Operation(summary = "根据id查询分销商提现明细表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopDealerWithdrawService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:save')") + @Transactional(rollbackFor = {Exception.class}) + @Operation(summary = "添加分销商提现明细表") + @PostMapping() + public ApiResult save(@RequestBody ShopDealerWithdraw shopDealerWithdraw) { + try { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("未登录或登录已失效"); + } + + if (shopDealerWithdraw.getMoney() == null || shopDealerWithdraw.getMoney().compareTo(java.math.BigDecimal.ZERO) <= 0) { + return fail("提现金额必须大于0"); + } + + Integer tenantId = shopDealerWithdraw.getTenantId() != null ? shopDealerWithdraw.getTenantId() : getTenantId(); + if (tenantId == null) { + return fail("tenantId为空,无法发起提现"); + } + + shopDealerWithdraw.setTenantId(tenantId); + shopDealerWithdraw.setUserId(loginUser.getUserId()); + + Integer payType = shopDealerWithdraw.getPayType(); + if (payType == null) { + return fail("提现方式不能为空"); + } + + // 资金安全:用户申请后统一进入“待审核(10)”,审核通过后再由用户主动领取 + shopDealerWithdraw.setApplyStatus(10); + shopDealerWithdraw.setAuditTime(null); + + final ShopDealerUser dealerUser = shopDealerUserService.getByUserIdRel(loginUser.getUserId()); + if (dealerUser == null) { + return fail("分销商信息不存在"); + } + if (dealerUser.getMoney() == null || dealerUser.getMoney().compareTo(shopDealerWithdraw.getMoney()) < 0) { + return fail("可提现佣金不足"); + } + + if (!shopDealerWithdrawService.save(shopDealerWithdraw)) { + return fail("添加失败"); + } + + // 扣除提现金额 + dealerUser.setMoney(dealerUser.getMoney().subtract(shopDealerWithdraw.getMoney())); + if (!shopDealerUserService.updateById(dealerUser)) { + throw PaymentException.systemError("扣减可提现佣金失败", null); + } + + return success("添加成功"); + } catch (PaymentException e) { + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return fail(e.getMessage()); + } catch (Exception e) { + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return fail("添加失败"); + } + } + + @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:update')") + @Transactional(rollbackFor = {Exception.class}) + @Operation(summary = "修改分销商提现明细表") + @PutMapping() + public ApiResult update(@RequestBody ShopDealerWithdraw shopDealerWithdraw) { + if (shopDealerWithdraw.getId() == null) { + return fail("id不能为空"); + } + + // 以DB原数据为准,避免前端未传字段导致逻辑判断错误/金额被篡改等问题 + ShopDealerWithdraw db = shopDealerWithdrawService.getByIdRel(shopDealerWithdraw.getId()); + if (db == null) { + return fail("提现记录不存在"); + } + + // 防御:前端未传字段时,避免被 updateById 更新为 NULL + if (shopDealerWithdraw.getApplyStatus() == null) { + shopDealerWithdraw.setApplyStatus(db.getApplyStatus()); + } + if (shopDealerWithdraw.getPayType() == null) { + shopDealerWithdraw.setPayType(db.getPayType()); + } + + Integer newStatus = shopDealerWithdraw.getApplyStatus() != null ? shopDealerWithdraw.getApplyStatus() : db.getApplyStatus(); + Integer oldStatus = db.getApplyStatus(); + Integer payType = shopDealerWithdraw.getPayType() != null ? shopDealerWithdraw.getPayType() : db.getPayType(); + Integer incomingStatus = shopDealerWithdraw.getApplyStatus(); + + // 驳回操作(状态迁移到30时),退回金额,避免重复退回 + if (Integer.valueOf(30).equals(newStatus) && !Integer.valueOf(30).equals(oldStatus)) { + ShopDealerUser dealerUser = shopDealerUserService.getByUserIdRel(db.getUserId()); + if (dealerUser != null && dealerUser.getMoney() != null && db.getMoney() != null) { + dealerUser.setMoney(dealerUser.getMoney().add(db.getMoney())); + shopDealerUserService.updateById(dealerUser); + } + } + + // 审核通过:仅标记为 20,等待用户在提现记录中主动领取(微信等在线转账在领取环节执行) + if (Integer.valueOf(20).equals(incomingStatus) && !Integer.valueOf(20).equals(oldStatus)) { + shopDealerWithdraw.setAuditTime(LocalDateTime.now()); + } + + // 微信提现:已打款(40)由用户“领取成功”后置为 40,后台不允许直接改为 40 + if (Integer.valueOf(10).equals(payType) + && Integer.valueOf(40).equals(incomingStatus) + && !Integer.valueOf(40).equals(oldStatus)) { + return fail("微信提现请用户在提现记录中领取后自动完成,后台不可直接置为已打款"); + } + + // 已打款:非微信自动转账的场景,要求上传凭证 + if (Integer.valueOf(40).equals(incomingStatus) && !Integer.valueOf(40).equals(oldStatus)) { + shopDealerWithdraw.setAuditTime(LocalDateTime.now()); + if (!Integer.valueOf(10).equals(payType) && StrUtil.isBlankIfStr(shopDealerWithdraw.getImage())) { + return fail("请上传打款凭证"); + } + } + if (shopDealerWithdrawService.updateById(shopDealerWithdraw)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:update')") + @Operation(summary = "用户领取提现(审核通过后,返回微信收款确认页 package_info)") + @PostMapping("/receive/{id}") + public ApiResult receive(@PathVariable("id") Integer id) { + try { + User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("未登录或登录已失效"); + } + if (id == null) { + return fail("id不能为空"); + } + + ShopDealerWithdraw db = shopDealerWithdrawService.getByIdRel(id); + if (db == null) { + return fail("提现记录不存在"); + } + if (!loginUser.getUserId().equals(db.getUserId())) { + return fail("无权领取该提现记录"); + } + if (!Integer.valueOf(20).equals(db.getApplyStatus())) { + return fail("当前状态不可领取"); + } + if (!Integer.valueOf(10).equals(db.getPayType())) { + return fail("仅微信提现支持在线领取"); + } + + Integer tenantId = db.getTenantId() != null ? db.getTenantId() : getTenantId(); + if (tenantId == null) { + return fail("tenantId为空,无法发起微信转账"); + } + + String openid = StrUtil.isNotBlank(db.getOpenId()) ? db.getOpenId() : db.getOfficeOpenid(); + if (StrUtil.isBlank(openid)) { + // 兜底:从分销商信息关联获取openid + ShopDealerUser dealerUser = shopDealerUserService.getByUserIdRel(db.getUserId()); + if (dealerUser != null && StrUtil.isNotBlank(dealerUser.getOpenid())) { + openid = dealerUser.getOpenid(); + } + } + if (StrUtil.isBlank(openid)) { + return fail("用户openid为空,无法拉起微信收款确认页"); + } + + // 使用提现记录ID构造单号,保持幂等;微信要求 5-32 且仅字母/数字 + String outBillNo = String.format("WD%03d", db.getId()); + String remark = "分销商提现"; + String userName = db.getRealName(); + + WxTransferService.TransferBillsResponse resp = wxTransferService.initiateSingleTransferWithUserConfirm( + tenantId, + openid, + db.getMoney(), + outBillNo, + remark, + userName + ); + if (resp == null || StrUtil.isBlank(resp.getPackageInfo())) { + return fail("后台未返回 package_info,无法调起微信收款确认页"); + } + + Map data = new HashMap<>(); + data.put("package_info", resp.getPackageInfo()); + return success("领取发起成功", data); + } catch (PaymentException e) { + return fail(e.getMessage()); + } catch (Exception e) { + return fail("领取失败"); + } + } + + @Operation(summary = "用户领取成功回调(将状态置为已打款/已领取40)") + @PostMapping("/receive-success/{id}") + public ApiResult receiveSuccess(@PathVariable("id") Integer id) { + User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("未登录或登录已失效"); + } + if (id == null) { + return fail("id不能为空"); + } + + ShopDealerWithdraw db = shopDealerWithdrawService.getByIdRel(id); + if (db == null) { + return fail("提现记录不存在"); + } + if (!loginUser.getUserId().equals(db.getUserId())) { + return fail("无权操作该提现记录"); + } + if (!Integer.valueOf(10).equals(db.getPayType())) { + return fail("仅微信提现支持在线领取"); + } + if (Integer.valueOf(40).equals(db.getApplyStatus())) { + return success("已领取"); + } + if (!Integer.valueOf(20).equals(db.getApplyStatus())) { + return fail("当前状态不可确认领取"); + } + + ShopDealerWithdraw upd = new ShopDealerWithdraw(); + upd.setId(db.getId()); + upd.setApplyStatus(40); + upd.setAuditTime(LocalDateTime.now()); + if (shopDealerWithdrawService.updateById(upd)) { + return success("领取成功"); + } + return fail("领取失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:remove')") + @OperationLog + @Operation(summary = "删除分销商提现明细表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopDealerWithdrawService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:save')") + @OperationLog + @Operation(summary = "批量添加分销商提现明细表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopDealerWithdrawService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:update')") + @OperationLog + @Operation(summary = "批量修改分销商提现明细表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopDealerWithdrawService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:remove')") + @OperationLog + @Operation(summary = "批量删除分销商提现明细表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopDealerWithdrawService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopExpressController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopExpressController.java new file mode 100644 index 0000000..c638b0f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopExpressController.java @@ -0,0 +1,121 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopExpressService; +import com.gxwebsoft.shop.entity.ShopExpress; +import com.gxwebsoft.shop.param.ShopExpressParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 物流公司控制器 + * + * @author 科技小王子 + * @since 2025-08-12 12:07:03 + */ +@Tag(name = "物流公司管理") +@RestController +@RequestMapping("/api/shop/shop-express") +public class ShopExpressController extends BaseController { + @Resource + private ShopExpressService shopExpressService; + + @Operation(summary = "分页查询物流公司") + @GetMapping("/page") + public ApiResult> page(ShopExpressParam param) { + // 使用关联查询 + return success(shopExpressService.pageRel(param)); + } + + @Operation(summary = "查询全部物流公司") + @GetMapping() + public ApiResult> list(ShopExpressParam param) { + // 使用关联查询 + return success(shopExpressService.listRel(param)); + } + + @Operation(summary = "根据id查询物流公司") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopExpressService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopExpress:save')") + @OperationLog + @Operation(summary = "添加物流公司") + @PostMapping() + public ApiResult save(@RequestBody ShopExpress shopExpress) { + if (shopExpressService.save(shopExpress)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopExpress:update')") + @OperationLog + @Operation(summary = "修改物流公司") + @PutMapping() + public ApiResult update(@RequestBody ShopExpress shopExpress) { + if (shopExpressService.updateById(shopExpress)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopExpress:remove')") + @OperationLog + @Operation(summary = "删除物流公司") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopExpressService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopExpress:save')") + @OperationLog + @Operation(summary = "批量添加物流公司") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopExpressService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopExpress:update')") + @OperationLog + @Operation(summary = "批量修改物流公司") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopExpressService, "express_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopExpress:remove')") + @OperationLog + @Operation(summary = "批量删除物流公司") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopExpressService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopExpressTemplateController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopExpressTemplateController.java new file mode 100644 index 0000000..bbc7ac2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopExpressTemplateController.java @@ -0,0 +1,121 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopExpressTemplateService; +import com.gxwebsoft.shop.entity.ShopExpressTemplate; +import com.gxwebsoft.shop.param.ShopExpressTemplateParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 运费模板控制器 + * + * @author 科技小王子 + * @since 2025-08-12 12:07:03 + */ +@Tag(name = "运费模板管理") +@RestController +@RequestMapping("/api/shop/shop-express-template") +public class ShopExpressTemplateController extends BaseController { + @Resource + private ShopExpressTemplateService shopExpressTemplateService; + + @Operation(summary = "分页查询运费模板") + @GetMapping("/page") + public ApiResult> page(ShopExpressTemplateParam param) { + // 使用关联查询 + return success(shopExpressTemplateService.pageRel(param)); + } + + @Operation(summary = "查询全部运费模板") + @GetMapping() + public ApiResult> list(ShopExpressTemplateParam param) { + // 使用关联查询 + return success(shopExpressTemplateService.listRel(param)); + } + + @Operation(summary = "根据id查询运费模板") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopExpressTemplateService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopExpressTemplate:save')") + @OperationLog + @Operation(summary = "添加运费模板") + @PostMapping() + public ApiResult save(@RequestBody ShopExpressTemplate shopExpressTemplate) { + if (shopExpressTemplateService.save(shopExpressTemplate)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopExpressTemplate:update')") + @OperationLog + @Operation(summary = "修改运费模板") + @PutMapping() + public ApiResult update(@RequestBody ShopExpressTemplate shopExpressTemplate) { + if (shopExpressTemplateService.updateById(shopExpressTemplate)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopExpressTemplate:remove')") + @OperationLog + @Operation(summary = "删除运费模板") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopExpressTemplateService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopExpressTemplate:save')") + @OperationLog + @Operation(summary = "批量添加运费模板") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopExpressTemplateService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopExpressTemplate:update')") + @OperationLog + @Operation(summary = "批量修改运费模板") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopExpressTemplateService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopExpressTemplate:remove')") + @OperationLog + @Operation(summary = "批量删除运费模板") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopExpressTemplateService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopExpressTemplateDetailController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopExpressTemplateDetailController.java new file mode 100644 index 0000000..6c1553d --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopExpressTemplateDetailController.java @@ -0,0 +1,121 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopExpressTemplateDetailService; +import com.gxwebsoft.shop.entity.ShopExpressTemplateDetail; +import com.gxwebsoft.shop.param.ShopExpressTemplateDetailParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 运费模板控制器 + * + * @author 科技小王子 + * @since 2025-08-12 12:07:03 + */ +@Tag(name = "运费模板管理") +@RestController +@RequestMapping("/api/shop/shop-express-template-detail") +public class ShopExpressTemplateDetailController extends BaseController { + @Resource + private ShopExpressTemplateDetailService shopExpressTemplateDetailService; + + @Operation(summary = "分页查询运费模板") + @GetMapping("/page") + public ApiResult> page(ShopExpressTemplateDetailParam param) { + // 使用关联查询 + return success(shopExpressTemplateDetailService.pageRel(param)); + } + + @Operation(summary = "查询全部运费模板") + @GetMapping() + public ApiResult> list(ShopExpressTemplateDetailParam param) { + // 使用关联查询 + return success(shopExpressTemplateDetailService.listRel(param)); + } + + @Operation(summary = "根据id查询运费模板") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopExpressTemplateDetailService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopExpressTemplateDetail:save')") + @OperationLog + @Operation(summary = "添加运费模板") + @PostMapping() + public ApiResult save(@RequestBody ShopExpressTemplateDetail shopExpressTemplateDetail) { + if (shopExpressTemplateDetailService.save(shopExpressTemplateDetail)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopExpressTemplateDetail:update')") + @OperationLog + @Operation(summary = "修改运费模板") + @PutMapping() + public ApiResult update(@RequestBody ShopExpressTemplateDetail shopExpressTemplateDetail) { + if (shopExpressTemplateDetailService.updateById(shopExpressTemplateDetail)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopExpressTemplateDetail:remove')") + @OperationLog + @Operation(summary = "删除运费模板") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopExpressTemplateDetailService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopExpressTemplateDetail:save')") + @OperationLog + @Operation(summary = "批量添加运费模板") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopExpressTemplateDetailService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopExpressTemplateDetail:update')") + @OperationLog + @Operation(summary = "批量修改运费模板") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopExpressTemplateDetailService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopExpressTemplateDetail:remove')") + @OperationLog + @Operation(summary = "批量删除运费模板") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopExpressTemplateDetailService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopGiftController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopGiftController.java new file mode 100644 index 0000000..66f5023 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopGiftController.java @@ -0,0 +1,261 @@ +package com.gxwebsoft.shop.controller; + +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.RandomUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.config.ConfigProperties; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.FileRecord; +import com.gxwebsoft.shop.entity.ShopGoods; +import com.gxwebsoft.shop.service.ShopGiftService; +import com.gxwebsoft.shop.entity.ShopGift; +import com.gxwebsoft.shop.param.ShopGiftParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.shop.service.ShopGoodsService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.apache.poi.xssf.streaming.SXSSFRow; +import org.apache.poi.xssf.streaming.SXSSFSheet; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.FileOutputStream; +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 礼品卡控制器 + * + * @author 科技小王子 + * @since 2025-08-11 18:07:32 + */ +@Tag(name = "礼品卡管理") +@RestController +@RequestMapping("/api/shop/shop-gift") +public class ShopGiftController extends BaseController { + @Resource + private ShopGiftService shopGiftService; + @Value("${config.upload-path}") + private String uploadPath; + @Value("${config.api-url}") + private String apiUrl; + @Resource + private ShopGoodsService shopGoodsService; + + @Operation(summary = "根据code查询礼品卡") + @GetMapping("/by-code/{code}") + public ApiResult get(@PathVariable("code") String code) { + // 使用关联查询 + return success(shopGiftService.getByCode(code)); + } + + @Operation(summary = "礼品卡核销") + @PostMapping("/set-take") + public ApiResult setTake(@RequestBody ShopGift shopGift) { + if (getLoginUser() == null) return fail("请登录"); + if (shopGift.getCode() == null) { + return fail("非法请求"); + } + ShopGift shopGift1 = shopGiftService.getByCode(shopGift.getCode()); + if (shopGift1 == null) return fail("礼品卡不存在"); + if (shopGift1.getTakeTime() != null) { + return fail("礼品卡已使用"); + } + shopGift1.setTakeTime(LocalDateTime.now()); + shopGift1.setOperatorUserId(getLoginUserId()); + shopGiftService.updateById(shopGift1); + return success(); + } + + @PreAuthorize("hasAuthority('shop:shopGift:list')") + @Operation(summary = "分页查询礼品卡") + @GetMapping("/page") + public ApiResult> page(ShopGiftParam param) { + // 使用关联查询 + return success(shopGiftService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopGift:list')") + @Operation(summary = "查询全部礼品卡") + @GetMapping() + public ApiResult> list(ShopGiftParam param) { + // 使用关联查询 + return success(shopGiftService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopGift:list')") + @Operation(summary = "根据id查询礼品卡") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopGiftService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopGift:save')") + @OperationLog + @Operation(summary = "添加礼品卡") + @PostMapping() + public ApiResult save(@RequestBody ShopGift shopGift) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopGift.setUserId(loginUser.getUserId()); + } + if (shopGiftService.save(shopGift)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGift:update')") + @OperationLog + @Operation(summary = "修改礼品卡") + @PutMapping() + public ApiResult update(@RequestBody ShopGift shopGift) { + if (shopGiftService.updateById(shopGift)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGift:save')") + @OperationLog + @Operation(summary = "批量生成礼品卡") + @PostMapping("/make") + public ApiResult make(@RequestBody ShopGift shopGiftData) { + if (shopGiftData.getNum() == null || shopGiftData.getNum() <= 0) { + return fail("请输入正确的数量"); + } + if (shopGiftData.getGoodsId() == null || shopGiftData.getGoodsId() <= 0) { + return fail("请选择商品"); + } + List giftList = new ArrayList<>(); + for (int i = 0; i < shopGiftData.getNum(); i++) { + ShopGift shopGift = new ShopGift(); + shopGift.setName(shopGiftData.getName()); + shopGift.setCode(RandomUtil.randomString(8)); + shopGift.setGoodsId(shopGiftData.getGoodsId()); + shopGift.setUseLocation(shopGiftData.getUseLocation()); + shopGift.setComments(shopGiftData.getComments()); + giftList.add(shopGift); + } + if (shopGiftService.saveBatch(giftList)) { + return success("生成成功"); + } + return fail("生成失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGift:remove')") + @OperationLog + @Operation(summary = "删除礼品卡") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopGiftService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGift:save')") + @OperationLog + @Operation(summary = "批量添加礼品卡") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopGiftService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGift:update')") + @OperationLog + @Operation(summary = "批量修改礼品卡") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopGiftService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGift:remove')") + @OperationLog + @Operation(summary = "批量删除礼品卡") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopGiftService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGift:list')") + @Operation(summary = "导出礼品卡") + @PostMapping("/export") + public ApiResult export(@RequestBody(required = false) List ids) throws IOException { + String filename = "excel/礼品卡.xlsx"; + if (!FileUtil.exist(uploadPath + "excel")) { + FileUtil.mkdir(uploadPath + "excel"); + } + List list; + if (ids != null && !ids.isEmpty()) { + list = shopGiftService.listByIds(ids); + } else { + list = shopGiftService.list(); + } + if (!list.isEmpty()) { + Set goodsIds = list.stream().map(ShopGift::getGoodsId).collect(Collectors.toSet()); + List goodsList = shopGoodsService.listByIds(goodsIds); + for (ShopGift shopGift : list) { + ShopGoods shopGoods = goodsList.stream().filter(sG -> sG.getGoodsId().equals(shopGift.getGoodsId())).findFirst().orElse(null); + if (shopGoods != null) { + shopGift.setGoods(shopGoods); + } + } + } + String path = uploadPath + filename; + SXSSFWorkbook workbook = new SXSSFWorkbook(); + //创建工作表单 + SXSSFSheet sheet = workbook.createSheet(); + String[] headers = {"名称", "秘钥", "领取时间", "商品"}; + + SXSSFRow row0 = sheet.createRow(0); + for (int i = 0; i < headers.length; i++) { + row0.createCell(i).setCellValue(headers[i]); + } + if (!list.isEmpty()) { + for (ShopGift shopGift : list) { + SXSSFRow row = sheet.createRow(sheet.getLastRowNum() + 1); + row.createCell(0).setCellValue(shopGift.getName()); + row.createCell(1).setCellValue(shopGift.getCode()); + row.createCell(2).setCellValue(shopGift.getTakeTime()); + row.createCell(3).setCellValue(shopGift.getGoods() != null ? shopGift.getGoods().getName() : ""); + } + } + FileOutputStream output = new FileOutputStream(path); + workbook.write(output); + output.flush(); + + FileRecord result = new FileRecord(); + result.setCreateUserId(getLoginUserId()); + result.setName("礼品卡"); + result.setPath(filename); + result.setUrl(apiUrl + "/" + filename); + return success(result); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsCategoryController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsCategoryController.java new file mode 100644 index 0000000..49077a7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsCategoryController.java @@ -0,0 +1,128 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopGoodsCategoryService; +import com.gxwebsoft.shop.entity.ShopGoodsCategory; +import com.gxwebsoft.shop.param.ShopGoodsCategoryParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 商品分类控制器 + * + * @author 科技小王子 + * @since 2025-05-01 00:36:45 + */ +@Tag(name = "商品分类管理") +@RestController +@RequestMapping("/api/shop/shop-goods-category") +public class ShopGoodsCategoryController extends BaseController { + @Resource + private ShopGoodsCategoryService shopGoodsCategoryService; + + @PreAuthorize("hasAuthority('shop:shopGoodsCategory:list')") + @Operation(summary = "分页查询商品分类") + @GetMapping("/page") + public ApiResult> page(ShopGoodsCategoryParam param) { + // 使用关联查询 + return success(shopGoodsCategoryService.pageRel(param)); + } + + @Operation(summary = "查询全部商品分类") + @GetMapping() + public ApiResult> list(ShopGoodsCategoryParam param) { + // 使用关联查询 + return success(shopGoodsCategoryService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsCategory:list')") + @Operation(summary = "根据id查询商品分类") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopGoodsCategoryService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsCategory:save')") + @OperationLog + @Operation(summary = "添加商品分类") + @PostMapping() + public ApiResult save(@RequestBody ShopGoodsCategory shopGoodsCategory) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopGoodsCategory.setUserId(loginUser.getUserId()); + } + if (shopGoodsCategoryService.save(shopGoodsCategory)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsCategory:update')") + @OperationLog + @Operation(summary = "修改商品分类") + @PutMapping() + public ApiResult update(@RequestBody ShopGoodsCategory shopGoodsCategory) { + if (shopGoodsCategoryService.updateById(shopGoodsCategory)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsCategory:remove')") + @OperationLog + @Operation(summary = "删除商品分类") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopGoodsCategoryService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsCategory:save')") + @OperationLog + @Operation(summary = "批量添加商品分类") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopGoodsCategoryService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsCategory:update')") + @OperationLog + @Operation(summary = "批量修改商品分类") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopGoodsCategoryService, "category_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsCategory:remove')") + @OperationLog + @Operation(summary = "批量删除商品分类") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopGoodsCategoryService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsCommentController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsCommentController.java new file mode 100644 index 0000000..7f370af --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsCommentController.java @@ -0,0 +1,115 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopGoodsCommentService; +import com.gxwebsoft.shop.entity.ShopGoodsComment; +import com.gxwebsoft.shop.param.ShopGoodsCommentParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 评论表控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "评论表管理") +@RestController +@RequestMapping("/api/shop/shop-goods-comment") +public class ShopGoodsCommentController extends BaseController { + @Resource + private ShopGoodsCommentService shopGoodsCommentService; + + @Operation(summary = "分页查询评论表") + @GetMapping("/page") + public ApiResult> page(ShopGoodsCommentParam param) { + // 使用关联查询 + return success(shopGoodsCommentService.pageRel(param)); + } + + @Operation(summary = "查询全部评论表") + @GetMapping() + public ApiResult> list(ShopGoodsCommentParam param) { + // 使用关联查询 + return success(shopGoodsCommentService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsComment:list')") + @Operation(summary = "根据id查询评论表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopGoodsCommentService.getByIdRel(id)); + } + + @Operation(summary = "添加评论表") + @PostMapping() + public ApiResult save(@RequestBody ShopGoodsComment shopGoodsComment) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopGoodsComment.setUserId(loginUser.getUserId()); + } + if (shopGoodsCommentService.save(shopGoodsComment)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改评论表") + @PutMapping() + public ApiResult update(@RequestBody ShopGoodsComment shopGoodsComment) { + if (shopGoodsCommentService.updateById(shopGoodsComment)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除评论表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopGoodsCommentService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加评论表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopGoodsCommentService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改评论表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopGoodsCommentService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除评论表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopGoodsCommentService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsController.java new file mode 100644 index 0000000..4074e63 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsController.java @@ -0,0 +1,163 @@ +package com.gxwebsoft.shop.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopGoodsService; +import com.gxwebsoft.shop.entity.ShopGoods; +import com.gxwebsoft.shop.param.ShopGoodsParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 商品控制器 + * + * @author 科技小王子 + * @since 2025-04-24 20:52:13 + */ +@Tag(name = "商品管理") +@RestController +@RequestMapping("/api/shop/shop-goods") +public class ShopGoodsController extends BaseController { + @Resource + private ShopGoodsService shopGoodsService; + + @Operation(summary = "分页查询商品") + @GetMapping("/page") + public ApiResult> page(ShopGoodsParam param) { + // 使用关联查询 + return success(shopGoodsService.pageRel(param)); + } + + @Operation(summary = "查询全部商品") + @GetMapping() + public ApiResult> list(ShopGoodsParam param) { + // 使用关联查询 + return success(shopGoodsService.listRel(param)); + } + + @Operation(summary = "根据id查询商品") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopGoodsService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopGoods:save')") + @OperationLog + @Operation(summary = "添加商品") + @PostMapping() + public ApiResult save(@RequestBody ShopGoods shopGoods) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopGoods.setUserId(loginUser.getUserId()); + } + if (shopGoodsService.save(shopGoods)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoods:update')") + @OperationLog + @Operation(summary = "修改商品") + @PutMapping() + public ApiResult update(@RequestBody ShopGoods shopGoods) { + if (shopGoodsService.updateById(shopGoods)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoods:remove')") + @OperationLog + @Operation(summary = "删除商品") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopGoodsService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoods:save')") + @OperationLog + @Operation(summary = "批量添加商品") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopGoodsService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoods:update')") + @OperationLog + @Operation(summary = "批量修改商品") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopGoodsService, "goods_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoods:remove')") + @OperationLog + @Operation(summary = "批量删除商品") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopGoodsService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "统计信息") + @GetMapping("/data") + public ApiResult> data(ShopGoodsParam param) { + Map data = new HashMap<>(); + final LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + + if (param.getMerchantId() != null) { + wrapper.eq(ShopGoods::getMerchantId,param.getMerchantId()); + } + + long totalNum = shopGoodsService.count( + wrapper.eq(ShopGoods::getStatus,0).gt(ShopGoods::getStock,0) + ); + data.put("totalNum", Math.toIntExact(totalNum)); + wrapper.clear(); + + long totalNum2 = shopGoodsService.count( + wrapper.gt(ShopGoods::getStatus,0) + ); + data.put("totalNum2", Math.toIntExact(totalNum2)); + wrapper.clear(); + + long totalNum3 = shopGoodsService.count( + wrapper.eq(ShopGoods::getStock,0) + ); + data.put("totalNum3", Math.toIntExact(totalNum3)); + wrapper.clear(); + + // 下架已售罄的商品 + shopGoodsService.update(new LambdaUpdateWrapper().eq(ShopGoods::getStock,0).set(ShopGoods::getStatus,1)); + + return success(data); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsIncomeConfigController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsIncomeConfigController.java new file mode 100644 index 0000000..1e91159 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsIncomeConfigController.java @@ -0,0 +1,115 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopGoodsIncomeConfigService; +import com.gxwebsoft.shop.entity.ShopGoodsIncomeConfig; +import com.gxwebsoft.shop.param.ShopGoodsIncomeConfigParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 分润配置控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "分润配置管理") +@RestController +@RequestMapping("/api/shop/shop-goods-income-config") +public class ShopGoodsIncomeConfigController extends BaseController { + @Resource + private ShopGoodsIncomeConfigService shopGoodsIncomeConfigService; + + @Operation(summary = "分页查询分润配置") + @GetMapping("/page") + public ApiResult> page(ShopGoodsIncomeConfigParam param) { + // 使用关联查询 + return success(shopGoodsIncomeConfigService.pageRel(param)); + } + + @Operation(summary = "查询全部分润配置") + @GetMapping() + public ApiResult> list(ShopGoodsIncomeConfigParam param) { + // 使用关联查询 + return success(shopGoodsIncomeConfigService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsIncomeConfig:list')") + @Operation(summary = "根据id查询分润配置") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopGoodsIncomeConfigService.getByIdRel(id)); + } + + @Operation(summary = "添加分润配置") + @PostMapping() + public ApiResult save(@RequestBody ShopGoodsIncomeConfig shopGoodsIncomeConfig) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopGoodsIncomeConfig.setUserId(loginUser.getUserId()); + } + if (shopGoodsIncomeConfigService.save(shopGoodsIncomeConfig)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改分润配置") + @PutMapping() + public ApiResult update(@RequestBody ShopGoodsIncomeConfig shopGoodsIncomeConfig) { + if (shopGoodsIncomeConfigService.updateById(shopGoodsIncomeConfig)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除分润配置") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopGoodsIncomeConfigService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加分润配置") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopGoodsIncomeConfigService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改分润配置") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopGoodsIncomeConfigService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除分润配置") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopGoodsIncomeConfigService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsLogController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsLogController.java new file mode 100644 index 0000000..2a46786 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsLogController.java @@ -0,0 +1,115 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopGoodsLogService; +import com.gxwebsoft.shop.entity.ShopGoodsLog; +import com.gxwebsoft.shop.param.ShopGoodsLogParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 商品日志表控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "商品日志表管理") +@RestController +@RequestMapping("/api/shop/shop-goods-log") +public class ShopGoodsLogController extends BaseController { + @Resource + private ShopGoodsLogService shopGoodsLogService; + + @Operation(summary = "分页查询商品日志表") + @GetMapping("/page") + public ApiResult> page(ShopGoodsLogParam param) { + // 使用关联查询 + return success(shopGoodsLogService.pageRel(param)); + } + + @Operation(summary = "查询全部商品日志表") + @GetMapping() + public ApiResult> list(ShopGoodsLogParam param) { + // 使用关联查询 + return success(shopGoodsLogService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsLog:list')") + @Operation(summary = "根据id查询商品日志表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopGoodsLogService.getByIdRel(id)); + } + + @Operation(summary = "添加商品日志表") + @PostMapping() + public ApiResult save(@RequestBody ShopGoodsLog shopGoodsLog) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopGoodsLog.setUserId(loginUser.getUserId()); + } + if (shopGoodsLogService.save(shopGoodsLog)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改商品日志表") + @PutMapping() + public ApiResult update(@RequestBody ShopGoodsLog shopGoodsLog) { + if (shopGoodsLogService.updateById(shopGoodsLog)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除商品日志表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopGoodsLogService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加商品日志表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopGoodsLogService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改商品日志表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopGoodsLogService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除商品日志表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopGoodsLogService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsRelationController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsRelationController.java new file mode 100644 index 0000000..5e0d57c --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsRelationController.java @@ -0,0 +1,115 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopGoodsRelationService; +import com.gxwebsoft.shop.entity.ShopGoodsRelation; +import com.gxwebsoft.shop.param.ShopGoodsRelationParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 商品点赞和收藏表控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "商品点赞和收藏表管理") +@RestController +@RequestMapping("/api/shop/shop-goods-relation") +public class ShopGoodsRelationController extends BaseController { + @Resource + private ShopGoodsRelationService shopGoodsRelationService; + + @Operation(summary = "分页查询商品点赞和收藏表") + @GetMapping("/page") + public ApiResult> page(ShopGoodsRelationParam param) { + // 使用关联查询 + return success(shopGoodsRelationService.pageRel(param)); + } + + @Operation(summary = "查询全部商品点赞和收藏表") + @GetMapping() + public ApiResult> list(ShopGoodsRelationParam param) { + // 使用关联查询 + return success(shopGoodsRelationService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsRelation:list')") + @Operation(summary = "根据id查询商品点赞和收藏表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopGoodsRelationService.getByIdRel(id)); + } + + @Operation(summary = "添加商品点赞和收藏表") + @PostMapping() + public ApiResult save(@RequestBody ShopGoodsRelation shopGoodsRelation) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopGoodsRelation.setUserId(loginUser.getUserId()); + } + if (shopGoodsRelationService.save(shopGoodsRelation)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改商品点赞和收藏表") + @PutMapping() + public ApiResult update(@RequestBody ShopGoodsRelation shopGoodsRelation) { + if (shopGoodsRelationService.updateById(shopGoodsRelation)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除商品点赞和收藏表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopGoodsRelationService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加商品点赞和收藏表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopGoodsRelationService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改商品点赞和收藏表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopGoodsRelationService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除商品点赞和收藏表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopGoodsRelationService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsRoleCommissionController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsRoleCommissionController.java new file mode 100644 index 0000000..21508e2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsRoleCommissionController.java @@ -0,0 +1,121 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopGoodsRoleCommissionService; +import com.gxwebsoft.shop.entity.ShopGoodsRoleCommission; +import com.gxwebsoft.shop.param.ShopGoodsRoleCommissionParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 商品绑定角色的分润金额控制器 + * + * @author 科技小王子 + * @since 2025-05-01 09:53:38 + */ +@Tag(name = "商品绑定角色的分润金额管理") +@RestController +@RequestMapping("/api/shop/shop-goods-role-commission") +public class ShopGoodsRoleCommissionController extends BaseController { + @Resource + private ShopGoodsRoleCommissionService shopGoodsRoleCommissionService; + + @Operation(summary = "分页查询商品绑定角色的分润金额") + @GetMapping("/page") + public ApiResult> page(ShopGoodsRoleCommissionParam param) { + // 使用关联查询 + return success(shopGoodsRoleCommissionService.pageRel(param)); + } + + @Operation(summary = "查询全部商品绑定角色的分润金额") + @GetMapping() + public ApiResult> list(ShopGoodsRoleCommissionParam param) { + // 使用关联查询 + return success(shopGoodsRoleCommissionService.listRel(param)); + } + + @Operation(summary = "根据id查询商品绑定角色的分润金额") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopGoodsRoleCommissionService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsRoleCommission:save')") + @OperationLog + @Operation(summary = "添加商品绑定角色的分润金额") + @PostMapping() + public ApiResult save(@RequestBody ShopGoodsRoleCommission shopGoodsRoleCommission) { + if (shopGoodsRoleCommissionService.save(shopGoodsRoleCommission)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsRoleCommission:update')") + @OperationLog + @Operation(summary = "修改商品绑定角色的分润金额") + @PutMapping() + public ApiResult update(@RequestBody ShopGoodsRoleCommission shopGoodsRoleCommission) { + if (shopGoodsRoleCommissionService.updateById(shopGoodsRoleCommission)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsRoleCommission:remove')") + @OperationLog + @Operation(summary = "删除商品绑定角色的分润金额") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopGoodsRoleCommissionService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsRoleCommission:save')") + @OperationLog + @Operation(summary = "批量添加商品绑定角色的分润金额") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopGoodsRoleCommissionService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsRoleCommission:update')") + @OperationLog + @Operation(summary = "批量修改商品绑定角色的分润金额") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopGoodsRoleCommissionService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsRoleCommission:remove')") + @OperationLog + @Operation(summary = "批量删除商品绑定角色的分润金额") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopGoodsRoleCommissionService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsSkuController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsSkuController.java new file mode 100644 index 0000000..2884bdc --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsSkuController.java @@ -0,0 +1,121 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopGoodsSkuService; +import com.gxwebsoft.shop.entity.ShopGoodsSku; +import com.gxwebsoft.shop.param.ShopGoodsSkuParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 商品sku列表控制器 + * + * @author 科技小王子 + * @since 2025-05-01 09:43:31 + */ +@Tag(name = "商品sku列表管理") +@RestController +@RequestMapping("/api/shop/shop-goods-sku") +public class ShopGoodsSkuController extends BaseController { + @Resource + private ShopGoodsSkuService shopGoodsSkuService; + + @Operation(summary = "分页查询商品sku列表") + @GetMapping("/page") + public ApiResult> page(ShopGoodsSkuParam param) { + // 使用关联查询 + return success(shopGoodsSkuService.pageRel(param)); + } + + @Operation(summary = "查询全部商品sku列表") + @GetMapping() + public ApiResult> list(ShopGoodsSkuParam param) { + // 使用关联查询 + return success(shopGoodsSkuService.listRel(param)); + } + + @Operation(summary = "根据id查询商品sku列表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopGoodsSkuService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsSku:save')") + @OperationLog + @Operation(summary = "添加商品sku列表") + @PostMapping() + public ApiResult save(@RequestBody ShopGoodsSku shopGoodsSku) { + if (shopGoodsSkuService.save(shopGoodsSku)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsSku:update')") + @OperationLog + @Operation(summary = "修改商品sku列表") + @PutMapping() + public ApiResult update(@RequestBody ShopGoodsSku shopGoodsSku) { + if (shopGoodsSkuService.updateById(shopGoodsSku)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsSku:remove')") + @OperationLog + @Operation(summary = "删除商品sku列表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopGoodsSkuService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsSku:save')") + @OperationLog + @Operation(summary = "批量添加商品sku列表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopGoodsSkuService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsSku:update')") + @OperationLog + @Operation(summary = "批量修改商品sku列表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopGoodsSkuService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsSku:remove')") + @OperationLog + @Operation(summary = "批量删除商品sku列表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopGoodsSkuService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsSpecController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsSpecController.java new file mode 100644 index 0000000..398430e --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsSpecController.java @@ -0,0 +1,121 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopGoodsSpecService; +import com.gxwebsoft.shop.entity.ShopGoodsSpec; +import com.gxwebsoft.shop.param.ShopGoodsSpecParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 商品多规格控制器 + * + * @author 科技小王子 + * @since 2025-05-01 09:43:31 + */ +@Tag(name = "商品多规格管理") +@RestController +@RequestMapping("/api/shop/shop-goods-spec") +public class ShopGoodsSpecController extends BaseController { + @Resource + private ShopGoodsSpecService shopGoodsSpecService; + + @Operation(summary = "分页查询商品多规格") + @GetMapping("/page") + public ApiResult> page(ShopGoodsSpecParam param) { + // 使用关联查询 + return success(shopGoodsSpecService.pageRel(param)); + } + + @Operation(summary = "查询全部商品多规格") + @GetMapping() + public ApiResult> list(ShopGoodsSpecParam param) { + // 使用关联查询 + return success(shopGoodsSpecService.listRel(param)); + } + + @Operation(summary = "根据id查询商品多规格") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopGoodsSpecService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsSpec:save')") + @OperationLog + @Operation(summary = "添加商品多规格") + @PostMapping() + public ApiResult save(@RequestBody ShopGoodsSpec shopGoodsSpec) { + if (shopGoodsSpecService.save(shopGoodsSpec)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsSpec:update')") + @OperationLog + @Operation(summary = "修改商品多规格") + @PutMapping() + public ApiResult update(@RequestBody ShopGoodsSpec shopGoodsSpec) { + if (shopGoodsSpecService.updateById(shopGoodsSpec)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsSpec:remove')") + @OperationLog + @Operation(summary = "删除商品多规格") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopGoodsSpecService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsSpec:save')") + @OperationLog + @Operation(summary = "批量添加商品多规格") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopGoodsSpecService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsSpec:update')") + @OperationLog + @Operation(summary = "批量修改商品多规格") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopGoodsSpecService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopGoodsSpec:remove')") + @OperationLog + @Operation(summary = "批量删除商品多规格") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopGoodsSpecService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopMainController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopMainController.java new file mode 100644 index 0000000..5b96b22 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopMainController.java @@ -0,0 +1,57 @@ +package com.gxwebsoft.shop.controller; + +import cn.hutool.core.util.ObjectUtil; +import com.gxwebsoft.cms.entity.CmsWebsite; +import com.gxwebsoft.cms.service.CmsWebsiteService; +import com.gxwebsoft.shop.service.ShopWebsiteService; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.vo.ShopVo; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +/** + * 商城主入口 + * + * @author 科技小王子 + * @since 2024-09-10 20:36:14 + */ +@Slf4j +@Tag(name = "商城") +@RestController +@RequestMapping("/api/shop") +public class ShopMainController extends BaseController { + @Resource + private ShopWebsiteService shopWebsiteService; + + @Operation(summary = "商城基本信息", description = "获取商城的基本信息,包括配置、导航、设置和过期状态等") + @GetMapping("/getShopInfo") + public ApiResult getShopInfo() { + Integer tenantId = getTenantId(); + + if (ObjectUtil.isEmpty(tenantId)) { + return fail("租户ID不能为空", null); + } + + try { + // 使用专门的商城信息获取方法 + ShopVo shopVo = shopWebsiteService.getShopInfo(tenantId); +// log.debug("获取商城信息成功: {}", shopVo); + return success(shopVo); + } catch (IllegalArgumentException e) { + return fail(e.getMessage(), null); + } catch (RuntimeException e) { + return fail(e.getMessage(), null); + } catch (Exception e) { + log.error("获取商城信息失败", e); + return fail("获取商城信息失败", null); + } + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantAccountController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantAccountController.java new file mode 100644 index 0000000..3e5ca19 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantAccountController.java @@ -0,0 +1,115 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopMerchantAccountService; +import com.gxwebsoft.shop.entity.ShopMerchantAccount; +import com.gxwebsoft.shop.param.ShopMerchantAccountParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 商户账号控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "商户账号管理") +@RestController +@RequestMapping("/api/shop/shop-merchant-account") +public class ShopMerchantAccountController extends BaseController { + @Resource + private ShopMerchantAccountService shopMerchantAccountService; + + @Operation(summary = "分页查询商户账号") + @GetMapping("/page") + public ApiResult> page(ShopMerchantAccountParam param) { + // 使用关联查询 + return success(shopMerchantAccountService.pageRel(param)); + } + + @Operation(summary = "查询全部商户账号") + @GetMapping() + public ApiResult> list(ShopMerchantAccountParam param) { + // 使用关联查询 + return success(shopMerchantAccountService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopMerchantAccount:list')") + @Operation(summary = "根据id查询商户账号") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopMerchantAccountService.getByIdRel(id)); + } + + @Operation(summary = "添加商户账号") + @PostMapping() + public ApiResult save(@RequestBody ShopMerchantAccount shopMerchantAccount) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopMerchantAccount.setUserId(loginUser.getUserId()); + } + if (shopMerchantAccountService.save(shopMerchantAccount)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改商户账号") + @PutMapping() + public ApiResult update(@RequestBody ShopMerchantAccount shopMerchantAccount) { + if (shopMerchantAccountService.updateById(shopMerchantAccount)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除商户账号") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopMerchantAccountService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加商户账号") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopMerchantAccountService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改商户账号") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopMerchantAccountService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除商户账号") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopMerchantAccountService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantApplyController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantApplyController.java new file mode 100644 index 0000000..3b5d1cc --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantApplyController.java @@ -0,0 +1,192 @@ +package com.gxwebsoft.shop.controller; + +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.entity.ShopMerchant; +import com.gxwebsoft.shop.entity.ShopMerchantAccount; +import com.gxwebsoft.shop.service.ShopMerchantApplyService; +import com.gxwebsoft.shop.entity.ShopMerchantApply; +import com.gxwebsoft.shop.param.ShopMerchantApplyParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.shop.service.ShopMerchantService; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.beans.BeanUtils; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 商户入驻申请控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "商户入驻申请管理") +@RestController +@RequestMapping("/api/shop/shop-merchant-apply") +public class ShopMerchantApplyController extends BaseController { + @Resource + private ShopMerchantApplyService shopMerchantApplyService; + @Resource + private ShopMerchantService shopMerchantService; + + @Operation(summary = "分页查询商户入驻申请") + @GetMapping("/page") + public ApiResult> page(ShopMerchantApplyParam param) { + // 使用关联查询 + return success(shopMerchantApplyService.pageRel(param)); + } + + @Operation(summary = "查询全部商户入驻申请") + @GetMapping() + public ApiResult> list(ShopMerchantApplyParam param) { + // 使用关联查询 + return success(shopMerchantApplyService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopMerchantApply:list')") + @Operation(summary = "根据id查询商户入驻申请") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopMerchantApplyService.getByIdRel(id)); + } + + @Operation(summary = "添加商户入驻申请") + @PostMapping() + public ApiResult save(@RequestBody ShopMerchantApply shopMerchantApply) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopMerchantApply.setUserId(loginUser.getUserId()); + if(shopMerchantApplyService.count(new LambdaQueryWrapper().eq(ShopMerchantApply::getPhone,shopMerchantApply.getPhone())) > 0){ + return fail("该手机号码已存在"); + } + // 个人开发者认证材料:使用姓名+身份证号码 + if (shopMerchantApply.getType().equals(0)) { + shopMerchantApply.setMerchantName(shopMerchantApply.getRealName()); + shopMerchantApply.setMerchantCode(shopMerchantApply.getIdCard()); + } + shopMerchantApply.setCheckStatus(true); + shopMerchantApply.setTenantId(loginUser.getTenantId()); + if (shopMerchantApplyService.save(shopMerchantApply)) { + return success("您的申请已提交,请耐心等待工作人员的审核,非常感谢"); + } + } + return fail("提交失败"); + } + + @Operation(summary = "修改商户入驻申请") + @PutMapping() + public ApiResult update(@RequestBody ShopMerchantApply shopMerchantApply) { + if (shopMerchantApplyService.updateById(shopMerchantApply)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除商户入驻申请") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopMerchantApplyService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加商户入驻申请") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopMerchantApplyService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改商户入驻申请") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopMerchantApplyService, "apply_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除商户入驻申请") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopMerchantApplyService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "我的入驻信息") + @GetMapping("/getByUserId") + public ApiResult getByUserId() { + final User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("请先登录", null); + } + final ShopMerchantApply shopMerchantApply = shopMerchantApplyService.getOne(new LambdaQueryWrapper().eq(ShopMerchantApply::getUserId, getLoginUser().getUserId()).last("limit 1")); + return success(shopMerchantApply); + } + + @PreAuthorize("hasAuthority('shop:shopMerchantApply:update')") + @Operation(summary = "入驻审核") + @PutMapping("/check") + public ApiResult check(@RequestBody ShopMerchantApply shopMerchantApply) { + // 审核中? + shopMerchantApply.setCheckStatus(true); + // TODO 审核通过则创建商户 + if (shopMerchantApply.getStatus().equals(1)) { + final ShopMerchant one = shopMerchantService.getOne(new LambdaQueryWrapper().eq(ShopMerchant::getPhone, shopMerchantApply.getPhone()).last("limit 1")); + final ShopMerchantAccount merchantAccount = new ShopMerchantAccount(); + BeanUtils.copyProperties(shopMerchantApply, merchantAccount); + + final User user = new User(); + + if (ObjectUtil.isNotEmpty(one)) { + BeanUtils.copyProperties(shopMerchantApply, one); + one.setStatus(0); + shopMerchantService.updateById(one); + user.setRealName(shopMerchantApply.getRealName()); + } else { + final ShopMerchant merchant = new ShopMerchant(); + BeanUtils.copyProperties(shopMerchantApply, merchant); + merchant.setStatus(0); + shopMerchantService.save(merchant); + user.setRealName(shopMerchantApply.getRealName()); + } + + // TODO 创建商户账号 + // TODO 更新用户表的商户信息 + user.setUserId(shopMerchantApply.getUserId()); + shopMerchantApplyService.updateById(shopMerchantApply); + // TODO 入驻开发者中心(添加会员) + return success("操作成功"); + } + // TODO 驳回 + if (shopMerchantApply.getStatus().equals(2)) { + shopMerchantApply.setCheckStatus(false); + shopMerchantApplyService.updateById(shopMerchantApply); + return success("操作成功"); + } + // 审核状态 + shopMerchantApply.setStatus(0); + if (shopMerchantApplyService.updateById(shopMerchantApply)) { + return success("您的申请已提交,请耐心等待工作人员的审核,非常感谢"); + } + return fail("操作失败"); + } +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantController.java new file mode 100644 index 0000000..b95105b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantController.java @@ -0,0 +1,123 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopMerchantService; +import com.gxwebsoft.shop.entity.ShopMerchant; +import com.gxwebsoft.shop.param.ShopMerchantParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 商户控制器 + * + * @author 科技小王子 + * @since 2025-08-10 20:43:33 + */ +@Tag(name = "商户管理") +@RestController +@RequestMapping("/api/shop/shop-merchant") +public class ShopMerchantController extends BaseController { + @Resource + private ShopMerchantService shopMerchantService; + + @Operation(summary = "分页查询商户") + @GetMapping("/page") + public ApiResult> page(ShopMerchantParam param) { + // 使用关联查询 + return success(shopMerchantService.pageRel(param)); + } + + @Operation(summary = "查询全部商户") + @GetMapping() + public ApiResult> list(ShopMerchantParam param) { + // 使用关联查询 + return success(shopMerchantService.listRel(param)); + } + + @Operation(summary = "根据id查询商户") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Long id) { + // 使用关联查询 + return success(shopMerchantService.getByIdRel(id)); + } + + @Operation(summary = "添加商户") + @PostMapping() + public ApiResult save(@RequestBody ShopMerchant shopMerchant) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopMerchant.setUserId(loginUser.getUserId()); + } + if (shopMerchantService.save(shopMerchant)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopMerchant:update')") + @OperationLog + @Operation(summary = "修改商户") + @PutMapping() + public ApiResult update(@RequestBody ShopMerchant shopMerchant) { + if (shopMerchantService.updateById(shopMerchant)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopMerchant:remove')") + @OperationLog + @Operation(summary = "删除商户") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopMerchantService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopMerchant:save')") + @OperationLog + @Operation(summary = "批量添加商户") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopMerchantService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopMerchant:update')") + @OperationLog + @Operation(summary = "批量修改商户") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopMerchantService, "merchant_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopMerchant:remove')") + @OperationLog + @Operation(summary = "批量删除商户") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopMerchantService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantTypeController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantTypeController.java new file mode 100644 index 0000000..4bdac19 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantTypeController.java @@ -0,0 +1,110 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopMerchantTypeService; +import com.gxwebsoft.shop.entity.ShopMerchantType; +import com.gxwebsoft.shop.param.ShopMerchantTypeParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 商户类型控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "商户类型管理") +@RestController +@RequestMapping("/api/shop/shop-merchant-type") +public class ShopMerchantTypeController extends BaseController { + @Resource + private ShopMerchantTypeService shopMerchantTypeService; + + @Operation(summary = "分页查询商户类型") + @GetMapping("/page") + public ApiResult> page(ShopMerchantTypeParam param) { + // 使用关联查询 + return success(shopMerchantTypeService.pageRel(param)); + } + + @Operation(summary = "查询全部商户类型") + @GetMapping() + public ApiResult> list(ShopMerchantTypeParam param) { + // 使用关联查询 + return success(shopMerchantTypeService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopMerchantType:list')") + @Operation(summary = "根据id查询商户类型") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopMerchantTypeService.getByIdRel(id)); + } + + @Operation(summary = "添加商户类型") + @PostMapping() + public ApiResult save(@RequestBody ShopMerchantType shopMerchantType) { + if (shopMerchantTypeService.save(shopMerchantType)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改商户类型") + @PutMapping() + public ApiResult update(@RequestBody ShopMerchantType shopMerchantType) { + if (shopMerchantTypeService.updateById(shopMerchantType)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除商户类型") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopMerchantTypeService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加商户类型") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopMerchantTypeService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改商户类型") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopMerchantTypeService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除商户类型") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopMerchantTypeService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopOrderController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopOrderController.java new file mode 100644 index 0000000..1670772 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopOrderController.java @@ -0,0 +1,793 @@ +package com.gxwebsoft.shop.controller; + +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.gxwebsoft.common.core.config.ConfigProperties; +import com.gxwebsoft.common.core.config.CertificateProperties; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.utils.CertificateLoader; +import com.gxwebsoft.common.core.utils.WechatCertAutoConfig; +import com.gxwebsoft.common.core.utils.WechatPayConfigValidator; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.system.entity.Payment; +import com.gxwebsoft.shop.entity.ShopOrderDelivery; +import com.gxwebsoft.shop.service.*; +import com.gxwebsoft.shop.service.impl.KuaiDi100Impl; +import com.gxwebsoft.shop.task.OrderAutoCancelTask; +import com.gxwebsoft.shop.entity.ShopOrder; +import com.gxwebsoft.shop.param.ShopOrderParam; +import com.gxwebsoft.shop.dto.OrderCreateRequest; +import com.gxwebsoft.shop.dto.OrderPrepayRequest; +import com.gxwebsoft.shop.dto.UpdatePaymentStatusRequest; +import com.gxwebsoft.payment.service.PaymentService; +import com.gxwebsoft.payment.dto.PaymentResponse; +import com.gxwebsoft.payment.enums.PaymentType; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.system.entity.User; +import com.wechat.pay.java.core.notification.NotificationConfig; +import com.wechat.pay.java.core.notification.NotificationParser; +import com.wechat.pay.java.core.notification.RequestParam; +import com.wechat.pay.java.core.RSAAutoCertificateConfig; +import com.wechat.pay.java.service.partnerpayments.jsapi.model.Transaction; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.Operation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * 订单控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "订单管理") +@RestController +@RequestMapping("/api/shop/shop-order") +public class ShopOrderController extends BaseController { + private static final Logger logger = LoggerFactory.getLogger(ShopOrderController.class); + @Resource + private ShopOrderService shopOrderService; + @Resource + private ShopOrderGoodsService shopOrderGoodsService; + @Resource + private OrderBusinessService orderBusinessService; + @Resource + private OrderCancelService orderCancelService; + @Resource + private OrderAutoCancelTask orderAutoCancelTask; + @Resource + private RedisUtil redisUtil; + @Resource + private ConfigProperties conf; + @Resource + private CertificateProperties certConfig; + @Resource + private CertificateLoader certificateLoader; + @Resource + private WechatCertAutoConfig wechatCertAutoConfig; + @Resource + private WechatPayConfigValidator wechatPayConfigValidator; + @Value("${spring.profiles.active}") + String active; + @Resource + private KuaiDi100Impl kuaiDi100; + @Resource + private ShopExpressService expressService; + @Resource + private ShopUserAddressService shopUserAddressService; + @Resource + private ShopOrderDeliveryService shopOrderDeliveryService; + @Resource + private PaymentService paymentService; + + @Operation(summary = "分页查询订单") + @GetMapping("/page") + public ApiResult> page(ShopOrderParam param) { + // 使用关联查询 + return success(shopOrderService.pageRel(param)); + } + + @Operation(summary = "查询全部订单") + @GetMapping() + public ApiResult> list(ShopOrderParam param) { + // 使用关联查询 + return success(shopOrderService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopOrder:list')") + @Operation(summary = "根据id查询订单") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopOrderService.getByIdRel(id)); + } + + @Operation(summary = "添加订单") + @PostMapping() + public ApiResult save(@RequestBody OrderCreateRequest request) { + User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("用户未登录"); + } + + try { + Map wxOrderInfo = orderBusinessService.createOrder(request, loginUser); + return success("下单成功", wxOrderInfo); + } catch (Exception e) { + logger.error("创建订单失败 - 用户ID:{},请求:{}", loginUser.getUserId(), request, e); + return fail(e.getMessage()); + } + } + + @Operation(summary = "添加订单(兼容旧版本)") + @PostMapping("/legacy") + public ApiResult saveLegacy(@RequestBody ShopOrder shopOrder) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopOrder.setUserId(loginUser.getUserId()); + shopOrder.setOpenid(loginUser.getOpenid()); + shopOrder.setPayUserId(loginUser.getUserId()); + if (shopOrder.getOrderNo() == null) { + shopOrder.setOrderNo(Long.toString(IdUtil.getSnowflakeNextId())); + } + if (shopOrder.getComments() == null) { + shopOrder.setComments("暂无"); + } + // 微信支付(商品金额不能为0) + if (shopOrder.getTotalPrice().compareTo(BigDecimal.ZERO) == 0) { + return fail("商品金额不能为0"); + } + // 百色中学项目捐赠金额不能低于20元 + if (shopOrder.getTenantId().equals(10324) && shopOrder.getTotalPrice().compareTo(new BigDecimal("10")) < 0) { + return fail("捐款金额最低不能少于10元,感谢您的爱心捐赠^_^"); + } + // 测试支付 + if (loginUser.getPhone().equals("13737128880")) { + shopOrder.setPrice(new BigDecimal("0.01")); + shopOrder.setTotalPrice(new BigDecimal("0.01")); + } + if (shopOrderService.save(shopOrder)) { + return success("下单成功", shopOrderService.createWxOrder(shopOrder)); + } + } + return fail("添加失败"); + } + + @Operation(summary = "发起支付/重新支付(兼容 pay/prepay/repay)") + @PostMapping({"/pay", "/prepay", "/repay"}) + public ApiResult prepay(@RequestBody OrderPrepayRequest request) { + User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("用户未登录"); + } + + // 允许从请求显式传 tenantId(兼容一些历史调用),否则优先从请求头/登录态推断 + Integer tenantId = request != null ? request.getTenantId() : null; + if (tenantId == null) { + tenantId = ObjectUtil.defaultIfNull(getTenantId(), loginUser.getTenantId()); + } + + if (request == null || (request.getOrderId() == null && StrUtil.isBlank(request.getOrderNo()))) { + return fail("orderId 或 orderNo 不能为空"); + } + + ShopOrder order; + if (request.getOrderId() != null) { + order = shopOrderService.getById(request.getOrderId()); + } else { + if (tenantId == null) { + return fail("tenantId 不能为空"); + } + order = shopOrderService.getByOrderNo(request.getOrderNo(), tenantId); + } + if (order == null) { + return fail("订单不存在"); + } + + // 校验租户(避免用别的租户订单号撞库) + if (tenantId != null && order.getTenantId() != null && !tenantId.equals(order.getTenantId())) { + return fail("订单不存在"); + } + + // 普通用户只能操作自己的订单;管理员可越权(复用取消权限判断即可) + if (!loginUser.getUserId().equals(order.getUserId()) && !hasOrderCancelAuthority()) { + return fail("无权限操作此订单"); + } + + // 业务状态校验:这些错误需要明确返回(code!=0),避免前端误判为接口不支持而降级走创建订单 + if (Boolean.TRUE.equals(order.getPayStatus())) { + return fail("订单已支付"); + } + if (order.getDeleted() != null && order.getDeleted() == 1) { + return fail("订单已删除"); + } + if (order.getOrderStatus() != null) { + // 2=已取消;6=退款成功;7=客户端申请退款;其他非0状态也视为不可再次发起支付 + if (!Objects.equals(order.getOrderStatus(), 0)) { + return fail("订单状态不允许发起支付"); + } + } + if (order.getExpirationTime() != null && order.getExpirationTime().isBefore(LocalDateTime.now())) { + return fail("订单已过期"); + } + + // 补齐 createWxOrder 所需字段(注意:openid 在 ShopOrder 上是非持久化字段,查询出来为空) + Integer payType = request.getPayType() != null ? request.getPayType() : order.getPayType(); + if (payType == null) { + payType = 1; + } + if (!Objects.equals(payType, 1) && !Objects.equals(payType, 102)) { + return fail("该订单不支持发起微信支付"); + } + order.setPayType(payType); + order.setPayUserId(loginUser.getUserId()); + order.setOpenid(loginUser.getOpenid()); + if (order.getPayPrice() == null) { + order.setPayPrice(ObjectUtil.defaultIfNull(order.getTotalPrice(), BigDecimal.ZERO)); + } + if (StrUtil.isBlank(order.getComments())) { + order.setComments("订单支付"); + } + + try { + Map wxOrderInfo = shopOrderService.createWxOrder(order); + return success(wxOrderInfo); + } catch (Exception e) { + logger.error("发起支付失败 - userId={}, orderId={}, orderNo={}", + loginUser.getUserId(), order.getOrderId(), order.getOrderNo(), e); + return fail("发起支付失败:" + e.getMessage()); + } + } + + @PreAuthorize("hasAuthority('shop:shopOrder:update')") + @Operation(summary = "修改订单") + @PutMapping() + public ApiResult update(@RequestBody ShopOrder shopOrder) throws Exception { + if (shopOrder == null) { + return fail("订单不存在"); + } + // 退款相关操作单独走退款接口,便于做财务权限隔离 + if (Objects.equals(shopOrder.getOrderStatus(), 4) || Objects.equals(shopOrder.getOrderStatus(), 6)) { + return fail("退款相关操作请使用退款接口: PUT /api/shop/shop-order/refund"); + } + ShopOrder shopOrderNow = shopOrderService.getById(shopOrder.getOrderId()); + if (shopOrderNow == null) { + return fail("订单不存在"); + } + // 发货状态从“未发货(10)”变更为“已发货(20)”时,记录发货信息 + if (Objects.equals(shopOrderNow.getDeliveryStatus(), 10) && Objects.equals(shopOrder.getDeliveryStatus(), 20)) { + ShopOrderDelivery shopOrderDelivery = new ShopOrderDelivery(); + shopOrderDelivery.setOrderId(shopOrder.getOrderId()); + shopOrderDelivery.setDeliveryMethod(30); + shopOrderDelivery.setExpressId(shopOrder.getExpressId()); + shopOrderDelivery.setSendName(shopOrder.getSendName()); + shopOrderDelivery.setSendPhone(shopOrder.getSendPhone()); + shopOrderDelivery.setSendAddress(shopOrder.getSendAddress()); + shopOrderDeliveryService.save(shopOrderDelivery); + + shopOrderDeliveryService.setExpress(getLoginUser(), shopOrderDelivery, shopOrder); + + } + if (shopOrderService.updateById(shopOrder)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopOrder:refund')") + @Operation(summary = "订单退款操作(申请退款/同意退款)", description = "orderStatus=4 申请退款;orderStatus=6 同意退款并发起原路退款") + @PutMapping("/refund") + public ApiResult refund(@RequestBody ShopOrder req) { + if (req == null || req.getOrderId() == null || req.getOrderStatus() == null) { + return fail("orderId 和 orderStatus 不能为空"); + } + if (!Objects.equals(req.getOrderStatus(), 4) && !Objects.equals(req.getOrderStatus(), 6)) { + return fail("orderStatus 仅支持 4(申请退款) 或 6(同意退款)"); + } + + ShopOrder current = shopOrderService.getById(req.getOrderId()); + if (current == null) { + return fail("订单不存在"); + } + + // 申请退款:只记录申请时间/原因/金额(如有) + if (Objects.equals(req.getOrderStatus(), 4)) { + ShopOrder patch = new ShopOrder(); + patch.setOrderId(req.getOrderId()); + patch.setOrderStatus(4); + patch.setRefundApplyTime(LocalDateTime.now()); + if (StrUtil.isNotBlank(req.getRefundReason())) { + patch.setRefundReason(req.getRefundReason()); + } + if (req.getRefundMoney() != null) { + patch.setRefundMoney(req.getRefundMoney()); + } + if (shopOrderService.updateById(patch)) { + return success("申请退款成功"); + } + return fail("申请退款失败"); + } + + // 同意退款:发起原路退款并更新退款信息 + try { + if (!Boolean.TRUE.equals(current.getPayStatus())) { + return fail("订单未支付,无法退款"); + } + if (StrUtil.isNotBlank(current.getRefundOrder())) { + logger.warn("订单已经退款过,订单号: {}, 退款单号: {}", current.getOrderNo(), current.getRefundOrder()); + return fail("订单已退款,请勿重复操作"); + } + + String refundNo = "RF" + IdUtil.getSnowflakeNextId(); + + BigDecimal refundAmount = req.getRefundMoney(); + if (refundAmount == null || refundAmount.compareTo(BigDecimal.ZERO) <= 0) { + refundAmount = current.getTotalPrice(); + } + if (refundAmount.compareTo(current.getTotalPrice()) > 0) { + return fail("退款金额不能大于订单金额"); + } + + PaymentType paymentType = PaymentType.WECHAT_NATIVE; + if (current.getPayType() != null) { + // 支付方式:0余额支付,1微信支付,2支付宝支付,3银联支付,4现金支付,5POS机支付,6免费,7积分支付 + paymentType = PaymentType.getByCode(current.getPayType()); + if (paymentType == PaymentType.WECHAT) { + paymentType = PaymentType.WECHAT_NATIVE; + } + } + + logger.info("开始处理订单退款 - 订单号: {}, 退款单号: {}, 退款金额: {}, 支付方式: {}", + current.getOrderNo(), refundNo, refundAmount, paymentType); + + PaymentResponse refundResponse = paymentService.refund( + current.getOrderNo(), + refundNo, + paymentType, + current.getTotalPrice(), + refundAmount, + StrUtil.isNotBlank(req.getRefundReason()) ? req.getRefundReason() : "用户申请退款", + current.getTenantId() + ); + + if (!Boolean.TRUE.equals(refundResponse.getSuccess())) { + logger.error("订单退款失败 - 订单号: {}, 错误: {}", current.getOrderNo(), refundResponse.getErrorMessage()); + return fail("退款失败: " + refundResponse.getErrorMessage()); + } + + ShopOrder patch = new ShopOrder(); + patch.setOrderId(req.getOrderId()); + patch.setRefundOrder(refundNo); + patch.setRefundMoney(refundAmount); + patch.setRefundTime(LocalDateTime.now()); + patch.setOrderStatus(6); + if (StrUtil.isNotBlank(req.getRefundReason())) { + patch.setRefundReason(req.getRefundReason()); + } + + if (!shopOrderService.updateById(patch)) { + logger.error("退款已成功但订单更新失败 - orderId={}, orderNo={}, refundNo={}", current.getOrderId(), current.getOrderNo(), refundNo); + return fail("退款成功,但订单状态更新失败,请联系管理员"); + } + + logger.info("订单退款请求成功 - 订单号: {}, 退款单号: {}, 微信退款单号: {}", + current.getOrderNo(), refundNo, refundResponse.getTransactionId()); + return success("退款成功"); + + } catch (Exception e) { + logger.error("处理订单退款异常 - 订单号: {}, 错误: {}", current.getOrderNo(), e.getMessage(), e); + return fail("退款处理异常: " + e.getMessage()); + } + } + + @Operation(summary = "删除订单") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopOrderService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加订单") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopOrderService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改订单") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam != null && batchParam.getData() != null) { + Integer status = batchParam.getData().getOrderStatus(); + // 退款相关操作单独走退款接口,避免绕过财务权限 + if (Objects.equals(status, 4) || Objects.equals(status, 6)) { + return fail("退款相关操作请使用退款接口: PUT /api/shop/shop-order/refund"); + } + } + if (batchParam.update(shopOrderService, "order_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除订单") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopOrderService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "修复订单") + @PutMapping("/repair") + public ApiResult repair(@RequestBody ShopOrder shopOrder) { + final ShopOrder order = shopOrderService.getByOutTradeNo(shopOrder.getOrderNo()); + if (order != null) { + shopOrderService.queryOrderByOutTradeNo(order); + return success("修复成功"); + } + return fail("修复失败"); + } + + @Operation(summary = "统计订单总金额") + @GetMapping("/total") + public ApiResult total() { + return success(shopOrderService.total()); + } + + @Operation(summary = "取消订单") + @PutMapping("/cancel/{id}") + public ApiResult cancelOrder(@PathVariable("id") Integer id) { + try { + User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("用户未登录"); + } + + ShopOrder order = shopOrderService.getById(id); + if (order == null) { + return fail("订单不存在"); + } + + // 检查订单是否属于当前用户(非管理员用户) + if (!loginUser.getUserId().equals(order.getUserId()) && + !hasOrderCancelAuthority()) { + return fail("无权限取消此订单"); + } + + // 检查订单状态 + if (order.getPayStatus() != null && order.getPayStatus()) { + return fail("订单已支付,无法取消"); + } + + if (order.getOrderStatus() != null && order.getOrderStatus() != 0) { + return fail("订单状态不允许取消"); + } + + boolean success = orderCancelService.cancelOrder(order); + if (success) { + return success("订单取消成功"); + } else { + return fail("订单取消失败"); + } + + } catch (Exception e) { + logger.error("取消订单失败,订单ID:{}", id, e); + return fail("取消订单失败:" + e.getMessage()); + } + } + + @PreAuthorize("hasAuthority('shop:shopOrder:manage')") + @Operation(summary = "手动触发订单自动取消任务(管理员)") + @PostMapping("/auto-cancel/trigger") + public ApiResult triggerAutoCancelTask() { + try { + orderAutoCancelTask.manualCancelExpiredOrders(); + return success("自动取消任务已触发"); + } catch (Exception e) { + logger.error("触发自动取消任务失败", e); + return fail("触发失败:" + e.getMessage()); + } + } + + @PreAuthorize("hasAuthority('shop:shopOrder:manage')") + @Operation(summary = "获取自动取消任务状态(管理员)") + @GetMapping("/auto-cancel/status") + public ApiResult getAutoCancelTaskStatus() { + try { + String status = orderAutoCancelTask.getTaskStatus(); + return success(status); + } catch (Exception e) { + logger.error("获取自动取消任务状态失败", e); + return fail("获取状态失败:" + e.getMessage()); + } + } + + @Schema(description = "异步通知11") + @PostMapping("/notify/{tenantId}") + public String wxNotify(@RequestHeader Map header, @RequestBody String body, @PathVariable("tenantId") Integer tenantId) { + logger.info("异步通知*************** = " + tenantId); + + // 获取支付配置信息用于解密 + String key = "Payment:1:".concat(tenantId.toString()); + Payment payment = redisUtil.get(key, Payment.class); + + // 检查支付配置 + if (ObjectUtil.isEmpty(payment)) { + throw new RuntimeException("未找到租户支付配置信息,租户ID: " + tenantId); + } + + logger.info("开始处理微信支付异步通知 - 租户ID: {}", tenantId); + logger.info("支付配置信息 - 商户号: {}, 应用ID: {}", payment.getMchId(), payment.getAppId()); + + // 验证微信支付配置 + WechatPayConfigValidator.ValidationResult validation = wechatPayConfigValidator.validateWechatPayConfig(payment, tenantId); + if (!validation.isValid()) { + logger.error("❌ 微信支付配置验证失败: {}", validation.getErrors()); + logger.info("📋 配置诊断报告:\n{}", wechatPayConfigValidator.generateDiagnosticReport(payment, tenantId)); + throw new RuntimeException("微信支付配置验证失败: " + validation.getErrors()); + } + logger.info("✅ 微信支付配置验证通过"); + + RequestParam requestParam = new RequestParam.Builder() + .serialNumber(header.get("wechatpay-serial")) + .nonce(header.get("wechatpay-nonce")) + .signature(header.get("wechatpay-signature")) + .timestamp(header.get("wechatpay-timestamp")) + .body(body) + .build(); + + // 创建通知配置 - 使用与下单方法相同的证书配置逻辑 + NotificationConfig config; + try { + if (active.equals("dev")) { + // 开发环境 - 构建包含租户号的私钥路径 + String tenantCertPath = "dev/wechat/" + tenantId; + String privateKeyPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getPrivateKeyFile(); + + logger.info("开发环境异步通知证书路径: {}", privateKeyPath); + logger.info("租户ID: {}, 证书目录: {}", tenantId, tenantCertPath); + + // 检查证书文件是否存在 + if (!certificateLoader.certificateExists(privateKeyPath)) { + logger.error("证书文件不存在: {}", privateKeyPath); + throw new RuntimeException("证书文件不存在: " + privateKeyPath); + } + + String privateKey = certificateLoader.loadCertificatePath(privateKeyPath); + + // 使用验证器获取有效的 APIv3 密钥 + String apiV3Key = wechatPayConfigValidator.getValidApiV3Key(payment); + + logger.info("私钥文件加载成功: {}", privateKey); + logger.info("使用APIv3密钥来源: {}", payment.getApiKey() != null && !payment.getApiKey().trim().isEmpty() ? "数据库配置" : "配置文件默认"); + logger.info("APIv3密钥长度: {}", apiV3Key != null ? apiV3Key.length() : 0); + logger.info("商户证书序列号: {}", payment.getMerchantSerialNumber()); + + // 使用自动证书配置 + config = new RSAAutoCertificateConfig.Builder() + .merchantId(payment.getMchId()) + .privateKeyFromPath(privateKey) + .merchantSerialNumber(payment.getMerchantSerialNumber()) + .apiV3Key(apiV3Key) + .build(); + + logger.info("✅ 开发环境使用自动证书配置创建通知解析器成功"); + } else { + // 生产环境 - 使用自动证书配置 + final String certRootPath = certConfig.getCertRootPath(); + logger.info("生产环境证书根路径: {}", certRootPath); + + String privateKeyRelativePath = payment.getApiclientKey(); + logger.info("数据库中的私钥相对路径: {}", privateKeyRelativePath); + + // 生产环境已经没有/file目录,所有路径都直接拼接到根路径 + String privateKeyFullPath; + // 处理数据库中可能存在的历史路径格式 + String cleanPath = privateKeyRelativePath; + if (privateKeyRelativePath.startsWith("/file/")) { + // 去掉历史的 /file/ 前缀 + cleanPath = privateKeyRelativePath.substring(6); + } else if (privateKeyRelativePath.startsWith("file/")) { + // 去掉历史的 file/ 前缀 + cleanPath = privateKeyRelativePath.substring(5); + } + // 确保路径以 / 开头 + if (!cleanPath.startsWith("/")) { + cleanPath = "/" + cleanPath; + } + privateKeyFullPath = certRootPath + cleanPath; + + logger.info("生产环境私钥完整路径: {}", privateKeyFullPath); + String privateKey = certificateLoader.loadCertificatePath(privateKeyFullPath); + String apiV3Key = payment.getApiKey(); + + // 使用自动证书配置 + config = new RSAAutoCertificateConfig.Builder() + .merchantId(payment.getMchId()) + .privateKeyFromPath(privateKey) + .merchantSerialNumber(payment.getMerchantSerialNumber()) + .apiV3Key(apiV3Key) + .build(); + + logger.info("✅ 生产环境使用自动证书配置创建通知解析器成功"); + } + } catch (Exception e) { + logger.error("❌ 创建通知配置失败 - 租户ID: {}, 商户号: {}", tenantId, payment.getMchId(), e); + logger.error("🔍 错误详情: {}", e.getMessage()); + logger.error("💡 请检查:"); + logger.error("1. 证书文件是否存在且路径正确"); + logger.error("2. APIv3密钥是否配置正确"); + logger.error("3. 商户证书序列号是否正确"); + logger.error("4. 网络连接是否正常"); + throw new RuntimeException("微信支付通知配置失败: " + e.getMessage(), e); + } + + // 初始化 NotificationParser + NotificationParser parser = new NotificationParser(config); + logger.info("✅ 通知解析器创建成功,准备解析异步通知"); + + // 以支付通知回调为例,验签、解密并转换成 Transaction + try { + logger.info("开始解析微信支付异步通知..."); + Transaction transaction = parser.parse(requestParam, Transaction.class); + logger.info("✅ 异步通知解析成功 - 交易状态: {}, 商户订单号: {}", + transaction.getTradeStateDesc(), transaction.getOutTradeNo()); + + if (StrUtil.equals("支付成功", transaction.getTradeStateDesc())) { + final String outTradeNo = transaction.getOutTradeNo(); + final String transactionId = transaction.getTransactionId(); + final Integer total = transaction.getAmount().getTotal(); + final String tradeStateDesc = transaction.getTradeStateDesc(); + final Transaction.TradeStateEnum tradeState = transaction.getTradeState(); + final Transaction.TradeTypeEnum tradeType = transaction.getTradeType(); + System.out.println("transaction = " + transaction); + System.out.println("tradeStateDesc = " + tradeStateDesc); + System.out.println("tradeType = " + tradeType); + System.out.println("tradeState = " + tradeState); + System.out.println("outTradeNo = " + outTradeNo); + System.out.println("amount = " + total); + // 1. 查询要处理的订单 + ShopOrder order = shopOrderService.getByOutTradeNo(outTradeNo); + logger.info("查询要处理的订单order = " + order); + // 2. 已支付则跳过 + if (order.getPayStatus().equals(true)) { + return "SUCCESS"; + } + // 2. 未支付则处理更新订单状态 + if (order.getPayStatus().equals(false)) { + // 5. TODO 处理订单状态 + order.setPayTime(LocalDateTime.now()); + order.setExpirationTime(order.getCreateTime()); + order.setPayStatus(true); + order.setTransactionId(transactionId); + order.setPayPrice(new BigDecimal(NumberUtil.decimalFormat("0.00", total * 0.01))); + order.setExpirationTime(LocalDateTime.now().plusYears(10)); + System.out.println("实际付款金额 = " + order.getPayPrice()); + // 更新订单状态并处理支付成功后的业务逻辑(包括累加商品销量) + shopOrderService.updateByOutTradeNo(order); + return "SUCCESS"; + } + } + } catch (Exception e) { + logger.error("❌ 处理微信支付异步通知失败 - 租户ID: {}, 商户号: {}", tenantId, payment.getMchId(), e); + logger.error("🔍 异常详情: {}", e.getMessage()); + logger.error("💡 可能的原因:"); + logger.error("1. 证书配置错误或证书文件损坏"); + logger.error("2. 微信支付平台证书已过期"); + logger.error("3. 签名验证失败"); + logger.error("4. 请求参数格式错误"); + + // 返回失败,微信会重试 + return "fail"; + } + + logger.warn("⚠️ 异步通知处理完成但未找到匹配的支付成功状态"); + return "fail"; + } + + @Operation(summary = "更新订单支付状态", description = "用户支付成功后主动同步订单状态") + @PutMapping("/payment-status") + public ApiResult updateOrderPaymentStatus(@RequestBody UpdatePaymentStatusRequest request) { + logger.info("收到更新订单支付状态请求: orderNo={}, paymentStatus={}, transactionId={}", + request.getOrderNo(), request.getPaymentStatus(), request.getTransactionId()); + + final User loginUser = getLoginUser(); + if (loginUser == null) { + return fail("请先登录"); + } + + try { + // 参数验证 + if (StrUtil.isBlank(request.getOrderNo())) { + return fail("订单号不能为空"); + } + + // 查询订单 + ShopOrder order = shopOrderService.getByOrderNo(request.getOrderNo(), loginUser.getTenantId()); + if (order == null) { + return fail("订单不存在"); + } + + // 权限验证:只能更新自己的订单 + if (!order.getUserId().equals(loginUser.getUserId())) { + return fail("无权限操作此订单"); + } + + // 如果订单已经是支付成功状态,直接返回成功 + if (order.getPayStatus()) { + logger.info("订单已经是支付成功状态,无需更新: orderNo={}", request.getOrderNo()); + return success("订单状态已是最新"); + } + + // 调用支付状态同步服务 + boolean updated = shopOrderService.syncPaymentStatus( + request.getOrderNo(), + request.getPaymentStatus(), + request.getTransactionId(), + request.getPayTime(), + loginUser.getTenantId() + ); + + if (updated) { + logger.info("订单支付状态更新成功: orderNo={}, paymentStatus={}", + request.getOrderNo(), request.getPaymentStatus()); + return success("订单状态更新成功"); + } else { + logger.warn("订单支付状态更新失败: orderNo={}", request.getOrderNo()); + return fail("订单状态更新失败"); + } + + } catch (Exception e) { + logger.error("更新订单支付状态异常: orderNo={}, error={}", request.getOrderNo(), e.getMessage(), e); + return fail("更新订单状态失败: " + e.getMessage()); + } + } + + /** + * 检查是否有订单取消权限 + */ + private boolean hasOrderCancelAuthority() { + try { + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication == null) { + return false; + } + + // 检查是否有管理员权限 + return authentication.getAuthorities().stream() + .anyMatch(authority -> + authority.getAuthority().equals("shop:shopOrder:cancel") || + authority.getAuthority().equals("shop:shopOrder:update") || + authority.getAuthority().equals("ROLE_ADMIN") || + authority.getAuthority().equals("shop:shopOrder:manage")); + } catch (Exception e) { + logger.warn("检查订单取消权限时发生异常", e); + return false; + } + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopOrderDeliveryController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopOrderDeliveryController.java new file mode 100644 index 0000000..7da73e8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopOrderDeliveryController.java @@ -0,0 +1,140 @@ +package com.gxwebsoft.shop.controller; + +import cn.binarywang.wx.miniapp.api.WxMaOrderShippingService; +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.api.impl.WxMaOrderShippingServiceImpl; +import cn.binarywang.wx.miniapp.bean.shop.request.shipping.*; +import cn.binarywang.wx.miniapp.bean.shop.response.WxMaOrderShippingInfoBaseResponse; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import com.gxwebsoft.common.core.utils.JSONUtil; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.entity.*; +import com.gxwebsoft.shop.service.ShopExpressService; +import com.gxwebsoft.shop.service.ShopOrderDeliveryService; +import com.gxwebsoft.shop.param.ShopOrderDeliveryParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.shop.service.impl.KuaiDi100Impl; +import com.kuaidi100.sdk.pojo.HttpResult; +import com.kuaidi100.sdk.request.BOrderReq; +import com.kuaidi100.sdk.response.SubscribeResp; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 发货单控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "发货单管理") +@RestController +@RequestMapping("/api/shop/shop-order-delivery") +public class ShopOrderDeliveryController extends BaseController { + @Resource + private ShopOrderDeliveryService shopOrderDeliveryService; + + + @Operation(summary = "发货回调") + @PostMapping("/notify") + @GetMapping("/notify") + public SubscribeResp notify(@RequestBody Map data) { + System.out.println("快递100回调:" + data); + SubscribeResp subscribeResp = new SubscribeResp(); + subscribeResp.setResult(Boolean.TRUE); + subscribeResp.setReturnCode("200"); + subscribeResp.setMessage("成功"); + return subscribeResp; + } + + @Operation(summary = "分页查询发货单") + @GetMapping("/page") + public ApiResult> page(ShopOrderDeliveryParam param) { + // 使用关联查询 + return success(shopOrderDeliveryService.pageRel(param)); + } + + @Operation(summary = "查询全部发货单") + @GetMapping() + public ApiResult> list(ShopOrderDeliveryParam param) { + // 使用关联查询 + return success(shopOrderDeliveryService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopOrderDelivery:list')") + @Operation(summary = "根据id查询发货单") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopOrderDeliveryService.getByIdRel(id)); + } + + @Operation(summary = "添加发货单") + @PostMapping() + public ApiResult save(@RequestBody ShopOrderDelivery shopOrderDelivery) { + if (shopOrderDeliveryService.save(shopOrderDelivery)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改发货单") + @PutMapping() + public ApiResult update(@RequestBody ShopOrderDelivery shopOrderDelivery) { + if (shopOrderDeliveryService.updateById(shopOrderDelivery)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除发货单") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopOrderDeliveryService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加发货单") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopOrderDeliveryService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改发货单") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopOrderDeliveryService, "delivery_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除发货单") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopOrderDeliveryService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopOrderDeliveryGoodsController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopOrderDeliveryGoodsController.java new file mode 100644 index 0000000..760becb --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopOrderDeliveryGoodsController.java @@ -0,0 +1,110 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopOrderDeliveryGoodsService; +import com.gxwebsoft.shop.entity.ShopOrderDeliveryGoods; +import com.gxwebsoft.shop.param.ShopOrderDeliveryGoodsParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 发货单商品控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "发货单商品管理") +@RestController +@RequestMapping("/api/shop/shop-order-delivery-goods") +public class ShopOrderDeliveryGoodsController extends BaseController { + @Resource + private ShopOrderDeliveryGoodsService shopOrderDeliveryGoodsService; + + @Operation(summary = "分页查询发货单商品") + @GetMapping("/page") + public ApiResult> page(ShopOrderDeliveryGoodsParam param) { + // 使用关联查询 + return success(shopOrderDeliveryGoodsService.pageRel(param)); + } + + @Operation(summary = "查询全部发货单商品") + @GetMapping() + public ApiResult> list(ShopOrderDeliveryGoodsParam param) { + // 使用关联查询 + return success(shopOrderDeliveryGoodsService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopOrderDeliveryGoods:list')") + @Operation(summary = "根据id查询发货单商品") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopOrderDeliveryGoodsService.getByIdRel(id)); + } + + @Operation(summary = "添加发货单商品") + @PostMapping() + public ApiResult save(@RequestBody ShopOrderDeliveryGoods shopOrderDeliveryGoods) { + if (shopOrderDeliveryGoodsService.save(shopOrderDeliveryGoods)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改发货单商品") + @PutMapping() + public ApiResult update(@RequestBody ShopOrderDeliveryGoods shopOrderDeliveryGoods) { + if (shopOrderDeliveryGoodsService.updateById(shopOrderDeliveryGoods)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除发货单商品") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopOrderDeliveryGoodsService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加发货单商品") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopOrderDeliveryGoodsService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改发货单商品") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopOrderDeliveryGoodsService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除发货单商品") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopOrderDeliveryGoodsService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopOrderExtractController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopOrderExtractController.java new file mode 100644 index 0000000..5b89db0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopOrderExtractController.java @@ -0,0 +1,115 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopOrderExtractService; +import com.gxwebsoft.shop.entity.ShopOrderExtract; +import com.gxwebsoft.shop.param.ShopOrderExtractParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 自提订单联系方式控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "自提订单联系方式管理") +@RestController +@RequestMapping("/api/shop/shop-order-extract") +public class ShopOrderExtractController extends BaseController { + @Resource + private ShopOrderExtractService shopOrderExtractService; + + @Operation(summary = "分页查询自提订单联系方式") + @GetMapping("/page") + public ApiResult> page(ShopOrderExtractParam param) { + // 使用关联查询 + return success(shopOrderExtractService.pageRel(param)); + } + + @Operation(summary = "查询全部自提订单联系方式") + @GetMapping() + public ApiResult> list(ShopOrderExtractParam param) { + // 使用关联查询 + return success(shopOrderExtractService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopOrderExtract:list')") + @Operation(summary = "根据id查询自提订单联系方式") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopOrderExtractService.getByIdRel(id)); + } + + @Operation(summary = "添加自提订单联系方式") + @PostMapping() + public ApiResult save(@RequestBody ShopOrderExtract shopOrderExtract) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopOrderExtract.setUserId(loginUser.getUserId()); + } + if (shopOrderExtractService.save(shopOrderExtract)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改自提订单联系方式") + @PutMapping() + public ApiResult update(@RequestBody ShopOrderExtract shopOrderExtract) { + if (shopOrderExtractService.updateById(shopOrderExtract)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除自提订单联系方式") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopOrderExtractService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加自提订单联系方式") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopOrderExtractService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改自提订单联系方式") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopOrderExtractService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除自提订单联系方式") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopOrderExtractService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopOrderGoodsController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopOrderGoodsController.java new file mode 100644 index 0000000..cc01666 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopOrderGoodsController.java @@ -0,0 +1,115 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopOrderGoodsService; +import com.gxwebsoft.shop.entity.ShopOrderGoods; +import com.gxwebsoft.shop.param.ShopOrderGoodsParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 商品信息控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "商品信息管理") +@RestController +@RequestMapping("/api/shop/shop-order-goods") +public class ShopOrderGoodsController extends BaseController { + @Resource + private ShopOrderGoodsService shopOrderGoodsService; + + @Operation(summary = "分页查询商品信息") + @GetMapping("/page") + public ApiResult> page(ShopOrderGoodsParam param) { + // 使用关联查询 + return success(shopOrderGoodsService.pageRel(param)); + } + + @Operation(summary = "查询全部商品信息") + @GetMapping() + public ApiResult> list(ShopOrderGoodsParam param) { + // 使用关联查询 + return success(shopOrderGoodsService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopOrderGoods:list')") + @Operation(summary = "根据id查询商品信息") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopOrderGoodsService.getByIdRel(id)); + } + + @Operation(summary = "添加商品信息") + @PostMapping() + public ApiResult save(@RequestBody ShopOrderGoods shopOrderGoods) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopOrderGoods.setUserId(loginUser.getUserId()); + } + if (shopOrderGoodsService.save(shopOrderGoods)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改商品信息") + @PutMapping() + public ApiResult update(@RequestBody ShopOrderGoods shopOrderGoods) { + if (shopOrderGoodsService.updateById(shopOrderGoods)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除商品信息") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopOrderGoodsService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加商品信息") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopOrderGoodsService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改商品信息") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopOrderGoodsService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除商品信息") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopOrderGoodsService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopOrderInfoController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopOrderInfoController.java new file mode 100644 index 0000000..e9f91d8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopOrderInfoController.java @@ -0,0 +1,115 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopOrderInfoService; +import com.gxwebsoft.shop.entity.ShopOrderInfo; +import com.gxwebsoft.shop.param.ShopOrderInfoParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 场地控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "场地管理") +@RestController +@RequestMapping("/api/shop/shop-order-info") +public class ShopOrderInfoController extends BaseController { + @Resource + private ShopOrderInfoService shopOrderInfoService; + + @Operation(summary = "分页查询场地") + @GetMapping("/page") + public ApiResult> page(ShopOrderInfoParam param) { + // 使用关联查询 + return success(shopOrderInfoService.pageRel(param)); + } + + @Operation(summary = "查询全部场地") + @GetMapping() + public ApiResult> list(ShopOrderInfoParam param) { + // 使用关联查询 + return success(shopOrderInfoService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopOrderInfo:list')") + @Operation(summary = "根据id查询场地") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopOrderInfoService.getByIdRel(id)); + } + + @Operation(summary = "添加场地") + @PostMapping() + public ApiResult save(@RequestBody ShopOrderInfo shopOrderInfo) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopOrderInfo.setUserId(loginUser.getUserId()); + } + if (shopOrderInfoService.save(shopOrderInfo)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改场地") + @PutMapping() + public ApiResult update(@RequestBody ShopOrderInfo shopOrderInfo) { + if (shopOrderInfoService.updateById(shopOrderInfo)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除场地") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopOrderInfoService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加场地") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopOrderInfoService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改场地") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopOrderInfoService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除场地") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopOrderInfoService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopOrderInfoLogController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopOrderInfoLogController.java new file mode 100644 index 0000000..b9c62b6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopOrderInfoLogController.java @@ -0,0 +1,110 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopOrderInfoLogService; +import com.gxwebsoft.shop.entity.ShopOrderInfoLog; +import com.gxwebsoft.shop.param.ShopOrderInfoLogParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 订单核销控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "订单核销管理") +@RestController +@RequestMapping("/api/shop/shop-order-info-log") +public class ShopOrderInfoLogController extends BaseController { + @Resource + private ShopOrderInfoLogService shopOrderInfoLogService; + + @Operation(summary = "分页查询订单核销") + @GetMapping("/page") + public ApiResult> page(ShopOrderInfoLogParam param) { + // 使用关联查询 + return success(shopOrderInfoLogService.pageRel(param)); + } + + @Operation(summary = "查询全部订单核销") + @GetMapping() + public ApiResult> list(ShopOrderInfoLogParam param) { + // 使用关联查询 + return success(shopOrderInfoLogService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopOrderInfoLog:list')") + @Operation(summary = "根据id查询订单核销") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopOrderInfoLogService.getByIdRel(id)); + } + + @Operation(summary = "添加订单核销") + @PostMapping() + public ApiResult save(@RequestBody ShopOrderInfoLog shopOrderInfoLog) { + if (shopOrderInfoLogService.save(shopOrderInfoLog)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改订单核销") + @PutMapping() + public ApiResult update(@RequestBody ShopOrderInfoLog shopOrderInfoLog) { + if (shopOrderInfoLogService.updateById(shopOrderInfoLog)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除订单核销") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopOrderInfoLogService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加订单核销") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopOrderInfoLogService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改订单核销") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopOrderInfoLogService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除订单核销") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopOrderInfoLogService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopRechargeOrderController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopRechargeOrderController.java new file mode 100644 index 0000000..1525208 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopRechargeOrderController.java @@ -0,0 +1,115 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopRechargeOrderService; +import com.gxwebsoft.shop.entity.ShopRechargeOrder; +import com.gxwebsoft.shop.param.ShopRechargeOrderParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 会员充值订单表控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Tag(name = "会员充值订单表管理") +@RestController +@RequestMapping("/api/shop/shop-recharge-order") +public class ShopRechargeOrderController extends BaseController { + @Resource + private ShopRechargeOrderService shopRechargeOrderService; + + @Operation(summary = "分页查询会员充值订单表") + @GetMapping("/page") + public ApiResult> page(ShopRechargeOrderParam param) { + // 使用关联查询 + return success(shopRechargeOrderService.pageRel(param)); + } + + @Operation(summary = "查询全部会员充值订单表") + @GetMapping() + public ApiResult> list(ShopRechargeOrderParam param) { + // 使用关联查询 + return success(shopRechargeOrderService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopRechargeOrder:list')") + @Operation(summary = "根据id查询会员充值订单表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopRechargeOrderService.getByIdRel(id)); + } + + @Operation(summary = "添加会员充值订单表") + @PostMapping() + public ApiResult save(@RequestBody ShopRechargeOrder shopRechargeOrder) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopRechargeOrder.setUserId(loginUser.getUserId()); + } + if (shopRechargeOrderService.save(shopRechargeOrder)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改会员充值订单表") + @PutMapping() + public ApiResult update(@RequestBody ShopRechargeOrder shopRechargeOrder) { + if (shopRechargeOrderService.updateById(shopRechargeOrder)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除会员充值订单表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopRechargeOrderService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加会员充值订单表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopRechargeOrderService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改会员充值订单表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopRechargeOrderService, "order_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除会员充值订单表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopRechargeOrderService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopSpecController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopSpecController.java new file mode 100644 index 0000000..60ddcc8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopSpecController.java @@ -0,0 +1,126 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopSpecService; +import com.gxwebsoft.shop.entity.ShopSpec; +import com.gxwebsoft.shop.param.ShopSpecParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 规格控制器 + * + * @author 科技小王子 + * @since 2025-05-01 09:44:00 + */ +@Tag(name = "规格管理") +@RestController +@RequestMapping("/api/shop/shop-spec") +public class ShopSpecController extends BaseController { + @Resource + private ShopSpecService shopSpecService; + + @Operation(summary = "分页查询规格") + @GetMapping("/page") + public ApiResult> page(ShopSpecParam param) { + // 使用关联查询 + return success(shopSpecService.pageRel(param)); + } + + @Operation(summary = "查询全部规格") + @GetMapping() + public ApiResult> list(ShopSpecParam param) { + // 使用关联查询 + return success(shopSpecService.listRel(param)); + } + + @Operation(summary = "根据id查询规格") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopSpecService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopSpec:save')") + @OperationLog + @Operation(summary = "添加规格") + @PostMapping() + public ApiResult save(@RequestBody ShopSpec shopSpec) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopSpec.setUserId(loginUser.getUserId()); + } + if (shopSpecService.save(shopSpec)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopSpec:update')") + @OperationLog + @Operation(summary = "修改规格") + @PutMapping() + public ApiResult update(@RequestBody ShopSpec shopSpec) { + if (shopSpecService.updateById(shopSpec)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopSpec:remove')") + @OperationLog + @Operation(summary = "删除规格") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopSpecService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopSpec:save')") + @OperationLog + @Operation(summary = "批量添加规格") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopSpecService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopSpec:update')") + @OperationLog + @Operation(summary = "批量修改规格") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopSpecService, "spec_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopSpec:remove')") + @OperationLog + @Operation(summary = "批量删除规格") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopSpecService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopSpecValueController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopSpecValueController.java new file mode 100644 index 0000000..6d98bb3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopSpecValueController.java @@ -0,0 +1,121 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopSpecValueService; +import com.gxwebsoft.shop.entity.ShopSpecValue; +import com.gxwebsoft.shop.param.ShopSpecValueParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 规格值控制器 + * + * @author 科技小王子 + * @since 2025-05-01 09:44:00 + */ +@Tag(name = "规格值管理") +@RestController +@RequestMapping("/api/shop/shop-spec-value") +public class ShopSpecValueController extends BaseController { + @Resource + private ShopSpecValueService shopSpecValueService; + + @Operation(summary = "分页查询规格值") + @GetMapping("/page") + public ApiResult> page(ShopSpecValueParam param) { + // 使用关联查询 + return success(shopSpecValueService.pageRel(param)); + } + + @Operation(summary = "查询全部规格值") + @GetMapping() + public ApiResult> list(ShopSpecValueParam param) { + // 使用关联查询 + return success(shopSpecValueService.listRel(param)); + } + + @Operation(summary = "根据id查询规格值") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopSpecValueService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopSpecValue:save')") + @OperationLog + @Operation(summary = "添加规格值") + @PostMapping() + public ApiResult save(@RequestBody ShopSpecValue shopSpecValue) { + if (shopSpecValueService.save(shopSpecValue)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopSpecValue:update')") + @OperationLog + @Operation(summary = "修改规格值") + @PutMapping() + public ApiResult update(@RequestBody ShopSpecValue shopSpecValue) { + if (shopSpecValueService.updateById(shopSpecValue)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopSpecValue:remove')") + @OperationLog + @Operation(summary = "删除规格值") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopSpecValueService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopSpecValue:save')") + @OperationLog + @Operation(summary = "批量添加规格值") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopSpecValueService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopSpecValue:update')") + @OperationLog + @Operation(summary = "批量修改规格值") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopSpecValueService, "spec_value_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopSpecValue:remove')") + @OperationLog + @Operation(summary = "批量删除规格值") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopSpecValueService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopSplashController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopSplashController.java new file mode 100644 index 0000000..d39e628 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopSplashController.java @@ -0,0 +1,115 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopSplashService; +import com.gxwebsoft.shop.entity.ShopSplash; +import com.gxwebsoft.shop.param.ShopSplashParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 开屏广告控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +@Tag(name = "开屏广告管理") +@RestController +@RequestMapping("/api/shop/shop-splash") +public class ShopSplashController extends BaseController { + @Resource + private ShopSplashService shopSplashService; + + @Operation(summary = "分页查询开屏广告") + @GetMapping("/page") + public ApiResult> page(ShopSplashParam param) { + // 使用关联查询 + return success(shopSplashService.pageRel(param)); + } + + @Operation(summary = "查询全部开屏广告") + @GetMapping() + public ApiResult> list(ShopSplashParam param) { + // 使用关联查询 + return success(shopSplashService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopSplash:list')") + @Operation(summary = "根据id查询开屏广告") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopSplashService.getByIdRel(id)); + } + + @Operation(summary = "添加开屏广告") + @PostMapping() + public ApiResult save(@RequestBody ShopSplash shopSplash) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopSplash.setUserId(loginUser.getUserId()); + } + if (shopSplashService.save(shopSplash)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改开屏广告") + @PutMapping() + public ApiResult update(@RequestBody ShopSplash shopSplash) { + if (shopSplashService.updateById(shopSplash)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除开屏广告") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopSplashService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加开屏广告") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopSplashService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改开屏广告") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopSplashService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除开屏广告") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopSplashService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopStoreController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopStoreController.java new file mode 100644 index 0000000..b89a714 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopStoreController.java @@ -0,0 +1,125 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopStoreService; +import com.gxwebsoft.shop.entity.ShopStore; +import com.gxwebsoft.shop.param.ShopStoreParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 门店控制器 + * + * @author 科技小王子 + * @since 2026-01-30 15:00:25 + */ +@Tag(name = "门店管理") +@RestController +@RequestMapping("/api/shop/shop-store") +public class ShopStoreController extends BaseController { + @Resource + private ShopStoreService shopStoreService; + + @Operation(summary = "分页查询门店") + @GetMapping("/page") + public ApiResult> page(ShopStoreParam param) { + // 使用关联查询 + return success(shopStoreService.pageRel(param)); + } + + @Operation(summary = "查询全部门店") + @GetMapping() + public ApiResult> list(ShopStoreParam param) { + // 使用关联查询 + return success(shopStoreService.listRel(param)); + } + + @Operation(summary = "根据id查询门店") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopStoreService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopStore:save')") + @OperationLog + @Operation(summary = "添加门店") + @PostMapping() + public ApiResult save(@RequestBody ShopStore shopStore) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // shopStore.setUserId(loginUser.getUserId()); + // } + if (shopStoreService.save(shopStore)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopStore:update')") + @OperationLog + @Operation(summary = "修改门店") + @PutMapping() + public ApiResult update(@RequestBody ShopStore shopStore) { + if (shopStoreService.updateById(shopStore)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopStore:remove')") + @OperationLog + @Operation(summary = "删除门店") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopStoreService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopStore:save')") + @OperationLog + @Operation(summary = "批量添加门店") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopStoreService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopStore:update')") + @OperationLog + @Operation(summary = "批量修改门店") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopStoreService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopStore:remove')") + @OperationLog + @Operation(summary = "批量删除门店") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopStoreService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopStoreRiderController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopStoreRiderController.java new file mode 100644 index 0000000..9cbb330 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopStoreRiderController.java @@ -0,0 +1,125 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopStoreRiderService; +import com.gxwebsoft.shop.entity.ShopStoreRider; +import com.gxwebsoft.shop.param.ShopStoreRiderParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 配送员控制器 + * + * @author 科技小王子 + * @since 2026-01-30 15:14:16 + */ +@Tag(name = "配送员管理") +@RestController +@RequestMapping("/api/shop/shop-store-rider") +public class ShopStoreRiderController extends BaseController { + @Resource + private ShopStoreRiderService shopStoreRiderService; + + @Operation(summary = "分页查询配送员") + @GetMapping("/page") + public ApiResult> page(ShopStoreRiderParam param) { + // 使用关联查询 + return success(shopStoreRiderService.pageRel(param)); + } + + @Operation(summary = "查询全部配送员") + @GetMapping() + public ApiResult> list(ShopStoreRiderParam param) { + // 使用关联查询 + return success(shopStoreRiderService.listRel(param)); + } + + @Operation(summary = "根据id查询配送员") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Long id) { + // 使用关联查询 + return success(shopStoreRiderService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopStoreRider:save')") + @OperationLog + @Operation(summary = "添加配送员") + @PostMapping() + public ApiResult save(@RequestBody ShopStoreRider shopStoreRider) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // shopStoreRider.setUserId(loginUser.getUserId()); + // } + if (shopStoreRiderService.save(shopStoreRider)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopStoreRider:update')") + @OperationLog + @Operation(summary = "修改配送员") + @PutMapping() + public ApiResult update(@RequestBody ShopStoreRider shopStoreRider) { + if (shopStoreRiderService.updateById(shopStoreRider)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopStoreRider:remove')") + @OperationLog + @Operation(summary = "删除配送员") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopStoreRiderService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopStoreRider:save')") + @OperationLog + @Operation(summary = "批量添加配送员") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopStoreRiderService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopStoreRider:update')") + @OperationLog + @Operation(summary = "批量修改配送员") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopStoreRiderService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopStoreRider:remove')") + @OperationLog + @Operation(summary = "批量删除配送员") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopStoreRiderService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopStoreUserController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopStoreUserController.java new file mode 100644 index 0000000..d76771f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopStoreUserController.java @@ -0,0 +1,126 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopStoreUserService; +import com.gxwebsoft.shop.entity.ShopStoreUser; +import com.gxwebsoft.shop.param.ShopStoreUserParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 店员控制器 + * + * @author 科技小王子 + * @since 2026-01-30 15:00:25 + */ +@Tag(name = "店员管理") +@RestController +@RequestMapping("/api/shop/shop-store-user") +public class ShopStoreUserController extends BaseController { + @Resource + private ShopStoreUserService shopStoreUserService; + + @Operation(summary = "分页查询店员") + @GetMapping("/page") + public ApiResult> page(ShopStoreUserParam param) { + // 使用关联查询 + return success(shopStoreUserService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopStoreUser:list')") + @Operation(summary = "查询全部店员") + @GetMapping() + public ApiResult> list(ShopStoreUserParam param) { + // 使用关联查询 + return success(shopStoreUserService.listRel(param)); + } + + @Operation(summary = "根据id查询店员") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopStoreUserService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopStoreUser:save')") + @OperationLog + @Operation(summary = "添加店员") + @PostMapping() + public ApiResult save(@RequestBody ShopStoreUser shopStoreUser) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // shopStoreUser.setUserId(loginUser.getUserId()); + // } + if (shopStoreUserService.save(shopStoreUser)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopStoreUser:update')") + @OperationLog + @Operation(summary = "修改店员") + @PutMapping() + public ApiResult update(@RequestBody ShopStoreUser shopStoreUser) { + if (shopStoreUserService.updateById(shopStoreUser)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopStoreUser:remove')") + @OperationLog + @Operation(summary = "删除店员") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopStoreUserService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopStoreUser:save')") + @OperationLog + @Operation(summary = "批量添加店员") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopStoreUserService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopStoreUser:update')") + @OperationLog + @Operation(summary = "批量修改店员") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopStoreUserService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopStoreUser:remove')") + @OperationLog + @Operation(summary = "批量删除店员") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopStoreUserService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopUserAddressController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopUserAddressController.java new file mode 100644 index 0000000..e2290f9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopUserAddressController.java @@ -0,0 +1,133 @@ + package com.gxwebsoft.shop.controller; + + import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; + import com.gxwebsoft.common.core.web.BaseController; + import com.gxwebsoft.shop.service.ShopUserAddressService; + import com.gxwebsoft.shop.entity.ShopUserAddress; + import com.gxwebsoft.shop.param.ShopUserAddressParam; + import com.gxwebsoft.common.core.web.ApiResult; + import com.gxwebsoft.common.core.web.PageResult; + import com.gxwebsoft.common.core.web.BatchParam; + import com.gxwebsoft.common.core.annotation.OperationLog; + import com.gxwebsoft.common.system.entity.User; + import io.swagger.v3.oas.annotations.tags.Tag; + import io.swagger.v3.oas.annotations.Operation; + import org.springframework.security.access.prepost.PreAuthorize; + import org.springframework.web.bind.annotation.*; + + import javax.annotation.Resource; + import java.util.List; + + /** + * 收货地址控制器 + * + * @author 科技小王子 + * @since 2025-07-22 23:06:40 + */ + @Tag(name = "收货地址管理") + @RestController + @RequestMapping("/api/shop/shop-user-address") + public class ShopUserAddressController extends BaseController { + @Resource + private ShopUserAddressService shopUserAddressService; + + @PreAuthorize("hasAuthority('shop:shopUserAddress:list')") + @Operation(summary = "分页查询收货地址") + @GetMapping("/page") + public ApiResult> page(ShopUserAddressParam param) { + // 使用关联查询 + return success(shopUserAddressService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopUserAddress:list')") + @Operation(summary = "查询全部收货地址") + @GetMapping() + public ApiResult> list(ShopUserAddressParam param) { + // 使用关联查询 + param.setUserId(getLoginUser().getUserId()); + return success(shopUserAddressService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopUserAddress:list')") + @Operation(summary = "根据id查询收货地址") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopUserAddressService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopUserAddress:save')") + @OperationLog + @Operation(summary = "添加收货地址") + @PostMapping() + public ApiResult save(@RequestBody ShopUserAddress shopUserAddress) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopUserAddress.setUserId(loginUser.getUserId()); + if (shopUserAddressService.count(new LambdaQueryWrapper().eq(ShopUserAddress::getUserId, loginUser.getUserId()).eq(ShopUserAddress::getAddress, shopUserAddress.getAddress())) > 0) { + return success("该地址已存在"); + } + } + if (shopUserAddressService.save(shopUserAddress)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUserAddress:update')") + @OperationLog + @Operation(summary = "修改收货地址") + @PutMapping() + public ApiResult update(@RequestBody ShopUserAddress shopUserAddress) { + if (shopUserAddressService.updateById(shopUserAddress)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUserAddress:remove')") + @OperationLog + @Operation(summary = "删除收货地址") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopUserAddressService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUserAddress:save')") + @OperationLog + @Operation(summary = "批量添加收货地址") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopUserAddressService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUserAddress:update')") + @OperationLog + @Operation(summary = "批量修改收货地址") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopUserAddressService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUserAddress:remove')") + @OperationLog + @Operation(summary = "批量删除收货地址") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopUserAddressService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + } diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopUserBalanceLogController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopUserBalanceLogController.java new file mode 100644 index 0000000..0db1573 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopUserBalanceLogController.java @@ -0,0 +1,115 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopUserBalanceLogService; +import com.gxwebsoft.shop.entity.ShopUserBalanceLog; +import com.gxwebsoft.shop.param.ShopUserBalanceLogParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 用户余额变动明细表控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +@Tag(name = "用户余额变动明细表管理") +@RestController +@RequestMapping("/api/shop/shop-user-balance-log") +public class ShopUserBalanceLogController extends BaseController { + @Resource + private ShopUserBalanceLogService shopUserBalanceLogService; + + @Operation(summary = "分页查询用户余额变动明细表") + @GetMapping("/page") + public ApiResult> page(ShopUserBalanceLogParam param) { + // 使用关联查询 + return success(shopUserBalanceLogService.pageRel(param)); + } + + @Operation(summary = "查询全部用户余额变动明细表") + @GetMapping() + public ApiResult> list(ShopUserBalanceLogParam param) { + // 使用关联查询 + return success(shopUserBalanceLogService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopUserBalanceLog:list')") + @Operation(summary = "根据id查询用户余额变动明细表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopUserBalanceLogService.getByIdRel(id)); + } + + @Operation(summary = "添加用户余额变动明细表") + @PostMapping() + public ApiResult save(@RequestBody ShopUserBalanceLog shopUserBalanceLog) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopUserBalanceLog.setUserId(loginUser.getUserId()); + } + if (shopUserBalanceLogService.save(shopUserBalanceLog)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改用户余额变动明细表") + @PutMapping() + public ApiResult update(@RequestBody ShopUserBalanceLog shopUserBalanceLog) { + if (shopUserBalanceLogService.updateById(shopUserBalanceLog)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除用户余额变动明细表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopUserBalanceLogService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加用户余额变动明细表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopUserBalanceLogService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改用户余额变动明细表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopUserBalanceLogService, "log_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除用户余额变动明细表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopUserBalanceLogService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopUserCollectionController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopUserCollectionController.java new file mode 100644 index 0000000..0e01d68 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopUserCollectionController.java @@ -0,0 +1,115 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopUserCollectionService; +import com.gxwebsoft.shop.entity.ShopUserCollection; +import com.gxwebsoft.shop.param.ShopUserCollectionParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 我的收藏控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +@Tag(name = "我的收藏管理") +@RestController +@RequestMapping("/api/shop/shop-user-collection") +public class ShopUserCollectionController extends BaseController { + @Resource + private ShopUserCollectionService shopUserCollectionService; + + @Operation(summary = "分页查询我的收藏") + @GetMapping("/page") + public ApiResult> page(ShopUserCollectionParam param) { + // 使用关联查询 + return success(shopUserCollectionService.pageRel(param)); + } + + @Operation(summary = "查询全部我的收藏") + @GetMapping() + public ApiResult> list(ShopUserCollectionParam param) { + // 使用关联查询 + return success(shopUserCollectionService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopUserCollection:list')") + @Operation(summary = "根据id查询我的收藏") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopUserCollectionService.getByIdRel(id)); + } + + @Operation(summary = "添加我的收藏") + @PostMapping() + public ApiResult save(@RequestBody ShopUserCollection shopUserCollection) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopUserCollection.setUserId(loginUser.getUserId()); + } + if (shopUserCollectionService.save(shopUserCollection)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改我的收藏") + @PutMapping() + public ApiResult update(@RequestBody ShopUserCollection shopUserCollection) { + if (shopUserCollectionService.updateById(shopUserCollection)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除我的收藏") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopUserCollectionService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加我的收藏") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopUserCollectionService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改我的收藏") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopUserCollectionService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除我的收藏") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopUserCollectionService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopUserController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopUserController.java new file mode 100644 index 0000000..10f53a5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopUserController.java @@ -0,0 +1,127 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.shop.entity.ShopUser; +import com.gxwebsoft.shop.param.ShopUserParam; +import com.gxwebsoft.shop.service.ShopUserService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 用户记录表控制器 + * + * @author 科技小王子 + * @since 2025-10-03 13:41:09 + */ +@Tag(name = "用户记录表管理") +@RestController +@RequestMapping("/api/shop/shop-user") +public class ShopUserController extends BaseController { + @Resource + private ShopUserService shopUserService; + + @PreAuthorize("hasAuthority('shop:shopUser:list')") + @Operation(summary = "分页查询用户记录表") + @GetMapping("/page") + public ApiResult> page(ShopUserParam param) { + // 使用关联查询 + return success(shopUserService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopUser:list')") + @Operation(summary = "查询全部用户记录表") + @GetMapping() + public ApiResult> list(ShopUserParam param) { + // 使用关联查询 + return success(shopUserService.listRel(param)); + } + + @Operation(summary = "根据userId查询用户记录表") + @GetMapping("/{userId}") + public ApiResult get(@PathVariable("userId") Integer userId) { + // 使用关联查询 + return success(shopUserService.getByIdRel(userId)); + } + + @PreAuthorize("hasAuthority('shop:shopUser:save')") + @OperationLog + @Operation(summary = "添加用户记录表") + @PostMapping() + public ApiResult save(@RequestBody ShopUser shopUser) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopUser.setUserId(loginUser.getUserId()); + } + if (shopUserService.save(shopUser)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUser:update')") + @OperationLog + @Operation(summary = "修改用户记录表") + @PutMapping() + public ApiResult update(@RequestBody ShopUser shopUser) { + if (shopUserService.updateById(shopUser)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUser:remove')") + @OperationLog + @Operation(summary = "删除用户记录表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopUserService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUser:save')") + @OperationLog + @Operation(summary = "批量添加用户记录表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopUserService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUser:update')") + @OperationLog + @Operation(summary = "批量修改用户记录表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopUserService, "user_id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUser:remove')") + @OperationLog + @Operation(summary = "批量删除用户记录表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopUserService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopUserCouponController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopUserCouponController.java new file mode 100644 index 0000000..a9382b2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopUserCouponController.java @@ -0,0 +1,309 @@ +package com.gxwebsoft.shop.controller; + +import cn.hutool.core.date.LocalDateTimeUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.entity.ShopCoupon; +import com.gxwebsoft.shop.entity.ShopCouponApplyCate; +import com.gxwebsoft.shop.entity.ShopCouponApplyItem; +import com.gxwebsoft.shop.service.ShopCouponApplyCateService; +import com.gxwebsoft.shop.service.ShopCouponApplyItemService; +import com.gxwebsoft.shop.service.ShopCouponService; +import com.gxwebsoft.shop.service.ShopUserCouponService; +import com.gxwebsoft.shop.service.CouponStatusService; +import com.gxwebsoft.shop.entity.ShopUserCoupon; +import com.gxwebsoft.shop.param.ShopUserCouponParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.math.BigDecimal; + +import javax.annotation.Resource; +import java.text.ParseException; +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; +import java.util.List; + +/** + * 用户优惠券控制器 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Slf4j +@Tag(name = "用户优惠券管理") +@RestController +@RequestMapping("/api/shop/shop-user-coupon") +public class ShopUserCouponController extends BaseController { + @Resource + private ShopUserCouponService shopUserCouponService; + @Resource + private ShopCouponService couponService; + @Resource + private ShopCouponApplyCateService couponApplyCateService; + @Resource + private ShopCouponApplyItemService couponApplyItemService; + @Resource + private CouponStatusService couponStatusService; + + @Operation(summary = "用户优惠券列表") + @PostMapping("/list") + public ApiResult> list(@RequestBody ShopUserCoupon userCouponParam) throws ParseException { + MPJLambdaWrapper queryWrapper = new MPJLambdaWrapper() + .selectAll(ShopUserCoupon.class) + .selectAs(ShopCoupon::getName, ShopCoupon::getName) + .eq(ShopUserCoupon::getUserId, getLoginUserId()) + .leftJoin(ShopCoupon.class, ShopCoupon::getId, ShopUserCoupon::getCouponId); + if (userCouponParam.getIsExpire() != null) + queryWrapper.eq(ShopUserCoupon::getIsExpire, userCouponParam.getIsExpire()); + if (userCouponParam.getIsUse() != null) queryWrapper.eq(ShopUserCoupon::getIsUse, userCouponParam.getIsUse()); + List userCouponList = shopUserCouponService.list(queryWrapper); + for (ShopUserCoupon userCoupon : userCouponList) { + try { + // 使用新的状态管理服务检查和更新状态 + couponStatusService.checkAndUpdateCouponStatus(userCoupon); + + // 确保BigDecimal字段不为null时才处理 + if (userCoupon.getReducePrice() == null) { + userCoupon.setReducePrice(BigDecimal.ZERO); + } + if (userCoupon.getMinPrice() == null) { + userCoupon.setMinPrice(BigDecimal.ZERO); + } + + ShopCoupon coupon = couponService.getById(userCoupon.getCouponId()); + if (coupon != null) { + // 确保优惠券模板的BigDecimal字段不为null + if (coupon.getReducePrice() == null) { + coupon.setReducePrice(BigDecimal.ZERO); + } + if (coupon.getMinPrice() == null) { + coupon.setMinPrice(BigDecimal.ZERO); + } + + coupon.setCouponApplyCateList(couponApplyCateService.list( + new LambdaQueryWrapper() + .eq(ShopCouponApplyCate::getCouponId, userCoupon.getCouponId()) + )); + coupon.setCouponApplyItemList(couponApplyItemService.list( + new LambdaQueryWrapper() + .eq(ShopCouponApplyItem::getCouponId, userCoupon.getCouponId()) + )); + userCoupon.setCouponItem(coupon); + } + } catch (Exception e) { + log.error("处理用户优惠券数据异常: {}", e.getMessage(), e); + // 设置默认值避免序列化异常 + if (userCoupon.getReducePrice() == null) { + userCoupon.setReducePrice(BigDecimal.ZERO); + } + if (userCoupon.getMinPrice() == null) { + userCoupon.setMinPrice(BigDecimal.ZERO); + } + } + } + return success(userCouponList); + } + + @Operation(summary = "领取优惠券") + @PostMapping("/take") + public ApiResult take(@RequestBody ShopUserCoupon userCoupon) { + final User loginUser = getLoginUser(); + if (loginUser == null) return fail("请先登录"); + ShopCoupon coupon = couponService.getByIdRel(userCoupon.getCouponId()); + + // 检查优惠券是否存在 + if (coupon == null) return fail("优惠券不存在"); + + // 安全地检查已领取数量,避免空指针异常 + Integer receiveNum = coupon.getReceiveNum(); + if (receiveNum == null) receiveNum = 0; + + if (coupon.getTotalCount() != -1 && receiveNum >= coupon.getTotalCount()) return fail("已经被领完了"); + List userCouponList = shopUserCouponService.list( + new LambdaQueryWrapper() + .eq(ShopUserCoupon::getCouponId, userCoupon.getCouponId()) + .eq(ShopUserCoupon::getUserId, getLoginUserId()) + ); + int userNotUsedNum = 0; + for (ShopUserCoupon userCouponItem : userCouponList) { + if (userCouponItem.getIsUse().equals(0)) userNotUsedNum++; + } + if (userNotUsedNum > 0) return fail("您还有未使用的优惠券,无法领取"); + if (coupon.getLimitPerUser() > -1) { + if (userCouponList.size() >= coupon.getLimitPerUser()) + return fail("每用户最多领取" + coupon.getLimitPerUser() + "张优惠券"); + } + userCoupon.setType(coupon.getType()); + userCoupon.setReducePrice(coupon.getReducePrice()); + userCoupon.setDiscount(coupon.getDiscount()); + userCoupon.setMinPrice(coupon.getMinPrice()); + Integer expireType = coupon.getExpireType(); + userCoupon.setExpireType(expireType); + if (expireType == 10) { + userCoupon.setStartTime(LocalDateTime.now()); + userCoupon.setEndTime(LocalDateTimeUtil.offset(userCoupon.getStartTime(), coupon.getExpireDay(), ChronoUnit.DAYS)); + } else { + userCoupon.setStartTime(coupon.getStartTime()); + userCoupon.setEndTime(coupon.getEndTime()); + } + userCoupon.setUserId(getLoginUserId()); + shopUserCouponService.save(userCoupon); + + // 安全地更新已领取数量,避免空指针异常 + Integer currentReceiveNum = coupon.getReceiveNum(); + if (currentReceiveNum == null) currentReceiveNum = 0; + coupon.setReceiveNum(currentReceiveNum + 1); + couponService.updateById(coupon); + return success("领取成功"); + } + + @Operation(summary = "分页查询用户优惠券") + @GetMapping("/page") + public ApiResult> page(ShopUserCouponParam param) { + // 使用关联查询 + return success(shopUserCouponService.pageRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopUserCoupon:list')") + @Operation(summary = "查询全部用户优惠券") + @GetMapping() + public ApiResult> list(ShopUserCouponParam param) { + // 使用关联查询 + return success(shopUserCouponService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopUserCoupon:list')") + @Operation(summary = "根据id查询用户优惠券") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopUserCouponService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopUserCoupon:save')") + @OperationLog + @Operation(summary = "添加用户优惠券") + @PostMapping() + public ApiResult save(@RequestBody ShopUserCoupon shopUserCoupon) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopUserCoupon.setUserId(loginUser.getUserId()); + } + if (shopUserCouponService.save(shopUserCoupon)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUserCoupon:update')") + @OperationLog + @Operation(summary = "修改用户优惠券") + @PutMapping() + public ApiResult update(@RequestBody ShopUserCoupon shopUserCoupon) { + if (shopUserCouponService.updateById(shopUserCoupon)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUserCoupon:remove')") + @OperationLog + @Operation(summary = "删除用户优惠券") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopUserCouponService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUserCoupon:save')") + @OperationLog + @Operation(summary = "批量添加用户优惠券") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopUserCouponService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUserCoupon:update')") + @OperationLog + @Operation(summary = "批量修改用户优惠券") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopUserCouponService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUserCoupon:remove')") + @OperationLog + @Operation(summary = "批量删除用户优惠券") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopUserCouponService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "获取我的可用优惠券") + @GetMapping("/my/available") + public ApiResult> getMyAvailableCoupons() { + try { + List coupons = couponStatusService.getAvailableCoupons(getLoginUserId()); + return success("获取成功", coupons); + } catch (Exception e) { + return fail("获取失败",null); + } + } + + @Operation(summary = "获取我的已使用优惠券") + @GetMapping("/my/used") + public ApiResult> getMyUsedCoupons() { + try { + List coupons = couponStatusService.getUsedCoupons(getLoginUserId()); + return success("获取成功", coupons); + } catch (Exception e) { + return fail("获取失败",null); + } + } + + @Operation(summary = "获取我的已过期优惠券") + @GetMapping("/my/expired") + public ApiResult> getMyExpiredCoupons() { + try { + List coupons = couponStatusService.getExpiredCoupons(getLoginUserId()); + return success("获取成功", coupons); + } catch (Exception e) { + return fail("获取失败",null); + } + } + + @Operation(summary = "获取我的优惠券统计") + @GetMapping("/my/statistics") + public ApiResult getMyCouponStatistics() { + try { + CouponStatusService.CouponStatusResult result = + couponStatusService.getUserCouponsGroupByStatus(getLoginUserId()); + return success("获取成功", result); + } catch (Exception e) { + return fail("获取失败",null); + } + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopUserRefereeController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopUserRefereeController.java new file mode 100644 index 0000000..0309be9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopUserRefereeController.java @@ -0,0 +1,134 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopUserRefereeService; +import com.gxwebsoft.shop.entity.ShopUserReferee; +import com.gxwebsoft.shop.param.ShopUserRefereeParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 用户推荐关系表控制器 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Tag(name = "用户推荐关系表管理") +@RestController +@RequestMapping("/api/shop/shop-user-referee") +public class ShopUserRefereeController extends BaseController { + @Resource + private ShopUserRefereeService shopUserRefereeService; + + @Operation(summary = "分页查询用户推荐关系表") + @GetMapping("/page") + public ApiResult> page(ShopUserRefereeParam param) { + // 使用关联查询 + return success(shopUserRefereeService.pageRel(param)); + } + + @Operation(summary = "查询全部用户推荐关系表") + @GetMapping() + public ApiResult> list(ShopUserRefereeParam param) { + // 使用关联查询 + return success(shopUserRefereeService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopUserReferee:list')") + @Operation(summary = "根据id查询用户推荐关系表") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopUserRefereeService.getByIdRel(id)); + } + + @Operation(summary = "根据userId查询推荐人信息") + @GetMapping("/getByUserId/{userId}") + public ApiResult getByUserId(@PathVariable("userId") Integer userId) { + // 使用关联查询 + return success(shopUserRefereeService.getByUserIdRel(userId)); + } + + @PreAuthorize("hasAuthority('shop:shopUserReferee:save')") + @OperationLog + @Operation(summary = "添加用户推荐关系表") + @PostMapping() + public ApiResult save(@RequestBody ShopUserReferee shopUserReferee) { + // 记录当前登录用户id + User loginUser = getLoginUser(); + if (loginUser != null) { + shopUserReferee.setUserId(loginUser.getUserId()); + } + if (shopUserRefereeService.save(shopUserReferee)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUserReferee:update')") + @OperationLog + @Operation(summary = "修改用户推荐关系表") + @PutMapping() + public ApiResult update(@RequestBody ShopUserReferee shopUserReferee) { + if (shopUserRefereeService.updateById(shopUserReferee)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUserReferee:remove')") + @OperationLog + @Operation(summary = "删除用户推荐关系表") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopUserRefereeService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUserReferee:save')") + @OperationLog + @Operation(summary = "批量添加用户推荐关系表") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopUserRefereeService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUserReferee:update')") + @OperationLog + @Operation(summary = "批量修改用户推荐关系表") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopUserRefereeService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopUserReferee:remove')") + @OperationLog + @Operation(summary = "批量删除用户推荐关系表") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopUserRefereeService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopWarehouseController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopWarehouseController.java new file mode 100644 index 0000000..727d51d --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopWarehouseController.java @@ -0,0 +1,125 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopWarehouseService; +import com.gxwebsoft.shop.entity.ShopWarehouse; +import com.gxwebsoft.shop.param.ShopWarehouseParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 仓库控制器 + * + * @author 科技小王子 + * @since 2026-01-30 17:46:48 + */ +@Tag(name = "仓库管理") +@RestController +@RequestMapping("/api/shop/shop-warehouse") +public class ShopWarehouseController extends BaseController { + @Resource + private ShopWarehouseService shopWarehouseService; + + @Operation(summary = "分页查询仓库") + @GetMapping("/page") + public ApiResult> page(ShopWarehouseParam param) { + // 使用关联查询 + return success(shopWarehouseService.pageRel(param)); + } + + @Operation(summary = "查询全部仓库") + @GetMapping() + public ApiResult> list(ShopWarehouseParam param) { + // 使用关联查询 + return success(shopWarehouseService.listRel(param)); + } + + @Operation(summary = "根据id查询仓库") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopWarehouseService.getByIdRel(id)); + } + + @PreAuthorize("hasAuthority('shop:shopWarehouse:save')") + @OperationLog + @Operation(summary = "添加仓库") + @PostMapping() + public ApiResult save(@RequestBody ShopWarehouse shopWarehouse) { + // 记录当前登录用户id + // User loginUser = getLoginUser(); + // if (loginUser != null) { + // shopWarehouse.setUserId(loginUser.getUserId()); + // } + if (shopWarehouseService.save(shopWarehouse)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopWarehouse:update')") + @OperationLog + @Operation(summary = "修改仓库") + @PutMapping() + public ApiResult update(@RequestBody ShopWarehouse shopWarehouse) { + if (shopWarehouseService.updateById(shopWarehouse)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopWarehouse:remove')") + @OperationLog + @Operation(summary = "删除仓库") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopWarehouseService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @PreAuthorize("hasAuthority('shop:shopWarehouse:save')") + @OperationLog + @Operation(summary = "批量添加仓库") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopWarehouseService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @PreAuthorize("hasAuthority('shop:shopWarehouse:update')") + @OperationLog + @Operation(summary = "批量修改仓库") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopWarehouseService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @PreAuthorize("hasAuthority('shop:shopWarehouse:remove')") + @OperationLog + @Operation(summary = "批量删除仓库") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopWarehouseService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopWechatDepositController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopWechatDepositController.java new file mode 100644 index 0000000..7c29f20 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopWechatDepositController.java @@ -0,0 +1,110 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.service.ShopWechatDepositService; +import com.gxwebsoft.shop.entity.ShopWechatDeposit; +import com.gxwebsoft.shop.param.ShopWechatDepositParam; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.BatchParam; +import com.gxwebsoft.common.core.annotation.OperationLog; +import com.gxwebsoft.common.system.entity.User; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 押金控制器 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +@Tag(name = "押金管理") +@RestController +@RequestMapping("/api/shop/shop-wechat-deposit") +public class ShopWechatDepositController extends BaseController { + @Resource + private ShopWechatDepositService shopWechatDepositService; + + @Operation(summary = "分页查询押金") + @GetMapping("/page") + public ApiResult> page(ShopWechatDepositParam param) { + // 使用关联查询 + return success(shopWechatDepositService.pageRel(param)); + } + + @Operation(summary = "查询全部押金") + @GetMapping() + public ApiResult> list(ShopWechatDepositParam param) { + // 使用关联查询 + return success(shopWechatDepositService.listRel(param)); + } + + @PreAuthorize("hasAuthority('shop:shopWechatDeposit:list')") + @Operation(summary = "根据id查询押金") + @GetMapping("/{id}") + public ApiResult get(@PathVariable("id") Integer id) { + // 使用关联查询 + return success(shopWechatDepositService.getByIdRel(id)); + } + + @Operation(summary = "添加押金") + @PostMapping() + public ApiResult save(@RequestBody ShopWechatDeposit shopWechatDeposit) { + if (shopWechatDepositService.save(shopWechatDeposit)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "修改押金") + @PutMapping() + public ApiResult update(@RequestBody ShopWechatDeposit shopWechatDeposit) { + if (shopWechatDepositService.updateById(shopWechatDeposit)) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "删除押金") + @DeleteMapping("/{id}") + public ApiResult remove(@PathVariable("id") Integer id) { + if (shopWechatDepositService.removeById(id)) { + return success("删除成功"); + } + return fail("删除失败"); + } + + @Operation(summary = "批量添加押金") + @PostMapping("/batch") + public ApiResult saveBatch(@RequestBody List list) { + if (shopWechatDepositService.saveBatch(list)) { + return success("添加成功"); + } + return fail("添加失败"); + } + + @Operation(summary = "批量修改押金") + @PutMapping("/batch") + public ApiResult removeBatch(@RequestBody BatchParam batchParam) { + if (batchParam.update(shopWechatDepositService, "id")) { + return success("修改成功"); + } + return fail("修改失败"); + } + + @Operation(summary = "批量删除押金") + @DeleteMapping("/batch") + public ApiResult removeBatch(@RequestBody List ids) { + if (shopWechatDepositService.removeByIds(ids)) { + return success("删除成功"); + } + return fail("删除失败"); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/UserCardController.java b/src/main/java/com/gxwebsoft/shop/controller/UserCardController.java new file mode 100644 index 0000000..8a7869b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/UserCardController.java @@ -0,0 +1,125 @@ +package com.gxwebsoft.shop.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.dto.UserCardStats; +import com.gxwebsoft.shop.entity.ShopGift; +import com.gxwebsoft.shop.entity.ShopUserCoupon; +import com.gxwebsoft.shop.mapper.UserCardStatsMapper; +import com.gxwebsoft.shop.service.ShopGiftService; +import com.gxwebsoft.shop.service.ShopUserCouponService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +@Tag(name = "用户卡包") +@RestController +@RequestMapping("/api/user/card") +public class UserCardController extends BaseController { + + private static final long USER_CARD_STATS_CACHE_SECONDS = 60L; + private static final DateTimeFormatter DATETIME_FMT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + + @Resource + private RedisUtil redisUtil; + @Resource + private UserCardStatsMapper userCardStatsMapper; + @Resource + private ShopUserCouponService shopUserCouponService; + @Resource + private ShopGiftService shopGiftService; + + @Operation(summary = "获取当前用户卡包统计(余额/积分/优惠券/礼品卡,60s 缓存)") + @GetMapping("/stats") + public ApiResult getUserCardStats() { + Integer userId = getLoginUserId(); + if (userId == null) { + return fail("请先登录", null); + } + + String cacheKey = "UserCard:Stats:" + + (getTenantId() == null ? "0" : getTenantId()) + + ":" + userId; + UserCardStats cached = redisUtil.get(cacheKey, UserCardStats.class); + if (cached != null) { + return success("ok", cached); + } + + // 余额/积分:从 core 库取(避免 modules 库不存在 sys_user 导致报错);优惠券/礼品卡用 COUNT 聚合 + Integer tenantId = getTenantId(); + Map bp = userCardStatsMapper.selectBalancePoints(userId, tenantId); + BigDecimal balance = toBigDecimal(bp == null ? null : bp.get("balance")); + Integer points = toIntObj(bp == null ? null : bp.get("points")); + + long coupons = shopUserCouponService.count(new LambdaQueryWrapper() + .eq(ShopUserCoupon::getUserId, userId) + .eq(ShopUserCoupon::getStatus, ShopUserCoupon.STATUS_UNUSED)); + + long giftCards = shopGiftService.count(new LambdaQueryWrapper() + .eq(ShopGift::getUserId, userId) + .eq(ShopGift::getStatus, 0)); + + UserCardStats stats = new UserCardStats(); + stats.setBalance(balance.setScale(2, RoundingMode.HALF_UP).toPlainString()); + stats.setPoints(points); + stats.setCoupons(toInt(coupons)); + stats.setGiftCards(toInt(giftCards)); + stats.setLastUpdateTime(LocalDateTime.now().format(DATETIME_FMT)); + + redisUtil.set(cacheKey, stats, USER_CARD_STATS_CACHE_SECONDS, TimeUnit.SECONDS); + return success("ok", stats); + } + + private static BigDecimal toBigDecimal(Object value) { + if (value == null) { + return BigDecimal.ZERO; + } + if (value instanceof BigDecimal) { + return (BigDecimal) value; + } + if (value instanceof Number) { + return BigDecimal.valueOf(((Number) value).doubleValue()); + } + try { + return new BigDecimal(String.valueOf(value)); + } catch (Exception e) { + return BigDecimal.ZERO; + } + } + + private static Integer toIntObj(Object value) { + if (value == null) { + return 0; + } + if (value instanceof Number) { + return ((Number) value).intValue(); + } + try { + return Integer.parseInt(String.valueOf(value)); + } catch (Exception e) { + return 0; + } + } + + private static Integer toInt(long value) { + if (value <= 0) { + return 0; + } + if (value > Integer.MAX_VALUE) { + return Integer.MAX_VALUE; + } + return (int) value; + } +} diff --git a/src/main/java/com/gxwebsoft/shop/controller/UserOrderController.java b/src/main/java/com/gxwebsoft/shop/controller/UserOrderController.java new file mode 100644 index 0000000..dd9bf32 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/controller/UserOrderController.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.controller; + +import com.gxwebsoft.common.core.web.ApiResult; +import com.gxwebsoft.common.core.web.BaseController; +import com.gxwebsoft.shop.dto.UserOrderStats; +import com.gxwebsoft.shop.service.ShopOrderService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +/** + * 用户侧订单接口 + */ +@Tag(name = "用户订单") +@RestController +@RequestMapping("/api/user/orders") +public class UserOrderController extends BaseController { + + @Resource + private ShopOrderService shopOrderService; + + @Operation(summary = "获取当前用户订单状态统计(一次聚合查询,带 60s 缓存)") + @GetMapping("/stats") + public ApiResult getUserOrderStats(@RequestParam(value = "type", required = false) Integer type) { + Integer userId = getLoginUserId(); + if (userId == null) { + return fail("用户未登录", null); + } + return success(shopOrderService.getUserOrderStats(userId, getTenantId(), type)); + } +} + diff --git a/src/main/java/com/gxwebsoft/shop/dto/OrderCreateRequest.java b/src/main/java/com/gxwebsoft/shop/dto/OrderCreateRequest.java new file mode 100644 index 0000000..be9ca22 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/dto/OrderCreateRequest.java @@ -0,0 +1,179 @@ +package com.gxwebsoft.shop.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.math.BigDecimal; +import java.util.List; + +/** + * 订单创建请求DTO + * + * @author 科技小王子 + * @since 2025-01-26 + */ +@Data +@Schema(name = "OrderCreateRequest", description = "订单创建请求") +public class OrderCreateRequest { + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "订单类型,0商城订单 1预定订单/外卖 2会员卡") + @NotNull(message = "订单类型不能为空") + @Min(value = 0, message = "订单类型值无效") + @Max(value = 2, message = "订单类型值无效") + private Integer type; + + @Size(max = 60, message = "备注长度不能超过60个字符") + @Schema(description = "订单标题") + private String title; + + @Schema(description = "快递/自提") + private Integer deliveryType; + + @Schema(description = "下单渠道,0小程序预定 1俱乐部训练场 3活动订场") + private Integer channel; + + @Schema(description = "商户ID") + private Long merchantId; + + @Schema(description = "商户名称") + private String merchantName; + + @Schema(description = "商户编号") + private String merchantCode; + + @Schema(description = "店铺ID") + private Integer storeId; + + @Schema(description = "使用的优惠券id") + private Integer couponId; + + @Schema(description = "使用的会员卡id") + private String cardId; + + @Schema(description = "关联收货地址") + private Integer addressId; + + @Schema(description = "收货地址") + private String address; + + @Schema(description = "收货人姓名") + private String realName; + + @Schema(description = "地址纬度") + private String addressLat; + + @Schema(description = "地址经度") + private String addressLng; + + @Schema(description = "自提店铺id") + private Integer selfTakeMerchantId; + + @Schema(description = "自提店铺") + private String selfTakeMerchantName; + + @Schema(description = "配送开始时间") + private String sendStartTime; + + @Schema(description = "配送结束时间") + private String sendEndTime; + + @Schema(description = "发货店铺id") + private Integer expressMerchantId; + + @Schema(description = "发货店铺") + private String expressMerchantName; + + @Schema(description = "订单总额") + @NotNull(message = "订单总额不能为空") + @DecimalMin(value = "0.01", message = "订单总额必须大于0") + @Digits(integer = 10, fraction = 2, message = "订单总额格式不正确") + private BigDecimal totalPrice; + + @Schema(description = "减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格") + @DecimalMin(value = "0", message = "减少金额不能为负数") + private BigDecimal reducePrice; + + @Schema(description = "实际付款") + @DecimalMin(value = "0", message = "实际付款不能为负数") + private BigDecimal payPrice; + + @Schema(description = "用于统计") + private BigDecimal price; + + @Schema(description = "价钱,用于积分赠送") + private BigDecimal money; + + @Schema(description = "教练价格") + private BigDecimal coachPrice; + + @Schema(description = "购买数量") + @Min(value = 1, message = "购买数量必须大于0") + private Integer totalNum; + + @Schema(description = "教练id") + private Integer coachId; + + @Schema(description = "来源ID,存商品ID") + private Integer formId; + + @Schema(description = "支付类型,0余额支付, 1微信支付,102微信Native,2会员卡支付,3支付宝,4现金,5POS机,6VIP月卡,7VIP年卡,8VIP次卡,9IC月卡,10IC年卡,11IC次卡,12免费,13VIP充值卡,14IC充值卡,15积分支付,16VIP季卡,17IC季卡,18代付") + private Integer payType; + + @Schema(description = "代付支付方式") + private Integer friendPayType; + + @Schema(description = "优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡") + private Integer couponType; + + @Schema(description = "优惠说明") + private String couponDesc; + + @Schema(description = "预约详情开始时间数组") + private String startTime; + + @Schema(description = "备注") + @Size(max = 500, message = "备注长度不能超过500字符") + private String comments; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "租户id") + @NotNull(message = "租户ID不能为空") + private Integer tenantId; + + @Schema(description = "订单商品列表") + @Valid + @NotEmpty(message = "订单商品列表不能为空") + private List goodsItems; + + /** + * 订单商品项 + */ + @Data + @Schema(name = "OrderGoodsItem", description = "订单商品项") + public static class OrderGoodsItem { + @Schema(description = "商品ID", required = true) + @NotNull(message = "商品ID不能为空") + private Integer goodsId; + + @Schema(description = "商品SKU ID") + private Integer skuId; + + @Schema(description = "商品数量", required = true) + @NotNull(message = "商品数量不能为空") + @Min(value = 1, message = "商品数量必须大于0") + private Integer quantity; + + @Schema(description = "支付类型") + private Integer payType; + + @Schema(description = "规格信息,如:颜色:红色|尺寸:L") + private String specInfo; + } +} diff --git a/src/main/java/com/gxwebsoft/shop/dto/OrderPrepayRequest.java b/src/main/java/com/gxwebsoft/shop/dto/OrderPrepayRequest.java new file mode 100644 index 0000000..9690c6b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/dto/OrderPrepayRequest.java @@ -0,0 +1,32 @@ +package com.gxwebsoft.shop.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.Positive; + +/** + * 订单重新发起支付请求DTO + * + * 前端会按 /shop/shop-order/pay -> /prepay -> /repay 依次尝试。 + * 后端可统一实现为同一套逻辑(多个URL别名),避免出现 404 导致前端误判为不支持接口。 + */ +@Data +@Schema(name = "OrderPrepayRequest", description = "订单重新发起支付请求") +public class OrderPrepayRequest { + + @Schema(description = "订单ID(二选一:orderId 或 orderNo)") + @Positive(message = "订单ID必须为正数") + private Integer orderId; + + @Schema(description = "订单号(二选一:orderId 或 orderNo)") + private String orderNo; + + @Schema(description = "支付方式:1=微信支付,102=微信Native(兼容旧类型)。不传则使用订单原支付方式/默认微信支付") + private Integer payType; + + @Schema(description = "租户ID(可选;不传则从当前登录用户/请求头推断)") + @Positive(message = "租户ID必须为正数") + private Integer tenantId; +} + diff --git a/src/main/java/com/gxwebsoft/shop/dto/UpdatePaymentStatusRequest.java b/src/main/java/com/gxwebsoft/shop/dto/UpdatePaymentStatusRequest.java new file mode 100644 index 0000000..999b0a8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/dto/UpdatePaymentStatusRequest.java @@ -0,0 +1,32 @@ +package com.gxwebsoft.shop.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * 更新订单支付状态请求DTO + * + * @author 科技小王子 + * @since 2025-08-30 + */ +@Data +@Schema(name = "UpdatePaymentStatusRequest", description = "更新订单支付状态请求") +public class UpdatePaymentStatusRequest { + + @Schema(description = "订单号", required = true) + @NotBlank(message = "订单号不能为空") + private String orderNo; + + @Schema(description = "支付状态:1=支付成功,0=支付失败", required = true) + @NotNull(message = "支付状态不能为空") + private Integer paymentStatus; + + @Schema(description = "微信交易号") + private String transactionId; + + @Schema(description = "支付时间,格式:yyyy-MM-dd HH:mm:ss") + private String payTime; +} diff --git a/src/main/java/com/gxwebsoft/shop/dto/UserCardStats.java b/src/main/java/com/gxwebsoft/shop/dto/UserCardStats.java new file mode 100644 index 0000000..9674041 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/dto/UserCardStats.java @@ -0,0 +1,31 @@ +package com.gxwebsoft.shop.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** + * 用户卡包统计(余额/积分/优惠券/礼品卡) + */ +@Data +@Schema(name = "UserCardStats", description = "用户卡包统计") +public class UserCardStats implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "用户余额(字符串/BigDecimal 字符串)") + private String balance; + + @Schema(description = "用户积分") + private Integer points; + + @Schema(description = "可用优惠券数量(按 status=0 口径)") + private Integer coupons; + + @Schema(description = "未使用礼品卡数量(按 status=0 口径)") + private Integer giftCards; + + @Schema(description = "最后更新时间(yyyy-MM-dd HH:mm:ss)") + private String lastUpdateTime; +} + diff --git a/src/main/java/com/gxwebsoft/shop/dto/UserOrderStats.java b/src/main/java/com/gxwebsoft/shop/dto/UserOrderStats.java new file mode 100644 index 0000000..ae563ca --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/dto/UserOrderStats.java @@ -0,0 +1,50 @@ +package com.gxwebsoft.shop.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.util.Map; + +/** + * 用户订单各状态数量统计(用于订单页徽标/统计) + */ +@Data +@Schema(name = "UserOrderStats", description = "用户订单各状态数量统计") +public class UserOrderStats implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "全部(默认过滤已取消订单:order_status != 2)") + private Long total; + + @Schema(description = "待支付(statusFilter=0)") + private Long waitPay; + + @Schema(description = "待发货(statusFilter=1)") + private Long waitDeliver; + + @Schema(description = "待核销(statusFilter=2)") + private Long waitVerify; + + @Schema(description = "待收货(statusFilter=3)") + private Long waitReceive; + + @Schema(description = "待评价(statusFilter=4)") + private Long waitComment; + + @Schema(description = "已完成(statusFilter=5)") + private Long completed; + + @Schema(description = "退款/售后(statusFilter=6)") + private Long refund; + + @Schema(description = "已删除(statusFilter=7)") + private Long deleted; + + @Schema(description = "已取消(statusFilter=8)") + private Long canceled; + + @Schema(description = "按 statusFilter 聚合的数量映射,key 为 \"0\"~\"8\"") + private Map statusFilter; +} + diff --git a/src/main/java/com/gxwebsoft/shop/entity/KuaiDi100Resp.java b/src/main/java/com/gxwebsoft/shop/entity/KuaiDi100Resp.java new file mode 100644 index 0000000..c1348ad --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/KuaiDi100Resp.java @@ -0,0 +1,11 @@ +package com.gxwebsoft.shop.entity; + +import lombok.Data; + +@Data +public class KuaiDi100Resp { + private String message; + private Integer returnCode; + private Boolean result; + private Object data; +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopArticle.java b/src/main/java/com/gxwebsoft/shop/entity/ShopArticle.java new file mode 100644 index 0000000..a11ff60 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopArticle.java @@ -0,0 +1,189 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品文章 + * + * @author 科技小王子 + * @since 2025-08-13 05:14:53 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopArticle对象", description = "商品文章") +public class ShopArticle implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "文章ID") + @TableId(value = "article_id", type = IdType.AUTO) + private Integer articleId; + + @Schema(description = "文章标题") + private String title; + + @Schema(description = "文章类型 0常规 1视频") + private Integer type; + + @Schema(description = "模型") + private String model; + + @Schema(description = "详情页模板") + private String detail; + + @Schema(description = "文章分类ID") + private Integer categoryId; + + @Schema(description = "上级id, 0是顶级") + private Integer parentId; + + @Schema(description = "话题") + private String topic; + + @Schema(description = "标签") + private String tags; + + @Schema(description = "封面图") + private String image; + + @Schema(description = "封面图宽") + private Integer imageWidth; + + @Schema(description = "封面图高") + private Integer imageHeight; + + @Schema(description = "付费金额") + private BigDecimal price; + + @Schema(description = "开始时间") + private LocalDateTime startTime; + + @Schema(description = "结束时间") + private LocalDateTime endTime; + + @Schema(description = "来源") + private String source; + + @Schema(description = "产品概述") + private String overview; + + @Schema(description = "虚拟阅读量(仅用作展示)") + private Integer virtualViews; + + @Schema(description = "实际阅读量") + private Integer actualViews; + + @Schema(description = "评分") + private BigDecimal rate; + + @Schema(description = "列表显示方式(10小图展示 20大图展示)") + private Integer showType; + + @Schema(description = "访问密码") + private String password; + + @Schema(description = "可见类型 0所有人 1登录可见 2密码可见") + private Integer permission; + + @Schema(description = "发布来源客户端 (APP、H5、小程序等)") + private String platform; + + @Schema(description = "文章附件") + private String files; + + @Schema(description = "视频地址") + private String video; + + @Schema(description = "接受的文件类型") + private String accept; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "点赞数") + private Integer likes; + + @Schema(description = "评论数") + private Integer commentNumbers; + + @Schema(description = "提醒谁看") + private String toUsers; + + @Schema(description = "作者") + private String author; + + @Schema(description = "推荐") + private Integer recommend; + + @Schema(description = "报名人数") + private Integer bmUsers; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "项目ID") + private Integer projectId; + + @Schema(description = "语言") + private String lang; + + @Schema(description = "关联默认语言的文章ID") + private Integer langArticleId; + + @Schema(description = "是否自动翻译") + private Boolean translation; + + @Schema(description = "编辑器类型 0 Markdown编辑器 1 富文本编辑器 ") + private Boolean editor; + + @Schema(description = "pdf文件地址") + private String pdfUrl; + + @Schema(description = "版本号") + private Integer version; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopBrand.java b/src/main/java/com/gxwebsoft/shop/entity/ShopBrand.java new file mode 100644 index 0000000..cfa7e1e --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopBrand.java @@ -0,0 +1,52 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 品牌 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopBrand对象", description = "品牌") +public class ShopBrand implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "brand_id", type = IdType.AUTO) + private Integer brandId; + + @Schema(description = "品牌名称") + private String brandName; + + @Schema(description = "图标") + private String image; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态") + private Integer status; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopCart.java b/src/main/java/com/gxwebsoft/shop/entity/ShopCart.java new file mode 100644 index 0000000..48c2e35 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopCart.java @@ -0,0 +1,95 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 购物车 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopCart对象", description = "购物车") +public class ShopCart implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "购物车表ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @Schema(description = "类型 0商城 1外卖") + private Integer type; + + @Schema(description = "唯一标识") + private String code; + + @Schema(description = "商品ID") + private Long goodsId; + + @Schema(description = "商品SKU ID") + private Integer skuId; + + @Schema(description = "商品规格") + private String spec; + + @Schema(description = "规格信息,如:颜色:红色|尺寸:L") + private String specInfo; + + @Schema(description = "商品价格") + private BigDecimal price; + + @Schema(description = "商品数量") + private Integer cartNum; + + @Schema(description = "单商品合计") + private BigDecimal totalPrice; + + @Schema(description = "0 = 未购买 1 = 已购买") + private Boolean isPay; + + @Schema(description = "是否为立即购买") + private Boolean isNew; + + @Schema(description = "是否为立即购买") + private Boolean isShow; + + @Schema(description = "拼团id") + private Integer combinationId; + + @Schema(description = "秒杀产品ID") + private Integer seckillId; + + @Schema(description = "砍价id") + private Integer bargainId; + + @Schema(description = "是否选中") + private Boolean selected; + + @Schema(description = "商户ID") + private Long merchantId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopCategory.java b/src/main/java/com/gxwebsoft/shop/entity/ShopCategory.java new file mode 100644 index 0000000..7ae2d46 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopCategory.java @@ -0,0 +1,122 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品分类 + * + * @author 科技小王子 + * @since 2025-04-24 20:52:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopCategory对象", description = "商品分类") +public class ShopCategory implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "上级id, 0是顶级") + private Integer parentId; + + @Schema(description = "菜单名称") + private String title; + + @Schema(description = "模型") + private String model; + + @Schema(description = "标识") + private String code; + + @Schema(description = "链接地址") + private String path; + + @Schema(description = "组件地址") + private String component; + + @Schema(description = "打开位置") + private String target; + + @Schema(description = "图标") + private String icon; + + @Schema(description = "banner") + private String banner; + + @Schema(description = "图标颜色") + private String color; + + @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") + private Integer hide; + + @Schema(description = "可见类型 0所有人 1登录可见 2密码可见") + private Integer permission; + + @Schema(description = "访问密码") + private String password; + + @Schema(description = "位置 0不限 1顶部 2底部") + private Integer position; + + @Schema(description = "仅在顶部显示") + private Integer top; + + @Schema(description = "仅在底部显示") + private Integer bottom; + + @Schema(description = "菜单选中的path") + private String active; + + @Schema(description = "其它路由元信息") + private String meta; + + @Schema(description = "css样式") + private String style; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "商户ID") + private Long merchantId; + + @Schema(description = "语言") + private String lang; + + @Schema(description = "设为首页") + private Integer home; + + @Schema(description = "推荐") + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopChatConversation.java b/src/main/java/com/gxwebsoft/shop/entity/ShopChatConversation.java new file mode 100644 index 0000000..0b4d2a7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopChatConversation.java @@ -0,0 +1,63 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 聊天消息表 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopChatConversation对象", description = "聊天消息表") +public class ShopChatConversation implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "好友ID") + private Integer friendId; + + @Schema(description = "消息类型") + private Integer type; + + @Schema(description = "消息内容") + private String content; + + @Schema(description = "未读消息") + private Integer unRead; + + @Schema(description = "状态, 0未读, 1已读") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopChatMessage.java b/src/main/java/com/gxwebsoft/shop/entity/ShopChatMessage.java new file mode 100644 index 0000000..7808cd9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopChatMessage.java @@ -0,0 +1,111 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 聊天消息表 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopChatMessage对象", description = "聊天消息表") +public class ShopChatMessage implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "发送人ID") + private Integer formUserId; + + @Schema(description = "发送人名称") + @TableField(exist = false) + private String formUserName; + + @Schema(description = "发送人头像") + @TableField(exist = false) + private String formUserAvatar; + + @Schema(description = "发送人手机号码") + @TableField(exist = false) + private String formUserPhone; + + @Schema(description = "发送人别名") + @TableField(exist = false) + private String formUserAlias; + + @Schema(description = "接收人ID") + private Integer toUserId; + + @Schema(description = "接收人名称") + @TableField(exist = false) + private String toUserName; + + @Schema(description = "接收人头像") + @TableField(exist = false) + private String toUserAvatar; + + @Schema(description = "接收人手机号码") + @TableField(exist = false) + private String toUserPhone; + + @Schema(description = "接收人别名") + @TableField(exist = false) + private String toUserAlias; + + @Schema(description = "消息类型") + private String type; + + @Schema(description = "消息内容") + private String content; + + @Schema(description = "屏蔽接收方") + private Integer sideTo; + + @Schema(description = "屏蔽发送方") + private Integer sideFrom; + + @Schema(description = "是否撤回") + private Integer withdraw; + + @Schema(description = "文件信息") + private String fileInfo; + + @Schema(description = "存在联系方式") + private Integer hasContact; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "状态, 0未读, 1已读") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopCommissionRole.java b/src/main/java/com/gxwebsoft/shop/entity/ShopCommissionRole.java new file mode 100644 index 0000000..6616688 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopCommissionRole.java @@ -0,0 +1,51 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分红角色 + * + * @author 科技小王子 + * @since 2025-05-01 10:01:15 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopCommissionRole对象", description = "分红角色") +public class ShopCommissionRole implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + private String title; + + private Integer provinceId; + + private Integer cityId; + + private Integer regionId; + + @Schema(description = "状态, 0正常, 1异常") + private Integer status; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + private Integer sortNumber; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopCommunity.java b/src/main/java/com/gxwebsoft/shop/entity/ShopCommunity.java new file mode 100644 index 0000000..03994c1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopCommunity.java @@ -0,0 +1,53 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 小区 + * + * @author 科技小王子 + * @since 2026-01-29 20:48:32 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopCommunity对象", description = "小区") +public class ShopCommunity implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "小区名称") + private String name; + + @Schema(description = "小区编号") + private String code; + + @Schema(description = "详细地址") + private String address; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopCount.java b/src/main/java/com/gxwebsoft/shop/entity/ShopCount.java new file mode 100644 index 0000000..518c42b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopCount.java @@ -0,0 +1,65 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import java.time.LocalDate; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商城销售统计表 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopCount对象", description = "商城销售统计表") +public class ShopCount implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "统计日期") + private LocalDate dateTime; + + @Schema(description = "总销售额") + private BigDecimal totalPrice; + + @Schema(description = "今日销售额") + private BigDecimal todayPrice; + + @Schema(description = "总会员数") + private BigDecimal totalUsers; + + @Schema(description = "今日新增") + private BigDecimal todayUsers; + + @Schema(description = "总订单笔数") + private BigDecimal totalOrders; + + @Schema(description = "今日订单笔数") + private BigDecimal todayOrders; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopCoupon.java b/src/main/java/com/gxwebsoft/shop/entity/ShopCoupon.java new file mode 100644 index 0000000..fae4872 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopCoupon.java @@ -0,0 +1,136 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import java.time.LocalDate; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.util.List; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 优惠券 + * + * @author 科技小王子 + * @since 2025-08-11 09:41:38 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopCoupon对象", description = "优惠券") +public class ShopCoupon implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "优惠券名称") + private String name; + + @Schema(description = "优惠券描述") + private String description; + + @Schema(description = "优惠券类型(10满减券 20折扣券 30免费劵)") + private Integer type; + + @Schema(description = "满减券-减免金额") + @JsonSerialize(using = ToStringSerializer.class) + @JsonInclude(JsonInclude.Include.NON_NULL) + private BigDecimal reducePrice; + + @Schema(description = "折扣券-折扣率(0-100)") + private Integer discount; + + @Schema(description = "最低消费金额") + @JsonSerialize(using = ToStringSerializer.class) + @JsonInclude(JsonInclude.Include.NON_NULL) + private BigDecimal minPrice; + + @Schema(description = "到期类型(10领取后生效 20固定时间)") + private Integer expireType; + + @Schema(description = "领取后生效-有效天数") + private Integer expireDay; + + @Schema(description = "有效期开始时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime startTime; + + @Schema(description = "有效期结束时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime endTime; + + @Schema(description = "适用范围(10全部商品 20指定商品 30指定分类)") + private Integer applyRange; + + @Schema(description = "适用范围配置(json格式)") + private String applyRangeConfig; + + @Schema(description = "是否过期(0未过期 1已过期)") + private Integer isExpire; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1禁用") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "创建用户ID") + private Integer userId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "发放总数量(-1表示无限制)") + private Integer totalCount; + + @Schema(description = "已发放数量") + private Integer issuedCount; + + @Schema(description = "每人限领数量(-1表示无限制)") + private Integer limitPerUser; + + @Schema(description = "是否启用(0禁用 1启用)") + private Boolean enabled; + + @TableField(exist = false) + private List couponApplyItemList; + + @TableField(exist = false) + private List couponApplyCateList; + + @TableField(exist = false) + private Boolean hasTake; + + @TableField(exist = false) + private Integer userTakeNum; + + @TableField(exist = false) + private Integer userUseNum; + + @TableField(exist = false) + private Integer receiveNum; +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopCouponApplyCate.java b/src/main/java/com/gxwebsoft/shop/entity/ShopCouponApplyCate.java new file mode 100644 index 0000000..26bf30c --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopCouponApplyCate.java @@ -0,0 +1,53 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 优惠券可用分类 + * + * @author 科技小王子 + * @since 2025-08-11 12:47:49 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopCouponApplyCate对象", description = "优惠券可用分类") +public class ShopCouponApplyCate implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + private Integer couponId; + + private Integer cateId; + + @Schema(description = "分类等级") + private Integer cateLevel; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopCouponApplyItem.java b/src/main/java/com/gxwebsoft/shop/entity/ShopCouponApplyItem.java new file mode 100644 index 0000000..504d9d7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopCouponApplyItem.java @@ -0,0 +1,61 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 优惠券可用分类 + * + * @author 科技小王子 + * @since 2025-08-11 12:47:49 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopCouponApplyItem对象", description = "优惠券可用分类") +public class ShopCouponApplyItem implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "优惠券ID") + private Integer couponId; + + @Schema(description = "商品ID") + private Integer goodsId; + + @Schema(description = "分类ID") + private Integer categoryId; + + @Schema(description = "类型(1商品 2分类)") + private Integer type; + + @Schema(description = "0服务1需求2闲置") + private Integer pk; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopDealerApply.java b/src/main/java/com/gxwebsoft/shop/entity/ShopDealerApply.java new file mode 100644 index 0000000..e5234d5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopDealerApply.java @@ -0,0 +1,125 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分销商申请记录表 + * + * @author 科技小王子 + * @since 2025-08-11 23:50:18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopDealerApply对象", description = "分销商申请记录表") +public class ShopDealerApply implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "apply_id", type = IdType.AUTO) + private Integer applyId; + + @Schema(description = "0经销商,1企业也,2集团)") + private Integer type; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "昵称") + @TableField(exist = false) + private String nickName; + + @Schema(description = "手机号码") + @TableField(exist = false) + private String phone; + + @Schema(description = "姓名") + private String realName; + + @Schema(description = "分销商名称") + private String dealerName; + + @Schema(description = "分销商编码") + private String dealerCode; + + @Schema(description = "手机号") + private String mobile; + + @Schema(description = "合同金额") + private BigDecimal money; + + @Schema(description = "详细地址") + private String address; + + @Schema(description = "社区") + private String community; + + @Schema(description = "楼栋号") + private String buildingNumber; + + @Schema(description = "单元号") + private String unitNumber; + + @Schema(description = "房号") + private String roomNumber; + + @Schema(description = "佣金比例") + @TableField(exist = false) + private BigDecimal rate; + + @Schema(description = "推荐人用户ID") + private Integer refereeId; + + @Schema(description = "申请方式(10需后台审核 20无需审核)") + private Integer applyType; + + @Schema(description = "申请时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime applyTime; + + @Schema(description = "审核状态 (10待审核 20审核通过 30驳回)") + private Integer applyStatus; + + @Schema(description = "审核时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime auditTime; + + @Schema(description = "合同时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime contractTime; + + @Schema(description = "到期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime expirationTime; + + @Schema(description = "驳回原因") + private String rejectReason; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "商城ID") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "推荐人名称") + @TableField(exist = false) + private String refereeName; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopDealerBank.java b/src/main/java/com/gxwebsoft/shop/entity/ShopDealerBank.java new file mode 100644 index 0000000..eded8a3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopDealerBank.java @@ -0,0 +1,61 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 分销商提现银行卡 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopDealerBank对象", description = "分销商提现银行卡") +public class ShopDealerBank implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "分销商用户ID") + private Integer userId; + + @Schema(description = "开户行名称") + private String bankName; + + @Schema(description = "银行开户名") + private String bankAccount; + + @Schema(description = "银行卡号") + private String bankCard; + + @Schema(description = "申请状态 (10待审核 20审核通过 30驳回)") + private Integer applyStatus; + + @Schema(description = "驳回原因") + private String rejectReason; + + @Schema(description = "默认收货地址") + private Boolean isDefault; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopDealerCapital.java b/src/main/java/com/gxwebsoft/shop/entity/ShopDealerCapital.java new file mode 100644 index 0000000..11707ba --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopDealerCapital.java @@ -0,0 +1,70 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分销商资金明细表 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopDealerCapital对象", description = "分销商资金明细表") +public class ShopDealerCapital implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "分销商用户ID") + private Integer userId; + + @Schema(description = "分销商昵称") + @TableField(exist = false) + private String nickName; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "资金流动类型 (10佣金收入 20提现支出 30转账支出 40转账收入)") + private Integer flowType; + + @Schema(description = "金额") + private BigDecimal money; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "对方用户ID") + private Integer toUserId; + + @Schema(description = "对方昵称") + @TableField(exist = false) + private String toNickName; + + @Schema(description = "结算月份") + private String month; + + @Schema(description = "商城ID") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopDealerOrder.java b/src/main/java/com/gxwebsoft/shop/entity/ShopDealerOrder.java new file mode 100644 index 0000000..32be34d --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopDealerOrder.java @@ -0,0 +1,140 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分销商订单记录表 + * + * @author 科技小王子 + * @since 2025-08-12 11:55:18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopDealerOrder对象", description = "分销商订单记录表") +public class ShopDealerOrder implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "买家用户ID") + private Integer userId; + + @Excel(name = "公司名称") + private String title; + + @Excel(name = "订单编号") + private String orderNo; + + @Schema(description = "买家用户昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "订单总金额(不含运费)") + private BigDecimal orderPrice; + + @Schema(description = "结算金额") + private BigDecimal settledPrice; + + @Schema(description = "换算成度") + private BigDecimal degreePrice; + + @Schema(description = "实发金额") + private BigDecimal payPrice; + + @Schema(description = "分销商用户id(一级)") + private Integer firstUserId; + + @Schema(description = "分销商用户昵称(一级)") + @TableField(exist = false) + private String firstNickname; + + @Schema(description = "分销商用户id(二级)") + private Integer secondUserId; + + @Schema(description = "分销商用户昵称(二级)") + @TableField(exist = false) + private String secondNickname; + + @Schema(description = "分销商用户id(三级)") + private Integer thirdUserId; + + @Schema(description = "分销商用户昵称(三级)") + @TableField(exist = false) + private String thirdNickname; + + @Schema(description = "分销佣金(一级)") + private BigDecimal firstMoney; + + @Schema(description = "分销佣金(二级)") + private BigDecimal secondMoney; + + @Schema(description = "分销佣金(三级)") + private BigDecimal thirdMoney; + + @Schema(description = "门店(一级)") + private Integer firstDividendUser; + + @Schema(description = "门店名称(一级)") + @TableField(exist = false) + private String firstDividendUserName; + + @Schema(description = "分红(一级)") + private BigDecimal firstDividend; + + @Schema(description = "门店(二级)") + private Integer secondDividendUser; + + @Schema(description = "门店名称(二级)") + @TableField(exist = false) + private String secondDividendUserName; + + @Schema(description = "分红(二级)") + private BigDecimal secondDividend; + + @Schema(description = "佣金比例") + private BigDecimal rate; + + @Schema(description = "单价") + private BigDecimal price; + + @Schema(description = "结算月份") + private String month; + + @Schema(description = "订单是否失效(0未失效 1已失效)") + private Integer isInvalid; + + @Schema(description = "佣金结算(0未结算 1已结算)") + private Integer isSettled; + + @Schema(description = "结算时间") + private LocalDateTime settleTime; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "商城ID") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopDealerRecord.java b/src/main/java/com/gxwebsoft/shop/entity/ShopDealerRecord.java new file mode 100644 index 0000000..3780cda --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopDealerRecord.java @@ -0,0 +1,67 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 客户跟进情况 + * + * @author 科技小王子 + * @since 2025-10-02 12:21:50 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(description = "客户跟进情况") +public class ShopDealerRecord implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "上级id, 0是顶级") + private Integer parentId; + + @Schema(description = "客户ID") + private Integer dealerId; + + @Schema(description = "内容") + private String content; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0待处理, 1已完成") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} \ No newline at end of file diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopDealerReferee.java b/src/main/java/com/gxwebsoft/shop/entity/ShopDealerReferee.java new file mode 100644 index 0000000..24ac1f5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopDealerReferee.java @@ -0,0 +1,90 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分销商推荐关系表 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopDealerReferee对象", description = "分销商推荐关系表") +public class ShopDealerReferee implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "分销商用户ID") + private Integer dealerId; + + @Schema(description = "分销商名称") + @TableField(exist = false) + private String dealerName; + + @Schema(description = "分销商头像") + @TableField(exist = false) + private String dealerAvatar; + + @Schema(description = "分销商手机号") + @TableField(exist = false) + private String dealerPhone; + + @Schema(description = "用户id(被推荐人)") + private Integer userId; + + @Schema(description = "昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "别名") + @TableField(exist = false) + private String alias; + + @Schema(description = "手机号") + @TableField(exist = false) + private String phone; + + @Schema(description = "是否管理员") + @TableField(exist = false) + private Boolean isAdmin; + + @Schema(description = "推荐关系层级(弃用)") + private Integer level; + + @Schema(description = "来源(如 goods_share)") + // NOTE: 表 shop_dealer_referee 若未新增该字段,需要 exist=false,避免 MyBatis-Plus 自动生成SQL时报 Unknown column。 + @TableField(exist = false) + private String source; + + @Schema(description = "场景参数(用于溯源统计,如 inviter=&source=goods_share&t=)") + @TableField(exist = false) + private String scene; + + @Schema(description = "商城ID") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopDealerSetting.java b/src/main/java/com/gxwebsoft/shop/entity/ShopDealerSetting.java new file mode 100644 index 0000000..710cf79 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopDealerSetting.java @@ -0,0 +1,41 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分销商设置表 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopDealerSetting对象", description = "分销商设置表") +public class ShopDealerSetting implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "设置项标示") + @TableId(value = "`key`", type = IdType.INPUT) + private String key; + + @Schema(description = "设置项描述") + @TableField(value = "`describe`") + private String describe; + + @Schema(description = "设置内容(json格式)") + @TableField(value = "`values`") + private String values; + + @Schema(description = "商城ID") + private Integer tenantId; + + @Schema(description = "更新时间") + private Integer updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopDealerUser.java b/src/main/java/com/gxwebsoft/shop/entity/ShopDealerUser.java new file mode 100644 index 0000000..a3530cc --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopDealerUser.java @@ -0,0 +1,119 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分销商用户记录表 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopDealerUser对象", description = "分销商用户记录表") +public class ShopDealerUser implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "0经销商,1企业也,2集团)") + private Integer type; + + @Schema(description = "自增ID") + private Integer userId; + + @Schema(description = "微信openid") + @TableField(exist = false) + private String openid; + + @Schema(description = "店铺名称") + private String dealerName; + + @Schema(description = "小区名称") + private String community; + + @Schema(description = "头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "姓名") + private String realName; + + @Schema(description = "手机号") + private String mobile; + + @Schema(description = "支付密码") + private String payPassword; + + @Schema(description = "当前可提现佣金") + private BigDecimal money; + + @Schema(description = "已冻结佣金") + private BigDecimal freezeMoney; + + @Schema(description = "累积提现佣金") + private BigDecimal totalMoney; + + @Schema(description = "单价") + private BigDecimal price; + + @Schema(description = "佣金比例") + private BigDecimal rate; + + @Schema(description = "推荐人用户ID") + private Integer refereeId; + + @Schema(description = "成员数量(一级)") + private Integer firstNum; + + @Schema(description = "成员数量(二级)") + private Integer secondNum; + + @Schema(description = "成员数量(三级)") + private Integer thirdNum; + + @Schema(description = "小区ID") + private Integer communityId; + + @Schema(description = "店铺ID") + private Integer dealerUserId; + + @Schema(description = "店铺名称") + @TableField(exist = false) + private String shopName; + + @Schema(description = "专属二维码") + private String qrcode; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "是否删除") + private Integer isDelete; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopDealerWithdraw.java b/src/main/java/com/gxwebsoft/shop/entity/ShopDealerWithdraw.java new file mode 100644 index 0000000..6289926 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopDealerWithdraw.java @@ -0,0 +1,108 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分销商提现明细表 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopDealerWithdraw对象", description = "分销商提现明细表") +public class ShopDealerWithdraw implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "分销商用户ID") + private Integer userId; + + @Schema(description = "昵称") + @TableField(exist = false) + private String nickName; + + @Schema(description = "头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "手机号") + @TableField(exist = false) + private String phone; + + @Schema(description = "真实姓名") + @TableField(exist = false) + private String realName; + + @Schema(description = "提现金额") + private BigDecimal money; + + @Schema(description = "打款方式 (10微信 20支付宝 30银行卡)") + private Integer payType; + + @Schema(description = "支付宝姓名") + private String alipayName; + + @Schema(description = "支付宝账号") + private String alipayAccount; + + @Schema(description = "开户行名称") + private String bankName; + + @Schema(description = "银行开户名") + private String bankAccount; + + @Schema(description = "银行卡号") + private String bankCard; + + @Schema(description = "申请状态 (10待审核 20审核通过 30驳回 40已打款)") + private Integer applyStatus; + + @Schema(description = "审核时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime auditTime; + + @Schema(description = "驳回原因") + private String rejectReason; + + @Schema(description = "上传支付凭证") + private String image; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "来源客户端(APP、H5、小程序等)") + private String platform; + + @Schema(description = "微信openId") + @TableField(exist = false) + private String openId; + + @Schema(description = "公众号openId") + @TableField(exist = false) + private String officeOpenid; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopExpress.java b/src/main/java/com/gxwebsoft/shop/entity/ShopExpress.java new file mode 100644 index 0000000..9f0c5fe --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopExpress.java @@ -0,0 +1,59 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 物流公司 + * + * @author 科技小王子 + * @since 2025-08-12 12:07:03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopExpress对象", description = "物流公司") +public class ShopExpress implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "物流公司ID") + @TableId(value = "express_id", type = IdType.AUTO) + private Integer expressId; + + @Schema(description = "物流公司名称") + private String expressName; + + @Schema(description = "物流公司编码 (微信)") + private String wxCode; + + @Schema(description = "物流公司编码 (快递100)") + private String kuaidi100Code; + + @Schema(description = "物流公司编码 (快递鸟)") + private String kdniaoCode; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopExpressTemplate.java b/src/main/java/com/gxwebsoft/shop/entity/ShopExpressTemplate.java new file mode 100644 index 0000000..1f5b8fa --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopExpressTemplate.java @@ -0,0 +1,65 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 运费模板 + * + * @author 科技小王子 + * @since 2025-08-12 12:07:03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopExpressTemplate对象", description = "运费模板") +public class ShopExpressTemplate implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + private Boolean type; + + private String title; + + @Schema(description = "收件价格") + private BigDecimal firstAmount; + + @Schema(description = "续件价格") + private BigDecimal extraAmount; + + @Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + private Integer sortNumber; + + @Schema(description = "首件数量/重量") + private BigDecimal firstNum; + + @Schema(description = "续件数量/重量") + private BigDecimal extraNum; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopExpressTemplateDetail.java b/src/main/java/com/gxwebsoft/shop/entity/ShopExpressTemplateDetail.java new file mode 100644 index 0000000..7d8d3ec --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopExpressTemplateDetail.java @@ -0,0 +1,70 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 运费模板 + * + * @author 科技小王子 + * @since 2025-08-12 12:07:03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopExpressTemplateDetail对象", description = "运费模板") +public class ShopExpressTemplateDetail implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + private Integer templateId; + + @Schema(description = "0按件") + private Boolean type; + + private Integer provinceId; + + private Integer cityId; + + @Schema(description = "首件数量/重量") + private BigDecimal firstNum; + + @Schema(description = "收件价格") + private BigDecimal firstAmount; + + @Schema(description = "续件价格") + private BigDecimal extraAmount; + + @Schema(description = "续件数量/重量") + private BigDecimal extraNum; + + @Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + private Integer sortNumber; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopGift.java b/src/main/java/com/gxwebsoft/shop/entity/ShopGift.java new file mode 100644 index 0000000..261c980 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopGift.java @@ -0,0 +1,112 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 礼品卡 + * + * @author 科技小王子 + * @since 2025-08-11 18:07:31 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopGift对象", description = "礼品卡") +public class ShopGift implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "礼品卡名称") + private String name; + + @Schema(description = "秘钥") + private String code; + + @Schema(description = "商品ID") + private Integer goodsId; + + @Schema(description = "商品名称") + @TableField(exist = false) + private String goodsName; + + @Schema(description = "商品图片") + @TableField(exist = false) + private String goodsImage; + + @Schema(description = "面值") + @TableField(exist = false) + private BigDecimal faceValue; + + @Schema(description = "使用地点") + private String useLocation; + + @Schema(description = "领取时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime takeTime; + + @Schema(description = "核销时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime verificationTime; + + @Schema(description = "操作人ID") + private Integer operatorUserId; + + @Schema(description = "操作人") + @TableField(exist = false) + private String operatorUserName; + + @Schema(description = "操作备注") + private String operatorRemarks; + + @Schema(description = "是否展示") + private Boolean isShow; + + @Schema(description = "状态, 0上架 1待上架 2待审核 3审核不通过") + private Integer status; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "昵称") + @TableField(exist = false) + private String nickName; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @TableField(exist = false) + private Integer num; + + @TableField(exist = false) + private ShopGoods goods; +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopGoods.java b/src/main/java/com/gxwebsoft/shop/entity/ShopGoods.java new file mode 100644 index 0000000..9d3f303 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopGoods.java @@ -0,0 +1,171 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品 + * + * @author 科技小王子 + * @since 2025-04-24 20:52:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopGoods对象", description = "商品") +public class ShopGoods implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "goods_id", type = IdType.AUTO) + private Integer goodsId; + + @Schema(description = "商品名称") + private String name; + + @Schema(description = "产品编码") + private String code; + + @Schema(description = "类型 0软件产品 1实物商品 2虚拟商品") + private Integer type; + + @Schema(description = "封面图") + private String image; + + @Schema(description = "父级分类ID") + private Integer parentId; + + @Schema(description = "产品分类ID") + private Integer categoryId; + + @Schema(description = "分类名称") + @TableField(exist = false) + private String categoryName; + + @Schema(description = "路由地址") + private String path; + + @Schema(description = "标签") + private String tag; + + @Schema(description = "产品规格 0单规格 1多规格") + private Integer specs; + + @Schema(description = "货架") + private String position; + + @Schema(description = "单位名称 (个)") + private String unitName; + + @Schema(description = "商品价格") + private BigDecimal price; + + @Schema(description = "进货价格") + private BigDecimal buyingPrice; + + @Schema(description = "经销商价格") + private BigDecimal dealerPrice; + + @Schema(description = "市场价") + private BigDecimal salePrice; + + @Schema(description = "佣金") + private BigDecimal commission; + + @Schema(description = "是否开启分销佣金(0否 1是)") + private Integer isOpenCommission; + + @Schema(description = "佣金类型(10固定金额 20百分比)") + private Integer commissionType; + + @Schema(description = "分销佣金(一级)") + private BigDecimal firstMoney; + + @Schema(description = "分销佣金(二级)") + private BigDecimal secondMoney; + + @Schema(description = "分销佣金(三级)") + private BigDecimal thirdMoney; + + @Schema(description = "分红(一级)") + private BigDecimal firstDividend; + + @Schema(description = "分红(二级)") + private BigDecimal secondDividend; + + @Schema(description = "库存计算方式(10下单减库存 20付款减库存)") + private Integer deductStockType; + + @Schema(description = "交付方式(0不启用)") + private Integer deliveryMethod; + + @Schema(description = "购买时长(0不启用,1 一次性,2 按时长)") + private Integer durationMethod; + + @Schema(description = "可购买数量") + private Integer canBuyNumber; + + @Schema(description = "商品详情") + private String content; + + @Schema(description = "轮播图") + private String files; + + @Schema(description = "销量") + private Integer sales; + + @Schema(description = "库存") + private Integer stock; + + @Schema(description = "安装次数") + private Integer install; + + @Schema(description = "评分") + private BigDecimal rate; + + @Schema(description = "消费赚取积分") + private BigDecimal gainIntegral; + + @Schema(description = "推荐") + private Integer recommend; + + @Schema(description = "是否官方") + private Integer official; + + @Schema(description = "商户ID") + private Long merchantId; + + @Schema(description = "是否展示") + private Boolean isShow; + + @Schema(description = "状态, 0上架 1待上架 2待审核 3审核不通过") + private Integer status; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsCategory.java b/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsCategory.java new file mode 100644 index 0000000..6b902cd --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsCategory.java @@ -0,0 +1,96 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品分类 + * + * @author 科技小王子 + * @since 2025-05-01 00:36:45 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopGoodsCategory对象", description = "商品分类") +public class ShopGoodsCategory implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "商品分类ID") + @TableId(value = "category_id", type = IdType.AUTO) + private Integer categoryId; + + @Schema(description = "分类标识") + private String categoryCode; + + @Schema(description = "分类名称") + private String title; + + @Schema(description = "类型 0商城分类 1外卖分类") + private Integer type; + + @Schema(description = "分类图片") + private String image; + + @Schema(description = "上级分类ID") + private Integer parentId; + + @Schema(description = "路由/链接地址") + private String path; + + @Schema(description = "组件路径") + private String component; + + @Schema(description = "绑定的页面") + private Integer pageId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "商品数量") + private Integer count; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") + private Integer hide; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "是否显示在首页") + private Integer showIndex; + + @Schema(description = "商铺ID") + private Long merchantId; + + @Schema(description = "状态, 0正常, 1禁用") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsComment.java b/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsComment.java new file mode 100644 index 0000000..e6ebc8e --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsComment.java @@ -0,0 +1,99 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 评论表 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopGoodsComment对象", description = "评论表") +public class ShopGoodsComment implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "评论ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "用户ID") + private Integer uid; + + @Schema(description = "订单ID") + private Integer oid; + + @Schema(description = "商品唯一id") + private String unique; + + @Schema(description = "商品id") + private Integer goodsId; + + @Schema(description = "某种商品类型(普通商品、秒杀商品)") + private String replyType; + + @Schema(description = "商品分数") + private Boolean goodsScore; + + @Schema(description = "服务分数") + private Boolean serviceScore; + + @Schema(description = "评论内容") + private String comment; + + @Schema(description = "评论图片") + private String pics; + + @Schema(description = "管理员回复内容") + private String merchantReplyContent; + + @Schema(description = "管理员回复时间") + private Integer merchantReplyTime; + + @Schema(description = "0未删除1已删除") + private Boolean isDel; + + @Schema(description = "0未回复1已回复") + private Boolean isReply; + + @Schema(description = "用户名称") + private String nickname; + + @Schema(description = "用户头像") + private String avatar; + + @Schema(description = "商品规格属性值,多个,号隔开") + private String sku; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "更新时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsIncomeConfig.java b/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsIncomeConfig.java new file mode 100644 index 0000000..9b4da71 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsIncomeConfig.java @@ -0,0 +1,64 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分润配置 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopGoodsIncomeConfig对象", description = "分润配置") +public class ShopGoodsIncomeConfig implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + private Integer goodsId; + + @Schema(description = "店铺类型") + private String merchantShopType; + + private Integer skuId; + + @Schema(description = "比例") + private BigDecimal rate; + + @Schema(description = "用户id") + private Integer userId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsLog.java b/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsLog.java new file mode 100644 index 0000000..13ac171 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsLog.java @@ -0,0 +1,86 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品日志表 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopGoodsLog对象", description = "商品日志表") +public class ShopGoodsLog implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "统计ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "类型visit,cart,order,pay,collect,refund") + private String type; + + @Schema(description = "商品ID") + private Integer goodsId; + + @Schema(description = "是否浏览") + private Boolean visitNum; + + @Schema(description = "加入购物车数量") + private Integer cartNum; + + @Schema(description = "下单数量") + private Integer orderNum; + + @Schema(description = "支付数量") + private Integer payNum; + + @Schema(description = "支付金额") + private BigDecimal payPrice; + + @Schema(description = "商品成本价") + private BigDecimal costPrice; + + @Schema(description = "支付用户ID") + private Integer payUid; + + @Schema(description = "退款数量") + private Integer refundNum; + + @Schema(description = "退款金额") + private BigDecimal refundPrice; + + @Schema(description = "收藏") + private Boolean collectNum; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsRelation.java b/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsRelation.java new file mode 100644 index 0000000..c615929 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsRelation.java @@ -0,0 +1,53 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品点赞和收藏表 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopGoodsRelation对象", description = "商品点赞和收藏表") +public class ShopGoodsRelation implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "商品ID") + private Integer goodsId; + + @Schema(description = "类型(收藏(collect)、点赞(like))") + private String type; + + @Schema(description = "某种类型的商品(普通商品、秒杀商品)") + private String category; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "更新时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsRoleCommission.java b/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsRoleCommission.java new file mode 100644 index 0000000..7e926cb --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsRoleCommission.java @@ -0,0 +1,52 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品绑定角色的分润金额 + * + * @author 科技小王子 + * @since 2025-05-01 09:53:38 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopGoodsRoleCommission对象", description = "商品绑定角色的分润金额") +public class ShopGoodsRoleCommission implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + private Integer roleId; + + private Integer goodsId; + + private String sku; + + private BigDecimal amount; + + @Schema(description = "状态, 0正常, 1异常") + private Integer status; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + private Integer sortNumber; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsSku.java b/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsSku.java new file mode 100644 index 0000000..a57666a --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsSku.java @@ -0,0 +1,79 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品sku列表 + * + * @author 科技小王子 + * @since 2025-05-01 09:43:31 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopGoodsSku对象", description = "商品sku列表") +public class ShopGoodsSku implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "商品ID") + private Integer goodsId; + + @Schema(description = "商品属性索引值 (attr_value|attr_value[|....])") + private String sku; + + @Schema(description = "商品图片") + private String image; + + @Schema(description = "商品价格") + private BigDecimal price; + + @Schema(description = "市场价格") + private BigDecimal salePrice; + + @Schema(description = "成本价") + private BigDecimal cost; + + @Schema(description = "库存") + private Integer stock; + + @Schema(description = "sku编码") + private String skuNo; + + @Schema(description = "商品条码") + private String barCode; + + @Schema(description = "重量") + private BigDecimal weight; + + @Schema(description = "体积") + private BigDecimal volume; + + @Schema(description = "唯一值") + private String uuid; + + @Schema(description = "状态, 0正常, 1异常") + private Integer status; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsSpec.java b/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsSpec.java new file mode 100644 index 0000000..4885e73 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsSpec.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品多规格 + * + * @author 科技小王子 + * @since 2025-05-01 09:43:31 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopGoodsSpec对象", description = "商品多规格") +public class ShopGoodsSpec implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "商品ID") + private Integer goodsId; + + @Schema(description = "规格ID") + private Integer specId; + + @Schema(description = "规格名称") + private String specName; + + @Schema(description = "规格值") + private String specValue; + + @Schema(description = "活动类型 0=商品,1=秒杀,2=砍价,3=拼团") + private Boolean type; + + @Schema(description = "租户id") + private Integer tenantId; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopMerchant.java b/src/main/java/com/gxwebsoft/shop/entity/ShopMerchant.java new file mode 100644 index 0000000..1915909 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopMerchant.java @@ -0,0 +1,145 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商户 + * + * @author 科技小王子 + * @since 2025-08-10 20:43:33 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopMerchant对象", description = "商户") +public class ShopMerchant implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "merchant_id", type = IdType.AUTO) + private Long merchantId; + + @Schema(description = "商户名称") + private String merchantName; + + @Schema(description = "商户编号") + private String merchantCode; + + @Schema(description = "商户类型") + private Integer type; + + @Schema(description = "商户图标") + private String image; + + @Schema(description = "商户手机号") + private String phone; + + @Schema(description = "商户姓名") + private String realName; + + @Schema(description = "店铺类型") + private String shopType; + + @Schema(description = "项目分类") + private String itemType; + + @Schema(description = "商户分类") + private String category; + + @Schema(description = "商户经营分类") + private Integer merchantCategoryId; + + @Schema(description = "商户分类") + private String merchantCategoryTitle; + + @Schema(description = "经纬度") + private String lngAndLat; + + private String lng; + + private String lat; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "详细地址") + private String address; + + @Schema(description = "手续费") + private BigDecimal commission; + + @Schema(description = "关键字") + private String keywords; + + @Schema(description = "资质图片") + private String files; + + @Schema(description = "营业时间") + private String businessTime; + + @Schema(description = "文章内容") + private String content; + + @Schema(description = "每小时价格") + private BigDecimal price; + + @Schema(description = "是否自营") + private Integer ownStore; + + @Schema(description = "是否可以快递") + private Boolean canExpress; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "是否营业") + private Integer isOn; + + private String startTime; + + private String endTime; + + @Schema(description = "是否需要审核") + private Integer goodsReview; + + @Schema(description = "管理入口") + private String adminUrl; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "所有人") + private Integer userId; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "状态") + private Integer status; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopMerchantAccount.java b/src/main/java/com/gxwebsoft/shop/entity/ShopMerchantAccount.java new file mode 100644 index 0000000..308818b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopMerchantAccount.java @@ -0,0 +1,68 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商户账号 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopMerchantAccount对象", description = "商户账号") +public class ShopMerchantAccount implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "商户手机号") + private String phone; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "商户ID") + private Long merchantId; + + @Schema(description = "角色ID") + private Integer roleId; + + @Schema(description = "角色名称") + private String roleName; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态") + private Integer status; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "密码") + @TableField(exist = false) + private String password; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopMerchantApply.java b/src/main/java/com/gxwebsoft/shop/entity/ShopMerchantApply.java new file mode 100644 index 0000000..461e67f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopMerchantApply.java @@ -0,0 +1,134 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; + +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商户入驻申请 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopMerchantApply对象", description = "商户入驻申请") +public class ShopMerchantApply implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "apply_id", type = IdType.AUTO) + private Integer applyId; + + @Schema(description = "类型") + private Integer type; + + @Schema(description = "店铺类型") + private String shopType; + + @Schema(description = "商户名称") + private String merchantName; + + @Schema(description = "商户图标") + private String image; + + @Schema(description = "商户手机号") + private String phone; + + @Schema(description = "商户姓名") + private String realName; + + @Schema(description = "社会信用代码") + private String merchantCode; + + @Schema(description = "身份证号码") + private String idCard; + + @Schema(description = "身份证正面") + private String sfz1; + + @Schema(description = "身份证反面") + private String sfz2; + + @Schema(description = "营业执照") + private String yyzz; + + @Schema(description = "行业父级分类") + private Integer parentId; + + @Schema(description = "行业分类ID") + private Integer categoryId; + + @Schema(description = "行业分类") + private String category; + + @Schema(description = "手续费") + private BigDecimal commission; + + @Schema(description = "关键字") + private String keywords; + + @Schema(description = "资质图片") + private String files; + + @Schema(description = "所有人") + private Integer userId; + + @Schema(description = "是否自营") + private Integer ownStore; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "是否需要审核") + private Integer goodsReview; + + @Schema(description = "工作负责人") + private String name2; + + @Schema(description = "驳回原因") + private String reason; + + @Schema(description = "审核完成时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime completedTime; + + @Schema(description = "审核状态") + private Boolean checkStatus; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态") + private Integer status; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "应用名称") + @TableField(exist = false) + private String tenantName; + + @Schema(description = "应用图标") + @TableField(exist = false) + private String logo; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopMerchantType.java b/src/main/java/com/gxwebsoft/shop/entity/ShopMerchantType.java new file mode 100644 index 0000000..f847eff --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopMerchantType.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商户类型 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopMerchantType对象", description = "商户类型") +public class ShopMerchantType implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "店铺类型") + private String name; + + @Schema(description = "店铺入驻条件") + private String comments; + + @Schema(description = "状态") + private Integer status; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopOrder.java b/src/main/java/com/gxwebsoft/shop/entity/ShopOrder.java new file mode 100644 index 0000000..f40f795 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopOrder.java @@ -0,0 +1,358 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import java.util.List; + +import com.gxwebsoft.bszx.entity.BszxBm; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.*; + +/** + * 订单 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopOrder对象", description = "订单") +public class ShopOrder implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "订单号") + @TableId(value = "order_id", type = IdType.AUTO) + private Integer orderId; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "订单类型,0商城订单 1预定订单/外卖 2会员卡") + private Integer type; + + @Schema(description = "订单标题") + private String title; + + @Schema(description = "快递/自提") + private Integer deliveryType; + + @Schema(description = "下单渠道,0小程序预定 1俱乐部训练场 3活动订场") + private Integer channel; + + @Schema(description = "微信支付订单号") + private String transactionId; + + @Schema(description = "微信退款订单号") + private String refundOrder; + + @Schema(description = "商户ID") + private Long merchantId; + + @Schema(description = "商户名称") + private String merchantName; + + @Schema(description = "商户编号") + private String merchantCode; + + @Schema(description = "店铺ID") + private Integer storeId; + + @Schema(description = "店铺名称") + @TableField(exist = false) + private String storeName; + + @Schema(description = "配送员ID") + private Integer riderId; + + @Schema(description = "配送员名称") + @TableField(exist = false) + private String riderName; + + @Schema(description = "仓库ID") + private Integer warehouseId; + + @Schema(description = "仓库名称") + @TableField(exist = false) + private String warehouseName; + + @Schema(description = "使用的优惠券id") + private Integer couponId; + + @Schema(description = "使用的会员卡id") + private String cardId; + + @Schema(description = "关联管理员id") + private Integer adminId; + + @Schema(description = "核销管理员id") + private Integer confirmId; + + @Schema(description = "IC卡号") + private String icCard; + + @Schema(description = "收货人id") + private Integer addressId; + + @Schema(description = "收货地址") + private String address; + + private String addressLat; + + private String addressLng; + + @Schema(description = "买家备注") + private String buyerRemarks; + + @Schema(description = "自提店铺id") + private Integer selfTakeMerchantId; + + @Schema(description = "自提店铺") + private String selfTakeMerchantName; + + @Schema(description = "配送开始时间") + private String sendStartTime; + + @Schema(description = "配送结束时间") + private String sendEndTime; + + @Schema(description = "送达拍照记录") + private String sendEndImg; + + @Schema(description = "发货店铺id") + private Integer expressMerchantId; + + @Schema(description = "发货店铺") + private String expressMerchantName; + + @Schema(description = "订单总额") + @NotNull(message = "订单总额不能为空") + @DecimalMin(value = "0.01", message = "订单总额必须大于0") + @Digits(integer = 10, fraction = 2, message = "订单总额格式不正确") + private BigDecimal totalPrice; + + @Schema(description = "减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格") + @DecimalMin(value = "0", message = "减少金额不能为负数") + private BigDecimal reducePrice; + + @Schema(description = "实际付款") + @DecimalMin(value = "0", message = "实际付款不能为负数") + private BigDecimal payPrice; + + @Schema(description = "用于统计") + private BigDecimal price; + + @Schema(description = "价钱,用于积分赠送") + private BigDecimal money; + + @Schema(description = "退款金额") + private BigDecimal refundMoney; + + @Schema(description = "教练价格") + private BigDecimal coachPrice; + + @Schema(description = "购买数量") + @Min(value = 1, message = "购买数量必须大于0") + private Integer totalNum; + + @Schema(description = "教练id") + private Integer coachId; + + @Schema(description = "来源ID,存商品ID") + private Integer formId; + + @Schema(description = "支付的用户id") + private Integer payUserId; + + @Schema(description = "支付方式:0余额支付,1微信支付,2支付宝支付,3银联支付,4现金支付,5POS机支付,6免费,7积分支付") + private Integer payType; + + @Schema(description = "微信支付子类型:JSAPI小程序支付,NATIVE扫码支付") + private String wechatPayType; + + @Schema(description = "代付支付方式:0余额支付,1微信支付,2支付宝支付,3银联支付,4现金支付,5POS机支付,6免费,7积分支付") + private Integer friendPayType; + + @Schema(description = "0未付款,1已付款") + private Boolean payStatus; + + @Schema(description = "0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款") + private Integer orderStatus; + + @Schema(description = "发货状态(10未发货 20已发货 30部分发货)") + private Integer deliveryStatus; + + @Schema(description = "发货备注") + private String deliveryNote; + + @Schema(description = "快递单号") + private String expressNo; + + @Schema(description = "发货时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime deliveryTime; + + @Schema(description = "优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡") + private Integer couponType; + + @Schema(description = "优惠说明") + private String couponDesc; + + @Schema(description = "二维码地址,保存订单号,支付成功后才生成") + private String qrcode; + + @Schema(description = "vip月卡年卡、ic月卡年卡回退次数") + private Integer returnNum; + + @Schema(description = "vip充值回退金额") + private BigDecimal returnMoney; + + @Schema(description = "预约详情开始时间数组") + private String startTime; + + @Schema(description = "是否已开具发票:0未开发票,1已开发票,2不能开具发票") + private Integer isInvoice; + + @Schema(description = "发票流水号") + private String invoiceNo; + + @Schema(description = "支付时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime payTime; + + @Schema(description = "退款原因") + @NotBlank(message = "退款原因不能为空") + private String refundReason; + + @Schema(description = "退款时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime refundTime; + + @Schema(description = "申请退款时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime refundApplyTime; + + @Schema(description = "取消时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime cancelTime; + + @Schema(description = "取消原因") + private String cancelReason; + + @Schema(description = "过期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime expirationTime; + + @Schema(description = "评价状态 0未评价 1已评价") + private Integer evaluateStatus; + + @Schema(description = "评价时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime evaluateTime; + + @Schema(description = "对账情况:0=未对账;1=已对账;3=已对账,金额对不上;4=未查询到该订单") + private Integer checkBill; + + @Schema(description = "订单是否已结算(0未结算 1已结算)") + private Integer isSettled; + + @Schema(description = "商户备注") + private String merchantRemarks; + + @Schema(description = "系统版本号 0当前版本 value=其他版本") + private Integer version; + + @Schema(description = "用户id") + private Integer userId; + + @Schema(description = "头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "手机号码") + @TableField(exist = false) + private String phone; + + @Schema(description = "手机号码(脱敏)") + @TableField(exist = false) + private String mobile; + + @Schema(description = "备注") + @Size(max = 500, message = "备注长度不能超过500字符") + private String comments; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + @NotNull(message = "租户ID不能为空") + private Integer tenantId; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "自提码") + private String selfTakeCode; + + @Schema(description = "是否已收到赠品") + private Boolean hasTakeGift; + + @Schema(description = "accessToken") + @TableField(exist = false) + private String accessToken; + + @Schema(description = "openid") + @TableField(exist = false) + private String openid; + + @Schema(description = "订单商品") + @TableField(exist = false) + private List orderGoods; + + @Schema(description = "报名信息") + @TableField(exist = false) + private BszxBm bm; + + @Schema(description = "快递id") + @TableField(exist = false) + private Integer expressId; + + @Schema(description = "发货人") + @TableField(exist = false) + private String sendName; + + @Schema(description = "发货人联系方式") + @TableField(exist = false) + private String sendPhone; + + @Schema(description = "发货地址") + @TableField(exist = false) + private String sendAddress; + + @TableField(exist = false) + private ShopOrderDelivery shopOrderDelivery; +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopOrderDelivery.java b/src/main/java/com/gxwebsoft/shop/entity/ShopOrderDelivery.java new file mode 100644 index 0000000..7edf12b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopOrderDelivery.java @@ -0,0 +1,78 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 发货单 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopOrderDelivery对象", description = "发货单") +public class ShopOrderDelivery implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "发货单ID") + @TableId(value = "delivery_id", type = IdType.AUTO) + private Integer deliveryId; + + @Schema(description = "订单ID") + private Integer orderId; + + @Schema(description = "发货方式(10手动录入 20无需物流 30电子面单)") + private Integer deliveryMethod; + + @Schema(description = "打包方式(废弃)") + private Integer packMethod; + + @Schema(description = "物流公司ID") + private Integer expressId; + + @Schema(description = "发货人") + private String sendName; + + @Schema(description = "发货人联系方式") + private String sendPhone; + + @Schema(description = "发货地址") + private String sendAddress; + + @Schema(description = "物流单号") + private String expressNo; + + @Schema(description = "电子面单模板内容") + private String eorderHtml; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @TableField(exist = false) + private String expressName; +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopOrderDeliveryGoods.java b/src/main/java/com/gxwebsoft/shop/entity/ShopOrderDeliveryGoods.java new file mode 100644 index 0000000..e990a06 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopOrderDeliveryGoods.java @@ -0,0 +1,63 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 发货单商品 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopOrderDeliveryGoods对象", description = "发货单商品") +public class ShopOrderDeliveryGoods implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "发货单ID") + private Integer deliveryId; + + @Schema(description = "订单ID") + private Integer orderId; + + @Schema(description = "订单商品ID") + private Integer orderGoodsId; + + @Schema(description = "商品ID") + private Integer goodsId; + + @Schema(description = "发货数量") + private Integer deliveryNum; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopOrderExtract.java b/src/main/java/com/gxwebsoft/shop/entity/ShopOrderExtract.java new file mode 100644 index 0000000..4d3d39b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopOrderExtract.java @@ -0,0 +1,60 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 自提订单联系方式 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopOrderExtract对象", description = "自提订单联系方式") +public class ShopOrderExtract implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "订单ID") + private Integer orderId; + + @Schema(description = "联系人姓名") + private String linkman; + + @Schema(description = "联系电话") + private String phone; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopOrderGoods.java b/src/main/java/com/gxwebsoft/shop/entity/ShopOrderGoods.java new file mode 100644 index 0000000..195affc --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopOrderGoods.java @@ -0,0 +1,121 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import java.time.LocalDate; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalTime; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import java.util.List; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品信息 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopOrderGoods对象", description = "商品信息") +public class ShopOrderGoods implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "关联订单表id") + private Integer orderId; + + @Schema(description = "订单标识") + private String orderCode; + + @Schema(description = "关联商户ID") + private Long merchantId; + + @Schema(description = "商户名称") + private String merchantName; + + @Schema(description = "商品封面图") + private String image; + + @Schema(description = "关联商品id") + private Integer goodsId; + + @Schema(description = "商品名称") + private String goodsName; + + @Schema(description = "商品规格") + private String spec; + + private Integer skuId; + + @Schema(description = "单价") + private BigDecimal price; + + @Schema(description = "购买数量") + private Integer totalNum; + + @Schema(description = "0 未付款 1已付款,2无需付款或占用状态") + private Integer payStatus; + + @Schema(description = "0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款") + private Integer orderStatus; + + @Schema(description = "是否免费:0收费、1免费") + private Boolean isFree; + + @Schema(description = "系统版本 0当前版本 其他版本") + private Integer version; + + @Schema(description = "预约时间段") + private String timePeriod; + + @Schema(description = "预定日期") + private LocalDate dateTime; + + @Schema(description = "开场时间") + private LocalTime startTime; + + @Schema(description = "结束时间") + private LocalTime endTime; + + @Schema(description = "毫秒时间戳") + private Long timeFlag; + + @Schema(description = "过期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime expirationTime; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "用户id") + private Integer userId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "更新时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @TableField(exist = false) + private List goodsList; +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopOrderInfo.java b/src/main/java/com/gxwebsoft/shop/entity/ShopOrderInfo.java new file mode 100644 index 0000000..9c26566 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopOrderInfo.java @@ -0,0 +1,122 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import java.time.LocalDate; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalTime; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 场地 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopOrderInfo对象", description = "场地") +public class ShopOrderInfo implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "关联订单表id") + private Integer orderId; + + @Schema(description = "组合数据:日期+时间段+场馆id+场地id") + private String orderCode; + + @Schema(description = "关联商户ID") + private Long merchantId; + + @Schema(description = "商户名称") + private String merchantName; + + @Schema(description = "关联场地id") + private Integer fieldId; + + @Schema(description = "场地名称") + private String fieldName; + + @Schema(description = "单价") + private BigDecimal price; + + @Schema(description = "儿童价") + private BigDecimal childrenPrice; + + @Schema(description = "成人人数") + private Integer adultNum; + + @Schema(description = "儿童人数") + private Integer childrenNum; + + @Schema(description = "已核销的成人票数") + private Integer adultNumUse; + + @Schema(description = "已核销的儿童票数") + private Integer childrenNumUse; + + @Schema(description = "0 未付款 1已付款,2无需付款或占用状态") + private Integer payStatus; + + @Schema(description = "0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款") + private Integer orderStatus; + + @Schema(description = "是否免费:0收费、1免费") + private Boolean isFree; + + @Schema(description = "是否支持儿童票:0不支持、1支持") + private Boolean isChildren; + + @Schema(description = "系统版本 0当前版本 其他版本") + private Integer version; + + @Schema(description = "预订类型:0全场,1半场") + private Boolean isHalf; + + @Schema(description = "预约时间段") + private String timePeriod; + + @Schema(description = "预定日期") + private LocalDate dateTime; + + @Schema(description = "开场时间") + private LocalTime startTime; + + @Schema(description = "结束时间") + private LocalTime endTime; + + @Schema(description = "毫秒时间戳") + private Long timeFlag; + + @Schema(description = "过期时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime expirationTime; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "用户id") + private Integer userId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "更新时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopOrderInfoLog.java b/src/main/java/com/gxwebsoft/shop/entity/ShopOrderInfoLog.java new file mode 100644 index 0000000..0d026ba --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopOrderInfoLog.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 订单核销 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopOrderInfoLog对象", description = "订单核销") +public class ShopOrderInfoLog implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "关联订单表id") + private Integer orderId; + + @Schema(description = "关联商户ID") + private Long merchantId; + + @Schema(description = "关联场地id") + private Integer fieldId; + + @Schema(description = "核销数量") + private Boolean useNum; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopRechargeOrder.java b/src/main/java/com/gxwebsoft/shop/entity/ShopRechargeOrder.java new file mode 100644 index 0000000..87592a8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopRechargeOrder.java @@ -0,0 +1,103 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 会员充值订单表 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopRechargeOrder对象", description = "会员充值订单表") +public class ShopRechargeOrder implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "订单ID") + @TableId(value = "order_id", type = IdType.AUTO) + private Integer orderId; + + @Schema(description = "订单号") + private String orderNo; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "充值方式(10自定义金额 20套餐充值)") + private Integer rechargeType; + + @Schema(description = "机构id") + private Integer organizationId; + + @Schema(description = "充值套餐ID") + private Integer planId; + + @Schema(description = "用户支付金额") + private BigDecimal payPrice; + + @Schema(description = "赠送金额") + private BigDecimal giftMoney; + + @Schema(description = "实际到账金额") + private BigDecimal actualMoney; + + @Schema(description = "用户可用余额") + private BigDecimal balance; + + @Schema(description = "支付方式(微信/支付宝)") + private String payMethod; + + @Schema(description = "支付状态(10待支付 20已支付)") + private Integer payStatus; + + @Schema(description = "付款时间") + private Integer payTime; + + @Schema(description = "第三方交易记录ID") + private Integer tradeId; + + @Schema(description = "来源客户端 (APP、H5、小程序等)") + private String platform; + + @Schema(description = "所属门店ID") + private Integer shopId; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "商户编码") + private String merchantCode; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopSpec.java b/src/main/java/com/gxwebsoft/shop/entity/ShopSpec.java new file mode 100644 index 0000000..8c32f26 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopSpec.java @@ -0,0 +1,60 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 规格 + * + * @author 科技小王子 + * @since 2025-05-01 09:44:00 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopSpec对象", description = "规格") +public class ShopSpec implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "规格ID") + @TableId(value = "spec_id", type = IdType.AUTO) + private Integer specId; + + @Schema(description = "规格名称") + private String specName; + + @Schema(description = "规格值") + private String specValue; + + @Schema(description = "商户ID") + private Long merchantId; + + @Schema(description = "创建用户") + private Integer userId; + + @Schema(description = "更新者") + private Integer updater; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1待修,2异常已修,3异常未修") + private Integer status; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopSpecValue.java b/src/main/java/com/gxwebsoft/shop/entity/ShopSpecValue.java new file mode 100644 index 0000000..2cfe2c2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopSpecValue.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 规格值 + * + * @author 科技小王子 + * @since 2025-05-01 09:44:00 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopSpecValue对象", description = "规格值") +public class ShopSpecValue implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "规格值ID") + @TableId(value = "spec_value_id", type = IdType.AUTO) + private Integer specValueId; + + @Schema(description = "规格组ID") + private Integer specId; + + @Schema(description = "规格值") + private String specValue; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopSplash.java b/src/main/java/com/gxwebsoft/shop/entity/ShopSplash.java new file mode 100644 index 0000000..1bb2655 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopSplash.java @@ -0,0 +1,65 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 开屏广告 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopSplash对象", description = "开屏广告") +public class ShopSplash implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "标题") + private String title; + + @Schema(description = "图片") + private String image; + + @Schema(description = "跳转类型") + private String jumpType; + + @Schema(description = "跳转主键") + private Integer jumpPk; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopStore.java b/src/main/java/com/gxwebsoft/shop/entity/ShopStore.java new file mode 100644 index 0000000..5c42c0b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopStore.java @@ -0,0 +1,90 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 门店 + * + * @author 科技小王子 + * @since 2026-01-30 15:00:25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopStore对象", description = "门店") +public class ShopStore implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "店铺名称") + private String name; + + @Schema(description = "门店地址") + private String address; + + @Schema(description = "手机号码") + private String phone; + + @Schema(description = "邮箱") + private String email; + + @Schema(description = "门店经理") + private String managerName; + + @Schema(description = "门店banner") + private String shopBanner; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "经度和纬度") + private String lngAndLat; + + @Schema(description = "位置") + private String location; + + @Schema(description = "区域") + private String district; + + @Schema(description = "轮廓") + private String points; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "是否删除") + private Integer isDelete; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopStoreRider.java b/src/main/java/com/gxwebsoft/shop/entity/ShopStoreRider.java new file mode 100644 index 0000000..b0821a6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopStoreRider.java @@ -0,0 +1,102 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 配送员 + * + * @author 科技小王子 + * @since 2026-01-30 15:14:15 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopStoreRider对象", description = "配送员") +public class ShopStoreRider implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @Schema(description = "门店ID") + private Integer storeId; + + @Schema(description = "门店名称") + @TableField(exist = false) + private String storeName; + + @Schema(description = "骑手编号(可选)") + private String riderNo; + + @Schema(description = "姓名") + private String realName; + + @Schema(description = "手机号") + private String mobile; + + @Schema(description = "头像") + private String avatar; + + @Schema(description = "身份证号(可选)") + private String idCardNo; + + @Schema(description = "状态:1启用;0禁用") + private Integer status; + + @Schema(description = "接单状态:0休息/下线;1在线;2忙碌") + private Integer workStatus; + + @Schema(description = "是否开启自动派单:1是;0否") + private Integer autoDispatchEnabled; + + @Schema(description = "派单优先级(同小区多骑手时可用,值越大越优先)") + private Integer dispatchPriority; + + @Schema(description = "最大同时配送单数(0表示不限制)") + private Integer maxOnhandOrders; + + @Schema(description = "是否计算工资(提成):1计算;0不计算(如三方配送点可设0)") + private Integer commissionCalcEnabled; + + @Schema(description = "水每桶提成金额(元/桶)") + private BigDecimal waterBucketUnitFee; + + @Schema(description = "其他商品提成方式:1按订单固定金额;2按订单金额比例;3按商品规则(另表)") + private Integer otherGoodsCommissionType; + + @Schema(description = "其他商品提成值:固定金额(元)或比例(%)") + private BigDecimal otherGoodsCommissionValue; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "是否删除") + private Integer isDelete; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopStoreUser.java b/src/main/java/com/gxwebsoft/shop/entity/ShopStoreUser.java new file mode 100644 index 0000000..22ae996 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopStoreUser.java @@ -0,0 +1,54 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 店员 + * + * @author 科技小王子 + * @since 2026-01-30 15:00:25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopStoreUser对象", description = "店员") +public class ShopStoreUser implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "门店ID") + private Integer storeId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "是否删除") + private Integer isDelete; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopUser.java b/src/main/java/com/gxwebsoft/shop/entity/ShopUser.java new file mode 100644 index 0000000..f540f64 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopUser.java @@ -0,0 +1,254 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * 用户记录表 + * + * @author 科技小王子 + * @since 2025-10-03 13:41:09 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(description = "用户记录表") +public class ShopUser implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "id") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "用户id") + private Integer userId; + + @Schema(description = "用户类型 0个人用户 1企业用户 2其他") + private Integer type; + + @Schema(description = "账号") + private String username; + + @Schema(description = "密码") + private String password; + + @Schema(description = "昵称") + private String nickname; + + @Schema(description = "手机号") + private String phone; + + @Schema(description = "性别 1男 2女") + private Integer sex; + + @Schema(description = "职务") + private String position; + + @Schema(description = "注册来源客户端 (APP、H5、MP-WEIXIN等)") + private String platform; + + @Schema(description = "邮箱") + private String email; + + @Schema(description = "邮箱是否验证, 0否, 1是") + private Integer emailVerified; + + @Schema(description = "别名") + private String alias; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "证件号码") + private String idCard; + + @Schema(description = "出生日期") + private LocalDate birthday; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "用户可用余额") + private BigDecimal balance; + + @Schema(description = "已提现金额") + private BigDecimal cashedMoney; + + @Schema(description = "用户可用积分") + private Integer points; + + @Schema(description = "用户总支付的金额") + private BigDecimal payMoney; + + @Schema(description = "实际消费的金额(不含退款)") + private BigDecimal expendMoney; + + @Schema(description = "密码") + private String payPassword; + + @Schema(description = "会员等级ID") + private Integer gradeId; + + @Schema(description = "行业分类") + private String category; + + @Schema(description = "个人简介") + private String introduction; + + @Schema(description = "机构id") + private Integer organizationId; + + @Schema(description = "会员分组ID") + private Integer groupId; + + @Schema(description = "头像") + private String avatar; + + @Schema(description = "背景图") + private String bgImage; + + @Schema(description = "用户编码") + private String userCode; + + @Schema(description = "是否已实名认证") + private Integer certification; + + @Schema(description = "年龄") + private Integer age; + + @Schema(description = "是否线下会员") + private Boolean offline; + + @Schema(description = "关注数") + private Integer followers; + + @Schema(description = "粉丝数") + private Integer fans; + + @Schema(description = "点赞数") + private Integer likes; + + @Schema(description = "评论数") + private Integer commentNumbers; + + @Schema(description = "是否推荐") + private Integer recommend; + + @Schema(description = "微信openid") + private String openid; + + @Schema(description = "微信公众号openid") + private String officeOpenid; + + @Schema(description = "微信unionID") + private String unionid; + + @Schema(description = "客户端ID") + private String clientId; + + @Schema(description = "不允许办卡") + private Boolean notAllowVip; + + @Schema(description = "是否管理员") + private Boolean isAdmin; + + @Schema(description = "是否企业管理员") + private Boolean isOrganizationAdmin; + + @Schema(description = "累计登录次数") + private Integer loginNum; + + @Schema(description = "企业ID") + private Integer companyId; + + @Schema(description = "可管理的场馆") + private String merchants; + + @Schema(description = "商户ID") + private Integer merchantId; + + @Schema(description = "商户名称") + private String merchantName; + + @Schema(description = "商户头像") + private String merchantAvatar; + + @Schema(description = "第三方系统的用户ID") + private Integer uid; + + @Schema(description = "专家角色") + private Boolean expertType; + + @Schema(description = "过期时间") + private Integer expireTime; + + @Schema(description = "最后结算时间") + private LocalDateTime settlementTime; + + @Schema(description = "资质") + private String aptitude; + + @Schema(description = "行业类型(父级)") + private String industryParent; + + @Schema(description = "行业类型(子级)") + private String industryChild; + + @Schema(description = "头衔") + private String title; + + @Schema(description = "安装的产品ID") + private Integer templateId; + + @Schema(description = "插件安装状态(仅对超超管判断) 0未安装 1已安装 ") + private Integer installed; + + @Schema(description = "特长") + private String speciality; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0在线, 1离线") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopUserAddress.java b/src/main/java/com/gxwebsoft/shop/entity/ShopUserAddress.java new file mode 100644 index 0000000..a033356 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopUserAddress.java @@ -0,0 +1,80 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; + +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 收货地址 + * + * @author 科技小王子 + * @since 2025-07-22 23:06:40 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopUserAddress对象", description = "收货地址") +public class ShopUserAddress implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "姓名") + private String name; + + @Schema(description = "手机号码") + private String phone; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "收货地址") + private String address; + + @Schema(description = "收货地址") + private String fullAddress; + + private String lat; + + private String lng; + + @Schema(description = "1先生 2女士") + private Integer gender; + + @Schema(description = "家、公司、学校") + private String type; + + @Schema(description = "默认收货地址") + private Boolean isDefault; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopUserBalanceLog.java b/src/main/java/com/gxwebsoft/shop/entity/ShopUserBalanceLog.java new file mode 100644 index 0000000..77e41df --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopUserBalanceLog.java @@ -0,0 +1,82 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户余额变动明细表 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopUserBalanceLog对象", description = "用户余额变动明细表") +public class ShopUserBalanceLog implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "log_id", type = IdType.AUTO) + private Integer logId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "余额变动场景(0下级下单1供应商收入2差价收益 10用户充值 20用户消费 30管理员操作 40订单退款)") + private Integer scene; + + @Schema(description = "变动金额") + private BigDecimal money; + + @Schema(description = "变动后余额") + private BigDecimal balance; + + @Schema(description = "管理员备注") + private String remark; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "操作人ID") + private Integer adminId; + + @Schema(description = "排序(数字越小越靠前)") + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "商户ID") + private Long merchantId; + + @Schema(description = "商户编码") + private String merchantCode; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopUserCollection.java b/src/main/java/com/gxwebsoft/shop/entity/ShopUserCollection.java new file mode 100644 index 0000000..6f89cf8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopUserCollection.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 我的收藏 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopUserCollection对象", description = "我的收藏") +public class ShopUserCollection implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "0店铺,1商品") + private Boolean type; + + @Schema(description = "租户ID") + private Integer tid; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "注册时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopUserCoupon.java b/src/main/java/com/gxwebsoft/shop/entity/ShopUserCoupon.java new file mode 100644 index 0000000..d25ad57 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopUserCoupon.java @@ -0,0 +1,210 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户优惠券 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopUserCoupon对象", description = "用户优惠券") +public class ShopUserCoupon implements Serializable { + private static final long serialVersionUID = 1L; + + // 优惠券类型常量 + public static final int TYPE_REDUCE = 10; // 满减券 + public static final int TYPE_DISCOUNT = 20; // 折扣券 + public static final int TYPE_FREE = 30; // 免费券 + + // 使用状态常量 + public static final int STATUS_UNUSED = 0; // 未使用 + public static final int STATUS_USED = 1; // 已使用 + public static final int STATUS_EXPIRED = 2; // 已过期 + + // 获取方式常量 + public static final int OBTAIN_ACTIVE = 10; // 主动领取 + public static final int OBTAIN_SYSTEM = 20; // 系统发放 + public static final int OBTAIN_ACTIVITY = 30; // 活动赠送 + + // 适用范围常量 + public static final int APPLY_ALL = 10; // 全部商品 + public static final int APPLY_GOODS = 20; // 指定商品 + public static final int APPLY_CATEGORY = 30; // 指定分类 + + @Schema(description = "id") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + @Schema(description = "优惠券模板ID") + private Integer couponId; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "优惠券名称") + private String name; + + @Schema(description = "优惠券描述") + private String description; + + @Schema(description = "优惠券类型(10满减券 20折扣券 30免费劵)") + private Integer type; + + @Schema(description = "满减券-减免金额") + @JsonSerialize(using = ToStringSerializer.class) + @JsonInclude(JsonInclude.Include.NON_NULL) + private BigDecimal reducePrice; + + @Schema(description = "折扣券-折扣率(0-100)") + private Integer discount; + + @Schema(description = "最低消费金额") + @JsonSerialize(using = ToStringSerializer.class) + @JsonInclude(JsonInclude.Include.NON_NULL) + private BigDecimal minPrice; + + @Schema(description = "适用范围(10全部商品 20指定商品 30指定分类)") + private Integer applyRange; + + @Schema(description = "到期类型(10领取后生效 20固定时间)") + private Integer expireType; + + @Schema(description = "领取后生效-有效天数") + private Integer expireDay; + + @Schema(description = "适用范围配置(json格式)") + private String applyRangeConfig; + + @Schema(description = "是否过期(0未过期 1已过期)") + private Integer isExpire; + + @Schema(description = "有效期开始时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime startTime; + + @Schema(description = "有效期结束时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime endTime; + + @Schema(description = "使用状态(0未使用 1已使用 2已过期)") + private Integer status; + + @Schema(description = "使用时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime useTime; + + @Schema(description = "使用订单ID") + private Integer orderId; + + @Schema(description = "是否已使用") + private Integer isUse; + + @Schema(description = "使用订单号") + private String orderNo; + + @Schema(description = "获取方式(10主动领取 20系统发放 30活动赠送)") + private Integer obtainType; + + @Schema(description = "获取来源描述") + private String obtainSource; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Boolean deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + + @TableField(exist = false) + private ShopCoupon couponItem; + + /** + * 判断优惠券是否可用 + * @return true-可用,false-不可用 + */ + public boolean isAvailable() { + return this.status != null && this.status == STATUS_UNUSED && !isExpired(); + } + + /** + * 判断优惠券是否已使用 + * @return true-已使用,false-未使用 + */ + public boolean isUsed() { + return this.status != null && this.status == STATUS_USED; + } + + /** + * 判断优惠券是否已过期 + * @return true-已过期,false-未过期 + */ + public boolean isExpired() { + if (this.status != null && this.status == STATUS_EXPIRED) { + return true; + } + return this.endTime != null && this.endTime.isBefore(LocalDateTime.now()); + } + + /** + * 获取优惠券状态描述 + * @return 状态描述 + */ + public String getStatusDesc() { + if (isExpired()) { + return "已过期"; + } else if (isUsed()) { + return "已使用"; + } else if (isAvailable()) { + return "可使用"; + } else { + return "未知状态"; + } + } + + /** + * 更新优惠券状态为已使用 + * @param orderId 订单ID + * @param orderNo 订单号 + */ + public void markAsUsed(Integer orderId, String orderNo) { + this.status = STATUS_USED; + this.isUse = 1; + this.useTime = LocalDateTime.now(); + this.orderId = orderId; + this.orderNo = orderNo; + } + + /** + * 更新优惠券状态为已过期 + */ + public void markAsExpired() { + this.status = STATUS_EXPIRED; + this.isExpire = 1; + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopUserReferee.java b/src/main/java/com/gxwebsoft/shop/entity/ShopUserReferee.java new file mode 100644 index 0000000..231d023 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopUserReferee.java @@ -0,0 +1,81 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户推荐关系表 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopUserReferee对象", description = "用户推荐关系表") +public class ShopUserReferee implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "推荐人ID") + private Integer dealerId; + + @Schema(description = "分销商名称") + @TableField(exist = false) + private String dealerName; + + @Schema(description = "分销商头像") + @TableField(exist = false) + private String dealerAvatar; + + @Schema(description = "分销商手机号") + @TableField(exist = false) + private String dealerPhone; + + @Schema(description = "用户id(被推荐人)") + private Integer userId; + + @Schema(description = "昵称") + @TableField(exist = false) + private String nickname; + + @Schema(description = "头像") + @TableField(exist = false) + private String avatar; + + @Schema(description = "手机号") + @TableField(exist = false) + private String phone; + + @Schema(description = "推荐关系层级(1,2,3)") + private Integer level; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否删除, 0否, 1是") + @TableLogic + private Integer deleted; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopWarehouse.java b/src/main/java/com/gxwebsoft/shop/entity/ShopWarehouse.java new file mode 100644 index 0000000..55f83e8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopWarehouse.java @@ -0,0 +1,81 @@ +package com.gxwebsoft.shop.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 仓库 + * + * @author 科技小王子 + * @since 2026-01-30 17:46:47 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopWarehouse对象", description = "仓库") +public class ShopWarehouse implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "仓库名称") + private String name; + + @Schema(description = "唯一标识") + private String code; + + @Schema(description = "类型 中心仓,区域仓,门店仓") + private String type; + + @Schema(description = "仓库地址") + private String address; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "联系电话") + private String phone; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "经纬度") + private String lngAndLat; + + @Schema(description = "用户ID") + private Integer userId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + private Integer sortNumber; + + @Schema(description = "是否删除") + private Integer isDelete; + + @Schema(description = "租户id") + private Integer tenantId; + + @Schema(description = "创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime createTime; + + @Schema(description = "修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime updateTime; + +} diff --git a/src/main/java/com/gxwebsoft/shop/entity/ShopWechatDeposit.java b/src/main/java/com/gxwebsoft/shop/entity/ShopWechatDeposit.java new file mode 100644 index 0000000..1b6100c --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/entity/ShopWechatDeposit.java @@ -0,0 +1,66 @@ +package com.gxwebsoft.shop.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 押金 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Schema(name = "ShopWechatDeposit对象", description = "押金") +public class ShopWechatDeposit implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + + @Schema(description = "订单id") + private Integer oid; + + @Schema(description = "用户id") + private Integer uid; + + @Schema(description = "场地订单号") + private String orderNum; + + @Schema(description = "付款订单号") + private String wechatOrder; + + @Schema(description = "退款订单号 ") + private String wechatReturn; + + @Schema(description = "场馆名称") + private String siteName; + + @Schema(description = "微信昵称") + private String username; + + @Schema(description = "手机号码") + private String phone; + + @Schema(description = "物品名称") + private String name; + + @Schema(description = "押金金额") + private BigDecimal price; + + @Schema(description = "押金状态,1已付款,2未付款,已退押金") + private Boolean status; + + @Schema(description = "创建时间") + private Integer createTime; + + @Schema(description = "租户id") + private Integer tenantId; + +} diff --git a/src/main/java/com/gxwebsoft/shop/enums/OrderStatusEnum.java b/src/main/java/com/gxwebsoft/shop/enums/OrderStatusEnum.java new file mode 100644 index 0000000..3fd46c0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/enums/OrderStatusEnum.java @@ -0,0 +1,32 @@ +package com.gxwebsoft.shop.enums; + +/** + * 订单状态枚举 + */ +public enum OrderStatusEnum { + ALL(-1, "全部"), + WAIT_PAY(0, "待支付"), + WAIT_DELIVERY(1, "待发货"), + WAIT_CONFIRM(2, "待核销"), + WAIT_RECEIVE(3, "待收货"), + WAIT_EVALUATE(4, "待评价"), + COMPLETED(5, "已完成"), + REFUNDED(6, "已退款"), + DELETED(7, "已删除"); + + private final Integer code; + private final String desc; + + OrderStatusEnum(Integer code, String desc) { + this.code = code; + this.desc = desc; + } + + public Integer getCode() { + return code; + } + + public String getDesc() { + return desc; + } +} \ No newline at end of file diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopArticleMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopArticleMapper.java new file mode 100644 index 0000000..d6d3d85 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopArticleMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopArticle; +import com.gxwebsoft.shop.param.ShopArticleParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 商品文章Mapper + * + * @author 科技小王子 + * @since 2025-08-13 05:14:53 + */ +public interface ShopArticleMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopArticleParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopArticleParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopBrandMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopBrandMapper.java new file mode 100644 index 0000000..49a914d --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopBrandMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopBrand; +import com.gxwebsoft.shop.param.ShopBrandParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 品牌Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopBrandMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopBrandParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopBrandParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopCartMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopCartMapper.java new file mode 100644 index 0000000..ae8b981 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopCartMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopCart; +import com.gxwebsoft.shop.param.ShopCartParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 购物车Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopCartMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopCartParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopCartParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopCategoryMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopCategoryMapper.java new file mode 100644 index 0000000..2cfd98c --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopCategoryMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopCategory; +import com.gxwebsoft.shop.param.ShopCategoryParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 商品分类Mapper + * + * @author 科技小王子 + * @since 2025-04-24 20:52:13 + */ +public interface ShopCategoryMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopCategoryParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopCategoryParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopChatConversationMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopChatConversationMapper.java new file mode 100644 index 0000000..483b761 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopChatConversationMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopChatConversation; +import com.gxwebsoft.shop.param.ShopChatConversationParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 聊天消息表Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopChatConversationMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopChatConversationParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopChatConversationParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopChatMessageMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopChatMessageMapper.java new file mode 100644 index 0000000..264bc4b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopChatMessageMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopChatMessage; +import com.gxwebsoft.shop.param.ShopChatMessageParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 聊天消息表Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopChatMessageMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopChatMessageParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopChatMessageParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopCommissionRoleMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopCommissionRoleMapper.java new file mode 100644 index 0000000..2f66f28 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopCommissionRoleMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopCommissionRole; +import com.gxwebsoft.shop.param.ShopCommissionRoleParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 分红角色Mapper + * + * @author 科技小王子 + * @since 2025-05-01 10:01:15 + */ +public interface ShopCommissionRoleMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopCommissionRoleParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopCommissionRoleParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopCommunityMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopCommunityMapper.java new file mode 100644 index 0000000..c46985e --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopCommunityMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopCommunity; +import com.gxwebsoft.shop.param.ShopCommunityParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 小区Mapper + * + * @author 科技小王子 + * @since 2026-01-29 20:48:32 + */ +public interface ShopCommunityMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopCommunityParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopCommunityParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopCountMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopCountMapper.java new file mode 100644 index 0000000..24701c6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopCountMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopCount; +import com.gxwebsoft.shop.param.ShopCountParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 商城销售统计表Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopCountMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopCountParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopCountParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponApplyCateMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponApplyCateMapper.java new file mode 100644 index 0000000..6d86d1d --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponApplyCateMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopCouponApplyCate; +import com.gxwebsoft.shop.param.ShopCouponApplyCateParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 优惠券可用分类Mapper + * + * @author 科技小王子 + * @since 2025-08-11 12:47:49 + */ +public interface ShopCouponApplyCateMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopCouponApplyCateParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopCouponApplyCateParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponApplyItemMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponApplyItemMapper.java new file mode 100644 index 0000000..077989a --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponApplyItemMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopCouponApplyItem; +import com.gxwebsoft.shop.param.ShopCouponApplyItemParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 优惠券可用分类Mapper + * + * @author 科技小王子 + * @since 2025-08-11 12:47:49 + */ +public interface ShopCouponApplyItemMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopCouponApplyItemParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopCouponApplyItemParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponMapper.java new file mode 100644 index 0000000..a6a8ff1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopCoupon; +import com.gxwebsoft.shop.param.ShopCouponParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 优惠券Mapper + * + * @author 科技小王子 + * @since 2025-08-11 23:51:23 + */ +public interface ShopCouponMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopCouponParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopCouponParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerApplyMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerApplyMapper.java new file mode 100644 index 0000000..ce2ee91 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerApplyMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopDealerApply; +import com.gxwebsoft.shop.param.ShopDealerApplyParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 分销商申请记录表Mapper + * + * @author 科技小王子 + * @since 2025-08-11 23:50:18 + */ +public interface ShopDealerApplyMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopDealerApplyParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopDealerApplyParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerBankMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerBankMapper.java new file mode 100644 index 0000000..2ec78ed --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerBankMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopDealerBank; +import com.gxwebsoft.shop.param.ShopDealerBankParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 分销商提现银行卡Mapper + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +public interface ShopDealerBankMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopDealerBankParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopDealerBankParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerCapitalMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerCapitalMapper.java new file mode 100644 index 0000000..d996c07 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerCapitalMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopDealerCapital; +import com.gxwebsoft.shop.param.ShopDealerCapitalParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 分销商资金明细表Mapper + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +public interface ShopDealerCapitalMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopDealerCapitalParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopDealerCapitalParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerOrderMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerOrderMapper.java new file mode 100644 index 0000000..928b066 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerOrderMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopDealerOrder; +import com.gxwebsoft.shop.param.ShopDealerOrderParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 分销商订单记录表Mapper + * + * @author 科技小王子 + * @since 2025-08-12 11:55:18 + */ +public interface ShopDealerOrderMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopDealerOrderParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopDealerOrderParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerRecordMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerRecordMapper.java new file mode 100644 index 0000000..09f365f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerRecordMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopDealerRecord; +import com.gxwebsoft.shop.param.ShopDealerRecordParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 客户跟进情况Mapper + * + * @author 科技小王子 + * @since 2025-10-02 12:21:50 + */ +public interface ShopDealerRecordMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopDealerRecordParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopDealerRecordParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerRefereeMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerRefereeMapper.java new file mode 100644 index 0000000..70ddf37 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerRefereeMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopDealerReferee; +import com.gxwebsoft.shop.param.ShopDealerRefereeParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 分销商推荐关系表Mapper + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +public interface ShopDealerRefereeMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopDealerRefereeParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopDealerRefereeParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerSettingMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerSettingMapper.java new file mode 100644 index 0000000..5d10a6c --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerSettingMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopDealerSetting; +import com.gxwebsoft.shop.param.ShopDealerSettingParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 分销商设置表Mapper + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +public interface ShopDealerSettingMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopDealerSettingParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopDealerSettingParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerUserMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerUserMapper.java new file mode 100644 index 0000000..c1b5fd3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerUserMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopDealerUser; +import com.gxwebsoft.shop.param.ShopDealerUserParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 分销商用户记录表Mapper + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +public interface ShopDealerUserMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopDealerUserParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopDealerUserParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerWithdrawMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerWithdrawMapper.java new file mode 100644 index 0000000..0d5a427 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerWithdrawMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopDealerWithdraw; +import com.gxwebsoft.shop.param.ShopDealerWithdrawParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 分销商提现明细表Mapper + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +public interface ShopDealerWithdrawMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopDealerWithdrawParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopDealerWithdrawParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopExpressMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopExpressMapper.java new file mode 100644 index 0000000..1d236e7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopExpressMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopExpress; +import com.gxwebsoft.shop.param.ShopExpressParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 物流公司Mapper + * + * @author 科技小王子 + * @since 2025-08-12 12:07:03 + */ +public interface ShopExpressMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopExpressParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopExpressParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopExpressTemplateDetailMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopExpressTemplateDetailMapper.java new file mode 100644 index 0000000..fd26f85 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopExpressTemplateDetailMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopExpressTemplateDetail; +import com.gxwebsoft.shop.param.ShopExpressTemplateDetailParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 运费模板Mapper + * + * @author 科技小王子 + * @since 2025-08-12 12:07:03 + */ +public interface ShopExpressTemplateDetailMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopExpressTemplateDetailParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopExpressTemplateDetailParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopExpressTemplateMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopExpressTemplateMapper.java new file mode 100644 index 0000000..a205498 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopExpressTemplateMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopExpressTemplate; +import com.gxwebsoft.shop.param.ShopExpressTemplateParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 运费模板Mapper + * + * @author 科技小王子 + * @since 2025-08-12 12:07:03 + */ +public interface ShopExpressTemplateMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopExpressTemplateParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopExpressTemplateParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopGiftMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopGiftMapper.java new file mode 100644 index 0000000..bf0a45d --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopGiftMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopGift; +import com.gxwebsoft.shop.param.ShopGiftParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 礼品卡Mapper + * + * @author 科技小王子 + * @since 2025-08-11 18:07:31 + */ +public interface ShopGiftMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopGiftParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopGiftParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsCategoryMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsCategoryMapper.java new file mode 100644 index 0000000..ff7e088 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsCategoryMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopGoodsCategory; +import com.gxwebsoft.shop.param.ShopGoodsCategoryParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 商品分类Mapper + * + * @author 科技小王子 + * @since 2025-05-01 00:36:45 + */ +public interface ShopGoodsCategoryMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopGoodsCategoryParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopGoodsCategoryParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsCommentMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsCommentMapper.java new file mode 100644 index 0000000..302a1f0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsCommentMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopGoodsComment; +import com.gxwebsoft.shop.param.ShopGoodsCommentParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 评论表Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopGoodsCommentMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopGoodsCommentParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopGoodsCommentParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsIncomeConfigMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsIncomeConfigMapper.java new file mode 100644 index 0000000..9091b99 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsIncomeConfigMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopGoodsIncomeConfig; +import com.gxwebsoft.shop.param.ShopGoodsIncomeConfigParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 分润配置Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopGoodsIncomeConfigMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopGoodsIncomeConfigParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopGoodsIncomeConfigParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsLogMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsLogMapper.java new file mode 100644 index 0000000..946b338 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsLogMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopGoodsLog; +import com.gxwebsoft.shop.param.ShopGoodsLogParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 商品日志表Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopGoodsLogMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopGoodsLogParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopGoodsLogParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsMapper.java new file mode 100644 index 0000000..20ac974 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsMapper.java @@ -0,0 +1,51 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopGoods; +import com.gxwebsoft.shop.param.ShopGoodsParam; +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Update; + +import java.util.List; + +/** + * 商品Mapper + * + * @author 科技小王子 + * @since 2025-04-24 20:52:13 + */ +public interface ShopGoodsMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopGoodsParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopGoodsParam param); + + /** + * 累加商品销售数量 + * 使用@InterceptorIgnore忽略租户隔离,确保能更新成功 + * + * @param goodsId 商品ID + * @param saleCount 累加的销售数量 + * @return 影响的行数 + */ + @InterceptorIgnore(tenantLine = "true") + @Update("UPDATE shop_goods SET sales = IFNULL(sales, 0) + #{saleCount} WHERE goods_id = #{goodsId}") + int addSaleCount(@Param("goodsId") Integer goodsId, @Param("saleCount") Integer saleCount); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsRelationMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsRelationMapper.java new file mode 100644 index 0000000..2e02403 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsRelationMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopGoodsRelation; +import com.gxwebsoft.shop.param.ShopGoodsRelationParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 商品点赞和收藏表Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopGoodsRelationMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopGoodsRelationParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopGoodsRelationParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsRoleCommissionMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsRoleCommissionMapper.java new file mode 100644 index 0000000..d68181d --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsRoleCommissionMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopGoodsRoleCommission; +import com.gxwebsoft.shop.param.ShopGoodsRoleCommissionParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 商品绑定角色的分润金额Mapper + * + * @author 科技小王子 + * @since 2025-05-01 09:53:38 + */ +public interface ShopGoodsRoleCommissionMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopGoodsRoleCommissionParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopGoodsRoleCommissionParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsSkuMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsSkuMapper.java new file mode 100644 index 0000000..072ebd9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsSkuMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopGoodsSku; +import com.gxwebsoft.shop.param.ShopGoodsSkuParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 商品sku列表Mapper + * + * @author 科技小王子 + * @since 2025-05-01 09:43:31 + */ +public interface ShopGoodsSkuMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopGoodsSkuParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopGoodsSkuParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsSpecMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsSpecMapper.java new file mode 100644 index 0000000..503e262 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsSpecMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopGoodsSpec; +import com.gxwebsoft.shop.param.ShopGoodsSpecParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 商品多规格Mapper + * + * @author 科技小王子 + * @since 2025-05-01 09:43:31 + */ +public interface ShopGoodsSpecMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopGoodsSpecParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopGoodsSpecParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantAccountMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantAccountMapper.java new file mode 100644 index 0000000..cbbe061 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantAccountMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopMerchantAccount; +import com.gxwebsoft.shop.param.ShopMerchantAccountParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 商户账号Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopMerchantAccountMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopMerchantAccountParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopMerchantAccountParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantApplyMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantApplyMapper.java new file mode 100644 index 0000000..3377503 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantApplyMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopMerchantApply; +import com.gxwebsoft.shop.param.ShopMerchantApplyParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 商户入驻申请Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopMerchantApplyMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopMerchantApplyParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopMerchantApplyParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantMapper.java new file mode 100644 index 0000000..747a9c3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopMerchant; +import com.gxwebsoft.shop.param.ShopMerchantParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 商户Mapper + * + * @author 科技小王子 + * @since 2025-08-10 20:43:33 + */ +public interface ShopMerchantMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopMerchantParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopMerchantParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantTypeMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantTypeMapper.java new file mode 100644 index 0000000..e1ea739 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantTypeMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopMerchantType; +import com.gxwebsoft.shop.param.ShopMerchantTypeParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 商户类型Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopMerchantTypeMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopMerchantTypeParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopMerchantTypeParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderDeliveryGoodsMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderDeliveryGoodsMapper.java new file mode 100644 index 0000000..ae5af95 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderDeliveryGoodsMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopOrderDeliveryGoods; +import com.gxwebsoft.shop.param.ShopOrderDeliveryGoodsParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 发货单商品Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopOrderDeliveryGoodsMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopOrderDeliveryGoodsParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopOrderDeliveryGoodsParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderDeliveryMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderDeliveryMapper.java new file mode 100644 index 0000000..cfe334b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderDeliveryMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopOrderDelivery; +import com.gxwebsoft.shop.param.ShopOrderDeliveryParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 发货单Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopOrderDeliveryMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopOrderDeliveryParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopOrderDeliveryParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderExtractMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderExtractMapper.java new file mode 100644 index 0000000..643a832 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderExtractMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopOrderExtract; +import com.gxwebsoft.shop.param.ShopOrderExtractParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 自提订单联系方式Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopOrderExtractMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopOrderExtractParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopOrderExtractParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderGoodsMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderGoodsMapper.java new file mode 100644 index 0000000..69b747d --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderGoodsMapper.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopOrderGoods; +import com.gxwebsoft.shop.param.ShopOrderGoodsParam; +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + * 商品信息Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopOrderGoodsMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopOrderGoodsParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopOrderGoodsParam param); + + /** + * 根据订单ID查询订单商品列表(忽略租户隔离) + * @param orderId 订单ID + * @return List + */ + @InterceptorIgnore(tenantLine = "true") + @Select("SELECT * FROM shop_order_goods WHERE order_id = #{orderId}") + List selectListByOrderIdIgnoreTenant(@Param("orderId") Integer orderId); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderInfoLogMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderInfoLogMapper.java new file mode 100644 index 0000000..f7f98a4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderInfoLogMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopOrderInfoLog; +import com.gxwebsoft.shop.param.ShopOrderInfoLogParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 订单核销Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopOrderInfoLogMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopOrderInfoLogParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopOrderInfoLogParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderInfoMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderInfoMapper.java new file mode 100644 index 0000000..bbbc1ab --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderInfoMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopOrderInfo; +import com.gxwebsoft.shop.param.ShopOrderInfoParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 场地Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopOrderInfoMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopOrderInfoParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopOrderInfoParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderMapper.java new file mode 100644 index 0000000..e36a492 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderMapper.java @@ -0,0 +1,63 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopOrder; +import com.gxwebsoft.shop.param.ShopOrderParam; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +/** + * 订单Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopOrderMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopOrderParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopOrderParam param); + + @InterceptorIgnore(tenantLine = "true") + ShopOrder getByOutTradeNo(@Param("outTradeNo") String outTradeNo); + + @InterceptorIgnore(tenantLine = "true") + void updateByOutTradeNo(@Param("param") ShopOrder order); + + /** + * 统计订单总金额 + * 只统计已支付的订单(pay_status = 1)且未删除的订单(deleted = 0) + * + * @return 订单总金额 + */ + @Select("SELECT COALESCE(SUM(pay_price), 0) FROM shop_order WHERE pay_status = 1 AND deleted = 0 AND pay_price IS NOT NULL") + BigDecimal selectTotalAmount(); + + /** + * 获取用户订单各状态数量(用于前端订单页徽标/统计,一次查询返回多项聚合结果) + */ + Map selectUserOrderStats(@Param("userId") Integer userId, + @Param("tenantId") Integer tenantId, + @Param("type") Integer type); +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopRechargeOrderMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopRechargeOrderMapper.java new file mode 100644 index 0000000..1c25555 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopRechargeOrderMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopRechargeOrder; +import com.gxwebsoft.shop.param.ShopRechargeOrderParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 会员充值订单表Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopRechargeOrderMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopRechargeOrderParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopRechargeOrderParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopSpecMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopSpecMapper.java new file mode 100644 index 0000000..1999c43 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopSpecMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopSpec; +import com.gxwebsoft.shop.param.ShopSpecParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 规格Mapper + * + * @author 科技小王子 + * @since 2025-05-01 09:44:00 + */ +public interface ShopSpecMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopSpecParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopSpecParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopSpecValueMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopSpecValueMapper.java new file mode 100644 index 0000000..42815c5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopSpecValueMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopSpecValue; +import com.gxwebsoft.shop.param.ShopSpecValueParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 规格值Mapper + * + * @author 科技小王子 + * @since 2025-05-01 09:44:00 + */ +public interface ShopSpecValueMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopSpecValueParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopSpecValueParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopSplashMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopSplashMapper.java new file mode 100644 index 0000000..db49cb4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopSplashMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopSplash; +import com.gxwebsoft.shop.param.ShopSplashParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 开屏广告Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +public interface ShopSplashMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopSplashParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopSplashParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopStoreMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopStoreMapper.java new file mode 100644 index 0000000..1c56da8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopStoreMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopStore; +import com.gxwebsoft.shop.param.ShopStoreParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 门店Mapper + * + * @author 科技小王子 + * @since 2026-01-30 15:00:25 + */ +public interface ShopStoreMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopStoreParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopStoreParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopStoreRiderMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopStoreRiderMapper.java new file mode 100644 index 0000000..eacdf13 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopStoreRiderMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopStoreRider; +import com.gxwebsoft.shop.param.ShopStoreRiderParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 配送员Mapper + * + * @author 科技小王子 + * @since 2026-01-30 15:14:15 + */ +public interface ShopStoreRiderMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopStoreRiderParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopStoreRiderParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopStoreUserMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopStoreUserMapper.java new file mode 100644 index 0000000..3607f9c --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopStoreUserMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopStoreUser; +import com.gxwebsoft.shop.param.ShopStoreUserParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 店员Mapper + * + * @author 科技小王子 + * @since 2026-01-30 15:00:25 + */ +public interface ShopStoreUserMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopStoreUserParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopStoreUserParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopUserAddressMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopUserAddressMapper.java new file mode 100644 index 0000000..d89f1a6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopUserAddressMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopUserAddress; +import com.gxwebsoft.shop.param.ShopUserAddressParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 收货地址Mapper + * + * @author 科技小王子 + * @since 2025-07-22 23:06:40 + */ +public interface ShopUserAddressMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopUserAddressParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopUserAddressParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopUserBalanceLogMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopUserBalanceLogMapper.java new file mode 100644 index 0000000..4169458 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopUserBalanceLogMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopUserBalanceLog; +import com.gxwebsoft.shop.param.ShopUserBalanceLogParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 用户余额变动明细表Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +public interface ShopUserBalanceLogMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopUserBalanceLogParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopUserBalanceLogParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopUserCollectionMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopUserCollectionMapper.java new file mode 100644 index 0000000..f285ae4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopUserCollectionMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopUserCollection; +import com.gxwebsoft.shop.param.ShopUserCollectionParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 我的收藏Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +public interface ShopUserCollectionMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopUserCollectionParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopUserCollectionParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopUserCouponMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopUserCouponMapper.java new file mode 100644 index 0000000..07c4c43 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopUserCouponMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopUserCoupon; +import com.gxwebsoft.shop.param.ShopUserCouponParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 用户优惠券Mapper + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +public interface ShopUserCouponMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopUserCouponParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopUserCouponParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopUserMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopUserMapper.java new file mode 100644 index 0000000..d6c093f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopUserMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopUser; +import com.gxwebsoft.shop.param.ShopUserParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 用户记录表Mapper + * + * @author 科技小王子 + * @since 2026-02-10 00:37:07 + */ +public interface ShopUserMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopUserParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopUserParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopUserRefereeMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopUserRefereeMapper.java new file mode 100644 index 0000000..207fd90 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopUserRefereeMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopUserReferee; +import com.gxwebsoft.shop.param.ShopUserRefereeParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 用户推荐关系表Mapper + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +public interface ShopUserRefereeMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopUserRefereeParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopUserRefereeParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopWarehouseMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopWarehouseMapper.java new file mode 100644 index 0000000..05c72b1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopWarehouseMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopWarehouse; +import com.gxwebsoft.shop.param.ShopWarehouseParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 仓库Mapper + * + * @author 科技小王子 + * @since 2026-01-30 17:46:47 + */ +public interface ShopWarehouseMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopWarehouseParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopWarehouseParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/ShopWechatDepositMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/ShopWechatDepositMapper.java new file mode 100644 index 0000000..3c8424c --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/ShopWechatDepositMapper.java @@ -0,0 +1,37 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gxwebsoft.shop.entity.ShopWechatDeposit; +import com.gxwebsoft.shop.param.ShopWechatDepositParam; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 押金Mapper + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +public interface ShopWechatDepositMapper extends BaseMapper { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") ShopWechatDepositParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") ShopWechatDepositParam param); + +} diff --git a/src/main/java/com/gxwebsoft/shop/mapper/UserCardStatsMapper.java b/src/main/java/com/gxwebsoft/shop/mapper/UserCardStatsMapper.java new file mode 100644 index 0000000..a918ef4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/UserCardStatsMapper.java @@ -0,0 +1,16 @@ +package com.gxwebsoft.shop.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import org.apache.ibatis.annotations.Param; + +import java.util.Map; + +/** + * 用户卡包统计查询(跨库读取 gxwebsoft_core.sys_user) + */ +public interface UserCardStatsMapper { + + @InterceptorIgnore(tenantLine = "true") + Map selectBalancePoints(@Param("userId") Integer userId, @Param("tenantId") Integer tenantId); +} + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopArticleMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopArticleMapper.xml new file mode 100644 index 0000000..119dc2e --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopArticleMapper.xml @@ -0,0 +1,189 @@ + + + + + + + SELECT a.* + FROM shop_article a + + + AND a.article_id = #{param.articleId} + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.type = #{param.type} + + + AND a.model LIKE CONCAT('%', #{param.model}, '%') + + + AND a.detail LIKE CONCAT('%', #{param.detail}, '%') + + + AND a.category_id = #{param.categoryId} + + + AND a.parent_id = #{param.parentId} + + + AND a.topic LIKE CONCAT('%', #{param.topic}, '%') + + + AND a.tags LIKE CONCAT('%', #{param.tags}, '%') + + + AND a.image LIKE CONCAT('%', #{param.image}, '%') + + + AND a.image_width = #{param.imageWidth} + + + AND a.image_height = #{param.imageHeight} + + + AND a.price = #{param.price} + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') + + + AND a.source LIKE CONCAT('%', #{param.source}, '%') + + + AND a.overview LIKE CONCAT('%', #{param.overview}, '%') + + + AND a.virtual_views = #{param.virtualViews} + + + AND a.actual_views = #{param.actualViews} + + + AND a.rate = #{param.rate} + + + AND a.show_type = #{param.showType} + + + AND a.password LIKE CONCAT('%', #{param.password}, '%') + + + AND a.permission = #{param.permission} + + + AND a.platform LIKE CONCAT('%', #{param.platform}, '%') + + + AND a.files LIKE CONCAT('%', #{param.files}, '%') + + + AND a.video LIKE CONCAT('%', #{param.video}, '%') + + + AND a.accept LIKE CONCAT('%', #{param.accept}, '%') + + + AND a.longitude LIKE CONCAT('%', #{param.longitude}, '%') + + + AND a.latitude LIKE CONCAT('%', #{param.latitude}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.likes = #{param.likes} + + + AND a.comment_numbers = #{param.commentNumbers} + + + AND a.to_users LIKE CONCAT('%', #{param.toUsers}, '%') + + + AND a.author LIKE CONCAT('%', #{param.author}, '%') + + + AND a.recommend = #{param.recommend} + + + AND a.bm_users = #{param.bmUsers} + + + AND a.user_id = #{param.userId} + + + AND a.project_id = #{param.projectId} + + + AND a.lang LIKE CONCAT('%', #{param.lang}, '%') + + + AND a.lang_article_id = #{param.langArticleId} + + + AND a.translation = #{param.translation} + + + AND a.editor = #{param.editor} + + + AND a.pdf_url LIKE CONCAT('%', #{param.pdfUrl}, '%') + + + AND a.version = #{param.version} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopBrandMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopBrandMapper.xml new file mode 100644 index 0000000..bf5177f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopBrandMapper.xml @@ -0,0 +1,51 @@ + + + + + + + SELECT a.* + FROM shop_brand a + + + AND a.brand_id = #{param.brandId} + + + AND a.brand_name LIKE CONCAT('%', #{param.brandName}, '%') + + + AND a.image LIKE CONCAT('%', #{param.image}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCartMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCartMapper.xml new file mode 100644 index 0000000..318a402 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCartMapper.xml @@ -0,0 +1,84 @@ + + + + + + + SELECT a.* + FROM shop_cart a + + + AND a.id = #{param.id} + + + AND a.type = #{param.type} + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.goods_id LIKE CONCAT('%', #{param.goodsId}, '%') + + + AND a.spec LIKE CONCAT('%', #{param.spec}, '%') + + + AND a.price = #{param.price} + + + AND a.cart_num = #{param.cartNum} + + + AND a.total_price = #{param.totalPrice} + + + AND a.is_pay = #{param.isPay} + + + AND a.is_new = #{param.isNew} + + + AND a.is_show = #{param.isShow} + + + AND a.combination_id = #{param.combinationId} + + + AND a.seckill_id = #{param.seckillId} + + + AND a.bargain_id = #{param.bargainId} + + + AND a.selected = #{param.selected} + + + AND a.merchant_id LIKE CONCAT('%', #{param.merchantId}, '%') + + + AND a.user_id LIKE CONCAT('%', #{param.userId}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCategoryMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCategoryMapper.xml new file mode 100644 index 0000000..e3596c6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCategoryMapper.xml @@ -0,0 +1,123 @@ + + + + + + + SELECT a.* + FROM shop_category a + + + AND a.id = #{param.id} + + + AND a.parent_id = #{param.parentId} + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.model LIKE CONCAT('%', #{param.model}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.path LIKE CONCAT('%', #{param.path}, '%') + + + AND a.component LIKE CONCAT('%', #{param.component}, '%') + + + AND a.target LIKE CONCAT('%', #{param.target}, '%') + + + AND a.icon LIKE CONCAT('%', #{param.icon}, '%') + + + AND a.banner LIKE CONCAT('%', #{param.banner}, '%') + + + AND a.color LIKE CONCAT('%', #{param.color}, '%') + + + AND a.hide = #{param.hide} + + + AND a.permission = #{param.permission} + + + AND a.password LIKE CONCAT('%', #{param.password}, '%') + + + AND a.position = #{param.position} + + + AND a.top = #{param.top} + + + AND a.bottom = #{param.bottom} + + + AND a.active LIKE CONCAT('%', #{param.active}, '%') + + + AND a.meta LIKE CONCAT('%', #{param.meta}, '%') + + + AND a.style LIKE CONCAT('%', #{param.style}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.merchant_id = #{param.merchantId} + + + AND a.lang LIKE CONCAT('%', #{param.lang}, '%') + + + AND a.home = #{param.home} + + + AND a.recommend = #{param.recommend} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopChatConversationMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopChatConversationMapper.xml new file mode 100644 index 0000000..4f133fc --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopChatConversationMapper.xml @@ -0,0 +1,60 @@ + + + + + + + SELECT a.* + FROM shop_chat_conversation a + + + AND a.id = #{param.id} + + + AND a.user_id = #{param.userId} + + + AND a.friend_id = #{param.friendId} + + + AND a.type = #{param.type} + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.un_read = #{param.unRead} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopChatMessageMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopChatMessageMapper.xml new file mode 100644 index 0000000..b3c356f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopChatMessageMapper.xml @@ -0,0 +1,78 @@ + + + + + + + SELECT a.*, b.nickname as formUserName, b.avatar as formUserAvatar, b.phone as formUserPhone, b.alias as formUserAlias, + c.nickname as toUserName, c.avatar as toUserAvatar, c.phone as toUserPhone, c.alias as toUserAlias + FROM shop_chat_message a + LEFT JOIN gxwebsoft_core.sys_user b ON a.form_user_id = b.user_id + LEFT JOIN gxwebsoft_core.sys_user c ON a.to_user_id = c.user_id + + + AND a.id = #{param.id} + + + AND a.form_user_id = #{param.formUserId} + + + AND a.to_user_id = #{param.toUserId} + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.side_to = #{param.sideTo} + + + AND a.side_from = #{param.sideFrom} + + + AND a.withdraw = #{param.withdraw} + + + AND a.file_info LIKE CONCAT('%', #{param.fileInfo}, '%') + + + AND a.has_contact = #{param.hasContact} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCommissionRoleMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCommissionRoleMapper.xml new file mode 100644 index 0000000..74e6faa --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCommissionRoleMapper.xml @@ -0,0 +1,57 @@ + + + + + + + SELECT a.* + FROM shop_commission_role a + + + AND a.id = #{param.id} + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.province_id = #{param.provinceId} + + + AND a.city_id = #{param.cityId} + + + AND a.region_id = #{param.regionId} + + + AND a.status = #{param.status} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND a.sort_number = #{param.sortNumber} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCommunityMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCommunityMapper.xml new file mode 100644 index 0000000..ad46b31 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCommunityMapper.xml @@ -0,0 +1,54 @@ + + + + + + + SELECT a.* + FROM shop_community a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCountMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCountMapper.xml new file mode 100644 index 0000000..78583ae --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCountMapper.xml @@ -0,0 +1,63 @@ + + + + + + + SELECT a.* + FROM shop_count a + + + AND a.id = #{param.id} + + + AND a.date_time LIKE CONCAT('%', #{param.dateTime}, '%') + + + AND a.total_price = #{param.totalPrice} + + + AND a.today_price = #{param.todayPrice} + + + AND a.total_users = #{param.totalUsers} + + + AND a.today_users = #{param.todayUsers} + + + AND a.total_orders = #{param.totalOrders} + + + AND a.today_orders = #{param.todayOrders} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCouponApplyCateMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCouponApplyCateMapper.xml new file mode 100644 index 0000000..ef13b35 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCouponApplyCateMapper.xml @@ -0,0 +1,54 @@ + + + + + + + SELECT a.* + FROM shop_coupon_apply_cate a + + + AND a.id = #{param.id} + + + AND a.coupon_id = #{param.couponId} + + + AND a.cate_id = #{param.cateId} + + + AND a.cate_level = #{param.cateLevel} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCouponApplyItemMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCouponApplyItemMapper.xml new file mode 100644 index 0000000..141b156 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCouponApplyItemMapper.xml @@ -0,0 +1,60 @@ + + + + + + + SELECT a.* + FROM shop_coupon_apply_item a + + + AND a.id = #{param.id} + + + AND a.coupon_id = #{param.couponId} + + + AND a.goods_id = #{param.goodsId} + + + AND a.category_id = #{param.categoryId} + + + AND a.type = #{param.type} + + + AND a.pk = #{param.pk} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCouponMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCouponMapper.xml new file mode 100644 index 0000000..6030a91 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCouponMapper.xml @@ -0,0 +1,103 @@ + + + + + + + SELECT a.*, + COALESCE((SELECT COUNT(*) FROM shop_user_coupon suc WHERE suc.coupon_id = a.id AND suc.deleted = 0), 0) AS receive_num + FROM shop_coupon a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.description LIKE CONCAT('%', #{param.description}, '%') + + + AND a.type = #{param.type} + + + AND a.reduce_price = #{param.reducePrice} + + + AND a.discount = #{param.discount} + + + AND a.min_price = #{param.minPrice} + + + AND a.expire_type = #{param.expireType} + + + AND a.expire_day = #{param.expireDay} + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') + + + AND a.apply_range = #{param.applyRange} + + + AND a.apply_range_config LIKE CONCAT('%', #{param.applyRangeConfig}, '%') + + + AND a.is_expire = #{param.isExpire} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND a.total_count = #{param.totalCount} + + + AND a.issued_count = #{param.issuedCount} + + + AND a.limit_per_user = #{param.limitPerUser} + + + AND a.enabled = #{param.enabled} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerApplyMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerApplyMapper.xml new file mode 100644 index 0000000..7f89064 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerApplyMapper.xml @@ -0,0 +1,92 @@ + + + + + + + SELECT a.*, b.nickname as nickName, b.phone, c.nickname as refereeName, d.rate + FROM shop_dealer_apply a + LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id + LEFT JOIN gxwebsoft_core.sys_user c ON a.referee_id = c.user_id + LEFT JOIN shop_dealer_user d ON a.user_id = d.user_id + + + AND a.apply_id = #{param.applyId} + + + AND a.type = #{param.type} + + + AND a.user_id = #{param.userId} + + + AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') + + + AND a.mobile LIKE CONCAT('%', #{param.mobile}, '%') + + + AND a.community LIKE CONCAT('%', #{param.community}, '%') + + + AND a.building_number = #{param.buildingNumber} + + + AND a.unit_number = #{param.unitNumber} + + + AND a.room_number = #{param.roomNumber} + + + AND a.dealer_name LIKE CONCAT('%', #{param.dealerName}, '%') + + + AND a.dealer_code = #{param.dealerCode} + + + AND a.referee_id = #{param.refereeId} + + + AND a.apply_type = #{param.applyType} + + + AND a.apply_time = #{param.applyTime} + + + AND a.apply_status = #{param.applyStatus} + + + AND a.audit_time = #{param.auditTime} + + + AND a.expiration_time = #{param.expirationTime} + + + AND a.reject_reason LIKE CONCAT('%', #{param.rejectReason}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.mobile = #{param.keywords} + OR a.real_name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.dealer_name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerBankMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerBankMapper.xml new file mode 100644 index 0000000..023b7a2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerBankMapper.xml @@ -0,0 +1,60 @@ + + + + + + + SELECT a.* + FROM shop_dealer_bank a + + + AND a.id = #{param.id} + + + AND a.user_id = #{param.userId} + + + AND a.is_default = #{param.isDefault} + + + AND a.bank_name LIKE CONCAT('%', #{param.bankName}, '%') + + + AND a.bank_account LIKE CONCAT('%', #{param.bankAccount}, '%') + + + AND a.bank_card LIKE CONCAT('%', #{param.bankCard}, '%') + + + AND a.apply_status = #{param.applyStatus} + + + AND a.audit_time = #{param.auditTime} + + + AND a.reject_reason LIKE CONCAT('%', #{param.rejectReason}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerCapitalMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerCapitalMapper.xml new file mode 100644 index 0000000..98e03f8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerCapitalMapper.xml @@ -0,0 +1,59 @@ + + + + + + + SELECT a.*, b.order_no, b.month, c.nickname AS nickName, d.nickname AS toNickName + FROM shop_dealer_capital a + LEFT JOIN shop_dealer_order b ON a.order_no = b.order_no + LEFT JOIN gxwebsoft_core.sys_user c ON a.user_id = c.user_id and c.deleted = 0 + LEFT JOIN gxwebsoft_core.sys_user d ON a.to_user_id = d.user_id and d.deleted = 0 + + + AND a.id = #{param.id} + + + AND a.user_id = #{param.userId} + + + AND a.order_no = #{param.orderNo} + + + AND a.flow_type = #{param.flowType} + + + AND a.money = #{param.money} + + + AND a.to_user_id = #{param.toUserId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND b.month = #{param.month} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.user_id = #{param.keywords} + OR a.order_no = #{param.keywords} + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerOrderMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerOrderMapper.xml new file mode 100644 index 0000000..7b4a182 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerOrderMapper.xml @@ -0,0 +1,92 @@ + + + + + + + SELECT a.*, b.nickname, c.nickname AS firstNickname, d.nickname AS secondNickname, e.nickname AS thirdNickname, f.rate, f.price, g.nickname AS firstDividendUserName, h.nickname AS secondDividendUserName + FROM shop_dealer_order a + LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id + LEFT JOIN gxwebsoft_core.sys_user c ON a.first_user_id = c.user_id + LEFT JOIN gxwebsoft_core.sys_user d ON a.second_user_id = d.user_id + LEFT JOIN gxwebsoft_core.sys_user e ON a.third_user_id = e.user_id + LEFT JOIN gxwebsoft_core.sys_user g ON a.first_dividend_user = g.user_id + LEFT JOIN gxwebsoft_core.sys_user h ON a.second_dividend_user = h.user_id + LEFT JOIN shop_dealer_user f ON a.user_id = f.user_id + + + AND a.id = #{param.id} + + + AND a.user_id = #{param.userId} + + + AND ( a.first_user_id = #{param.resourceId} OR a.second_user_id = #{param.resourceId} OR a.third_user_id = #{param.resourceId} OR a.first_dividend_user = #{param.resourceId} OR a.first_dividend_user = #{param.resourceId} OR a.second_dividend_user = #{param.resourceId} ) + + + AND a.month = #{param.month} + + + AND a.order_no = #{param.orderNo} + + + AND a.order_price = #{param.orderPrice} + + + AND a.first_user_id = #{param.firstUserId} + + + AND a.second_user_id = #{param.secondUserId} + + + AND a.third_user_id = #{param.thirdUserId} + + + AND a.first_money = #{param.firstMoney} + + + AND a.second_money = #{param.secondMoney} + + + AND a.third_money = #{param.thirdMoney} + + + AND a.is_invalid = #{param.isInvalid} + + + AND a.is_settled = #{param.isSettled} + + + AND a.comments = #{param.comments} + + + AND a.settle_time = #{param.settleTime} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.order_no LIKE CONCAT('%', #{param.keywords}, '%') + OR a.title LIKE CONCAT('%', #{param.keywords}, '%') + OR a.user_id = #{param.keywords} + OR a.month = #{param.keywords} + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerRecordMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerRecordMapper.xml new file mode 100644 index 0000000..41c8c3a --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerRecordMapper.xml @@ -0,0 +1,63 @@ + + + + + + + SELECT a.* + FROM shop_dealer_record a + + + AND a.id = #{param.id} + + + AND a.parent_id = #{param.parentId} + + + AND a.dealer_id = #{param.dealerId} + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerRefereeMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerRefereeMapper.xml new file mode 100644 index 0000000..a8635f1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerRefereeMapper.xml @@ -0,0 +1,61 @@ + + + + + + + SELECT DISTINCT a.*, + d.nickname AS dealerName, + d.avatar AS dealerAvatar, + d.phone AS dealerPhone, + u.nickname, + u.avatar, + u.alias, + u.phone, + u.is_admin as isAdmin + FROM shop_dealer_referee a + INNER JOIN gxwebsoft_core.sys_user d ON a.dealer_id = d.user_id AND d.deleted = 0 + INNER JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id AND u.deleted = 0 + + + AND a.tenant_id = #{param.tenantId} + + + AND a.id = #{param.id} + + + AND a.dealer_id = #{param.dealerId} + + + AND a.user_id = #{param.userId} + + + AND a.level = #{param.level} + + + AND u.is_admin = 1 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerSettingMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerSettingMapper.xml new file mode 100644 index 0000000..66e51a2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerSettingMapper.xml @@ -0,0 +1,36 @@ + + + + + + + SELECT a.* + FROM shop_dealer_setting a + + + AND a.`key` = #{param.key} + + + AND a.`describe` LIKE CONCAT('%', #{param.describe}, '%') + + + AND a.`values` LIKE CONCAT('%', #{param.values}, '%') + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerUserMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerUserMapper.xml new file mode 100644 index 0000000..f103c11 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerUserMapper.xml @@ -0,0 +1,84 @@ + + + + + + + SELECT a.*, b.openid, b.avatar, c.dealer_name AS shopName + FROM shop_dealer_user a + LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id + LEFT JOIN shop_dealer_user c ON a.dealer_user_id = c.id + + + AND a.id = #{param.id} + + + AND a.type = #{param.type} + + + AND a.user_id = #{param.userId} + + + AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') + + + AND a.mobile LIKE CONCAT('%', #{param.mobile}, '%') + + + AND a.pay_password LIKE CONCAT('%', #{param.payPassword}, '%') + + + AND a.money = #{param.money} + + + AND a.freeze_money = #{param.freezeMoney} + + + AND a.total_money = #{param.totalMoney} + + + AND a.referee_id = #{param.refereeId} + + + AND a.first_num = #{param.firstNum} + + + AND a.second_num = #{param.secondNum} + + + AND a.third_num = #{param.thirdNum} + + + AND a.qrcode LIKE CONCAT('%', #{param.qrcode}, '%') + + + AND a.is_delete = #{param.isDelete} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND a.sort_number = #{param.sortNumber} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.user_id = #{param.keywords} OR a.dealer_name LIKE CONCAT('%', #{param.keywords}, '%') OR a.real_name LIKE CONCAT('%', #{param.keywords}, '%') OR a.mobile LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerWithdrawMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerWithdrawMapper.xml new file mode 100644 index 0000000..767ee27 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerWithdrawMapper.xml @@ -0,0 +1,75 @@ + + + + + + + SELECT a.*, b.nickname, b.phone AS phone, b.avatar,b.openid,b.office_openid, c.real_name as realName + FROM shop_dealer_withdraw a + LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id + LEFT JOIN gxwebsoft_core.sys_user_verify c ON a.user_id = c.user_id AND c.status = 1 + + + AND a.id = #{param.id} + + + AND a.user_id = #{param.userId} + + + AND a.money = #{param.money} + + + AND a.pay_type = #{param.payType} + + + AND a.alipay_name LIKE CONCAT('%', #{param.alipayName}, '%') + + + AND a.alipay_account LIKE CONCAT('%', #{param.alipayAccount}, '%') + + + AND a.bank_name LIKE CONCAT('%', #{param.bankName}, '%') + + + AND a.bank_account LIKE CONCAT('%', #{param.bankAccount}, '%') + + + AND a.bank_card LIKE CONCAT('%', #{param.bankCard}, '%') + + + AND a.apply_status = #{param.applyStatus} + + + AND a.audit_time = #{param.auditTime} + + + AND a.reject_reason LIKE CONCAT('%', #{param.rejectReason}, '%') + + + AND a.platform LIKE CONCAT('%', #{param.platform}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.user_id = #{param.keywords} + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopExpressMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopExpressMapper.xml new file mode 100644 index 0000000..100e558 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopExpressMapper.xml @@ -0,0 +1,57 @@ + + + + + + + SELECT a.* + FROM shop_express a + + + AND a.express_id = #{param.expressId} + + + AND a.express_name LIKE CONCAT('%', #{param.expressName}, '%') + + + AND a.wx_code LIKE CONCAT('%', #{param.wxCode}, '%') + + + AND a.kuaidi100_code LIKE CONCAT('%', #{param.kuaidi100Code}, '%') + + + AND a.kdniao_code LIKE CONCAT('%', #{param.kdniaoCode}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopExpressTemplateDetailMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopExpressTemplateDetailMapper.xml new file mode 100644 index 0000000..867265d --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopExpressTemplateDetailMapper.xml @@ -0,0 +1,72 @@ + + + + + + + SELECT a.* + FROM shop_express_template_detail a + + + AND a.id = #{param.id} + + + AND a.template_id = #{param.templateId} + + + AND a.type = #{param.type} + + + AND a.province_id = #{param.provinceId} + + + AND a.city_id = #{param.cityId} + + + AND a.first_num = #{param.firstNum} + + + AND a.first_amount = #{param.firstAmount} + + + AND a.extra_amount = #{param.extraAmount} + + + AND a.extra_num = #{param.extraNum} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND a.sort_number = #{param.sortNumber} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopExpressTemplateMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopExpressTemplateMapper.xml new file mode 100644 index 0000000..a0b1784 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopExpressTemplateMapper.xml @@ -0,0 +1,66 @@ + + + + + + + SELECT a.* + FROM shop_express_template a + + + AND a.id = #{param.id} + + + AND a.type = #{param.type} + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.first_amount = #{param.firstAmount} + + + AND a.extra_amount = #{param.extraAmount} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.first_num = #{param.firstNum} + + + AND a.extra_num = #{param.extraNum} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGiftMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGiftMapper.xml new file mode 100644 index 0000000..b2f0569 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGiftMapper.xml @@ -0,0 +1,77 @@ + + + + + + + SELECT a.*,b.name as goodsName, b.price as faceValue, b.image as goodsImage,c.nickname, u.nickname as operatorUserName + FROM shop_gift a + LEFT JOIN shop_goods b ON a.goods_id = b.goods_id + LEFT JOIN gxwebsoft_core.sys_user c ON a.user_id = c.user_id + LEFT JOIN gxwebsoft_core.sys_user u ON a.operator_user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.goods_id = #{param.goodsId} + + + AND a.take_time LIKE CONCAT('%', #{param.takeTime}, '%') + + + AND a.operator_user_id = #{param.operatorUserId} + + + AND a.is_show = #{param.isShow} + + + AND a.status = #{param.status} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.user_id = #{param.userId} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.code = #{param.keywords} + OR a.name LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsCategoryMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsCategoryMapper.xml new file mode 100644 index 0000000..74bf790 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsCategoryMapper.xml @@ -0,0 +1,93 @@ + + + + + + + SELECT a.* + FROM shop_goods_category a + + + AND a.category_id = #{param.categoryId} + + + AND a.category_code LIKE CONCAT('%', #{param.categoryCode}, '%') + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.type = #{param.type} + + + AND a.image LIKE CONCAT('%', #{param.image}, '%') + + + AND a.parent_id = #{param.parentId} + + + AND a.path LIKE CONCAT('%', #{param.path}, '%') + + + AND a.component LIKE CONCAT('%', #{param.component}, '%') + + + AND a.page_id = #{param.pageId} + + + AND a.user_id = #{param.userId} + + + AND a.count = #{param.count} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.hide = #{param.hide} + + + AND a.recommend = #{param.recommend} + + + AND a.show_index = #{param.showIndex} + + + AND a.merchant_id = #{param.merchantId} + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsCommentMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsCommentMapper.xml new file mode 100644 index 0000000..a6b5545 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsCommentMapper.xml @@ -0,0 +1,96 @@ + + + + + + + SELECT a.* + FROM shop_goods_comment a + + + AND a.id = #{param.id} + + + AND a.uid = #{param.uid} + + + AND a.oid = #{param.oid} + + + AND a.unique LIKE CONCAT('%', #{param.unique}, '%') + + + AND a.goods_id = #{param.goodsId} + + + AND a.reply_type LIKE CONCAT('%', #{param.replyType}, '%') + + + AND a.goods_score = #{param.goodsScore} + + + AND a.service_score = #{param.serviceScore} + + + AND a.comment LIKE CONCAT('%', #{param.comment}, '%') + + + AND a.pics LIKE CONCAT('%', #{param.pics}, '%') + + + AND a.merchant_reply_content LIKE CONCAT('%', #{param.merchantReplyContent}, '%') + + + AND a.merchant_reply_time = #{param.merchantReplyTime} + + + AND a.is_del = #{param.isDel} + + + AND a.is_reply = #{param.isReply} + + + AND a.nickname LIKE CONCAT('%', #{param.nickname}, '%') + + + AND a.avatar LIKE CONCAT('%', #{param.avatar}, '%') + + + AND a.sku LIKE CONCAT('%', #{param.sku}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsIncomeConfigMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsIncomeConfigMapper.xml new file mode 100644 index 0000000..8819d02 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsIncomeConfigMapper.xml @@ -0,0 +1,63 @@ + + + + + + + SELECT a.* + FROM shop_goods_income_config a + + + AND a.id = #{param.id} + + + AND a.goods_id = #{param.goodsId} + + + AND a.merchant_shop_type LIKE CONCAT('%', #{param.merchantShopType}, '%') + + + AND a.sku_id = #{param.skuId} + + + AND a.rate = #{param.rate} + + + AND a.user_id = #{param.userId} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsLogMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsLogMapper.xml new file mode 100644 index 0000000..4d24262 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsLogMapper.xml @@ -0,0 +1,81 @@ + + + + + + + SELECT a.* + FROM shop_goods_log a + + + AND a.id = #{param.id} + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.goods_id = #{param.goodsId} + + + AND a.visit_num = #{param.visitNum} + + + AND a.cart_num = #{param.cartNum} + + + AND a.order_num = #{param.orderNum} + + + AND a.pay_num = #{param.payNum} + + + AND a.pay_price = #{param.payPrice} + + + AND a.cost_price = #{param.costPrice} + + + AND a.pay_uid = #{param.payUid} + + + AND a.refund_num = #{param.refundNum} + + + AND a.refund_price = #{param.refundPrice} + + + AND a.collect_num = #{param.collectNum} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.status = #{param.status} + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsMapper.xml new file mode 100644 index 0000000..a14c354 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsMapper.xml @@ -0,0 +1,151 @@ + + + + + + + SELECT a.*, b.title AS categoryName + FROM shop_goods a + LEFT JOIN cms_navigation b ON a.category_id = b.navigation_id + + + AND a.goods_id = #{param.goodsId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.type = #{param.type} + + + AND a.image LIKE CONCAT('%', #{param.image}, '%') + + + AND a.parent_id = #{param.parentId} + + + AND a.category_id = #{param.categoryId} + + + AND a.path LIKE CONCAT('%', #{param.path}, '%') + + + AND a.tag LIKE CONCAT('%', #{param.tag}, '%') + + + AND a.specs = #{param.specs} + + + AND a.position LIKE CONCAT('%', #{param.position}, '%') + + + AND a.unit_name LIKE CONCAT('%', #{param.unitName}, '%') + + + AND a.price = #{param.price} + + + AND a.buying_price = #{param.buyingPrice} + + + AND a.dealer_price = #{param.dealerPrice} + + + AND a.deduct_stock_type = #{param.deductStockType} + + + AND a.delivery_method = #{param.deliveryMethod} + + + AND a.duration_method = #{param.durationMethod} + + + AND a.can_buy_number = #{param.canBuyNumber} + + + AND a.files LIKE CONCAT('%', #{param.files}, '%') + + + AND a.sales = #{param.sales} + + + AND a.stock = #{param.stock} + + + AND a.install = #{param.install} + + + AND a.rate = #{param.rate} + + + AND a.gain_integral = #{param.gainIntegral} + + + AND a.recommend = #{param.recommend} + + + AND a.official = #{param.official} + + + AND a.merchant_id = #{param.merchantId} + + + AND a.is_show = #{param.isShow} + + + AND a.status = #{param.status} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.user_id = #{param.userId} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + + AND a.status = 0 + + + AND a.status != 0 + + + AND a.stock = 0 + + + + AND (a.name LIKE CONCAT('%', #{param.keywords}, '%') + OR a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsRelationMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsRelationMapper.xml new file mode 100644 index 0000000..063a2a8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsRelationMapper.xml @@ -0,0 +1,48 @@ + + + + + + + SELECT a.* + FROM shop_goods_relation a + + + AND a.id = #{param.id} + + + AND a.user_id = #{param.userId} + + + AND a.goods_id = #{param.goodsId} + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.category LIKE CONCAT('%', #{param.category}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsRoleCommissionMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsRoleCommissionMapper.xml new file mode 100644 index 0000000..a0cb44a --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsRoleCommissionMapper.xml @@ -0,0 +1,57 @@ + + + + + + + SELECT a.* + FROM shop_goods_role_commission a + + + AND a.id = #{param.id} + + + AND a.role_id = #{param.roleId} + + + AND a.goods_id = #{param.goodsId} + + + AND a.sku LIKE CONCAT('%', #{param.sku}, '%') + + + AND a.amount = #{param.amount} + + + AND a.status = #{param.status} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND a.sort_number = #{param.sortNumber} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsSkuMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsSkuMapper.xml new file mode 100644 index 0000000..dec4d76 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsSkuMapper.xml @@ -0,0 +1,78 @@ + + + + + + + SELECT a.* + FROM shop_goods_sku a + + + AND a.id = #{param.id} + + + AND a.goods_id = #{param.goodsId} + + + AND a.sku LIKE CONCAT('%', #{param.sku}, '%') + + + AND a.image LIKE CONCAT('%', #{param.image}, '%') + + + AND a.price = #{param.price} + + + AND a.sale_price = #{param.salePrice} + + + AND a.cost = #{param.cost} + + + AND a.stock = #{param.stock} + + + AND a.sku_no LIKE CONCAT('%', #{param.skuNo}, '%') + + + AND a.bar_code LIKE CONCAT('%', #{param.barCode}, '%') + + + AND a.weight = #{param.weight} + + + AND a.volume = #{param.volume} + + + AND a.uuid LIKE CONCAT('%', #{param.uuid}, '%') + + + AND a.status = #{param.status} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsSpecMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsSpecMapper.xml new file mode 100644 index 0000000..aeed405 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsSpecMapper.xml @@ -0,0 +1,45 @@ + + + + + + + SELECT a.* + FROM shop_goods_spec a + + + AND a.id = #{param.id} + + + AND a.goods_id = #{param.goodsId} + + + AND a.spec_id = #{param.specId} + + + AND a.spec_name LIKE CONCAT('%', #{param.specName}, '%') + + + AND a.spec_value LIKE CONCAT('%', #{param.specValue}, '%') + + + AND a.type = #{param.type} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantAccountMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantAccountMapper.xml new file mode 100644 index 0000000..95280c1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantAccountMapper.xml @@ -0,0 +1,63 @@ + + + + + + + SELECT a.* + FROM shop_merchant_account a + + + AND a.id = #{param.id} + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') + + + AND a.merchant_id = #{param.merchantId} + + + AND a.role_id = #{param.roleId} + + + AND a.role_name LIKE CONCAT('%', #{param.roleName}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantApplyMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantApplyMapper.xml new file mode 100644 index 0000000..52b8979 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantApplyMapper.xml @@ -0,0 +1,123 @@ + + + + + + + SELECT a.* + FROM shop_merchant_apply a + + + AND a.apply_id = #{param.applyId} + + + AND a.type = #{param.type} + + + AND a.shop_type LIKE CONCAT('%', #{param.shopType}, '%') + + + AND a.merchant_name LIKE CONCAT('%', #{param.merchantName}, '%') + + + AND a.image LIKE CONCAT('%', #{param.image}, '%') + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') + + + AND a.category_id = #{param.categoryId} + + + AND a.category LIKE CONCAT('%', #{param.category}, '%') + + + AND a.lng_and_lat LIKE CONCAT('%', #{param.lngAndLat}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.region_id LIKE CONCAT('%', #{param.regionId}, '%') + + + AND a.commission = #{param.commission} + + + AND a.keywords LIKE CONCAT('%', #{param.keywords}, '%') + + + AND a.yyzz LIKE CONCAT('%', #{param.yyzz}, '%') + + + AND a.sfz1 LIKE CONCAT('%', #{param.sfz1}, '%') + + + AND a.sfz2 LIKE CONCAT('%', #{param.sfz2}, '%') + + + AND a.files LIKE CONCAT('%', #{param.files}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.own_store = #{param.ownStore} + + + AND a.recommend = #{param.recommend} + + + AND a.goods_review = #{param.goodsReview} + + + AND a.name2 LIKE CONCAT('%', #{param.name2}, '%') + + + AND a.reason LIKE CONCAT('%', #{param.reason}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantMapper.xml new file mode 100644 index 0000000..66384d5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantMapper.xml @@ -0,0 +1,150 @@ + + + + + + + SELECT a.* + FROM shop_merchant a + + + AND a.merchant_id = #{param.merchantId} + + + AND a.merchant_name LIKE CONCAT('%', #{param.merchantName}, '%') + + + AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%') + + + AND a.type = #{param.type} + + + AND a.image LIKE CONCAT('%', #{param.image}, '%') + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') + + + AND a.shop_type LIKE CONCAT('%', #{param.shopType}, '%') + + + AND a.item_type LIKE CONCAT('%', #{param.itemType}, '%') + + + AND a.category LIKE CONCAT('%', #{param.category}, '%') + + + AND a.merchant_category_id = #{param.merchantCategoryId} + + + AND a.merchant_category_title LIKE CONCAT('%', #{param.merchantCategoryTitle}, '%') + + + AND a.lng_and_lat LIKE CONCAT('%', #{param.lngAndLat}, '%') + + + AND a.lng LIKE CONCAT('%', #{param.lng}, '%') + + + AND a.lat LIKE CONCAT('%', #{param.lat}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.commission = #{param.commission} + + + AND a.keywords LIKE CONCAT('%', #{param.keywords}, '%') + + + AND a.files LIKE CONCAT('%', #{param.files}, '%') + + + AND a.business_time LIKE CONCAT('%', #{param.businessTime}, '%') + + + AND a.content LIKE CONCAT('%', #{param.content}, '%') + + + AND a.price = #{param.price} + + + AND a.own_store = #{param.ownStore} + + + AND a.can_express = #{param.canExpress} + + + AND a.recommend = #{param.recommend} + + + AND a.is_on = #{param.isOn} + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') + + + AND a.goods_review = #{param.goodsReview} + + + AND a.admin_url LIKE CONCAT('%', #{param.adminUrl}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.status = #{param.status} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantTypeMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantTypeMapper.xml new file mode 100644 index 0000000..0ed4e42 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantTypeMapper.xml @@ -0,0 +1,48 @@ + + + + + + + SELECT a.* + FROM shop_merchant_type a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderDeliveryGoodsMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderDeliveryGoodsMapper.xml new file mode 100644 index 0000000..949a66f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderDeliveryGoodsMapper.xml @@ -0,0 +1,60 @@ + + + + + + + SELECT a.* + FROM shop_order_delivery_goods a + + + AND a.id = #{param.id} + + + AND a.delivery_id = #{param.deliveryId} + + + AND a.order_id = #{param.orderId} + + + AND a.order_goods_id = #{param.orderGoodsId} + + + AND a.goods_id = #{param.goodsId} + + + AND a.delivery_num = #{param.deliveryNum} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderDeliveryMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderDeliveryMapper.xml new file mode 100644 index 0000000..eb3fd8d --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderDeliveryMapper.xml @@ -0,0 +1,63 @@ + + + + + + + SELECT a.* + FROM shop_order_delivery a + + + AND a.delivery_id = #{param.deliveryId} + + + AND a.order_id = #{param.orderId} + + + AND a.delivery_method = #{param.deliveryMethod} + + + AND a.pack_method = #{param.packMethod} + + + AND a.express_id = #{param.expressId} + + + AND a.express_no LIKE CONCAT('%', #{param.expressNo}, '%') + + + AND a.eorder_html LIKE CONCAT('%', #{param.eorderHtml}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderExtractMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderExtractMapper.xml new file mode 100644 index 0000000..ff26857 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderExtractMapper.xml @@ -0,0 +1,57 @@ + + + + + + + SELECT a.* + FROM shop_order_extract a + + + AND a.id = #{param.id} + + + AND a.order_id = #{param.orderId} + + + AND a.linkman LIKE CONCAT('%', #{param.linkman}, '%') + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderGoodsMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderGoodsMapper.xml new file mode 100644 index 0000000..dd22115 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderGoodsMapper.xml @@ -0,0 +1,105 @@ + + + + + + + SELECT a.* + FROM shop_order_goods a + + + AND a.id = #{param.id} + + + AND a.order_id = #{param.orderId} + + + AND a.order_code LIKE CONCAT('%', #{param.orderCode}, '%') + + + AND a.merchant_id = #{param.merchantId} + + + AND a.merchant_name LIKE CONCAT('%', #{param.merchantName}, '%') + + + AND a.image LIKE CONCAT('%', #{param.image}, '%') + + + AND a.goods_id = #{param.goodsId} + + + AND a.goods_name LIKE CONCAT('%', #{param.goodsName}, '%') + + + AND a.spec LIKE CONCAT('%', #{param.spec}, '%') + + + AND a.sku_id = #{param.skuId} + + + AND a.price = #{param.price} + + + AND a.total_num = #{param.totalNum} + + + AND a.pay_status = #{param.payStatus} + + + AND a.order_status = #{param.orderStatus} + + + AND a.is_free = #{param.isFree} + + + AND a.version = #{param.version} + + + AND a.time_period LIKE CONCAT('%', #{param.timePeriod}, '%') + + + AND a.date_time LIKE CONCAT('%', #{param.dateTime}, '%') + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') + + + AND a.time_flag LIKE CONCAT('%', #{param.timeFlag}, '%') + + + AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderInfoLogMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderInfoLogMapper.xml new file mode 100644 index 0000000..0dde816 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderInfoLogMapper.xml @@ -0,0 +1,48 @@ + + + + + + + SELECT a.* + FROM shop_order_info_log a + + + AND a.id = #{param.id} + + + AND a.order_id = #{param.orderId} + + + AND a.merchant_id = #{param.merchantId} + + + AND a.field_id = #{param.fieldId} + + + AND a.use_num = #{param.useNum} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderInfoMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderInfoMapper.xml new file mode 100644 index 0000000..b2e0149 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderInfoMapper.xml @@ -0,0 +1,114 @@ + + + + + + + SELECT a.* + FROM shop_order_info a + + + AND a.id = #{param.id} + + + AND a.order_id = #{param.orderId} + + + AND a.order_code LIKE CONCAT('%', #{param.orderCode}, '%') + + + AND a.merchant_id = #{param.merchantId} + + + AND a.merchant_name LIKE CONCAT('%', #{param.merchantName}, '%') + + + AND a.field_id = #{param.fieldId} + + + AND a.field_name LIKE CONCAT('%', #{param.fieldName}, '%') + + + AND a.price = #{param.price} + + + AND a.children_price = #{param.childrenPrice} + + + AND a.adult_num = #{param.adultNum} + + + AND a.children_num = #{param.childrenNum} + + + AND a.adult_num_use = #{param.adultNumUse} + + + AND a.children_num_use = #{param.childrenNumUse} + + + AND a.pay_status = #{param.payStatus} + + + AND a.order_status = #{param.orderStatus} + + + AND a.is_free = #{param.isFree} + + + AND a.is_children = #{param.isChildren} + + + AND a.version = #{param.version} + + + AND a.is_half = #{param.isHalf} + + + AND a.time_period LIKE CONCAT('%', #{param.timePeriod}, '%') + + + AND a.date_time LIKE CONCAT('%', #{param.dateTime}, '%') + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') + + + AND a.time_flag LIKE CONCAT('%', #{param.timeFlag}, '%') + + + AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderMapper.xml new file mode 100644 index 0000000..0c28dbf --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderMapper.xml @@ -0,0 +1,467 @@ + + + + + + + SELECT a.*,b.nickname, b.avatar,b.phone as phone, c.name as storeName, d.real_name as riderName, e.name as warehouseName + FROM shop_order a + LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id + LEFT JOIN shop_store c ON a.store_id = c.id + LEFT JOIN shop_store_rider d ON a.rider_id = d.id + LEFT JOIN shop_store_warehouse e ON a.warehouse_id = e.id + + + AND a.order_id = #{param.orderId} + + + AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%') + + + AND a.type = #{param.type} + + + AND a.delivery_type = #{param.deliveryType} + + + AND a.channel = #{param.channel} + + + AND a.transaction_id LIKE CONCAT('%', #{param.transactionId}, '%') + + + AND a.refund_order LIKE CONCAT('%', #{param.refundOrder}, '%') + + + AND a.merchant_id = #{param.merchantId} + + + AND a.merchant_name LIKE CONCAT('%', #{param.merchantName}, '%') + + + AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%') + + + AND a.store_id LIKE CONCAT('%', #{param.storeId}, '%') + + + AND a.rider_id LIKE CONCAT('%', #{param.riderId}, '%') + + + AND a.warehouse_id LIKE CONCAT('%', #{param.warehouseId}, '%') + + + AND a.coupon_id = #{param.couponId} + + + AND a.card_id LIKE CONCAT('%', #{param.cardId}, '%') + + + AND a.admin_id = #{param.adminId} + + + AND a.confirm_id = #{param.confirmId} + + + AND a.ic_card LIKE CONCAT('%', #{param.icCard}, '%') + + + AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') + + + AND b.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND b.nickname LIKE CONCAT('%', #{param.nickname}, '%') + + + AND a.address_id = #{param.addressId} + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.address_lat LIKE CONCAT('%', #{param.addressLat}, '%') + + + AND a.address_lng LIKE CONCAT('%', #{param.addressLng}, '%') + + + AND a.self_take_merchant_id = #{param.selfTakeMerchantId} + + + AND a.self_take_merchant_name LIKE CONCAT('%', #{param.selfTakeMerchantName}, '%') + + + AND a.send_start_time LIKE CONCAT('%', #{param.sendStartTime}, '%') + + + AND a.send_end_time LIKE CONCAT('%', #{param.sendEndTime}, '%') + + + AND a.express_merchant_id = #{param.expressMerchantId} + + + AND a.express_merchant_name LIKE CONCAT('%', #{param.expressMerchantName}, '%') + + + AND a.total_price = #{param.totalPrice} + + + AND a.reduce_price = #{param.reducePrice} + + + AND a.pay_price = #{param.payPrice} + + + AND a.price = #{param.price} + + + AND a.money = #{param.money} + + + AND a.refund_money = #{param.refundMoney} + + + AND a.coach_price = #{param.coachPrice} + + + AND a.total_num = #{param.totalNum} + + + AND a.coach_id = #{param.coachId} + + + AND a.pay_user_id = #{param.payUserId} + + + AND a.pay_type = #{param.payType} + + + AND a.friend_pay_type = #{param.friendPayType} + + + AND a.pay_status = #{param.payStatus} + + + AND a.order_status = #{param.orderStatus} + + + AND a.delivery_status = #{param.deliveryStatus} + + + AND a.delivery_time LIKE CONCAT('%', #{param.deliveryTime}, '%') + + + AND a.coupon_type = #{param.couponType} + + + AND a.coupon_desc LIKE CONCAT('%', #{param.couponDesc}, '%') + + + AND a.qrcode LIKE CONCAT('%', #{param.qrcode}, '%') + + + AND a.return_num = #{param.returnNum} + + + AND a.return_money = #{param.returnMoney} + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.is_invoice = #{param.isInvoice} + + + AND a.invoice_no LIKE CONCAT('%', #{param.invoiceNo}, '%') + + + AND a.pay_time LIKE CONCAT('%', #{param.payTime}, '%') + + + AND a.refund_time LIKE CONCAT('%', #{param.refundTime}, '%') + + + AND a.refund_apply_time LIKE CONCAT('%', #{param.refundApplyTime}, '%') + + + AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') + + + AND a.check_bill = #{param.checkBill} + + + AND a.is_settled = #{param.isSettled} + + + AND a.version = #{param.version} + + + AND a.user_id = #{param.userId} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND a.self_take_code LIKE CONCAT('%', #{param.selfTakeCode}, '%') + + + AND a.has_take_gift = #{param.hasTakeGift} + + + AND (a.order_no LIKE CONCAT('%', #{param.keywords}, '%') + OR a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.order_id = #{param.keywords} + OR b.phone = #{param.keywords} + OR b.phone = #{param.keywords} + OR b.nickname LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + AND a.order_status != 2 + + + + + + AND a.pay_status = 0 AND a.order_status = 0 + + + + AND a.pay_status = 1 AND a.delivery_status = 10 AND a.order_status = 0 + + + + AND a.pay_status = 1 AND a.order_status = 0 + + + + AND a.delivery_status = 20 AND a.order_status != 1 + + + + AND a.order_status = 1 AND a.evaluate_status = 0 + + + + AND a.order_status = 1 + + + + AND (a.order_status = 4 OR a.order_status = 5 OR a.order_status = 6 OR a.order_status = 7) + + + + AND a.deleted = 1 + + + + AND a.order_status = 2 + + + + AND a.create_time BETWEEN DATE_SUB(CURDATE(), INTERVAL 3 MONTH) AND CURDATE() + + + + + + + + + + + + + + + + + + + + UPDATE shop_order + + + pay_type = #{param.payType}, + + + pay_status = #{param.payStatus}, + + + order_status = #{param.orderStatus}, + + + delivery_status = #{param.deliveryStatus}, + + + delivery_time = #{param.deliveryTime}, + + + pay_time = #{param.payTime}, + + + refund_time = #{param.refundTime}, + + + self_take_code = #{param.selfTakeCode}, + + + invoice_no = #{param.invoiceNo}, + + + is_invoice = #{param.isInvoice}, + + + start_time = #{param.startTime}, + + + qrcode = #{param.qrcode}, + + + pay_user_id = #{param.payUserId}, + + + form_id = #{param.formId}, + + + total_price = #{param.totalPrice}, + + + reduce_price = #{param.reducePrice}, + + + pay_price = #{param.payPrice}, + + + price = #{param.price}, + + + money = #{param.money}, + + + refund_money = #{param.refundMoney}, + + + total_num = #{param.totalNum}, + + + coach_id = #{param.coachId}, + + + express_merchant_id = #{param.expressMerchantId}, + + + express_merchant_name = #{param.expressMerchantName}, + + + send_start_time = #{param.sendStartTime}, + + + send_end_time = #{param.sendEndTime}, + + + self_take_merchant_id = #{param.selfTakeMerchantId}, + + + self_take_merchant_name = #{param.selfTakeMerchantName}, + + + address_id = #{param.addressId}, + + + address = #{param.address}, + + + confirm_id = #{param.confirmId}, + + + ic_card = #{param.icCard}, + + + admin_id = #{param.adminId}, + + + card_id = #{param.cardId}, + + + coupon_id = #{param.couponId}, + + + merchant_id = #{param.merchantId}, + + + transaction_id = #{param.transactionId}, + + + refund_order = #{param.refundOrder}, + + + channel = #{param.channel}, + + + delivery_type = #{param.deliveryType}, + + + `type` = #{param.type}, + + + deleted = #{param.deleted}, + + + deleted = 0, + + + + order_no = #{param.orderNo} + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopRechargeOrderMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopRechargeOrderMapper.xml new file mode 100644 index 0000000..3ed8037 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopRechargeOrderMapper.xml @@ -0,0 +1,99 @@ + + + + + + + SELECT a.* + FROM shop_recharge_order a + + + AND a.order_id = #{param.orderId} + + + AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.recharge_type = #{param.rechargeType} + + + AND a.organization_id = #{param.organizationId} + + + AND a.plan_id = #{param.planId} + + + AND a.pay_price = #{param.payPrice} + + + AND a.gift_money = #{param.giftMoney} + + + AND a.actual_money = #{param.actualMoney} + + + AND a.balance = #{param.balance} + + + AND a.pay_method LIKE CONCAT('%', #{param.payMethod}, '%') + + + AND a.pay_status = #{param.payStatus} + + + AND a.pay_time = #{param.payTime} + + + AND a.trade_id = #{param.tradeId} + + + AND a.platform LIKE CONCAT('%', #{param.platform}, '%') + + + AND a.shop_id = #{param.shopId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopSpecMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopSpecMapper.xml new file mode 100644 index 0000000..9081159 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopSpecMapper.xml @@ -0,0 +1,60 @@ + + + + + + + SELECT a.* + FROM shop_spec a + + + AND a.spec_id = #{param.specId} + + + AND a.spec_name LIKE CONCAT('%', #{param.specName}, '%') + + + AND a.spec_value LIKE CONCAT('%', #{param.specValue}, '%') + + + AND a.merchant_id = #{param.merchantId} + + + AND a.user_id = #{param.userId} + + + AND a.updater = #{param.updater} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopSpecValueMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopSpecValueMapper.xml new file mode 100644 index 0000000..0543252 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopSpecValueMapper.xml @@ -0,0 +1,48 @@ + + + + + + + SELECT a.* + FROM shop_spec_value a + + + AND a.spec_value_id = #{param.specValueId} + + + AND a.spec_id = #{param.specId} + + + AND a.spec_value LIKE CONCAT('%', #{param.specValue}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopSplashMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopSplashMapper.xml new file mode 100644 index 0000000..bac8517 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopSplashMapper.xml @@ -0,0 +1,63 @@ + + + + + + + SELECT a.* + FROM shop_splash a + + + AND a.id = #{param.id} + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.image LIKE CONCAT('%', #{param.image}, '%') + + + AND a.jump_type LIKE CONCAT('%', #{param.jumpType}, '%') + + + AND a.jump_pk = #{param.jumpPk} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.user_id = #{param.userId} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopStoreMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopStoreMapper.xml new file mode 100644 index 0000000..9fe6da1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopStoreMapper.xml @@ -0,0 +1,75 @@ + + + + + + + SELECT a.* + FROM shop_store a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.email LIKE CONCAT('%', #{param.email}, '%') + + + AND a.manager_name LIKE CONCAT('%', #{param.managerName}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.lng_and_lat LIKE CONCAT('%', #{param.lngAndLat}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.is_delete = #{param.isDelete} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopStoreRiderMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopStoreRiderMapper.xml new file mode 100644 index 0000000..0b03901 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopStoreRiderMapper.xml @@ -0,0 +1,94 @@ + + + + + + + SELECT a.*, b.name AS storeName + FROM shop_store_rider a + LEFT JOIN shop_store b ON a.store_id = b.id + + + AND a.id = #{param.id} + + + AND a.store_id = #{param.storeId} + + + AND a.rider_no LIKE CONCAT('%', #{param.riderNo}, '%') + + + AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') + + + AND a.mobile LIKE CONCAT('%', #{param.mobile}, '%') + + + AND a.avatar LIKE CONCAT('%', #{param.avatar}, '%') + + + AND a.id_card_no LIKE CONCAT('%', #{param.idCardNo}, '%') + + + AND a.status = #{param.status} + + + AND a.work_status = #{param.workStatus} + + + AND a.auto_dispatch_enabled = #{param.autoDispatchEnabled} + + + AND a.dispatch_priority = #{param.dispatchPriority} + + + AND a.max_onhand_orders = #{param.maxOnhandOrders} + + + AND a.commission_calc_enabled = #{param.commissionCalcEnabled} + + + AND a.water_bucket_unit_fee = #{param.waterBucketUnitFee} + + + AND a.other_goods_commission_type = #{param.otherGoodsCommissionType} + + + AND a.other_goods_commission_value = #{param.otherGoodsCommissionValue} + + + AND a.user_id = #{param.userId} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.is_delete = #{param.isDelete} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopStoreUserMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopStoreUserMapper.xml new file mode 100644 index 0000000..2a8df9c --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopStoreUserMapper.xml @@ -0,0 +1,51 @@ + + + + + + + SELECT a.* + FROM shop_store_user a + + + AND a.id = #{param.id} + + + AND a.store_id = #{param.storeId} + + + AND a.user_id = #{param.userId} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.is_delete = #{param.isDelete} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserAddressMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserAddressMapper.xml new file mode 100644 index 0000000..37b630f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserAddressMapper.xml @@ -0,0 +1,82 @@ + + + + + + + SELECT a.* + FROM shop_user_address a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.country LIKE CONCAT('%', #{param.country}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.full_address LIKE CONCAT('%', #{param.fullAddress}, '%') + + + AND a.lat LIKE CONCAT('%', #{param.lat}, '%') + + + AND a.lng LIKE CONCAT('%', #{param.lng}, '%') + + + AND a.gender = #{param.gender} + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.is_default = #{param.isDefault} + + + AND a.user_id = #{param.userId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + OR a.phone = #{param.keywords} + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserBalanceLogMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserBalanceLogMapper.xml new file mode 100644 index 0000000..5ad4a74 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserBalanceLogMapper.xml @@ -0,0 +1,78 @@ + + + + + + + SELECT a.* + FROM shop_user_balance_log a + + + AND a.log_id = #{param.logId} + + + AND a.user_id = #{param.userId} + + + AND a.scene = #{param.scene} + + + AND a.money = #{param.money} + + + AND a.balance = #{param.balance} + + + AND a.remark LIKE CONCAT('%', #{param.remark}, '%') + + + AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%') + + + AND a.admin_id = #{param.adminId} + + + AND a.sort_number = #{param.sortNumber} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.merchant_id = #{param.merchantId} + + + AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%') + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserCollectionMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserCollectionMapper.xml new file mode 100644 index 0000000..98782e2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserCollectionMapper.xml @@ -0,0 +1,45 @@ + + + + + + + SELECT a.* + FROM shop_user_collection a + + + AND a.id = #{param.id} + + + AND a.type = #{param.type} + + + AND a.tid = #{param.tid} + + + AND a.user_id = #{param.userId} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserCouponMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserCouponMapper.xml new file mode 100644 index 0000000..48eaee5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserCouponMapper.xml @@ -0,0 +1,96 @@ + + + + + + + SELECT a.* + FROM shop_user_coupon a + + + AND a.id = #{param.id} + + + AND a.coupon_id = #{param.couponId} + + + AND a.user_id = #{param.userId} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.description LIKE CONCAT('%', #{param.description}, '%') + + + AND a.type = #{param.type} + + + AND a.reduce_price = #{param.reducePrice} + + + AND a.discount = #{param.discount} + + + AND a.min_price = #{param.minPrice} + + + AND a.apply_range = #{param.applyRange} + + + AND a.apply_range_config LIKE CONCAT('%', #{param.applyRangeConfig}, '%') + + + AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') + + + AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') + + + AND a.status = #{param.status} + + + AND a.use_time LIKE CONCAT('%', #{param.useTime}, '%') + + + AND a.order_id LIKE CONCAT('%', #{param.orderId}, '%') + + + AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%') + + + AND a.obtain_type = #{param.obtainType} + + + AND a.obtain_source LIKE CONCAT('%', #{param.obtainSource}, '%') + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserMapper.xml new file mode 100644 index 0000000..fa3f83c --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserMapper.xml @@ -0,0 +1,252 @@ + + + + + + + SELECT a.* + FROM shop_user a + + + AND a.user_id = #{param.userId} + + + AND a.type = #{param.type} + + + AND a.username LIKE CONCAT('%', #{param.username}, '%') + + + AND a.password LIKE CONCAT('%', #{param.password}, '%') + + + AND a.nickname LIKE CONCAT('%', #{param.nickname}, '%') + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.sex = #{param.sex} + + + AND a.position LIKE CONCAT('%', #{param.position}, '%') + + + AND a.platform LIKE CONCAT('%', #{param.platform}, '%') + + + AND a.email LIKE CONCAT('%', #{param.email}, '%') + + + AND a.email_verified = #{param.emailVerified} + + + AND a.alias LIKE CONCAT('%', #{param.alias}, '%') + + + AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') + + + AND a.id_card LIKE CONCAT('%', #{param.idCard}, '%') + + + AND a.birthday LIKE CONCAT('%', #{param.birthday}, '%') + + + AND a.country LIKE CONCAT('%', #{param.country}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.longitude LIKE CONCAT('%', #{param.longitude}, '%') + + + AND a.latitude LIKE CONCAT('%', #{param.latitude}, '%') + + + AND a.balance = #{param.balance} + + + AND a.cashed_money = #{param.cashedMoney} + + + AND a.points = #{param.points} + + + AND a.pay_money = #{param.payMoney} + + + AND a.expend_money = #{param.expendMoney} + + + AND a.pay_password LIKE CONCAT('%', #{param.payPassword}, '%') + + + AND a.grade_id = #{param.gradeId} + + + AND a.category LIKE CONCAT('%', #{param.category}, '%') + + + AND a.introduction LIKE CONCAT('%', #{param.introduction}, '%') + + + AND a.organization_id = #{param.organizationId} + + + AND a.group_id = #{param.groupId} + + + AND a.avatar LIKE CONCAT('%', #{param.avatar}, '%') + + + AND a.bg_image LIKE CONCAT('%', #{param.bgImage}, '%') + + + AND a.user_code LIKE CONCAT('%', #{param.userCode}, '%') + + + AND a.certification = #{param.certification} + + + AND a.age = #{param.age} + + + AND a.offline = #{param.offline} + + + AND a.followers = #{param.followers} + + + AND a.fans = #{param.fans} + + + AND a.likes = #{param.likes} + + + AND a.comment_numbers = #{param.commentNumbers} + + + AND a.recommend = #{param.recommend} + + + AND a.openid LIKE CONCAT('%', #{param.openid}, '%') + + + AND a.office_openid LIKE CONCAT('%', #{param.officeOpenid}, '%') + + + AND a.unionid LIKE CONCAT('%', #{param.unionid}, '%') + + + AND a.client_id LIKE CONCAT('%', #{param.clientId}, '%') + + + AND a.not_allow_vip = #{param.notAllowVip} + + + AND a.is_admin = #{param.isAdmin} + + + AND a.is_default = #{param.isDefault} + + + AND a.is_organization_admin = #{param.isOrganizationAdmin} + + + AND a.login_num = #{param.loginNum} + + + AND a.company_id = #{param.companyId} + + + AND a.merchants LIKE CONCAT('%', #{param.merchants}, '%') + + + AND a.merchant_id = #{param.merchantId} + + + AND a.merchant_name LIKE CONCAT('%', #{param.merchantName}, '%') + + + AND a.merchant_avatar LIKE CONCAT('%', #{param.merchantAvatar}, '%') + + + AND a.uid = #{param.uid} + + + AND a.expert_type = #{param.expertType} + + + AND a.expire_time = #{param.expireTime} + + + AND a.settlement_time LIKE CONCAT('%', #{param.settlementTime}, '%') + + + AND a.aptitude LIKE CONCAT('%', #{param.aptitude}, '%') + + + AND a.industry_parent LIKE CONCAT('%', #{param.industryParent}, '%') + + + AND a.industry_child LIKE CONCAT('%', #{param.industryChild}, '%') + + + AND a.title LIKE CONCAT('%', #{param.title}, '%') + + + AND a.template_id = #{param.templateId} + + + AND a.installed = #{param.installed} + + + AND a.speciality LIKE CONCAT('%', #{param.speciality}, '%') + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.status = #{param.status} + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserRefereeMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserRefereeMapper.xml new file mode 100644 index 0000000..3a1d993 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserRefereeMapper.xml @@ -0,0 +1,62 @@ + + + + + + + SELECT a.*, + d.nickname AS dealerName, + d.avatar AS dealerAvatar, + d.phone AS dealerPhone, + u.nickname, + u.avatar, + u.phone + FROM shop_user_referee a + LEFT JOIN gxwebsoft_core.sys_user d ON a.dealer_id = d.user_id + LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id + + + AND a.id = #{param.id} + + + AND a.dealer_id = #{param.dealerId} + + + AND a.user_id = #{param.userId} + + + AND a.level = #{param.level} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.deleted = #{param.deleted} + + + AND a.deleted = 0 + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopWarehouseMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopWarehouseMapper.xml new file mode 100644 index 0000000..121edaf --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopWarehouseMapper.xml @@ -0,0 +1,78 @@ + + + + + + + SELECT a.* + FROM shop_store_warehouse a + + + AND a.id = #{param.id} + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.code LIKE CONCAT('%', #{param.code}, '%') + + + AND a.type LIKE CONCAT('%', #{param.type}, '%') + + + AND a.address LIKE CONCAT('%', #{param.address}, '%') + + + AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.province LIKE CONCAT('%', #{param.province}, '%') + + + AND a.city LIKE CONCAT('%', #{param.city}, '%') + + + AND a.region LIKE CONCAT('%', #{param.region}, '%') + + + AND a.lng_and_lat LIKE CONCAT('%', #{param.lngAndLat}, '%') + + + AND a.user_id = #{param.userId} + + + AND a.comments LIKE CONCAT('%', #{param.comments}, '%') + + + AND a.sort_number = #{param.sortNumber} + + + AND a.is_delete = #{param.isDelete} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopWechatDepositMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopWechatDepositMapper.xml new file mode 100644 index 0000000..9840d34 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopWechatDepositMapper.xml @@ -0,0 +1,69 @@ + + + + + + + SELECT a.* + FROM shop_wechat_deposit a + + + AND a.id = #{param.id} + + + AND a.oid = #{param.oid} + + + AND a.uid = #{param.uid} + + + AND a.order_num LIKE CONCAT('%', #{param.orderNum}, '%') + + + AND a.wechat_order LIKE CONCAT('%', #{param.wechatOrder}, '%') + + + AND a.wechat_return LIKE CONCAT('%', #{param.wechatReturn}, '%') + + + AND a.site_name LIKE CONCAT('%', #{param.siteName}, '%') + + + AND a.username LIKE CONCAT('%', #{param.username}, '%') + + + AND a.phone LIKE CONCAT('%', #{param.phone}, '%') + + + AND a.name LIKE CONCAT('%', #{param.name}, '%') + + + AND a.price = #{param.price} + + + AND a.status = #{param.status} + + + AND a.create_time >= #{param.createTimeStart} + + + AND a.create_time <= #{param.createTimeEnd} + + + AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') + ) + + + + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/mapper/xml/UserCardStatsMapper.xml b/src/main/java/com/gxwebsoft/shop/mapper/xml/UserCardStatsMapper.xml new file mode 100644 index 0000000..1562236 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/mapper/xml/UserCardStatsMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopArticleParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopArticleParam.java new file mode 100644 index 0000000..3aceda1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopArticleParam.java @@ -0,0 +1,203 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品文章查询参数 + * + * @author 科技小王子 + * @since 2025-08-13 05:14:52 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopArticleParam对象", description = "商品文章查询参数") +public class ShopArticleParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "文章ID") + @QueryField(type = QueryType.EQ) + private Integer articleId; + + @Schema(description = "文章标题") + private String title; + + @Schema(description = "文章类型 0常规 1视频") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "模型") + private String model; + + @Schema(description = "详情页模板") + private String detail; + + @Schema(description = "文章分类ID") + @QueryField(type = QueryType.EQ) + private Integer categoryId; + + @Schema(description = "上级id, 0是顶级") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "话题") + private String topic; + + @Schema(description = "标签") + private String tags; + + @Schema(description = "封面图") + private String image; + + @Schema(description = "封面图宽") + @QueryField(type = QueryType.EQ) + private Integer imageWidth; + + @Schema(description = "封面图高") + @QueryField(type = QueryType.EQ) + private Integer imageHeight; + + @Schema(description = "付费金额") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "开始时间") + private String startTime; + + @Schema(description = "结束时间") + private String endTime; + + @Schema(description = "来源") + private String source; + + @Schema(description = "产品概述") + private String overview; + + @Schema(description = "虚拟阅读量(仅用作展示)") + @QueryField(type = QueryType.EQ) + private Integer virtualViews; + + @Schema(description = "实际阅读量") + @QueryField(type = QueryType.EQ) + private Integer actualViews; + + @Schema(description = "评分") + @QueryField(type = QueryType.EQ) + private BigDecimal rate; + + @Schema(description = "列表显示方式(10小图展示 20大图展示)") + @QueryField(type = QueryType.EQ) + private Integer showType; + + @Schema(description = "访问密码") + private String password; + + @Schema(description = "可见类型 0所有人 1登录可见 2密码可见") + @QueryField(type = QueryType.EQ) + private Integer permission; + + @Schema(description = "发布来源客户端 (APP、H5、小程序等)") + private String platform; + + @Schema(description = "文章附件") + private String files; + + @Schema(description = "视频地址") + private String video; + + @Schema(description = "接受的文件类型") + private String accept; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "点赞数") + @QueryField(type = QueryType.EQ) + private Integer likes; + + @Schema(description = "评论数") + @QueryField(type = QueryType.EQ) + private Integer commentNumbers; + + @Schema(description = "提醒谁看") + private String toUsers; + + @Schema(description = "作者") + private String author; + + @Schema(description = "推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "报名人数") + @QueryField(type = QueryType.EQ) + private Integer bmUsers; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "项目ID") + @QueryField(type = QueryType.EQ) + private Integer projectId; + + @Schema(description = "语言") + private String lang; + + @Schema(description = "关联默认语言的文章ID") + @QueryField(type = QueryType.EQ) + private Integer langArticleId; + + @Schema(description = "是否自动翻译") + @QueryField(type = QueryType.EQ) + private Boolean translation; + + @Schema(description = "编辑器类型 0 Markdown编辑器 1 富文本编辑器 ") + @QueryField(type = QueryType.EQ) + private Boolean editor; + + @Schema(description = "pdf文件地址") + private String pdfUrl; + + @Schema(description = "版本号") + @QueryField(type = QueryType.EQ) + private Integer version; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopBrandParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopBrandParam.java new file mode 100644 index 0000000..047ec9f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopBrandParam.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 品牌查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopBrandParam对象", description = "品牌查询参数") +public class ShopBrandParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer brandId; + + @Schema(description = "品牌名称") + private String brandName; + + @Schema(description = "图标") + private String image; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopCartParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopCartParam.java new file mode 100644 index 0000000..05bd2be --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopCartParam.java @@ -0,0 +1,96 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 购物车查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopCartParam对象", description = "购物车查询参数") +public class ShopCartParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "购物车表ID") + @QueryField(type = QueryType.EQ) + private Long id; + + @Schema(description = "类型 0商城 1外卖") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "唯一标识") + private String code; + + @Schema(description = "商品ID") + private Long goodsId; + + @Schema(description = "商品SKU ID") + @QueryField(type = QueryType.EQ) + private Integer skuId; + + @Schema(description = "商品规格") + private String spec; + + @Schema(description = "规格信息,如:颜色:红色|尺寸:L") + private String specInfo; + + @Schema(description = "商品价格") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "商品数量") + @QueryField(type = QueryType.EQ) + private Integer cartNum; + + @Schema(description = "单商品合计") + @QueryField(type = QueryType.EQ) + private BigDecimal totalPrice; + + @Schema(description = "0 = 未购买 1 = 已购买") + @QueryField(type = QueryType.EQ) + private Boolean isPay; + + @Schema(description = "是否为立即购买") + @QueryField(type = QueryType.EQ) + private Boolean isNew; + + @Schema(description = "是否为立即购买") + @QueryField(type = QueryType.EQ) + private Boolean isShow; + + @Schema(description = "拼团id") + @QueryField(type = QueryType.EQ) + private Integer combinationId; + + @Schema(description = "秒杀产品ID") + @QueryField(type = QueryType.EQ) + private Integer seckillId; + + @Schema(description = "砍价id") + @QueryField(type = QueryType.EQ) + private Integer bargainId; + + @Schema(description = "是否选中") + @QueryField(type = QueryType.EQ) + private Boolean selected; + + @Schema(description = "商户ID") + private Long merchantId; + + @Schema(description = "用户ID") + private Long userId; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopCategoryParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopCategoryParam.java new file mode 100644 index 0000000..2466e34 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopCategoryParam.java @@ -0,0 +1,127 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品分类查询参数 + * + * @author 科技小王子 + * @since 2025-04-24 20:52:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopCategoryParam对象", description = "商品分类查询参数") +public class ShopCategoryParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "上级id, 0是顶级") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "菜单名称") + private String title; + + @Schema(description = "模型") + private String model; + + @Schema(description = "标识") + private String code; + + @Schema(description = "链接地址") + private String path; + + @Schema(description = "组件地址") + private String component; + + @Schema(description = "打开位置") + private String target; + + @Schema(description = "图标") + private String icon; + + @Schema(description = "banner") + private String banner; + + @Schema(description = "图标颜色") + private String color; + + @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") + @QueryField(type = QueryType.EQ) + private Integer hide; + + @Schema(description = "可见类型 0所有人 1登录可见 2密码可见") + @QueryField(type = QueryType.EQ) + private Integer permission; + + @Schema(description = "访问密码") + private String password; + + @Schema(description = "位置 0不限 1顶部 2底部") + @QueryField(type = QueryType.EQ) + private Integer position; + + @Schema(description = "仅在顶部显示") + @QueryField(type = QueryType.EQ) + private Integer top; + + @Schema(description = "仅在底部显示") + @QueryField(type = QueryType.EQ) + private Integer bottom; + + @Schema(description = "菜单选中的path") + private String active; + + @Schema(description = "其它路由元信息") + private String meta; + + @Schema(description = "css样式") + private String style; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "商户ID") + @QueryField(type = QueryType.EQ) + private Long merchantId; + + @Schema(description = "语言") + private String lang; + + @Schema(description = "设为首页") + @QueryField(type = QueryType.EQ) + private Integer home; + + @Schema(description = "推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopChatConversationParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopChatConversationParam.java new file mode 100644 index 0000000..7202265 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopChatConversationParam.java @@ -0,0 +1,57 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 聊天消息表查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopChatConversationParam对象", description = "聊天消息表查询参数") +public class ShopChatConversationParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "好友ID") + @QueryField(type = QueryType.EQ) + private Integer friendId; + + @Schema(description = "消息类型") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "消息内容") + private String content; + + @Schema(description = "未读消息") + @QueryField(type = QueryType.EQ) + private Integer unRead; + + @Schema(description = "状态, 0未读, 1已读") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopChatMessageParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopChatMessageParam.java new file mode 100644 index 0000000..25c2fb5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopChatMessageParam.java @@ -0,0 +1,75 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 聊天消息表查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopChatMessageParam对象", description = "聊天消息表查询参数") +public class ShopChatMessageParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "发送人ID") + @QueryField(type = QueryType.EQ) + private Integer formUserId; + + @Schema(description = "接收人ID") + @QueryField(type = QueryType.EQ) + private Integer toUserId; + + @Schema(description = "消息类型") + private String type; + + @Schema(description = "消息内容") + private String content; + + @Schema(description = "屏蔽接收方") + @QueryField(type = QueryType.EQ) + private Integer sideTo; + + @Schema(description = "屏蔽发送方") + @QueryField(type = QueryType.EQ) + private Integer sideFrom; + + @Schema(description = "是否撤回") + @QueryField(type = QueryType.EQ) + private Integer withdraw; + + @Schema(description = "文件信息") + private String fileInfo; + + @Schema(description = "存在联系方式") + @QueryField(type = QueryType.EQ) + private Integer hasContact; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0未读, 1已读") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopCommissionRoleParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopCommissionRoleParam.java new file mode 100644 index 0000000..9b4e15c --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopCommissionRoleParam.java @@ -0,0 +1,50 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分红角色查询参数 + * + * @author 科技小王子 + * @since 2025-05-01 10:01:14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopCommissionRoleParam对象", description = "分红角色查询参数") +public class ShopCommissionRoleParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + private Integer id; + + private String title; + + @QueryField(type = QueryType.EQ) + private Integer provinceId; + + @QueryField(type = QueryType.EQ) + private Integer cityId; + + @QueryField(type = QueryType.EQ) + private Integer regionId; + + @Schema(description = "状态, 0正常, 1异常") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "备注") + private String comments; + + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopCommunityParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopCommunityParam.java new file mode 100644 index 0000000..ecf76af --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopCommunityParam.java @@ -0,0 +1,49 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 小区查询参数 + * + * @author 科技小王子 + * @since 2026-01-29 20:48:31 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopCommunityParam对象", description = "小区查询参数") +public class ShopCommunityParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "小区名称") + private String name; + + @Schema(description = "小区编号") + private String code; + + @Schema(description = "详细地址") + private String address; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopCountParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopCountParam.java new file mode 100644 index 0000000..55f57a0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopCountParam.java @@ -0,0 +1,64 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商城销售统计表查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopCountParam对象", description = "商城销售统计表查询参数") +public class ShopCountParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "统计日期") + private String dateTime; + + @Schema(description = "总销售额") + @QueryField(type = QueryType.EQ) + private BigDecimal totalPrice; + + @Schema(description = "今日销售额") + @QueryField(type = QueryType.EQ) + private BigDecimal todayPrice; + + @Schema(description = "总会员数") + @QueryField(type = QueryType.EQ) + private BigDecimal totalUsers; + + @Schema(description = "今日新增") + @QueryField(type = QueryType.EQ) + private BigDecimal todayUsers; + + @Schema(description = "总订单笔数") + @QueryField(type = QueryType.EQ) + private BigDecimal totalOrders; + + @Schema(description = "今日订单笔数") + @QueryField(type = QueryType.EQ) + private BigDecimal todayOrders; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopCouponApplyCateParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopCouponApplyCateParam.java new file mode 100644 index 0000000..b80698a --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopCouponApplyCateParam.java @@ -0,0 +1,46 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 优惠券可用分类查询参数 + * + * @author 科技小王子 + * @since 2025-08-11 12:47:48 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopCouponApplyCateParam对象", description = "优惠券可用分类查询参数") +public class ShopCouponApplyCateParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + private Integer id; + + @QueryField(type = QueryType.EQ) + private Integer couponId; + + @QueryField(type = QueryType.EQ) + private Integer cateId; + + @Schema(description = "分类等级") + @QueryField(type = QueryType.EQ) + private Boolean cateLevel; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopCouponApplyItemParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopCouponApplyItemParam.java new file mode 100644 index 0000000..f27cc47 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopCouponApplyItemParam.java @@ -0,0 +1,54 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 优惠券可用分类查询参数 + * + * @author 科技小王子 + * @since 2025-08-11 12:47:49 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopCouponApplyItemParam对象", description = "优惠券可用分类查询参数") +public class ShopCouponApplyItemParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + private Integer id; + + @QueryField(type = QueryType.EQ) + private Integer couponId; + + @Schema(description = "商品ID") + @QueryField(type = QueryType.EQ) + private Integer goodsId; + + @Schema(description = "分类ID") + @QueryField(type = QueryType.EQ) + private Integer categoryId; + + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "0服务1需求2闲置") + @QueryField(type = QueryType.EQ) + private Integer pk; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopCouponParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopCouponParam.java new file mode 100644 index 0000000..58f71f5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopCouponParam.java @@ -0,0 +1,108 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 优惠券查询参数 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:23 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopCouponParam对象", description = "优惠券查询参数") +public class ShopCouponParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "id") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "优惠券名称") + private String name; + + @Schema(description = "优惠券描述") + private String description; + + @Schema(description = "优惠券类型(10满减券 20折扣券 30免费劵)") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "满减券-减免金额") + @QueryField(type = QueryType.EQ) + private BigDecimal reducePrice; + + @Schema(description = "折扣券-折扣率(0-100)") + @QueryField(type = QueryType.EQ) + private Integer discount; + + @Schema(description = "最低消费金额") + @QueryField(type = QueryType.EQ) + private BigDecimal minPrice; + + @Schema(description = "到期类型(10领取后生效 20固定时间)") + @QueryField(type = QueryType.EQ) + private Integer expireType; + + @Schema(description = "领取后生效-有效天数") + @QueryField(type = QueryType.EQ) + private Integer expireDay; + + @Schema(description = "有效期开始时间") + private String startTime; + + @Schema(description = "有效期结束时间") + private String endTime; + + @Schema(description = "适用范围(10全部商品 20指定商品 30指定分类)") + @QueryField(type = QueryType.EQ) + private Integer applyRange; + + @Schema(description = "适用范围配置(json格式)") + private String applyRangeConfig; + + @Schema(description = "是否过期(0未过期 1已过期)") + @QueryField(type = QueryType.EQ) + private Integer isExpire; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1禁用") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "创建用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "发放总数量(-1表示无限制)") + @QueryField(type = QueryType.EQ) + private Integer totalCount; + + @Schema(description = "已发放数量") + @QueryField(type = QueryType.EQ) + private Integer issuedCount; + + @Schema(description = "每人限领数量(-1表示无限制)") + @QueryField(type = QueryType.EQ) + private Integer limitPerUser; + + @Schema(description = "是否启用(0禁用 1启用)") + @QueryField(type = QueryType.EQ) + private Boolean enabled; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopDealerApplyImportParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopDealerApplyImportParam.java new file mode 100644 index 0000000..b1b3b57 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopDealerApplyImportParam.java @@ -0,0 +1,72 @@ +package com.gxwebsoft.shop.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 分销商申请记录导入参数 + * + * @author 科技小王子 + * @since 2025-09-05 + */ +@Data +public class ShopDealerApplyImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "类型", replace = {"经销商_0", "企业_1", "集团_2"}) + private Integer type; + + @Excel(name = "用户ID") + private Integer userId; + + @Excel(name = "姓名") + private String realName; + + @Excel(name = "分销商名称") + private String dealerName; + + @Excel(name = "分销商编码") + private String dealerCode; + + @Excel(name = "手机号") + private String mobile; + + @Excel(name = "合同金额") + private BigDecimal money; + + @Excel(name = "详细地址") + private String address; + + @Excel(name = "社区") + private String community; + + @Excel(name = "楼栋号") + private String buildingNumber; + + @Excel(name = "单元号") + private String unitNumber; + + @Excel(name = "房号") + private String roomNumber; + + @Excel(name = "推荐人用户ID") + private Integer refereeId; + + @Excel(name = "申请方式", replace = {"需后台审核_10", "无需审核_20"}) + private Integer applyType; + + @Excel(name = "审核状态", replace = {"待审核_10", "审核通过_20", "驳回_30"}) + private Integer applyStatus; + + @Excel(name = "合同时间", format = "yyyy-MM-dd HH:mm:ss") + private String contractTime; + + @Excel(name = "驳回原因") + private String rejectReason; + + @Excel(name = "商城ID") + private Integer tenantId; +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopDealerApplyParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopDealerApplyParam.java new file mode 100644 index 0000000..684a029 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopDealerApplyParam.java @@ -0,0 +1,89 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分销商申请记录表查询参数 + * + * @author 科技小王子 + * @since 2025-08-11 23:50:17 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopDealerApplyParam对象", description = "分销商申请记录表查询参数") +public class ShopDealerApplyParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer applyId; + + @Schema(description = "0经销商,1企业也,2集团)") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "客户编号") + private String dealerCode; + + @Schema(description = "姓名") + private String realName; + + @Schema(description = "手机号") + private String mobile; + + @Schema(description = "社区") + private String community; + + @Schema(description = "楼栋号") + private String buildingNumber; + + @Schema(description = "单元号") + private String unitNumber; + + @Schema(description = "房号") + private String roomNumber; + + @Schema(description = "推荐人用户ID") + @QueryField(type = QueryType.EQ) + private Integer refereeId; + + @Schema(description = "申请方式(10需后台审核 20无需审核)") + @QueryField(type = QueryType.EQ) + private Integer applyType; + + @Schema(description = "申请时间") + @QueryField(type = QueryType.EQ) + private String applyTime; + + @Schema(description = "到期时间") + @QueryField(type = QueryType.EQ) + private String expirationTime; + + @Schema(description = "审核状态 (10待审核 20审核通过 30驳回)") + @QueryField(type = QueryType.EQ) + private Integer applyStatus; + + @Schema(description = "审核时间") + @QueryField(type = QueryType.EQ) + private String auditTime; + + @Schema(description = "驳回原因") + private String rejectReason; + + @Schema(description = "分销商名称") + @QueryField(type = QueryType.EQ) + private String dealerName; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopDealerBankParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopDealerBankParam.java new file mode 100644 index 0000000..5aa4941 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopDealerBankParam.java @@ -0,0 +1,58 @@ +package com.gxwebsoft.shop.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 分销商提现银行卡查询参数 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopDealerBankParam对象", description = "分销商提现银行卡查询参数") +public class ShopDealerBankParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "分销商用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "开户行名称") + private String bankName; + + @Schema(description = "银行开户名") + private String bankAccount; + + @Schema(description = "银行卡号") + private String bankCard; + + @Schema(description = "申请状态 (10待审核 20审核通过 30驳回)") + @QueryField(type = QueryType.EQ) + private Integer applyStatus; + + @Schema(description = "审核时间") + @QueryField(type = QueryType.EQ) + private Integer auditTime; + + @Schema(description = "驳回原因") + private String rejectReason; + + @Schema(description = "默认收货地址") + @QueryField(type = QueryType.EQ) + private Boolean isDefault; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopDealerCapitalParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopDealerCapitalParam.java new file mode 100644 index 0000000..96938dd --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopDealerCapitalParam.java @@ -0,0 +1,58 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分销商资金明细表查询参数 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:40 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopDealerCapitalParam对象", description = "分销商资金明细表查询参数") +public class ShopDealerCapitalParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "分销商用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "订单编号") + @QueryField(type = QueryType.EQ) + private String orderNo; + + @Schema(description = "资金流动类型 (10佣金收入 20提现支出 30转账支出 40转账收入 50佣金解冻)") + @QueryField(type = QueryType.EQ) + private Integer flowType; + + @Schema(description = "金额") + @QueryField(type = QueryType.EQ) + private BigDecimal money; + + @Schema(description = "描述") + private String comments; + + @Schema(description = "对方用户ID") + @QueryField(type = QueryType.EQ) + private Integer toUserId; + + @Schema(description = "月份") + @QueryField(type = QueryType.EQ) + private String month; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopDealerOrderImportParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopDealerOrderImportParam.java new file mode 100644 index 0000000..ee88898 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopDealerOrderImportParam.java @@ -0,0 +1,61 @@ +package com.gxwebsoft.shop.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.math.BigDecimal; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 分销商订单记录表导入参数 + * + * @author 科技小王子 + * @since 2025-08-12 11:55:18 + */ +@Data +public class ShopDealerOrderImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "主键ID") + private Integer id; + + @Excel(name = "买家用户ID") + private Integer userId; + + @Excel(name = "订单ID") + private Integer orderId; + + @Excel(name = "订单总金额") + private BigDecimal orderPrice; + + @Excel(name = "一级分销商ID") + private Integer firstUserId; + + @Excel(name = "二级分销商ID") + private Integer secondUserId; + + @Excel(name = "三级分销商ID") + private Integer thirdUserId; + + @Excel(name = "一级佣金") + private BigDecimal firstMoney; + + @Excel(name = "二级佣金") + private BigDecimal secondMoney; + + @Excel(name = "三级佣金") + private BigDecimal thirdMoney; + + @Excel(name = "订单状态") + private Integer isInvalid; + + @Excel(name = "结算状态") + private Integer isSettled; + + @Excel(name = "结算时间") + private LocalDateTime settleTime; + + @Excel(name = "租户ID") + private Integer tenantId; +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopDealerOrderParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopDealerOrderParam.java new file mode 100644 index 0000000..1f21f8a --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopDealerOrderParam.java @@ -0,0 +1,91 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分销商订单记录表查询参数 + * + * @author 科技小王子 + * @since 2025-08-12 11:55:18 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopDealerOrderParam对象", description = "分销商订单记录表查询参数") +public class ShopDealerOrderParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "买家用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Excel(name = "订单编号") + @QueryField(type = QueryType.EQ) + private String orderNo; + + @Schema(description = "订单总金额(不含运费)") + @QueryField(type = QueryType.EQ) + private BigDecimal orderPrice; + + @Schema(description = "分销商用户id(一级)") + @QueryField(type = QueryType.EQ) + private Integer firstUserId; + + @Schema(description = "分销商用户id(二级)") + @QueryField(type = QueryType.EQ) + private Integer secondUserId; + + @Schema(description = "分销商用户id(三级)") + @QueryField(type = QueryType.EQ) + private Integer thirdUserId; + + @Schema(description = "分销佣金(一级)") + @QueryField(type = QueryType.EQ) + private BigDecimal firstMoney; + + @Schema(description = "分销佣金(二级)") + @QueryField(type = QueryType.EQ) + private BigDecimal secondMoney; + + @Schema(description = "分销佣金(三级)") + @QueryField(type = QueryType.EQ) + private BigDecimal thirdMoney; + + @Schema(description = "订单是否失效(0未失效 1已失效)") + @QueryField(type = QueryType.EQ) + private Integer isInvalid; + + @Schema(description = "佣金结算(0未结算 1已结算)") + @QueryField(type = QueryType.EQ) + private Integer isSettled; + + @Schema(description = "结算时间") + @QueryField(type = QueryType.EQ) + private String settleTime; + + @Schema(description = "备注") + @QueryField(type = QueryType.EQ) + private String comments; + + @Schema(description = "关联ID") + @QueryField(type = QueryType.EQ) + private Integer resourceId; + + @Schema(description = "月份") + @QueryField(type = QueryType.EQ) + private String month; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopDealerRecordParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopDealerRecordParam.java new file mode 100644 index 0000000..84acded --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopDealerRecordParam.java @@ -0,0 +1,58 @@ +package com.gxwebsoft.shop.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 客户跟进情况查询参数 + * + * @author 科技小王子 + * @since 2025-10-02 12:21:50 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(description = "客户跟进情况查询参数") +public class ShopDealerRecordParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "上级id, 0是顶级") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "客户ID") + @QueryField(type = QueryType.EQ) + private Integer dealerId; + + @Schema(description = "内容") + private String content; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0待处理, 1已完成") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} \ No newline at end of file diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopDealerRefereeParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopDealerRefereeParam.java new file mode 100644 index 0000000..b96adf8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopDealerRefereeParam.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分销商推荐关系表查询参数 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopDealerRefereeParam对象", description = "分销商推荐关系表查询参数") +public class ShopDealerRefereeParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "分销商用户ID") + @QueryField(type = QueryType.EQ) + private Integer dealerId; + + @Schema(description = "用户id(被推荐人)") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "推荐关系层级(1,2,3)") + @QueryField(type = QueryType.EQ) + private Integer level; + + @Schema(description = "是否管理员") + @QueryField(type = QueryType.EQ) + private Boolean isAdmin; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopDealerSettingParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopDealerSettingParam.java new file mode 100644 index 0000000..e9f214e --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopDealerSettingParam.java @@ -0,0 +1,35 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分销商设置表查询参数 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopDealerSettingParam对象", description = "分销商设置表查询参数") +public class ShopDealerSettingParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "设置项标示") + @QueryField(type = QueryType.EQ) + private String key; + + @Schema(description = "设置项描述") + private String describe; + + @Schema(description = "设置内容(json格式)") + private String values; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopDealerSettingSaveParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopDealerSettingSaveParam.java new file mode 100644 index 0000000..6136aa4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopDealerSettingSaveParam.java @@ -0,0 +1,35 @@ +package com.gxwebsoft.shop.param; + +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** + * Shop dealer setting save parameters. + * + * @author WebSoft + * @since 2025-08-11 23:51:41 + */ +@Data +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopDealerSettingSaveParam", description = "Shop dealer setting save parameters") +public class ShopDealerSettingSaveParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Schema(description = "Setting key") + private String key; + + @Schema(description = "Setting description") + private String describe; + + @Schema(description = "Settings JSON content") + private String values; + + @Schema(description = "Tenant ID") + private Integer tenantId; + + @Schema(description = "Update time") + private Long updateTime; +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopDealerUserImportParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopDealerUserImportParam.java new file mode 100644 index 0000000..064bcb9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopDealerUserImportParam.java @@ -0,0 +1,70 @@ +package com.gxwebsoft.shop.param; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * 分销商用户导入参数 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Data +public class ShopDealerUserImportParam implements Serializable { + private static final long serialVersionUID = 1L; + + @Excel(name = "用户ID") + private Integer userId; + + @Excel(name = "姓名") + private String realName; + + @Excel(name = "手机号") + private String mobile; + + @Excel(name = "支付密码") + private String payPassword; + + @Excel(name = "当前可提现佣金") + private BigDecimal money; + + @Excel(name = "已冻结佣金") + private BigDecimal freezeMoney; + + @Excel(name = "累积提现佣金") + private BigDecimal totalMoney; + + @Excel(name = "推荐人用户ID") + private Integer refereeId; + + @Excel(name = "成员数量(一级)") + private Integer firstNum; + + @Excel(name = "成员数量(二级)") + private Integer secondNum; + + @Excel(name = "成员数量(三级)") + private Integer thirdNum; + + @Excel(name = "专属二维码") + private String qrcode; + + @Excel(name = "排序号") + private Integer sortNumber; + + @Excel(name = "是否删除") + private Integer isDelete; + + @Excel(name = "租户ID") + private Integer tenantId; + + @Excel(name = "创建时间") + private LocalDateTime createTime; + + @Excel(name = "修改时间") + private LocalDateTime updateTime; +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopDealerUserParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopDealerUserParam.java new file mode 100644 index 0000000..9953b1f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopDealerUserParam.java @@ -0,0 +1,89 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分销商用户记录表查询参数 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopDealerUserParam对象", description = "分销商用户记录表查询参数") +public class ShopDealerUserParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "类型") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "姓名") + private String realName; + + @Schema(description = "手机号") + private String mobile; + + @Schema(description = "支付密码") + private String payPassword; + + @Schema(description = "当前可提现佣金") + @QueryField(type = QueryType.EQ) + private BigDecimal money; + + @Schema(description = "已冻结佣金") + @QueryField(type = QueryType.EQ) + private BigDecimal freezeMoney; + + @Schema(description = "累积提现佣金") + @QueryField(type = QueryType.EQ) + private BigDecimal totalMoney; + + @Schema(description = "佣金比例") + @QueryField(type = QueryType.EQ) + private BigDecimal rate; + + @Schema(description = "推荐人用户ID") + @QueryField(type = QueryType.EQ) + private Integer refereeId; + + @Schema(description = "成员数量(一级)") + @QueryField(type = QueryType.EQ) + private Integer firstNum; + + @Schema(description = "成员数量(二级)") + @QueryField(type = QueryType.EQ) + private Integer secondNum; + + @Schema(description = "成员数量(三级)") + @QueryField(type = QueryType.EQ) + private Integer thirdNum; + + @Schema(description = "专属二维码") + private String qrcode; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除") + @QueryField(type = QueryType.EQ) + private Integer isDelete; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopDealerWithdrawParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopDealerWithdrawParam.java new file mode 100644 index 0000000..a510fc3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopDealerWithdrawParam.java @@ -0,0 +1,86 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分销商提现明细表查询参数 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopDealerWithdrawParam对象", description = "分销商提现明细表查询参数") +public class ShopDealerWithdrawParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "分销商用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "提现金额") + @QueryField(type = QueryType.EQ) + private BigDecimal money; + + @Schema(description = "打款方式 (10微信 20支付宝 30银行卡)") + @QueryField(type = QueryType.EQ) + private Integer payType; + + @Schema(description = "支付宝姓名") + private String alipayName; + + @Schema(description = "支付宝账号") + private String alipayAccount; + + @Schema(description = "开户行名称") + private String bankName; + + @Schema(description = "银行开户名") + private String bankAccount; + + @Schema(description = "银行卡号") + private String bankCard; + + @Schema(description = "申请状态 (10待审核 20审核通过 30驳回 40已打款)") + @QueryField(type = QueryType.EQ) + private Integer applyStatus; + + @Schema(description = "审核时间") + @QueryField(type = QueryType.EQ) + private String auditTime; + + @Schema(description = "驳回原因") + private String rejectReason; + + @Schema(description = "来源客户端(APP、H5、小程序等)") + private String platform; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "上传支付凭证") + private String image; + + @Schema(description = "微信openId") + @QueryField(type = QueryType.EQ) + private String openId; + + @Schema(description = "公众号openId") + @QueryField(type = QueryType.EQ) + private String officeOpenid; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopExpressParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopExpressParam.java new file mode 100644 index 0000000..ce43740 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopExpressParam.java @@ -0,0 +1,49 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 物流公司查询参数 + * + * @author 科技小王子 + * @since 2025-08-12 12:07:03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopExpressParam对象", description = "物流公司查询参数") +public class ShopExpressParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "物流公司ID") + @QueryField(type = QueryType.EQ) + private Integer expressId; + + @Schema(description = "物流公司名称") + private String expressName; + + @Schema(description = "物流公司编码 (微信)") + private String wxCode; + + @Schema(description = "物流公司编码 (快递100)") + private String kuaidi100Code; + + @Schema(description = "物流公司编码 (快递鸟)") + private String kdniaoCode; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopExpressTemplateDetailParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopExpressTemplateDetailParam.java new file mode 100644 index 0000000..6a2f8c9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopExpressTemplateDetailParam.java @@ -0,0 +1,68 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 运费模板查询参数 + * + * @author 科技小王子 + * @since 2025-08-12 12:07:03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopExpressTemplateDetailParam对象", description = "运费模板查询参数") +public class ShopExpressTemplateDetailParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + private Integer id; + + @QueryField(type = QueryType.EQ) + private Integer templateId; + + @Schema(description = "0按件") + @QueryField(type = QueryType.EQ) + private Boolean type; + + @QueryField(type = QueryType.EQ) + private Integer provinceId; + + @QueryField(type = QueryType.EQ) + private Integer cityId; + + @Schema(description = "首件数量/重量") + @QueryField(type = QueryType.EQ) + private BigDecimal firstNum; + + @Schema(description = "收件价格") + @QueryField(type = QueryType.EQ) + private BigDecimal firstAmount; + + @Schema(description = "续件价格") + @QueryField(type = QueryType.EQ) + private BigDecimal extraAmount; + + @Schema(description = "续件数量/重量") + @QueryField(type = QueryType.EQ) + private BigDecimal extraNum; + + @Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopExpressTemplateParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopExpressTemplateParam.java new file mode 100644 index 0000000..43c4ebd --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopExpressTemplateParam.java @@ -0,0 +1,60 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 运费模板查询参数 + * + * @author 科技小王子 + * @since 2025-08-12 12:07:03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopExpressTemplateParam对象", description = "运费模板查询参数") +public class ShopExpressTemplateParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + private Integer id; + + @QueryField(type = QueryType.EQ) + private Boolean type; + + private String title; + + @Schema(description = "收件价格") + @QueryField(type = QueryType.EQ) + private BigDecimal firstAmount; + + @Schema(description = "续件价格") + @QueryField(type = QueryType.EQ) + private BigDecimal extraAmount; + + @Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "首件数量/重量") + @QueryField(type = QueryType.EQ) + private BigDecimal firstNum; + + @Schema(description = "续件数量/重量") + @QueryField(type = QueryType.EQ) + private BigDecimal extraNum; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopGiftParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopGiftParam.java new file mode 100644 index 0000000..e5e710c --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopGiftParam.java @@ -0,0 +1,76 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 礼品卡查询参数 + * + * @author 科技小王子 + * @since 2025-08-11 18:07:31 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopGiftParam对象", description = "礼品卡查询参数") +public class ShopGiftParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + private Integer id; + + private String name; + + @Schema(description = "秘钥") + private String code; + + @Schema(description = "商品ID") + @QueryField(type = QueryType.EQ) + private Integer goodsId; + + @Schema(description = "使用地点") + private String useLocation; + + @Schema(description = "领取时间") + private String takeTime; + + @Schema(description = "操作人") + @QueryField(type = QueryType.EQ) + private Integer operatorUserId; + + @Schema(description = "核销时间") + private String verificationTime; + + @Schema(description = "是否展示") + @QueryField(type = QueryType.EQ) + private Boolean isShow; + + @Schema(description = "状态, 0未使用 1已使用 2失效") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "操作员备注") + private String operatorRemarks; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopGoodsCategoryParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsCategoryParam.java new file mode 100644 index 0000000..093afe7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsCategoryParam.java @@ -0,0 +1,96 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品分类查询参数 + * + * @author 科技小王子 + * @since 2025-05-01 00:36:45 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopGoodsCategoryParam对象", description = "商品分类查询参数") +public class ShopGoodsCategoryParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "商品分类ID") + @QueryField(type = QueryType.EQ) + private Integer categoryId; + + @Schema(description = "分类标识") + private String categoryCode; + + @Schema(description = "分类名称") + private String title; + + @Schema(description = "类型 0商城分类 1外卖分类") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "分类图片") + private String image; + + @Schema(description = "上级分类ID") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "路由/链接地址") + private String path; + + @Schema(description = "组件路径") + private String component; + + @Schema(description = "绑定的页面") + @QueryField(type = QueryType.EQ) + private Integer pageId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "商品数量") + @QueryField(type = QueryType.EQ) + private Integer count; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") + @QueryField(type = QueryType.EQ) + private Integer hide; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "是否显示在首页") + @QueryField(type = QueryType.EQ) + private Integer showIndex; + + @Schema(description = "商铺ID") + @QueryField(type = QueryType.EQ) + private Long merchantId; + + @Schema(description = "状态, 0正常, 1禁用") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopGoodsCommentParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsCommentParam.java new file mode 100644 index 0000000..cfae581 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsCommentParam.java @@ -0,0 +1,98 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 评论表查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopGoodsCommentParam对象", description = "评论表查询参数") +public class ShopGoodsCommentParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "评论ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer uid; + + @Schema(description = "订单ID") + @QueryField(type = QueryType.EQ) + private Integer oid; + + @Schema(description = "商品唯一id") + private String unique; + + @Schema(description = "商品id") + @QueryField(type = QueryType.EQ) + private Integer goodsId; + + @Schema(description = "某种商品类型(普通商品、秒杀商品)") + private String replyType; + + @Schema(description = "商品分数") + @QueryField(type = QueryType.EQ) + private Boolean goodsScore; + + @Schema(description = "服务分数") + @QueryField(type = QueryType.EQ) + private Boolean serviceScore; + + @Schema(description = "评论内容") + private String comment; + + @Schema(description = "评论图片") + private String pics; + + @Schema(description = "管理员回复内容") + private String merchantReplyContent; + + @Schema(description = "管理员回复时间") + @QueryField(type = QueryType.EQ) + private Integer merchantReplyTime; + + @Schema(description = "0未删除1已删除") + @QueryField(type = QueryType.EQ) + private Boolean isDel; + + @Schema(description = "0未回复1已回复") + @QueryField(type = QueryType.EQ) + private Boolean isReply; + + @Schema(description = "用户名称") + private String nickname; + + @Schema(description = "用户头像") + private String avatar; + + @Schema(description = "商品规格属性值,多个,号隔开") + private String sku; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopGoodsIncomeConfigParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsIncomeConfigParam.java new file mode 100644 index 0000000..e3989b9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsIncomeConfigParam.java @@ -0,0 +1,57 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 分润配置查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopGoodsIncomeConfigParam对象", description = "分润配置查询参数") +public class ShopGoodsIncomeConfigParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + private Integer id; + + @QueryField(type = QueryType.EQ) + private Integer goodsId; + + @Schema(description = "店铺类型") + private String merchantShopType; + + @QueryField(type = QueryType.EQ) + private Integer skuId; + + @Schema(description = "比例") + @QueryField(type = QueryType.EQ) + private BigDecimal rate; + + @Schema(description = "用户id") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopGoodsLogParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsLogParam.java new file mode 100644 index 0000000..2635a0b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsLogParam.java @@ -0,0 +1,89 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品日志表查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopGoodsLogParam对象", description = "商品日志表查询参数") +public class ShopGoodsLogParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "统计ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "类型visit,cart,order,pay,collect,refund") + private String type; + + @Schema(description = "商品ID") + @QueryField(type = QueryType.EQ) + private Integer goodsId; + + @Schema(description = "是否浏览") + @QueryField(type = QueryType.EQ) + private Boolean visitNum; + + @Schema(description = "加入购物车数量") + @QueryField(type = QueryType.EQ) + private Integer cartNum; + + @Schema(description = "下单数量") + @QueryField(type = QueryType.EQ) + private Integer orderNum; + + @Schema(description = "支付数量") + @QueryField(type = QueryType.EQ) + private Integer payNum; + + @Schema(description = "支付金额") + @QueryField(type = QueryType.EQ) + private BigDecimal payPrice; + + @Schema(description = "商品成本价") + @QueryField(type = QueryType.EQ) + private BigDecimal costPrice; + + @Schema(description = "支付用户ID") + @QueryField(type = QueryType.EQ) + private Integer payUid; + + @Schema(description = "退款数量") + @QueryField(type = QueryType.EQ) + private Integer refundNum; + + @Schema(description = "退款金额") + @QueryField(type = QueryType.EQ) + private BigDecimal refundPrice; + + @Schema(description = "收藏") + @QueryField(type = QueryType.EQ) + private Boolean collectNum; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopGoodsParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsParam.java new file mode 100644 index 0000000..0138743 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsParam.java @@ -0,0 +1,153 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品查询参数 + * + * @author 科技小王子 + * @since 2025-04-24 20:52:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopGoodsParam对象", description = "商品查询参数") +public class ShopGoodsParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer goodsId; + + @Schema(description = "商品名称") + private String name; + + @Schema(description = "产品编码") + private String code; + + @Schema(description = "类型 0软件产品 1实物商品 2虚拟商品") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "封面图") + private String image; + + @Schema(description = "父级分类ID") + @QueryField(type = QueryType.EQ) + private Integer parentId; + + @Schema(description = "产品分类ID") + @QueryField(type = QueryType.EQ) + private Integer categoryId; + + @Schema(description = "路由地址") + private String path; + + @Schema(description = "标签") + private String tag; + + @Schema(description = "产品规格 0单规格 1多规格") + @QueryField(type = QueryType.EQ) + private Integer specs; + + @Schema(description = "货架") + private String position; + + @Schema(description = "单位名称 (个)") + private String unitName; + + @Schema(description = "商品价格") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "进货价格") + @QueryField(type = QueryType.EQ) + private BigDecimal buyingPrice; + + @Schema(description = "经销商价格") + @QueryField(type = QueryType.EQ) + private BigDecimal dealerPrice; + + @Schema(description = "库存计算方式(10下单减库存 20付款减库存)") + @QueryField(type = QueryType.EQ) + private Integer deductStockType; + + @Schema(description = "交付方式(0不启用)") + @QueryField(type = QueryType.EQ) + private Integer deliveryMethod; + + @Schema(description = "购买时长(0不启用,1 一次性,2 按时长)") + @QueryField(type = QueryType.EQ) + private Integer durationMethod; + + @Schema(description = "可购买数量") + @QueryField(type = QueryType.EQ) + private Integer canBuyNumber; + + @Schema(description = "轮播图") + private String files; + + @Schema(description = "销量") + @QueryField(type = QueryType.EQ) + private Integer sales; + + @Schema(description = "库存") + @QueryField(type = QueryType.EQ) + private Integer stock; + + @Schema(description = "安装次数") + @QueryField(type = QueryType.EQ) + private Integer install; + + @Schema(description = "评分") + @QueryField(type = QueryType.EQ) + private BigDecimal rate; + + @Schema(description = "消费赚取积分") + @QueryField(type = QueryType.EQ) + private BigDecimal gainIntegral; + + @Schema(description = "推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "是否官方") + @QueryField(type = QueryType.EQ) + private Integer official; + + @Schema(description = "商户ID") + @QueryField(type = QueryType.EQ) + private Long merchantId; + + @Schema(description = "是否展示") + @QueryField(type = QueryType.EQ) + private Boolean isShow; + + @Schema(description = "状态, 0上架 1待上架 2待审核 3审核不通过") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopGoodsRelationParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsRelationParam.java new file mode 100644 index 0000000..d752169 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsRelationParam.java @@ -0,0 +1,44 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品点赞和收藏表查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopGoodsRelationParam对象", description = "商品点赞和收藏表查询参数") +public class ShopGoodsRelationParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "id") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "商品ID") + @QueryField(type = QueryType.EQ) + private Integer goodsId; + + @Schema(description = "类型(收藏(collect)、点赞(like))") + private String type; + + @Schema(description = "某种类型的商品(普通商品、秒杀商品)") + private String category; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopGoodsRoleCommissionParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsRoleCommissionParam.java new file mode 100644 index 0000000..eef6e45 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsRoleCommissionParam.java @@ -0,0 +1,50 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品绑定角色的分润金额查询参数 + * + * @author 科技小王子 + * @since 2025-05-01 09:53:38 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopGoodsRoleCommissionParam对象", description = "商品绑定角色的分润金额查询参数") +public class ShopGoodsRoleCommissionParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + private Integer id; + + @QueryField(type = QueryType.EQ) + private Integer roleId; + + @QueryField(type = QueryType.EQ) + private Integer goodsId; + + private String sku; + + @QueryField(type = QueryType.EQ) + private BigDecimal amount; + + @Schema(description = "状态, 0正常, 1异常") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "备注") + private String comments; + + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopGoodsSkuParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsSkuParam.java new file mode 100644 index 0000000..cba9b24 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsSkuParam.java @@ -0,0 +1,80 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品sku列表查询参数 + * + * @author 科技小王子 + * @since 2025-05-01 09:43:31 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopGoodsSkuParam对象", description = "商品sku列表查询参数") +public class ShopGoodsSkuParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "商品ID") + @QueryField(type = QueryType.EQ) + private Integer goodsId; + + @Schema(description = "商品属性索引值 (attr_value|attr_value[|....])") + private String sku; + + @Schema(description = "商品图片") + private String image; + + @Schema(description = "商品价格") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "市场价格") + @QueryField(type = QueryType.EQ) + private BigDecimal salePrice; + + @Schema(description = "成本价") + @QueryField(type = QueryType.EQ) + private BigDecimal cost; + + @Schema(description = "库存") + @QueryField(type = QueryType.EQ) + private Integer stock; + + @Schema(description = "sku编码") + private String skuNo; + + @Schema(description = "商品条码") + private String barCode; + + @Schema(description = "重量") + @QueryField(type = QueryType.EQ) + private BigDecimal weight; + + @Schema(description = "体积") + @QueryField(type = QueryType.EQ) + private BigDecimal volume; + + @Schema(description = "唯一值") + private String uuid; + + @Schema(description = "状态, 0正常, 1异常") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "备注") + private String comments; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopGoodsSpecParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsSpecParam.java new file mode 100644 index 0000000..34667e7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopGoodsSpecParam.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品多规格查询参数 + * + * @author 科技小王子 + * @since 2025-05-01 09:43:31 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopGoodsSpecParam对象", description = "商品多规格查询参数") +public class ShopGoodsSpecParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "商品ID") + @QueryField(type = QueryType.EQ) + private Integer goodsId; + + @Schema(description = "规格ID") + @QueryField(type = QueryType.EQ) + private Integer specId; + + @Schema(description = "规格名称") + private String specName; + + @Schema(description = "规格值") + private String specValue; + + @Schema(description = "活动类型 0=商品,1=秒杀,2=砍价,3=拼团") + @QueryField(type = QueryType.EQ) + private Boolean type; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopMerchantAccountParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopMerchantAccountParam.java new file mode 100644 index 0000000..d5a31fe --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopMerchantAccountParam.java @@ -0,0 +1,62 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商户账号查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopMerchantAccountParam对象", description = "商户账号查询参数") +public class ShopMerchantAccountParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "商户手机号") + private String phone; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "商户ID") + @QueryField(type = QueryType.EQ) + private Long merchantId; + + @Schema(description = "角色ID") + @QueryField(type = QueryType.EQ) + private Integer roleId; + + @Schema(description = "角色名称") + private String roleName; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopMerchantApplyParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopMerchantApplyParam.java new file mode 100644 index 0000000..0ad85d5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopMerchantApplyParam.java @@ -0,0 +1,126 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商户入驻申请查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopMerchantApplyParam对象", description = "商户入驻申请查询参数") +public class ShopMerchantApplyParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer applyId; + + @Schema(description = "类型") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "店铺类型") + private String shopType; + + @Schema(description = "商户名称") + private String merchantName; + + @Schema(description = "门店图片") + private String image; + + @Schema(description = "商户手机号") + private String phone; + + @Schema(description = "商户姓名") + private String realName; + + @Schema(description = "商户行业分类ID") + @QueryField(type = QueryType.EQ) + private Integer categoryId; + + @Schema(description = "商户分类") + private String category; + + @Schema(description = "经纬度") + private String lngAndLat; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "详细地址") + private String address; + + @Schema(description = "地区ID") + private String regionId; + + @Schema(description = "手续费") + @QueryField(type = QueryType.EQ) + private BigDecimal commission; + + @Schema(description = "关键字") + private String keywords; + + @Schema(description = "营业执照") + private String yyzz; + + @Schema(description = "身份证") + private String sfz1; + + @Schema(description = "身份证") + private String sfz2; + + @Schema(description = "资质图片") + private String files; + + @Schema(description = "所有人") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "是否自营") + @QueryField(type = QueryType.EQ) + private Integer ownStore; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "是否需要审核") + @QueryField(type = QueryType.EQ) + private Integer goodsReview; + + @Schema(description = "工作负责人") + private String name2; + + @Schema(description = "驳回原因") + private String reason; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopMerchantParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopMerchantParam.java new file mode 100644 index 0000000..1c087b7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopMerchantParam.java @@ -0,0 +1,149 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商户查询参数 + * + * @author 科技小王子 + * @since 2025-08-10 20:43:33 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopMerchantParam对象", description = "商户查询参数") +public class ShopMerchantParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Long merchantId; + + @Schema(description = "商户名称") + private String merchantName; + + @Schema(description = "商户编号") + private String merchantCode; + + @Schema(description = "商户类型") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "商户图标") + private String image; + + @Schema(description = "商户手机号") + private String phone; + + @Schema(description = "商户姓名") + private String realName; + + @Schema(description = "店铺类型") + private String shopType; + + @Schema(description = "项目分类") + private String itemType; + + @Schema(description = "商户分类") + private String category; + + @Schema(description = "商户经营分类") + @QueryField(type = QueryType.EQ) + private Integer merchantCategoryId; + + @Schema(description = "商户分类") + private String merchantCategoryTitle; + + @Schema(description = "经纬度") + private String lngAndLat; + + private String lng; + + private String lat; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "详细地址") + private String address; + + @Schema(description = "手续费") + @QueryField(type = QueryType.EQ) + private BigDecimal commission; + + @Schema(description = "关键字") + private String keywords; + + @Schema(description = "资质图片") + private String files; + + @Schema(description = "营业时间") + private String businessTime; + + @Schema(description = "文章内容") + private String content; + + @Schema(description = "每小时价格") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "是否自营") + @QueryField(type = QueryType.EQ) + private Integer ownStore; + + @Schema(description = "是否可以快递") + @QueryField(type = QueryType.EQ) + private Boolean canExpress; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "是否营业") + @QueryField(type = QueryType.EQ) + private Integer isOn; + + private String startTime; + + private String endTime; + + @Schema(description = "是否需要审核") + @QueryField(type = QueryType.EQ) + private Integer goodsReview; + + @Schema(description = "管理入口") + private String adminUrl; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "所有人") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "状态") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopMerchantTypeParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopMerchantTypeParam.java new file mode 100644 index 0000000..cca6e49 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopMerchantTypeParam.java @@ -0,0 +1,44 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商户类型查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopMerchantTypeParam对象", description = "商户类型查询参数") +public class ShopMerchantTypeParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "店铺类型") + private String name; + + @Schema(description = "店铺入驻条件") + private String comments; + + @Schema(description = "状态") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopOrderDeliveryGoodsParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopOrderDeliveryGoodsParam.java new file mode 100644 index 0000000..48d4657 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopOrderDeliveryGoodsParam.java @@ -0,0 +1,58 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 发货单商品查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopOrderDeliveryGoodsParam对象", description = "发货单商品查询参数") +public class ShopOrderDeliveryGoodsParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "发货单ID") + @QueryField(type = QueryType.EQ) + private Integer deliveryId; + + @Schema(description = "订单ID") + @QueryField(type = QueryType.EQ) + private Integer orderId; + + @Schema(description = "订单商品ID") + @QueryField(type = QueryType.EQ) + private Integer orderGoodsId; + + @Schema(description = "商品ID") + @QueryField(type = QueryType.EQ) + private Integer goodsId; + + @Schema(description = "发货数量") + @QueryField(type = QueryType.EQ) + private Integer deliveryNum; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopOrderDeliveryParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopOrderDeliveryParam.java new file mode 100644 index 0000000..9a3455f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopOrderDeliveryParam.java @@ -0,0 +1,60 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 发货单查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopOrderDeliveryParam对象", description = "发货单查询参数") +public class ShopOrderDeliveryParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "发货单ID") + @QueryField(type = QueryType.EQ) + private Integer deliveryId; + + @Schema(description = "订单ID") + @QueryField(type = QueryType.EQ) + private Integer orderId; + + @Schema(description = "发货方式(10手动录入 20无需物流 30电子面单)") + @QueryField(type = QueryType.EQ) + private Integer deliveryMethod; + + @Schema(description = "打包方式(废弃)") + @QueryField(type = QueryType.EQ) + private Integer packMethod; + + @Schema(description = "物流公司ID") + @QueryField(type = QueryType.EQ) + private Integer expressId; + + @Schema(description = "物流单号") + private String expressNo; + + @Schema(description = "电子面单模板内容") + private String eorderHtml; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopOrderExtractParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopOrderExtractParam.java new file mode 100644 index 0000000..1ba173b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopOrderExtractParam.java @@ -0,0 +1,52 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 自提订单联系方式查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopOrderExtractParam对象", description = "自提订单联系方式查询参数") +public class ShopOrderExtractParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "订单ID") + @QueryField(type = QueryType.EQ) + private Integer orderId; + + @Schema(description = "联系人姓名") + private String linkman; + + @Schema(description = "联系电话") + private String phone; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopOrderGoodsParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopOrderGoodsParam.java new file mode 100644 index 0000000..e309ac1 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopOrderGoodsParam.java @@ -0,0 +1,109 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 商品信息查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopOrderGoodsParam对象", description = "商品信息查询参数") +public class ShopOrderGoodsParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "关联订单表id") + @QueryField(type = QueryType.EQ) + private Integer orderId; + + @Schema(description = "订单标识") + private String orderCode; + + @Schema(description = "关联商户ID") + @QueryField(type = QueryType.EQ) + private Long merchantId; + + @Schema(description = "商户名称") + private String merchantName; + + @Schema(description = "商品封面图") + private String image; + + @Schema(description = "关联商品id") + @QueryField(type = QueryType.EQ) + private Integer goodsId; + + @Schema(description = "商品名称") + private String goodsName; + + @Schema(description = "商品规格") + private String spec; + + @QueryField(type = QueryType.EQ) + private Integer skuId; + + @Schema(description = "单价") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "购买数量") + @QueryField(type = QueryType.EQ) + private Integer totalNum; + + @Schema(description = "0 未付款 1已付款,2无需付款或占用状态") + @QueryField(type = QueryType.EQ) + private Integer payStatus; + + @Schema(description = "0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款") + @QueryField(type = QueryType.EQ) + private Integer orderStatus; + + @Schema(description = "是否免费:0收费、1免费") + @QueryField(type = QueryType.EQ) + private Boolean isFree; + + @Schema(description = "系统版本 0当前版本 其他版本") + @QueryField(type = QueryType.EQ) + private Integer version; + + @Schema(description = "预约时间段") + private String timePeriod; + + @Schema(description = "预定日期") + private String dateTime; + + @Schema(description = "开场时间") + private String startTime; + + @Schema(description = "结束时间") + private String endTime; + + @Schema(description = "毫秒时间戳") + private Long timeFlag; + + @Schema(description = "过期时间") + private String expirationTime; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "用户id") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopOrderInfoLogParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopOrderInfoLogParam.java new file mode 100644 index 0000000..a8f2f44 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopOrderInfoLogParam.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 订单核销查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopOrderInfoLogParam对象", description = "订单核销查询参数") +public class ShopOrderInfoLogParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "关联订单表id") + @QueryField(type = QueryType.EQ) + private Integer orderId; + + @Schema(description = "关联商户ID") + @QueryField(type = QueryType.EQ) + private Long merchantId; + + @Schema(description = "关联场地id") + @QueryField(type = QueryType.EQ) + private Integer fieldId; + + @Schema(description = "核销数量") + @QueryField(type = QueryType.EQ) + private Boolean useNum; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopOrderInfoParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopOrderInfoParam.java new file mode 100644 index 0000000..6b85a03 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopOrderInfoParam.java @@ -0,0 +1,124 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 场地查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopOrderInfoParam对象", description = "场地查询参数") +public class ShopOrderInfoParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "关联订单表id") + @QueryField(type = QueryType.EQ) + private Integer orderId; + + @Schema(description = "组合数据:日期+时间段+场馆id+场地id") + private String orderCode; + + @Schema(description = "关联商户ID") + @QueryField(type = QueryType.EQ) + private Long merchantId; + + @Schema(description = "商户名称") + private String merchantName; + + @Schema(description = "关联场地id") + @QueryField(type = QueryType.EQ) + private Integer fieldId; + + @Schema(description = "场地名称") + private String fieldName; + + @Schema(description = "单价") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "儿童价") + @QueryField(type = QueryType.EQ) + private BigDecimal childrenPrice; + + @Schema(description = "成人人数") + @QueryField(type = QueryType.EQ) + private Integer adultNum; + + @Schema(description = "儿童人数") + @QueryField(type = QueryType.EQ) + private Integer childrenNum; + + @Schema(description = "已核销的成人票数") + @QueryField(type = QueryType.EQ) + private Integer adultNumUse; + + @Schema(description = "已核销的儿童票数") + @QueryField(type = QueryType.EQ) + private Integer childrenNumUse; + + @Schema(description = "0 未付款 1已付款,2无需付款或占用状态") + @QueryField(type = QueryType.EQ) + private Integer payStatus; + + @Schema(description = "0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款") + @QueryField(type = QueryType.EQ) + private Integer orderStatus; + + @Schema(description = "是否免费:0收费、1免费") + @QueryField(type = QueryType.EQ) + private Boolean isFree; + + @Schema(description = "是否支持儿童票:0不支持、1支持") + @QueryField(type = QueryType.EQ) + private Boolean isChildren; + + @Schema(description = "系统版本 0当前版本 其他版本") + @QueryField(type = QueryType.EQ) + private Integer version; + + @Schema(description = "预订类型:0全场,1半场") + @QueryField(type = QueryType.EQ) + private Boolean isHalf; + + @Schema(description = "预约时间段") + private String timePeriod; + + @Schema(description = "预定日期") + private String dateTime; + + @Schema(description = "开场时间") + private String startTime; + + @Schema(description = "结束时间") + private String endTime; + + @Schema(description = "毫秒时间戳") + private Long timeFlag; + + @Schema(description = "过期时间") + private String expirationTime; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "用户id") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopOrderParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopOrderParam.java new file mode 100644 index 0000000..2d61365 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopOrderParam.java @@ -0,0 +1,274 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 订单查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopOrderParam对象", description = "订单查询参数") +public class ShopOrderParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "订单号") + @QueryField(type = QueryType.EQ) + private Integer orderId; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "订单类型,0商城订单 1预定订单/外卖 2会员卡") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "快递/自提") + @QueryField(type = QueryType.EQ) + private Integer deliveryType; + + @Schema(description = "下单渠道,0小程序预定 1俱乐部训练场 3活动订场") + @QueryField(type = QueryType.EQ) + private Integer channel; + + @Schema(description = "微信支付订单号") + private String transactionId; + + @Schema(description = "微信退款订单号") + private String refundOrder; + + @Schema(description = "商户ID") + @QueryField(type = QueryType.EQ) + private Long merchantId; + + @Schema(description = "商户名称") + private String merchantName; + + @Schema(description = "商户编号") + private String merchantCode; + + @Schema(description = "店铺ID") + private Integer storeId; + + @Schema(description = "配送员ID") + private Integer riderId; + + @Schema(description = "仓库ID") + private Integer warehouseId; + + @Schema(description = "使用的优惠券id") + @QueryField(type = QueryType.EQ) + private Integer couponId; + + @Schema(description = "使用的会员卡id") + private String cardId; + + @Schema(description = "关联管理员id") + @QueryField(type = QueryType.EQ) + private Integer adminId; + + @Schema(description = "核销管理员id") + @QueryField(type = QueryType.EQ) + private Integer confirmId; + + @Schema(description = "IC卡号") + private String icCard; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "手机号码") + private String phone; + + @Schema(description = "收货人id") + private Integer addressId; + + @Schema(description = "收货地址") + private String address; + + private String addressLat; + + private String addressLng; + + @Schema(description = "自提店铺id") + @QueryField(type = QueryType.EQ) + private Integer selfTakeMerchantId; + + @Schema(description = "自提店铺") + private String selfTakeMerchantName; + + @Schema(description = "配送开始时间") + private String sendStartTime; + + @Schema(description = "配送结束时间") + private String sendEndTime; + + @Schema(description = "发货店铺id") + @QueryField(type = QueryType.EQ) + private Integer expressMerchantId; + + @Schema(description = "发货店铺") + private String expressMerchantName; + + @Schema(description = "订单总额") + @QueryField(type = QueryType.EQ) + private BigDecimal totalPrice; + + @Schema(description = "减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格") + @QueryField(type = QueryType.EQ) + private BigDecimal reducePrice; + + @Schema(description = "实际付款") + @QueryField(type = QueryType.EQ) + private BigDecimal payPrice; + + @Schema(description = "用于统计") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "价钱,用于积分赠送") + @QueryField(type = QueryType.EQ) + private BigDecimal money; + + @Schema(description = "退款金额") + @QueryField(type = QueryType.EQ) + private BigDecimal refundMoney; + + @Schema(description = "教练价格") + @QueryField(type = QueryType.EQ) + private BigDecimal coachPrice; + + @Schema(description = "购买数量") + @QueryField(type = QueryType.EQ) + private Integer totalNum; + + @Schema(description = "教练id") + @QueryField(type = QueryType.EQ) + private Integer coachId; + + @Schema(description = "支付的用户id") + @QueryField(type = QueryType.EQ) + private Integer payUserId; + + @Schema(description = "支付方式:0余额支付,1微信支付,2支付宝支付,3银联支付,4现金支付,5POS机支付,6免费,7积分支付") + @QueryField(type = QueryType.EQ) + private Integer payType; + + @Schema(description = "代付支付方式:0余额支付,1微信支付,2支付宝支付,3银联支付,4现金支付,5POS机支付,6免费,7积分支付") + @QueryField(type = QueryType.EQ) + private Integer friendPayType; + + @Schema(description = "0未付款,1已付款") + @QueryField(type = QueryType.EQ) + private Boolean payStatus; + + @Schema(description = "0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款") + @QueryField(type = QueryType.EQ) + private Integer orderStatus; + + @Schema(description = "发货状态(10未发货 20已发货 30部分发货)") + @QueryField(type = QueryType.EQ) + private Integer deliveryStatus; + + @Schema(description = "发货备注") + private String deliveryNote; + + @Schema(description = "快递单号") + private String expressNo; + + @Schema(description = "发货时间") + private String deliveryTime; + + @Schema(description = "优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡") + @QueryField(type = QueryType.EQ) + private Integer couponType; + + @Schema(description = "优惠说明") + private String couponDesc; + + @Schema(description = "二维码地址,保存订单号,支付成功后才生成") + private String qrcode; + + @Schema(description = "vip月卡年卡、ic月卡年卡回退次数") + @QueryField(type = QueryType.EQ) + private Integer returnNum; + + @Schema(description = "vip充值回退金额") + @QueryField(type = QueryType.EQ) + private BigDecimal returnMoney; + + @Schema(description = "预约详情开始时间数组") + private String startTime; + + @Schema(description = "是否已开具发票:0未开发票,1已开发票,2不能开具发票") + @QueryField(type = QueryType.EQ) + private Boolean isInvoice; + + @Schema(description = "发票流水号") + private String invoiceNo; + + @Schema(description = "支付时间") + private String payTime; + + @Schema(description = "退款时间") + private String refundTime; + + @Schema(description = "申请退款时间") + private String refundApplyTime; + + @Schema(description = "过期时间") + private String expirationTime; + + @Schema(description = "对账情况:0=未对账;1=已对账;3=已对账,金额对不上;4=未查询到该订单") + @QueryField(type = QueryType.EQ) + private Integer checkBill; + + @Schema(description = "订单是否已结算(0未结算 1已结算)") + @QueryField(type = QueryType.EQ) + private Integer isSettled; + + @Schema(description = "系统版本号 0当前版本 value=其他版本") + @QueryField(type = QueryType.EQ) + private Integer version; + + @Schema(description = "用户id") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "用户昵称") + @QueryField(type = QueryType.LIKE) + private String nickname; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "自提码") + private String selfTakeCode; + + @Schema(description = "是否已收到赠品") + @QueryField(type = QueryType.EQ) + private Boolean hasTakeGift; + + @Schema(description = "订单状态筛选:-1全部,0待支付,1待发货,2待核销,3待收货,4待评价,5已完成,6已退款,7已删除") + private Integer statusFilter; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopRechargeOrderParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopRechargeOrderParam.java new file mode 100644 index 0000000..bbd1c3f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopRechargeOrderParam.java @@ -0,0 +1,105 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 会员充值订单表查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopRechargeOrderParam对象", description = "会员充值订单表查询参数") +public class ShopRechargeOrderParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "订单ID") + @QueryField(type = QueryType.EQ) + private Integer orderId; + + @Schema(description = "订单号") + private String orderNo; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "充值方式(10自定义金额 20套餐充值)") + @QueryField(type = QueryType.EQ) + private Integer rechargeType; + + @Schema(description = "机构id") + @QueryField(type = QueryType.EQ) + private Integer organizationId; + + @Schema(description = "充值套餐ID") + @QueryField(type = QueryType.EQ) + private Integer planId; + + @Schema(description = "用户支付金额") + @QueryField(type = QueryType.EQ) + private BigDecimal payPrice; + + @Schema(description = "赠送金额") + @QueryField(type = QueryType.EQ) + private BigDecimal giftMoney; + + @Schema(description = "实际到账金额") + @QueryField(type = QueryType.EQ) + private BigDecimal actualMoney; + + @Schema(description = "用户可用余额") + @QueryField(type = QueryType.EQ) + private BigDecimal balance; + + @Schema(description = "支付方式(微信/支付宝)") + private String payMethod; + + @Schema(description = "支付状态(10待支付 20已支付)") + @QueryField(type = QueryType.EQ) + private Integer payStatus; + + @Schema(description = "付款时间") + @QueryField(type = QueryType.EQ) + private Integer payTime; + + @Schema(description = "第三方交易记录ID") + @QueryField(type = QueryType.EQ) + private Integer tradeId; + + @Schema(description = "来源客户端 (APP、H5、小程序等)") + private String platform; + + @Schema(description = "所属门店ID") + @QueryField(type = QueryType.EQ) + private Integer shopId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "商户编码") + private String merchantCode; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopSpecParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopSpecParam.java new file mode 100644 index 0000000..c2d5070 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopSpecParam.java @@ -0,0 +1,59 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 规格查询参数 + * + * @author 科技小王子 + * @since 2025-05-01 09:44:00 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopSpecParam对象", description = "规格查询参数") +public class ShopSpecParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "规格ID") + @QueryField(type = QueryType.EQ) + private Integer specId; + + @Schema(description = "规格名称") + private String specName; + + @Schema(description = "规格值") + private String specValue; + + @Schema(description = "商户ID") + @QueryField(type = QueryType.EQ) + private Long merchantId; + + @Schema(description = "创建用户") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "更新者") + @QueryField(type = QueryType.EQ) + private Integer updater; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1待修,2异常已修,3异常未修") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopSpecValueParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopSpecValueParam.java new file mode 100644 index 0000000..f88b7e6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopSpecValueParam.java @@ -0,0 +1,44 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 规格值查询参数 + * + * @author 科技小王子 + * @since 2025-05-01 09:44:00 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopSpecValueParam对象", description = "规格值查询参数") +public class ShopSpecValueParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "规格值ID") + @QueryField(type = QueryType.EQ) + private Integer specValueId; + + @Schema(description = "规格组ID") + @QueryField(type = QueryType.EQ) + private Integer specId; + + @Schema(description = "规格值") + private String specValue; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopSplashParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopSplashParam.java new file mode 100644 index 0000000..be4b6d4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopSplashParam.java @@ -0,0 +1,57 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 开屏广告查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopSplashParam对象", description = "开屏广告查询参数") +public class ShopSplashParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "标题") + private String title; + + @Schema(description = "图片") + private String image; + + @Schema(description = "跳转类型") + private String jumpType; + + @Schema(description = "跳转主键") + @QueryField(type = QueryType.EQ) + private Integer jumpPk; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopStoreParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopStoreParam.java new file mode 100644 index 0000000..83d7708 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopStoreParam.java @@ -0,0 +1,77 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 门店查询参数 + * + * @author 科技小王子 + * @since 2026-01-30 15:00:25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopStoreParam对象", description = "门店查询参数") +public class ShopStoreParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "店铺名称") + private String name; + + @Schema(description = "门店地址") + private String address; + + @Schema(description = "手机号码") + private String phone; + + @Schema(description = "邮箱") + private String email; + + @Schema(description = "门店经理") + private String managerName; + + @Schema(description = "门店banner") + private String shopBanner; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "经度和纬度") + private String lngAndLat; + + @Schema(description = "仓库ID") + private Integer warehouseId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除") + @QueryField(type = QueryType.EQ) + private Integer isDelete; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopStoreRiderParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopStoreRiderParam.java new file mode 100644 index 0000000..4c4df31 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopStoreRiderParam.java @@ -0,0 +1,99 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 配送员查询参数 + * + * @author 科技小王子 + * @since 2026-01-30 15:14:15 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopStoreRiderParam对象", description = "配送员查询参数") +public class ShopStoreRiderParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Long id; + + @Schema(description = "门店ID") + @QueryField(type = QueryType.EQ) + private Integer storeId; + + @Schema(description = "骑手编号(可选)") + private String riderNo; + + @Schema(description = "姓名") + private String realName; + + @Schema(description = "手机号") + private String mobile; + + @Schema(description = "头像") + private String avatar; + + @Schema(description = "身份证号(可选)") + private String idCardNo; + + @Schema(description = "状态:1启用;0禁用") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "接单状态:0休息/下线;1在线;2忙碌") + @QueryField(type = QueryType.EQ) + private Integer workStatus; + + @Schema(description = "是否开启自动派单:1是;0否") + @QueryField(type = QueryType.EQ) + private Integer autoDispatchEnabled; + + @Schema(description = "派单优先级(同小区多骑手时可用,值越大越优先)") + @QueryField(type = QueryType.EQ) + private Integer dispatchPriority; + + @Schema(description = "最大同时配送单数(0表示不限制)") + @QueryField(type = QueryType.EQ) + private Integer maxOnhandOrders; + + @Schema(description = "是否计算工资(提成):1计算;0不计算(如三方配送点可设0)") + @QueryField(type = QueryType.EQ) + private Integer commissionCalcEnabled; + + @Schema(description = "水每桶提成金额(元/桶)") + @QueryField(type = QueryType.EQ) + private BigDecimal waterBucketUnitFee; + + @Schema(description = "其他商品提成方式:1按订单固定金额;2按订单金额比例;3按商品规则(另表)") + @QueryField(type = QueryType.EQ) + private Integer otherGoodsCommissionType; + + @Schema(description = "其他商品提成值:固定金额(元)或比例(%)") + @QueryField(type = QueryType.EQ) + private BigDecimal otherGoodsCommissionValue; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除") + @QueryField(type = QueryType.EQ) + private Integer isDelete; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopStoreUserParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopStoreUserParam.java new file mode 100644 index 0000000..5fd260a --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopStoreUserParam.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 店员查询参数 + * + * @author 科技小王子 + * @since 2026-01-30 15:00:25 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopStoreUserParam对象", description = "店员查询参数") +public class ShopStoreUserParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "门店ID") + @QueryField(type = QueryType.EQ) + private Integer storeId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除") + @QueryField(type = QueryType.EQ) + private Integer isDelete; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopUserAddressParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopUserAddressParam.java new file mode 100644 index 0000000..9120916 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopUserAddressParam.java @@ -0,0 +1,77 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 收货地址查询参数 + * + * @author 科技小王子 + * @since 2025-07-22 23:06:40 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopUserAddressParam对象", description = "收货地址查询参数") +public class ShopUserAddressParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "姓名") + private String name; + + @Schema(description = "手机号码") + private String phone; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "收货地址") + private String address; + + @Schema(description = "收货地址") + private String fullAddress; + + private String lat; + + private String lng; + + @Schema(description = "1先生 2女士") + @QueryField(type = QueryType.EQ) + private Integer gender; + + @Schema(description = "家、公司、学校") + private String type; + + @Schema(description = "默认收货地址") + @QueryField(type = QueryType.EQ) + private Boolean isDefault; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopUserBalanceLogParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopUserBalanceLogParam.java new file mode 100644 index 0000000..d33a9fb --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopUserBalanceLogParam.java @@ -0,0 +1,78 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户余额变动明细表查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopUserBalanceLogParam对象", description = "用户余额变动明细表查询参数") +public class ShopUserBalanceLogParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer logId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "余额变动场景(0下级下单1供应商收入2差价收益 10用户充值 20用户消费 30管理员操作 40订单退款)") + @QueryField(type = QueryType.EQ) + private Integer scene; + + @Schema(description = "变动金额") + @QueryField(type = QueryType.EQ) + private BigDecimal money; + + @Schema(description = "变动后余额") + @QueryField(type = QueryType.EQ) + private BigDecimal balance; + + @Schema(description = "管理员备注") + private String remark; + + @Schema(description = "订单编号") + private String orderNo; + + @Schema(description = "操作人ID") + @QueryField(type = QueryType.EQ) + private Integer adminId; + + @Schema(description = "排序(数字越小越靠前)") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0正常, 1冻结") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + + @Schema(description = "商户ID") + @QueryField(type = QueryType.EQ) + private Long merchantId; + + @Schema(description = "商户编码") + private String merchantCode; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopUserCollectionParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopUserCollectionParam.java new file mode 100644 index 0000000..e2a814b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopUserCollectionParam.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 我的收藏查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopUserCollectionParam对象", description = "我的收藏查询参数") +public class ShopUserCollectionParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "0店铺,1商品") + @QueryField(type = QueryType.EQ) + private Boolean type; + + @Schema(description = "租户ID") + @QueryField(type = QueryType.EQ) + private Integer tid; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopUserCouponParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopUserCouponParam.java new file mode 100644 index 0000000..3051530 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopUserCouponParam.java @@ -0,0 +1,96 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户优惠券查询参数 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopUserCouponParam对象", description = "用户优惠券查询参数") +public class ShopUserCouponParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "id") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "优惠券模板ID") + @QueryField(type = QueryType.EQ) + private Integer couponId; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "优惠券名称") + private String name; + + @Schema(description = "优惠券描述") + private String description; + + @Schema(description = "优惠券类型(10满减券 20折扣券 30免费劵)") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "满减券-减免金额") + @QueryField(type = QueryType.EQ) + private BigDecimal reducePrice; + + @Schema(description = "折扣券-折扣率(0-100)") + @QueryField(type = QueryType.EQ) + private Integer discount; + + @Schema(description = "最低消费金额") + @QueryField(type = QueryType.EQ) + private BigDecimal minPrice; + + @Schema(description = "适用范围(10全部商品 20指定商品 30指定分类)") + @QueryField(type = QueryType.EQ) + private Integer applyRange; + + @Schema(description = "适用范围配置(json格式)") + private String applyRangeConfig; + + @Schema(description = "有效期开始时间") + private String startTime; + + @Schema(description = "有效期结束时间") + private String endTime; + + @Schema(description = "使用状态(0未使用 1已使用 2已过期)") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "使用时间") + private String useTime; + + @Schema(description = "使用订单ID") + private Long orderId; + + @Schema(description = "使用订单号") + private String orderNo; + + @Schema(description = "获取方式(10主动领取 20系统发放 30活动赠送)") + @QueryField(type = QueryType.EQ) + private Integer obtainType; + + @Schema(description = "获取来源描述") + private String obtainSource; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Boolean deleted; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopUserParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopUserParam.java new file mode 100644 index 0000000..bceec72 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopUserParam.java @@ -0,0 +1,275 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户记录表查询参数 + * + * @author 科技小王子 + * @since 2026-02-10 00:37:06 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopUserParam对象", description = "用户记录表查询参数") +public class ShopUserParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "用户id") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "用户类型 0普通用户 1企业用户 2特殊用户") + @QueryField(type = QueryType.EQ) + private Integer type; + + @Schema(description = "账号") + private String username; + + @Schema(description = "密码") + private String password; + + @Schema(description = "昵称") + private String nickname; + + @Schema(description = "手机号") + private String phone; + + @Schema(description = "性别 1男 2女") + @QueryField(type = QueryType.EQ) + private Integer sex; + + @Schema(description = "职务") + private String position; + + @Schema(description = "注册来源客户端 (APP、H5、MP-WEIXIN等)") + private String platform; + + @Schema(description = "邮箱") + private String email; + + @Schema(description = "邮箱是否验证, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer emailVerified; + + @Schema(description = "别名") + private String alias; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "证件号码") + private String idCard; + + @Schema(description = "出生日期") + private String birthday; + + @Schema(description = "所在国家") + private String country; + + @Schema(description = "所在省份") + private String province; + + @Schema(description = "所在城市") + private String city; + + @Schema(description = "所在辖区") + private String region; + + @Schema(description = "街道地址") + private String address; + + @Schema(description = "经度") + private String longitude; + + @Schema(description = "纬度") + private String latitude; + + @Schema(description = "用户可用余额") + @QueryField(type = QueryType.EQ) + private BigDecimal balance; + + @Schema(description = "已提现金额") + @QueryField(type = QueryType.EQ) + private BigDecimal cashedMoney; + + @Schema(description = "用户可用积分") + @QueryField(type = QueryType.EQ) + private Integer points; + + @Schema(description = "用户总支付的金额") + @QueryField(type = QueryType.EQ) + private BigDecimal payMoney; + + @Schema(description = "实际消费的金额(不含退款)") + @QueryField(type = QueryType.EQ) + private BigDecimal expendMoney; + + @Schema(description = "密码") + private String payPassword; + + @Schema(description = "会员等级ID") + @QueryField(type = QueryType.EQ) + private Integer gradeId; + + @Schema(description = "行业分类") + private String category; + + @Schema(description = "个人简介") + private String introduction; + + @Schema(description = "机构id") + @QueryField(type = QueryType.EQ) + private Integer organizationId; + + @Schema(description = "会员分组ID") + @QueryField(type = QueryType.EQ) + private Integer groupId; + + @Schema(description = "头像") + private String avatar; + + @Schema(description = "背景图") + private String bgImage; + + @Schema(description = "用户编码") + private String userCode; + + @Schema(description = "是否已实名认证") + @QueryField(type = QueryType.EQ) + private Integer certification; + + @Schema(description = "年龄") + @QueryField(type = QueryType.EQ) + private Integer age; + + @Schema(description = "是否线下会员") + @QueryField(type = QueryType.EQ) + private Integer offline; + + @Schema(description = "关注数") + @QueryField(type = QueryType.EQ) + private Integer followers; + + @Schema(description = "粉丝数") + @QueryField(type = QueryType.EQ) + private Integer fans; + + @Schema(description = "点赞数") + @QueryField(type = QueryType.EQ) + private Integer likes; + + @Schema(description = "评论数") + @QueryField(type = QueryType.EQ) + private Integer commentNumbers; + + @Schema(description = "是否推荐") + @QueryField(type = QueryType.EQ) + private Integer recommend; + + @Schema(description = "微信openid") + private String openid; + + @Schema(description = "微信公众号openid") + private String officeOpenid; + + @Schema(description = "微信unionID") + private String unionid; + + @Schema(description = "客户端ID") + private String clientId; + + @Schema(description = "不允许办卡") + @QueryField(type = QueryType.EQ) + private Boolean notAllowVip; + + @Schema(description = "是否管理员") + @QueryField(type = QueryType.EQ) + private Boolean isAdmin; + + @Schema(description = "默认账号(适用于不同租户存在相同的手机号码)") + @QueryField(type = QueryType.EQ) + private Boolean isDefault; + + @Schema(description = "是否企业管理员") + @QueryField(type = QueryType.EQ) + private Boolean isOrganizationAdmin; + + @Schema(description = "累计登录次数") + @QueryField(type = QueryType.EQ) + private Integer loginNum; + + @Schema(description = "企业ID") + @QueryField(type = QueryType.EQ) + private Integer companyId; + + @Schema(description = "可管理的场馆") + private String merchants; + + @Schema(description = "商户ID") + @QueryField(type = QueryType.EQ) + private Long merchantId; + + @Schema(description = "商户名称") + private String merchantName; + + @Schema(description = "商户头像") + private String merchantAvatar; + + @Schema(description = "第三方系统的用户ID") + @QueryField(type = QueryType.EQ) + private Integer uid; + + @Schema(description = "专家角色") + @QueryField(type = QueryType.EQ) + private Boolean expertType; + + @Schema(description = "过期时间") + @QueryField(type = QueryType.EQ) + private Integer expireTime; + + @Schema(description = "最后结算时间") + private String settlementTime; + + @Schema(description = "资质") + private String aptitude; + + @Schema(description = "行业类型(父级)") + private String industryParent; + + @Schema(description = "行业类型(子级)") + private String industryChild; + + @Schema(description = "头衔") + private String title; + + @Schema(description = "安装的产品ID") + @QueryField(type = QueryType.EQ) + private Integer templateId; + + @Schema(description = "插件安装状态(仅对超超管判断) 0未安装 1已安装 ") + @QueryField(type = QueryType.EQ) + private Integer installed; + + @Schema(description = "特长") + private String speciality; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "状态, 0在线, 1离线") + @QueryField(type = QueryType.EQ) + private Integer status; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopUserRefereeParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopUserRefereeParam.java new file mode 100644 index 0000000..f0ea733 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopUserRefereeParam.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 用户推荐关系表查询参数 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopUserRefereeParam对象", description = "用户推荐关系表查询参数") +public class ShopUserRefereeParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "主键ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "推荐人ID") + @QueryField(type = QueryType.EQ) + private Integer dealerId; + + @Schema(description = "用户id(被推荐人)") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "推荐关系层级(1,2,3)") + @QueryField(type = QueryType.EQ) + private Integer level; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "是否删除, 0否, 1是") + @QueryField(type = QueryType.EQ) + private Integer deleted; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopWarehouseParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopWarehouseParam.java new file mode 100644 index 0000000..af4d819 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopWarehouseParam.java @@ -0,0 +1,77 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 仓库查询参数 + * + * @author 科技小王子 + * @since 2026-01-30 17:46:47 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopWarehouseParam对象", description = "仓库查询参数") +public class ShopWarehouseParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @Schema(description = "自增ID") + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "仓库名称") + private String name; + + @Schema(description = "唯一标识") + private String code; + + @Schema(description = "类型 中心仓,区域仓,门店仓") + private String type; + + @Schema(description = "仓库地址") + private String address; + + @Schema(description = "真实姓名") + private String realName; + + @Schema(description = "联系电话") + private String phone; + + @Schema(description = "所在省份") + @QueryField(type = QueryType.EQ) + private String province; + + @Schema(description = "所在城市") + @QueryField(type = QueryType.EQ) + private String city; + + @Schema(description = "所在辖区") + @QueryField(type = QueryType.EQ) + private String region; + + @Schema(description = "经纬度") + private String lngAndLat; + + @Schema(description = "用户ID") + @QueryField(type = QueryType.EQ) + private Integer userId; + + @Schema(description = "备注") + private String comments; + + @Schema(description = "排序号") + @QueryField(type = QueryType.EQ) + private Integer sortNumber; + + @Schema(description = "是否删除") + @QueryField(type = QueryType.EQ) + private Integer isDelete; + +} diff --git a/src/main/java/com/gxwebsoft/shop/param/ShopWechatDepositParam.java b/src/main/java/com/gxwebsoft/shop/param/ShopWechatDepositParam.java new file mode 100644 index 0000000..97370b7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/param/ShopWechatDepositParam.java @@ -0,0 +1,66 @@ +package com.gxwebsoft.shop.param; + +import java.math.BigDecimal; +import com.gxwebsoft.common.core.annotation.QueryField; +import com.gxwebsoft.common.core.annotation.QueryType; +import com.gxwebsoft.common.core.web.BaseParam; +import com.fasterxml.jackson.annotation.JsonInclude; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 押金查询参数 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@JsonInclude(JsonInclude.Include.NON_NULL) +@Schema(name = "ShopWechatDepositParam对象", description = "押金查询参数") +public class ShopWechatDepositParam extends BaseParam { + private static final long serialVersionUID = 1L; + + @QueryField(type = QueryType.EQ) + private Integer id; + + @Schema(description = "订单id") + @QueryField(type = QueryType.EQ) + private Integer oid; + + @Schema(description = "用户id") + @QueryField(type = QueryType.EQ) + private Integer uid; + + @Schema(description = "场地订单号") + private String orderNum; + + @Schema(description = "付款订单号") + private String wechatOrder; + + @Schema(description = "退款订单号 ") + private String wechatReturn; + + @Schema(description = "场馆名称") + private String siteName; + + @Schema(description = "微信昵称") + private String username; + + @Schema(description = "手机号码") + private String phone; + + @Schema(description = "物品名称") + private String name; + + @Schema(description = "押金金额") + @QueryField(type = QueryType.EQ) + private BigDecimal price; + + @Schema(description = "押金状态,1已付款,2未付款,已退押金") + @QueryField(type = QueryType.EQ) + private Boolean status; + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/CouponStatusService.java b/src/main/java/com/gxwebsoft/shop/service/CouponStatusService.java new file mode 100644 index 0000000..0bfad4a --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/CouponStatusService.java @@ -0,0 +1,154 @@ +package com.gxwebsoft.shop.service; + +import com.gxwebsoft.shop.entity.ShopUserCoupon; + +import java.util.List; + +/** + * 优惠券状态管理服务 + * + * @author WebSoft + * @since 2025-01-15 + */ +public interface CouponStatusService { + + /** + * 获取用户可用的优惠券列表 + * + * @param userId 用户ID + * @return 可用优惠券列表 + */ + List getAvailableCoupons(Integer userId); + + /** + * 获取用户已使用的优惠券列表 + * + * @param userId 用户ID + * @return 已使用优惠券列表 + */ + List getUsedCoupons(Integer userId); + + /** + * 获取用户已过期的优惠券列表 + * + * @param userId 用户ID + * @return 已过期优惠券列表 + */ + List getExpiredCoupons(Integer userId); + + /** + * 获取用户所有优惠券并按状态分类 + * + * @param userId 用户ID + * @return 分类后的优惠券列表 + */ + CouponStatusResult getUserCouponsGroupByStatus(Integer userId); + + /** + * 使用优惠券 + * + * @param userCouponId 用户优惠券ID + * @param orderId 订单ID + * @param orderNo 订单号 + * @return 是否成功 + */ + boolean useCoupon(Long userCouponId, Integer orderId, String orderNo); + + /** + * 退还优惠券(订单取消时) + * + * @param orderId 订单ID + * @return 是否成功 + */ + boolean returnCoupon(Integer orderId); + + /** + * 批量更新过期优惠券状态 + * + * @return 更新的数量 + */ + int updateExpiredCoupons(); + + /** + * 检查并更新单个优惠券状态 + * + * @param userCoupon 用户优惠券 + * @return 是否状态发生变化 + */ + boolean checkAndUpdateCouponStatus(ShopUserCoupon userCoupon); + + /** + * 验证优惠券是否可用于指定订单 + * + * @param userCouponId 用户优惠券ID + * @param totalAmount 订单总金额 + * @param goodsIds 商品ID列表 + * @return 验证结果 + */ + CouponValidationResult validateCouponForOrder(Long userCouponId, + java.math.BigDecimal totalAmount, + List goodsIds); + + /** + * 优惠券状态分类结果 + */ + class CouponStatusResult { + private List availableCoupons; // 可用优惠券 + private List usedCoupons; // 已使用优惠券 + private List expiredCoupons; // 已过期优惠券 + private int totalCount; // 总数量 + + // 构造函数 + public CouponStatusResult(List availableCoupons, + List usedCoupons, + List expiredCoupons) { + this.availableCoupons = availableCoupons; + this.usedCoupons = usedCoupons; + this.expiredCoupons = expiredCoupons; + this.totalCount = availableCoupons.size() + usedCoupons.size() + expiredCoupons.size(); + } + + // Getters and Setters + public List getAvailableCoupons() { return availableCoupons; } + public void setAvailableCoupons(List availableCoupons) { this.availableCoupons = availableCoupons; } + + public List getUsedCoupons() { return usedCoupons; } + public void setUsedCoupons(List usedCoupons) { this.usedCoupons = usedCoupons; } + + public List getExpiredCoupons() { return expiredCoupons; } + public void setExpiredCoupons(List expiredCoupons) { this.expiredCoupons = expiredCoupons; } + + public int getTotalCount() { return totalCount; } + public void setTotalCount(int totalCount) { this.totalCount = totalCount; } + } + + /** + * 优惠券验证结果 + */ + class CouponValidationResult { + private boolean valid; // 是否有效 + private String message; // 验证消息 + private java.math.BigDecimal discountAmount; // 优惠金额 + + public CouponValidationResult(boolean valid, String message) { + this.valid = valid; + this.message = message; + } + + public CouponValidationResult(boolean valid, String message, java.math.BigDecimal discountAmount) { + this.valid = valid; + this.message = message; + this.discountAmount = discountAmount; + } + + // Getters and Setters + public boolean isValid() { return valid; } + public void setValid(boolean valid) { this.valid = valid; } + + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } + + public java.math.BigDecimal getDiscountAmount() { return discountAmount; } + public void setDiscountAmount(java.math.BigDecimal discountAmount) { this.discountAmount = discountAmount; } + } +} diff --git a/src/main/java/com/gxwebsoft/shop/service/KuaiDi100.java b/src/main/java/com/gxwebsoft/shop/service/KuaiDi100.java new file mode 100644 index 0000000..6905f53 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/KuaiDi100.java @@ -0,0 +1,16 @@ +package com.gxwebsoft.shop.service; + +import com.kuaidi100.sdk.pojo.HttpResult; +import com.kuaidi100.sdk.request.BOrderReq; + +public interface KuaiDi100 { + /** + * 商家寄件 + * @param bOrderReq + * @return + * @throws Exception + */ + HttpResult border(BOrderReq bOrderReq) throws Exception; + + String pollList(String com, String num, String phone) throws Exception; +} diff --git a/src/main/java/com/gxwebsoft/shop/service/OrderBusinessService.java b/src/main/java/com/gxwebsoft/shop/service/OrderBusinessService.java new file mode 100644 index 0000000..81f772f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/OrderBusinessService.java @@ -0,0 +1,696 @@ +package com.gxwebsoft.shop.service; + +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; +import com.gxwebsoft.common.core.exception.BusinessException; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.shop.config.OrderConfigProperties; +import com.gxwebsoft.shop.dto.OrderCreateRequest; +import com.gxwebsoft.shop.entity.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * 订单业务服务类 + * 处理订单创建的核心业务逻辑 + * + * @author 科技小王子 + * @since 2025-01-26 + */ +@Slf4j +@Service +public class OrderBusinessService { + + @Resource + private ShopOrderService shopOrderService; + + @Resource + private ShopOrderGoodsService shopOrderGoodsService; + + @Resource + private ShopGoodsService shopGoodsService; + + @Resource + private ShopGoodsSkuService shopGoodsSkuService; + + @Resource + private OrderConfigProperties orderConfig; + + @Resource + private ShopUserAddressService shopUserAddressService; + @Resource + private ShopUserCouponService shopUserCouponService; + + /** + * 创建订单 + * + * @param request 订单创建请求 + * @param loginUser 当前登录用户 + * @return 微信支付订单信息 + */ + @Transactional(rollbackFor = Exception.class) + public Map createOrder(OrderCreateRequest request, User loginUser) { + + // 1. 参数校验 + validateOrderRequest(request, loginUser); + + // 2. 构建订单对象 + ShopOrder shopOrder = buildShopOrder(request, loginUser); + + // 3. 处理收货地址信息 + processDeliveryAddress(shopOrder, request, loginUser); + + // 4. 应用业务规则 + applyBusinessRules(shopOrder, loginUser); + + // 如果商品仅有一个则更新formId + if (request.getGoodsItems().size() == 1) { + shopOrder.setFormId(request.getGoodsItems().get(0).getGoodsId()); + } + + // 5. 保存订单 + boolean saved = shopOrderService.save(shopOrder); + if (!saved) { + throw new BusinessException("订单保存失败"); + } + + // 6. 保存订单商品 + saveOrderGoods(request, shopOrder); + + // 7. 标记优惠券为已使用 + if (shopOrder.getCouponId() != null && shopOrder.getCouponId() > 0) { + markCouponAsUsed(shopOrder.getCouponId(), shopOrder.getOrderId()); + } + + // 8. 创建微信支付订单 + try { + return shopOrderService.createWxOrder(shopOrder); + } catch (Exception e) { + log.error("创建微信支付订单失败,订单号:{}", shopOrder.getOrderNo(), e); + throw new BusinessException("创建支付订单失败:" + e.getMessage()); + } + } + + /** + * 校验订单请求参数 + */ + private void validateOrderRequest(OrderCreateRequest request, User loginUser) { + if (loginUser == null) { + throw new BusinessException("用户未登录"); + } + + // 检查是否为测试账号 + boolean isTestAccount = orderConfig.isTestAccount(loginUser.getPhone()); + + if (isTestAccount) { + // 测试账号:直接使用测试金额,跳过金额验证 + BigDecimal testAmount = orderConfig.getTestAccount().getTestPayAmount(); + request.setTotalPrice(testAmount); + log.info("测试账号订单,用户:{},使用测试金额:{}", loginUser.getPhone(), testAmount); + return; // 测试账号跳过后续验证 + } + + // 非测试账号:正常验证流程 + // 验证商品信息并计算总金额 + BigDecimal calculatedTotal = validateAndCalculateTotal(request); + + if (calculatedTotal.compareTo(BigDecimal.ZERO) <= 0) { + throw new BusinessException("商品金额不能为0"); + } + + // 检查前端传入的总金额是否正确(允许小的误差,比如0.01) + if (request.getTotalPrice() != null && + request.getTotalPrice().subtract(calculatedTotal).abs().compareTo(new BigDecimal("0.01")) > 0) { + log.warn("订单金额计算不一致,前端传入:{},后台计算:{}", request.getTotalPrice(), calculatedTotal); +// throw new BusinessException("订单金额计算错误,请刷新重试"); + } + + // 使用后台计算的金额 + request.setTotalPrice(calculatedTotal); + + // 检查租户特殊规则 + OrderConfigProperties.TenantRule tenantRule = orderConfig.getTenantRule(request.getTenantId()); + if (tenantRule != null && tenantRule.getMinAmount() != null) { + if (calculatedTotal.compareTo(tenantRule.getMinAmount()) < 0) { + throw new BusinessException(tenantRule.getMinAmountMessage()); + } + } + } + + /** + * 验证商品信息并计算总金额 + */ + private BigDecimal validateAndCalculateTotal(OrderCreateRequest request) { + if (CollectionUtils.isEmpty(request.getGoodsItems())) { + throw new BusinessException("订单商品列表不能为空"); + } + + BigDecimal total = BigDecimal.ZERO; + + for (OrderCreateRequest.OrderGoodsItem item : request.getGoodsItems()) { + // 验证商品ID + if (item.getGoodsId() == null) { + throw new BusinessException("商品ID不能为空"); + } + + // 验证购买数量 + if (item.getQuantity() == null || item.getQuantity() <= 0) { + throw new BusinessException("商品购买数量必须大于0"); + } + + // 获取商品信息 + ShopGoods goods = shopGoodsService.getById(item.getGoodsId()); + if (goods == null) { + throw new BusinessException("商品不存在,商品ID:" + item.getGoodsId()); + } + + // 验证商品状态 + if (goods.getStatus() == null || goods.getStatus() != 0) { + throw new BusinessException("商品已下架:" + goods.getName()); + } + + // 处理多规格商品价格和库存验证 + BigDecimal actualPrice = goods.getPrice(); // 默认使用商品价格 + Integer actualStock = goods.getStock(); // 默认使用商品库存 + String productName = goods.getName(); + + if (item.getSkuId() != null) { + // 多规格商品,获取SKU信息 + ShopGoodsSku sku = shopGoodsSkuService.getById(item.getSkuId()); + if (sku == null) { + throw new BusinessException("商品规格不存在,SKU ID:" + item.getSkuId()); + } + + // 验证SKU是否属于该商品 + if (!sku.getGoodsId().equals(item.getGoodsId())) { + throw new BusinessException("商品规格不匹配"); + } + + // 验证SKU状态 + if (sku.getStatus() == null || sku.getStatus() != 0) { + throw new BusinessException("商品规格已下架"); + } + + // 使用SKU的价格和库存 + actualPrice = sku.getPrice(); + actualStock = sku.getStock(); + productName = goods.getName() + "(" + (item.getSpecInfo() != null ? item.getSpecInfo() : sku.getSku()) + ")"; + } + + // 验证实际价格 + if (actualPrice == null || actualPrice.compareTo(BigDecimal.ZERO) <= 0) { + throw new BusinessException("商品价格异常:" + productName); + } + + // 验证库存 + if (actualStock != null && actualStock < item.getQuantity()) { + throw new BusinessException("商品库存不足:" + productName + ",当前库存:" + actualStock); + } + + // 验证购买数量限制(使用商品级别的限制) + if (goods.getCanBuyNumber() != null && goods.getCanBuyNumber() > 0 && + item.getQuantity() > goods.getCanBuyNumber()) { + throw new BusinessException("商品购买数量超过限制:" + productName + ",最大购买数量:" + goods.getCanBuyNumber()); + } + + // 计算商品小计(使用实际价格) + BigDecimal itemTotal = actualPrice.multiply(new BigDecimal(item.getQuantity())); + total = total.add(itemTotal); + + log.debug("商品验证通过 - ID:{},SKU ID:{},名称:{},单价:{},数量:{},小计:{}", + goods.getGoodsId(), item.getSkuId(), productName, actualPrice, item.getQuantity(), itemTotal); + } + + log.info("订单商品验证完成,总金额:{}", total); + return total; + } + + /** + * 构建订单对象 + */ + private ShopOrder buildShopOrder(OrderCreateRequest request, User loginUser) { + ShopOrder shopOrder = new ShopOrder(); + + // 复制请求参数到订单对象 + BeanUtils.copyProperties(request, shopOrder); + + // 确保租户ID正确设置(关键字段,影响微信支付证书路径) + shopOrder.setTenantId(loginUser.getTenantId()); + + // 验证关键字段 + if (shopOrder.getTenantId() == null) { + throw new BusinessException("租户ID不能为空,这会导致微信支付证书路径错误"); + } + + // 设置用户相关信息 + shopOrder.setUserId(loginUser.getUserId()); + shopOrder.setOpenid(loginUser.getOpenid()); + shopOrder.setPayUserId(loginUser.getUserId()); + + log.debug("构建订单对象 - 租户ID:{},用户ID:{}", shopOrder.getTenantId(), shopOrder.getUserId()); + + // 生成订单号(如果请求中没有提供) + if (shopOrder.getOrderNo() == null || shopOrder.getOrderNo().trim().isEmpty()) { + String generatedOrderNo = Long.toString(IdUtil.getSnowflakeNextId()); + shopOrder.setOrderNo(generatedOrderNo); + log.info("生成新订单号: {}", generatedOrderNo); + } else { + log.info("使用请求中的订单号: {}", shopOrder.getOrderNo()); + } + + // 设置默认备注 + if (shopOrder.getComments() == null) { + shopOrder.setComments(orderConfig.getDefaultConfig().getDefaultComments()); + } + + // 设置价格相关字段(解决数据库字段没有默认值的问题) + if (shopOrder.getPayPrice() == null) { + shopOrder.setPayPrice(shopOrder.getTotalPrice()); // 实际付款默认等于订单总额 + } + + if (shopOrder.getPrice() == null) { + shopOrder.setPrice(shopOrder.getTotalPrice()); // 用于统计的价格默认等于订单总额 + } + + if (shopOrder.getReducePrice() == null) { + shopOrder.setReducePrice(BigDecimal.ZERO); // 减少金额默认为0 + } + + if (shopOrder.getMoney() == null) { + shopOrder.setMoney(shopOrder.getTotalPrice()); // 用于积分赠送的价格默认等于订单总额 + } + + // 设置默认状态 + shopOrder.setPayStatus(false); // 未付款 + shopOrder.setOrderStatus(0); // 未使用 + shopOrder.setDeliveryStatus(10); // 未发货 + shopOrder.setIsInvoice(0); // 未开发票 + shopOrder.setIsSettled(0); // 未结算 + shopOrder.setCheckBill(0); // 未对账 + shopOrder.setVersion(0); // 当前版本 + + // 设置默认支付类型(如果没有指定) + if (shopOrder.getPayType() == null) { + shopOrder.setPayType(1); // 默认微信支付 + } + + // 优惠券处理 + if (shopOrder.getCouponId() != null && shopOrder.getCouponId() > 0) { + processCoupon(shopOrder, loginUser); + } + + return shopOrder; + } + + /** + * 处理优惠券 + */ + private void processCoupon(ShopOrder shopOrder, User loginUser) { + ShopUserCoupon coupon = shopUserCouponService.getById(shopOrder.getCouponId()); + if (coupon == null) { + throw new BusinessException("优惠券不存在"); + } + + // 验证优惠券是否属于当前用户 + if (!coupon.getUserId().equals(loginUser.getUserId())) { + throw new BusinessException("优惠券不属于当前用户"); + } + + // 验证优惠券是否已使用 + if (coupon.getIsUse() != null && coupon.getIsUse().equals(1)) { + throw new BusinessException("优惠券已使用"); + } + + // 验证优惠券是否过期 + if (coupon.getIsExpire() != null && coupon.getIsExpire().equals(1)) { + throw new BusinessException("优惠券已过期"); + } + + // 计算优惠金额 + BigDecimal reducePrice = BigDecimal.ZERO; + boolean canUse = true; + + if (coupon.getType().equals(10)) { + // 满减券 + reducePrice = coupon.getReducePrice() != null ? coupon.getReducePrice() : BigDecimal.ZERO; + BigDecimal minPrice = coupon.getMinPrice() != null ? coupon.getMinPrice() : BigDecimal.ZERO; + if (shopOrder.getTotalPrice().compareTo(minPrice) < 0) { + canUse = false; + throw new BusinessException("订单金额不满足优惠券使用条件,最低消费:" + minPrice + "元"); + } + } else if (coupon.getType().equals(20)) { + // 折扣券 - 计算减免金额(不是折扣后金额) + Integer discount = coupon.getDiscount() != null ? coupon.getDiscount() : 100; + if (discount < 0 || discount > 100) { + throw new BusinessException("优惠券折扣率异常"); + } + // 减免金额 = 原价 * (100 - 折扣率) / 100 + reducePrice = shopOrder.getTotalPrice() + .multiply(new BigDecimal(100 - discount)) + .divide(new BigDecimal(100), 2, RoundingMode.HALF_UP); + } else if (coupon.getType().equals(30)) { + // 免费券 + reducePrice = shopOrder.getTotalPrice(); + } else { + throw new BusinessException("不支持的优惠券类型"); + } + + if (canUse && reducePrice.compareTo(BigDecimal.ZERO) > 0) { + // 确保减免金额不超过订单总额 + if (reducePrice.compareTo(shopOrder.getTotalPrice()) > 0) { + reducePrice = shopOrder.getTotalPrice(); + } + + // 应用优惠 + shopOrder.setReducePrice(shopOrder.getReducePrice().add(reducePrice)); + shopOrder.setPayPrice(shopOrder.getPayPrice().subtract(reducePrice)); + + // 确保实付金额不为负数 + if (shopOrder.getPayPrice().compareTo(BigDecimal.ZERO) < 0) { + shopOrder.setPayPrice(BigDecimal.ZERO); + } + + log.info("应用优惠券成功 - 优惠券ID:{},类型:{},减免金额:{},实付金额:{}", + coupon.getId(), coupon.getType(), reducePrice, shopOrder.getPayPrice()); + } + } + + /** + * 处理收货地址信息 + * 优先级:前端传入地址 > 指定地址ID > 用户默认地址 + */ + private void processDeliveryAddress(ShopOrder shopOrder, OrderCreateRequest request, User loginUser) { + try { + // 1. 如果前端已经传入了完整的收货地址信息,直接使用 + if (isAddressInfoComplete(request)) { + log.info("使用前端传入的收货地址信息,用户ID:{}", loginUser.getUserId()); + return; + } + + // 2. 如果指定了地址ID,获取该地址信息 + if (request.getAddressId() != null) { + ShopUserAddress userAddress = shopUserAddressService.getById(request.getAddressId()); + if (userAddress != null && userAddress.getUserId().equals(loginUser.getUserId())) { + copyAddressToOrder(userAddress, shopOrder, request); + log.info("使用指定地址ID:{},用户ID:{}", request.getAddressId(), loginUser.getUserId()); + return; + } + log.warn("指定的地址ID不存在或不属于当前用户,地址ID:{},用户ID:{}", + request.getAddressId(), loginUser.getUserId()); + } + + // 3. 获取用户默认收货地址 + ShopUserAddress defaultAddress = shopUserAddressService.getDefaultAddress(loginUser.getUserId()); + if (defaultAddress != null) { + copyAddressToOrder(defaultAddress, shopOrder, request); + log.info("使用用户默认收货地址,地址ID:{},用户ID:{}", defaultAddress.getId(), loginUser.getUserId()); + return; + } + + // 4. 如果没有默认地址,获取用户的第一个地址 + List userAddresses = shopUserAddressService.getUserAddresses(loginUser.getUserId()); + if (!userAddresses.isEmpty()) { + ShopUserAddress firstAddress = userAddresses.get(0); + copyAddressToOrder(firstAddress, shopOrder, request); + log.info("使用用户第一个收货地址,地址ID:{},用户ID:{}", firstAddress.getId(), loginUser.getUserId()); + return; + } + // 5. 如果用户没有任何收货地址,抛出异常 + throw new BusinessException("请先添加收货地址"); + + } catch (BusinessException e) { + throw e; + } catch (Exception e) { + log.error("处理收货地址信息失败,用户ID:{}", loginUser.getUserId(), e); + throw new BusinessException("处理收货地址信息失败:" + e.getMessage()); + } + } + + /** + * 检查前端传入的地址信息是否完整 + */ + private boolean isAddressInfoComplete(OrderCreateRequest request) { + return request.getAddress() != null && !request.getAddress().trim().isEmpty() && + request.getRealName() != null && !request.getRealName().trim().isEmpty(); + } + + /** + * 将用户地址信息复制到订单中(创建快照) + */ + private void copyAddressToOrder(ShopUserAddress userAddress, ShopOrder shopOrder, OrderCreateRequest request) { + // 保存地址ID引用关系 + shopOrder.setAddressId(userAddress.getId()); + request.setAddressId(userAddress.getId()); + + // 创建地址信息快照 + if (request.getAddress() == null || request.getAddress().trim().isEmpty()) { + // 构建完整地址 + StringBuilder fullAddress = new StringBuilder(); + if (userAddress.getProvince() != null) fullAddress.append(userAddress.getProvince()); + if (userAddress.getCity() != null) fullAddress.append(userAddress.getCity()); + if (userAddress.getRegion() != null) fullAddress.append(userAddress.getRegion()); + if (userAddress.getAddress() != null) fullAddress.append(userAddress.getAddress()); + + shopOrder.setAddress(fullAddress.toString()); + request.setAddress(fullAddress.toString()); + } + + // 复制收货人信息 + if (request.getRealName() == null || request.getRealName().trim().isEmpty()) { + shopOrder.setRealName(userAddress.getName()); + request.setRealName(userAddress.getName()); + } + + // 复制经纬度信息 + if (request.getAddressLat() == null && userAddress.getLat() != null) { + shopOrder.setAddressLat(userAddress.getLat()); + request.setAddressLat(userAddress.getLat()); + } + if (request.getAddressLng() == null && userAddress.getLng() != null) { + shopOrder.setAddressLng(userAddress.getLng()); + request.setAddressLng(userAddress.getLng()); + } + + log.debug("地址信息快照创建完成 - 地址ID:{},收货人:{},地址:{}", + userAddress.getId(), userAddress.getName(), shopOrder.getAddress()); + } + + /** + * 应用业务规则 + */ + private void applyBusinessRules(ShopOrder shopOrder, User loginUser) { + // 测试账号处理 + if (orderConfig.isTestAccount(loginUser.getPhone())) { + BigDecimal testAmount = orderConfig.getTestAccount().getTestPayAmount(); + shopOrder.setPrice(testAmount); + shopOrder.setTotalPrice(testAmount); + shopOrder.setPayPrice(testAmount); // 确保实际付款也设置为测试金额 + shopOrder.setMoney(testAmount); // 确保积分计算金额也设置为测试金额 + log.info("应用测试账号规则,用户:{},测试金额:{}", loginUser.getPhone(), testAmount); + } + + // 其他业务规则可以在这里添加 + // 例如:VIP折扣、优惠券处理等 + } + + /** + * 校验订单金额 + */ + public void validateOrderAmount(BigDecimal amount, Integer tenantId) { + if (amount == null || amount.compareTo(BigDecimal.ZERO) <= 0) { + throw new BusinessException("订单金额必须大于0"); + } + + OrderConfigProperties.TenantRule tenantRule = orderConfig.getTenantRule(tenantId); + if (tenantRule != null && tenantRule.getMinAmount() != null) { + if (amount.compareTo(tenantRule.getMinAmount()) < 0) { + throw new BusinessException(tenantRule.getMinAmountMessage()); + } + } + } + + /** + * 保存订单商品 + */ + private void saveOrderGoods(OrderCreateRequest request, ShopOrder shopOrder) { + if (CollectionUtils.isEmpty(request.getGoodsItems())) { + log.warn("订单商品列表为空,订单号:{}", shopOrder.getOrderNo()); + return; + } + + List orderGoodsList = new ArrayList<>(); + for (OrderCreateRequest.OrderGoodsItem item : request.getGoodsItems()) { + // 重新获取商品信息(确保数据一致性) + ShopGoods goods = shopGoodsService.getById(item.getGoodsId()); + if (goods == null) { + throw new BusinessException("商品不存在,商品ID:" + item.getGoodsId()); + } + + // 再次验证商品状态(防止并发问题) + if (goods.getStatus() == null || goods.getStatus() != 0) { + throw new BusinessException("商品已下架:" + goods.getName()); + } + + // 处理多规格商品 + ShopGoodsSku sku = null; + BigDecimal actualPrice = goods.getPrice(); // 默认使用商品价格 + Integer actualStock = goods.getStock(); // 默认使用商品库存 + String specInfo = item.getSpecInfo(); // 规格信息 + + if (item.getSkuId() != null) { + // 多规格商品,获取SKU信息 + sku = shopGoodsSkuService.getById(item.getSkuId()); + if (sku == null) { + throw new BusinessException("商品规格不存在,SKU ID:" + item.getSkuId()); + } + + // 验证SKU是否属于该商品 + if (!sku.getGoodsId().equals(item.getGoodsId())) { + throw new BusinessException("商品规格不匹配"); + } + + // 验证SKU状态 + if (sku.getStatus() == null || sku.getStatus() != 0) { + throw new BusinessException("商品规格已下架"); + } + + // 使用SKU的价格和库存 + actualPrice = sku.getPrice(); + actualStock = sku.getStock(); + + // 如果前端没有传规格信息,使用SKU的规格信息 + if (specInfo == null || specInfo.trim().isEmpty()) { + specInfo = sku.getSku(); // 使用SKU的规格描述 + } + } + + // 验证库存 + if (actualStock == null || actualStock < item.getQuantity()) { + String stockMsg = sku != null ? "商品规格库存不足" : "商品库存不足"; + throw new BusinessException(stockMsg + ",当前库存:" + (actualStock != null ? actualStock : 0)); + } + + ShopOrderGoods orderGoods = new ShopOrderGoods(); + + // 设置订单关联信息 + orderGoods.setOrderId(shopOrder.getOrderId()); + orderGoods.setOrderCode(shopOrder.getOrderNo()); + + // 设置商户信息 + orderGoods.setMerchantId(shopOrder.getMerchantId()); + orderGoods.setMerchantName(shopOrder.getMerchantName()); + + // 设置商品信息(使用后台查询的真实数据) + orderGoods.setGoodsId(item.getGoodsId()); + orderGoods.setSkuId(item.getSkuId()); // 设置SKU ID + orderGoods.setGoodsName(goods.getName()); + orderGoods.setImage(sku != null && sku.getImage() != null ? sku.getImage() : goods.getImage()); // 优先使用SKU图片 + orderGoods.setPrice(actualPrice); // 使用实际价格(SKU价格或商品价格) + orderGoods.setTotalNum(item.getQuantity()); + + // 计算商品小计(用于日志记录) + BigDecimal itemTotal = actualPrice.multiply(new BigDecimal(item.getQuantity())); + + // 设置商品规格信息 + orderGoods.setSpec(specInfo); + + // 设置支付相关信息 + orderGoods.setPayStatus(0); // 0 未付款 + orderGoods.setOrderStatus(0); // 0 未使用 + orderGoods.setIsFree(false); // 默认收费 + orderGoods.setVersion(0); // 当前版本 + + // 设置其他信息 + orderGoods.setComments(request.getComments()); + orderGoods.setUserId(shopOrder.getUserId()); + orderGoods.setTenantId(shopOrder.getTenantId()); + + orderGoodsList.add(orderGoods); + + log.debug("准备保存订单商品 - 商品ID:{},名称:{},单价:{},数量:{},小计:{}", + goods.getGoodsId(), goods.getName(), goods.getPrice(), item.getQuantity(), itemTotal); + } + + // 批量保存订单商品 + boolean saved = shopOrderGoodsService.saveBatch(orderGoodsList); + if (!saved) { + throw new BusinessException("保存订单商品失败"); + } + + // 扣减库存 + deductStock(request); + + log.info("成功保存订单商品,订单号:{},商品数量:{}", shopOrder.getOrderNo(), orderGoodsList.size()); + } + + /** + * 扣减库存 + */ + private void deductStock(OrderCreateRequest request) { + for (OrderCreateRequest.OrderGoodsItem item : request.getGoodsItems()) { + if (item.getSkuId() != null) { + // 多规格商品,扣减SKU库存 + ShopGoodsSku sku = shopGoodsSkuService.getById(item.getSkuId()); + if (sku != null && sku.getStock() != null) { + int newStock = sku.getStock() - item.getQuantity(); + if (newStock < 0) { + throw new BusinessException("SKU库存不足,无法完成扣减"); + } + sku.setStock(newStock); + shopGoodsSkuService.updateById(sku); + log.debug("扣减SKU库存 - SKU ID:{},扣减数量:{},剩余库存:{}", + item.getSkuId(), item.getQuantity(), newStock); + } + } else { + // 单规格商品,扣减商品库存 + ShopGoods goods = shopGoodsService.getById(item.getGoodsId()); + if (goods != null && goods.getStock() != null) { + int newStock = goods.getStock() - item.getQuantity(); + if (newStock < 0) { + throw new BusinessException("商品库存不足,无法完成扣减"); + } + goods.setStock(newStock); + shopGoodsService.updateById(goods); + log.debug("扣减商品库存 - 商品ID:{},扣减数量:{},剩余库存:{}", + item.getGoodsId(), item.getQuantity(), newStock); + } + } + } + log.info("库存扣减完成"); + } + + /** + * 标记优惠券为已使用 + */ + private void markCouponAsUsed(Integer couponId, Integer orderId) { + try { + ShopUserCoupon coupon = shopUserCouponService.getById(couponId); + if (coupon != null) { + // 使用实体类提供的方法标记为已使用 + coupon.markAsUsed(orderId, null); // orderNo 在这里可以为null,因为已经有orderId了 + shopUserCouponService.updateById(coupon); + log.info("优惠券标记为已使用 - 优惠券ID:{},订单ID:{}", couponId, orderId); + } + } catch (Exception e) { + log.error("标记优惠券为已使用失败 - 优惠券ID:{},订单ID:{}", couponId, orderId, e); + // 不抛出异常,避免影响订单创建流程 + } + } + + /** + * 检查是否为测试账号11 + */ + public boolean isTestAccount(String phone) { + return orderConfig.isTestAccount(phone); + } +} diff --git a/src/main/java/com/gxwebsoft/shop/service/OrderCancelService.java b/src/main/java/com/gxwebsoft/shop/service/OrderCancelService.java new file mode 100644 index 0000000..da40112 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/OrderCancelService.java @@ -0,0 +1,65 @@ +package com.gxwebsoft.shop.service; + +import com.gxwebsoft.shop.entity.ShopOrder; + +import java.util.List; + +/** + * 订单取消服务接口 + * + * @author WebSoft + * @since 2025-01-26 + */ +public interface OrderCancelService { + + /** + * 取消单个订单 + * + * @param order 订单对象 + * @return 是否取消成功 + */ + boolean cancelOrder(ShopOrder order); + + /** + * 批量取消订单 + * + * @param orders 订单列表 + * @return 成功取消的订单数量 + */ + int batchCancelOrders(List orders); + + /** + * 查找超时的待付款订单 + * + * @param timeoutMinutes 超时时间(分钟) + * @param batchSize 批量大小 + * @return 超时订单列表 + */ + List findExpiredUnpaidOrders(Integer timeoutMinutes, Integer batchSize); + + /** + * 查找指定租户的超时订单 + * + * @param tenantId 租户ID + * @param timeoutMinutes 超时时间(分钟) + * @param batchSize 批量大小 + * @return 超时订单列表 + */ + List findExpiredUnpaidOrdersByTenant(Integer tenantId, Integer timeoutMinutes, Integer batchSize); + + /** + * 回退订单库存 + * + * @param order 订单对象 + * @return 是否回退成功 + */ + boolean restoreOrderStock(ShopOrder order); + + /** + * 退还订单优惠券 + * + * @param order 订单对象 + * @return 是否退还成功 + */ + boolean returnOrderCoupon(ShopOrder order); +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopArticleService.java b/src/main/java/com/gxwebsoft/shop/service/ShopArticleService.java new file mode 100644 index 0000000..da3c943 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopArticleService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopArticle; +import com.gxwebsoft.shop.param.ShopArticleParam; + +import java.util.List; + +/** + * 商品文章Service + * + * @author 科技小王子 + * @since 2025-08-13 05:14:53 + */ +public interface ShopArticleService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopArticleParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopArticleParam param); + + /** + * 根据id查询 + * + * @param articleId 文章ID + * @return ShopArticle + */ + ShopArticle getByIdRel(Integer articleId); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopBrandService.java b/src/main/java/com/gxwebsoft/shop/service/ShopBrandService.java new file mode 100644 index 0000000..294a1f5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopBrandService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopBrand; +import com.gxwebsoft.shop.param.ShopBrandParam; + +import java.util.List; + +/** + * 品牌Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopBrandService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopBrandParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopBrandParam param); + + /** + * 根据id查询 + * + * @param brandId ID + * @return ShopBrand + */ + ShopBrand getByIdRel(Integer brandId); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopCartService.java b/src/main/java/com/gxwebsoft/shop/service/ShopCartService.java new file mode 100644 index 0000000..18d4979 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopCartService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopCart; +import com.gxwebsoft.shop.param.ShopCartParam; + +import java.util.List; + +/** + * 购物车Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopCartService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopCartParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopCartParam param); + + /** + * 根据id查询 + * + * @param id 购物车表ID + * @return ShopCart + */ + ShopCart getByIdRel(Long id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopCategoryService.java b/src/main/java/com/gxwebsoft/shop/service/ShopCategoryService.java new file mode 100644 index 0000000..5ac828e --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopCategoryService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopCategory; +import com.gxwebsoft.shop.param.ShopCategoryParam; + +import java.util.List; + +/** + * 商品分类Service + * + * @author 科技小王子 + * @since 2025-04-24 20:52:13 + */ +public interface ShopCategoryService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopCategoryParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopCategoryParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return ShopCategory + */ + ShopCategory getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopChatConversationService.java b/src/main/java/com/gxwebsoft/shop/service/ShopChatConversationService.java new file mode 100644 index 0000000..32eeac3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopChatConversationService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopChatConversation; +import com.gxwebsoft.shop.param.ShopChatConversationParam; + +import java.util.List; + +/** + * 聊天消息表Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopChatConversationService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopChatConversationParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopChatConversationParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return ShopChatConversation + */ + ShopChatConversation getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopChatMessageService.java b/src/main/java/com/gxwebsoft/shop/service/ShopChatMessageService.java new file mode 100644 index 0000000..c1b40a8 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopChatMessageService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopChatMessage; +import com.gxwebsoft.shop.param.ShopChatMessageParam; + +import java.util.List; + +/** + * 聊天消息表Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopChatMessageService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopChatMessageParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopChatMessageParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return ShopChatMessage + */ + ShopChatMessage getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopCommissionRoleService.java b/src/main/java/com/gxwebsoft/shop/service/ShopCommissionRoleService.java new file mode 100644 index 0000000..e9ef11e --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopCommissionRoleService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopCommissionRole; +import com.gxwebsoft.shop.param.ShopCommissionRoleParam; + +import java.util.List; + +/** + * 分红角色Service + * + * @author 科技小王子 + * @since 2025-05-01 10:01:15 + */ +public interface ShopCommissionRoleService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopCommissionRoleParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopCommissionRoleParam param); + + /** + * 根据id查询 + * + * @param id + * @return ShopCommissionRole + */ + ShopCommissionRole getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopCommunityService.java b/src/main/java/com/gxwebsoft/shop/service/ShopCommunityService.java new file mode 100644 index 0000000..695b037 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopCommunityService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopCommunity; +import com.gxwebsoft.shop.param.ShopCommunityParam; + +import java.util.List; + +/** + * 小区Service + * + * @author 科技小王子 + * @since 2026-01-29 20:48:32 + */ +public interface ShopCommunityService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopCommunityParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopCommunityParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return ShopCommunity + */ + ShopCommunity getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopCountService.java b/src/main/java/com/gxwebsoft/shop/service/ShopCountService.java new file mode 100644 index 0000000..65af394 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopCountService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopCount; +import com.gxwebsoft.shop.param.ShopCountParam; + +import java.util.List; + +/** + * 商城销售统计表Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopCountService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopCountParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopCountParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return ShopCount + */ + ShopCount getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopCouponApplyCateService.java b/src/main/java/com/gxwebsoft/shop/service/ShopCouponApplyCateService.java new file mode 100644 index 0000000..f247bf7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopCouponApplyCateService.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopCouponApplyCate; +import com.gxwebsoft.shop.param.ShopCouponApplyCateParam; + +import java.util.List; + +/** + * 优惠券可用分类Service + * + * @author 科技小王子 + * @since 2025-08-11 12:47:49 + */ +public interface ShopCouponApplyCateService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopCouponApplyCateParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopCouponApplyCateParam param); + + /** + * 根据id查询 + * + * @param id + * @return ShopCouponApplyCate + */ + ShopCouponApplyCate getByIdRel(Integer id); + + void removeByCouponId(Integer couponId); +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopCouponApplyItemService.java b/src/main/java/com/gxwebsoft/shop/service/ShopCouponApplyItemService.java new file mode 100644 index 0000000..bcca01d --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopCouponApplyItemService.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopCouponApplyItem; +import com.gxwebsoft.shop.param.ShopCouponApplyItemParam; + +import java.util.List; + +/** + * 优惠券可用分类Service + * + * @author 科技小王子 + * @since 2025-08-11 12:47:49 + */ +public interface ShopCouponApplyItemService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopCouponApplyItemParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopCouponApplyItemParam param); + + /** + * 根据id查询 + * + * @param id + * @return ShopCouponApplyItem + */ + ShopCouponApplyItem getByIdRel(Integer id); + + void removeByCouponId(Integer couponId); +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopCouponService.java b/src/main/java/com/gxwebsoft/shop/service/ShopCouponService.java new file mode 100644 index 0000000..074b62c --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopCouponService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopCoupon; +import com.gxwebsoft.shop.param.ShopCouponParam; + +import java.util.List; + +/** + * 优惠券Service + * + * @author 科技小王子 + * @since 2025-08-11 23:51:23 + */ +public interface ShopCouponService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopCouponParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopCouponParam param); + + /** + * 根据id查询 + * + * @param id id + * @return ShopCoupon + */ + ShopCoupon getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopDealerApplyService.java b/src/main/java/com/gxwebsoft/shop/service/ShopDealerApplyService.java new file mode 100644 index 0000000..9ea4d40 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopDealerApplyService.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopDealerApply; +import com.gxwebsoft.shop.param.ShopDealerApplyParam; + +import java.util.List; + +/** + * 分销商申请记录表Service + * + * @author 科技小王子 + * @since 2025-08-11 23:50:18 + */ +public interface ShopDealerApplyService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopDealerApplyParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopDealerApplyParam param); + + /** + * 根据id查询 + * + * @param applyId 主键ID + * @return ShopDealerApply + */ + ShopDealerApply getByIdRel(Integer applyId); + + ShopDealerApply getByUserIdRel(Integer userId); + + ShopDealerApply getByDealerNameRel(String dealerName); +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopDealerBankService.java b/src/main/java/com/gxwebsoft/shop/service/ShopDealerBankService.java new file mode 100644 index 0000000..aba0ab0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopDealerBankService.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopDealerBank; +import com.gxwebsoft.shop.param.ShopDealerBankParam; + +import java.util.List; + +/** + * 分销商提现银行卡Service + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +public interface ShopDealerBankService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopDealerBankParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopDealerBankParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ShopDealerBank + */ + ShopDealerBank getByIdRel(Integer id); + + /** + * 获取默认银行卡 + * @return List + */ + ShopDealerBank getDefaultBank(Integer userId); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopDealerCapitalService.java b/src/main/java/com/gxwebsoft/shop/service/ShopDealerCapitalService.java new file mode 100644 index 0000000..67fb29c --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopDealerCapitalService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopDealerCapital; +import com.gxwebsoft.shop.param.ShopDealerCapitalParam; + +import java.util.List; + +/** + * 分销商资金明细表Service + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +public interface ShopDealerCapitalService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopDealerCapitalParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopDealerCapitalParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ShopDealerCapital + */ + ShopDealerCapital getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopDealerOrderService.java b/src/main/java/com/gxwebsoft/shop/service/ShopDealerOrderService.java new file mode 100644 index 0000000..8390e29 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopDealerOrderService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopDealerOrder; +import com.gxwebsoft.shop.param.ShopDealerOrderParam; + +import java.util.List; + +/** + * 分销商订单记录表Service + * + * @author 科技小王子 + * @since 2025-08-12 11:55:18 + */ +public interface ShopDealerOrderService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopDealerOrderParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopDealerOrderParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ShopDealerOrder + */ + ShopDealerOrder getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopDealerRecordService.java b/src/main/java/com/gxwebsoft/shop/service/ShopDealerRecordService.java new file mode 100644 index 0000000..d27357b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopDealerRecordService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopDealerRecord; +import com.gxwebsoft.shop.param.ShopDealerRecordParam; + +import java.util.List; + +/** + * 客户跟进情况Service + * + * @author 科技小王子 + * @since 2025-10-02 12:21:50 + */ +public interface ShopDealerRecordService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopDealerRecordParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopDealerRecordParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return ShopDealerRecord + */ + ShopDealerRecord getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopDealerRefereeService.java b/src/main/java/com/gxwebsoft/shop/service/ShopDealerRefereeService.java new file mode 100644 index 0000000..2abc0ec --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopDealerRefereeService.java @@ -0,0 +1,56 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopDealerReferee; +import com.gxwebsoft.shop.param.ShopDealerRefereeParam; + +import java.util.List; + +/** + * 分销商推荐关系表Service + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +public interface ShopDealerRefereeService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopDealerRefereeParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopDealerRefereeParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ShopDealerReferee + */ + ShopDealerReferee getByIdRel(Integer id); + + ShopDealerReferee getByUserIdRel(Integer userId); + + /** + * 绑定分销商推荐关系(一级)。 + *

+ * 规则: + *

    + *
  • 仅首次绑定生效:已存在(同一tenant、同一user、level=1)则不改绑
  • + *
  • 建议配合唯一索引保证并发幂等:UNIQUE(tenant_id, user_id, level)
  • + *
+ * + * @return true=本次新绑定写入成功;false=已绑定(幂等) + */ + boolean bindFirstLevel(Integer dealerId, Integer userId, Integer tenantId, String source, String scene); +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopDealerSettingService.java b/src/main/java/com/gxwebsoft/shop/service/ShopDealerSettingService.java new file mode 100644 index 0000000..c923759 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopDealerSettingService.java @@ -0,0 +1,50 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopDealerSetting; +import com.gxwebsoft.shop.param.ShopDealerSettingParam; + +import java.util.List; + +/** + * 分销商设置表Service + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +public interface ShopDealerSettingService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopDealerSettingParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopDealerSettingParam param); + + /** + * 根据id查询 + * + * @param key 设置项标示 + * @return ShopDealerSetting + */ + ShopDealerSetting getByIdRel(String key); + + /** + * 根据 key + tenantId 保存或更新 + * + * @param setting 设置项 + * @return boolean + */ + boolean saveOrUpdateByKey(ShopDealerSetting setting); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopDealerUserService.java b/src/main/java/com/gxwebsoft/shop/service/ShopDealerUserService.java new file mode 100644 index 0000000..8e86728 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopDealerUserService.java @@ -0,0 +1,45 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopDealerUser; +import com.gxwebsoft.shop.param.ShopDealerUserParam; + +import java.util.List; + +/** + * 分销商用户记录表Service + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +public interface ShopDealerUserService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopDealerUserParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopDealerUserParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ShopDealerUser + */ + ShopDealerUser getByIdRel(Integer id); + + ShopDealerUser getByUserIdRel(Integer userId); + + boolean updateByUserId(ShopDealerUser shopDealerUser); +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopDealerWithdrawService.java b/src/main/java/com/gxwebsoft/shop/service/ShopDealerWithdrawService.java new file mode 100644 index 0000000..61731e3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopDealerWithdrawService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopDealerWithdraw; +import com.gxwebsoft.shop.param.ShopDealerWithdrawParam; + +import java.util.List; + +/** + * 分销商提现明细表Service + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +public interface ShopDealerWithdrawService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopDealerWithdrawParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopDealerWithdrawParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ShopDealerWithdraw + */ + ShopDealerWithdraw getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopExpressService.java b/src/main/java/com/gxwebsoft/shop/service/ShopExpressService.java new file mode 100644 index 0000000..92dae06 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopExpressService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopExpress; +import com.gxwebsoft.shop.param.ShopExpressParam; + +import java.util.List; + +/** + * 物流公司Service + * + * @author 科技小王子 + * @since 2025-08-12 12:07:03 + */ +public interface ShopExpressService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopExpressParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopExpressParam param); + + /** + * 根据id查询 + * + * @param expressId 物流公司ID + * @return ShopExpress + */ + ShopExpress getByIdRel(Integer expressId); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopExpressTemplateDetailService.java b/src/main/java/com/gxwebsoft/shop/service/ShopExpressTemplateDetailService.java new file mode 100644 index 0000000..b63be6f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopExpressTemplateDetailService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopExpressTemplateDetail; +import com.gxwebsoft.shop.param.ShopExpressTemplateDetailParam; + +import java.util.List; + +/** + * 运费模板Service + * + * @author 科技小王子 + * @since 2025-08-12 12:07:03 + */ +public interface ShopExpressTemplateDetailService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopExpressTemplateDetailParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopExpressTemplateDetailParam param); + + /** + * 根据id查询 + * + * @param id + * @return ShopExpressTemplateDetail + */ + ShopExpressTemplateDetail getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopExpressTemplateService.java b/src/main/java/com/gxwebsoft/shop/service/ShopExpressTemplateService.java new file mode 100644 index 0000000..0c8c003 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopExpressTemplateService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopExpressTemplate; +import com.gxwebsoft.shop.param.ShopExpressTemplateParam; + +import java.util.List; + +/** + * 运费模板Service + * + * @author 科技小王子 + * @since 2025-08-12 12:07:03 + */ +public interface ShopExpressTemplateService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopExpressTemplateParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopExpressTemplateParam param); + + /** + * 根据id查询 + * + * @param id + * @return ShopExpressTemplate + */ + ShopExpressTemplate getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopGiftService.java b/src/main/java/com/gxwebsoft/shop/service/ShopGiftService.java new file mode 100644 index 0000000..5ff156d --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopGiftService.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopGift; +import com.gxwebsoft.shop.param.ShopGiftParam; + +import java.util.List; + +/** + * 礼品卡Service + * + * @author 科技小王子 + * @since 2025-08-11 18:07:31 + */ +public interface ShopGiftService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopGiftParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopGiftParam param); + + /** + * 根据id查询 + * + * @param id + * @return ShopGift + */ + ShopGift getByIdRel(Integer id); + + ShopGift getByCode(String code); +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopGoodsCategoryService.java b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsCategoryService.java new file mode 100644 index 0000000..5dbed7e --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsCategoryService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopGoodsCategory; +import com.gxwebsoft.shop.param.ShopGoodsCategoryParam; + +import java.util.List; + +/** + * 商品分类Service + * + * @author 科技小王子 + * @since 2025-05-01 00:36:45 + */ +public interface ShopGoodsCategoryService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopGoodsCategoryParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopGoodsCategoryParam param); + + /** + * 根据id查询 + * + * @param categoryId 商品分类ID + * @return ShopGoodsCategory + */ + ShopGoodsCategory getByIdRel(Integer categoryId); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopGoodsCommentService.java b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsCommentService.java new file mode 100644 index 0000000..6fc33d4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsCommentService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopGoodsComment; +import com.gxwebsoft.shop.param.ShopGoodsCommentParam; + +import java.util.List; + +/** + * 评论表Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopGoodsCommentService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopGoodsCommentParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopGoodsCommentParam param); + + /** + * 根据id查询 + * + * @param id 评论ID + * @return ShopGoodsComment + */ + ShopGoodsComment getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopGoodsIncomeConfigService.java b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsIncomeConfigService.java new file mode 100644 index 0000000..5784743 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsIncomeConfigService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopGoodsIncomeConfig; +import com.gxwebsoft.shop.param.ShopGoodsIncomeConfigParam; + +import java.util.List; + +/** + * 分润配置Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopGoodsIncomeConfigService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopGoodsIncomeConfigParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopGoodsIncomeConfigParam param); + + /** + * 根据id查询 + * + * @param id + * @return ShopGoodsIncomeConfig + */ + ShopGoodsIncomeConfig getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopGoodsLogService.java b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsLogService.java new file mode 100644 index 0000000..0c8d53b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsLogService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopGoodsLog; +import com.gxwebsoft.shop.param.ShopGoodsLogParam; + +import java.util.List; + +/** + * 商品日志表Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopGoodsLogService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopGoodsLogParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopGoodsLogParam param); + + /** + * 根据id查询 + * + * @param id 统计ID + * @return ShopGoodsLog + */ + ShopGoodsLog getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopGoodsRelationService.java b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsRelationService.java new file mode 100644 index 0000000..9c43aa9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsRelationService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopGoodsRelation; +import com.gxwebsoft.shop.param.ShopGoodsRelationParam; + +import java.util.List; + +/** + * 商品点赞和收藏表Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopGoodsRelationService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopGoodsRelationParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopGoodsRelationParam param); + + /** + * 根据id查询 + * + * @param id id + * @return ShopGoodsRelation + */ + ShopGoodsRelation getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopGoodsRoleCommissionService.java b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsRoleCommissionService.java new file mode 100644 index 0000000..6ff923f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsRoleCommissionService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopGoodsRoleCommission; +import com.gxwebsoft.shop.param.ShopGoodsRoleCommissionParam; + +import java.util.List; + +/** + * 商品绑定角色的分润金额Service + * + * @author 科技小王子 + * @since 2025-05-01 09:53:38 + */ +public interface ShopGoodsRoleCommissionService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopGoodsRoleCommissionParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopGoodsRoleCommissionParam param); + + /** + * 根据id查询 + * + * @param id + * @return ShopGoodsRoleCommission + */ + ShopGoodsRoleCommission getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopGoodsService.java b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsService.java new file mode 100644 index 0000000..115cf42 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsService.java @@ -0,0 +1,52 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopGoods; +import com.gxwebsoft.shop.param.ShopGoodsParam; + +import java.util.List; + +/** + * 商品Service + * + * @author 科技小王子 + * @since 2025-04-24 20:52:13 + */ +public interface ShopGoodsService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopGoodsParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopGoodsParam param); + + /** + * 根据id查询 + * + * @param goodsId 自增ID + * @return ShopGoods + */ + ShopGoods getByIdRel(Integer goodsId); + + /** + * 累加商品销售数量 + * 忽略租户隔离,确保能更新成功 + * + * @param goodsId 商品ID + * @param saleCount 累加的销售数量 + * @return 是否更新成功 + */ + boolean addSaleCount(Integer goodsId, Integer saleCount); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopGoodsSkuService.java b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsSkuService.java new file mode 100644 index 0000000..1431347 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsSkuService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopGoodsSku; +import com.gxwebsoft.shop.param.ShopGoodsSkuParam; + +import java.util.List; + +/** + * 商品sku列表Service + * + * @author 科技小王子 + * @since 2025-05-01 09:43:31 + */ +public interface ShopGoodsSkuService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopGoodsSkuParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopGoodsSkuParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ShopGoodsSku + */ + ShopGoodsSku getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopGoodsSpecService.java b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsSpecService.java new file mode 100644 index 0000000..32250e7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopGoodsSpecService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopGoodsSpec; +import com.gxwebsoft.shop.param.ShopGoodsSpecParam; + +import java.util.List; + +/** + * 商品多规格Service + * + * @author 科技小王子 + * @since 2025-05-01 09:43:31 + */ +public interface ShopGoodsSpecService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopGoodsSpecParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopGoodsSpecParam param); + + /** + * 根据id查询 + * + * @param id 主键 + * @return ShopGoodsSpec + */ + ShopGoodsSpec getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopMerchantAccountService.java b/src/main/java/com/gxwebsoft/shop/service/ShopMerchantAccountService.java new file mode 100644 index 0000000..127420f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopMerchantAccountService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopMerchantAccount; +import com.gxwebsoft.shop.param.ShopMerchantAccountParam; + +import java.util.List; + +/** + * 商户账号Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopMerchantAccountService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopMerchantAccountParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopMerchantAccountParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return ShopMerchantAccount + */ + ShopMerchantAccount getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopMerchantApplyService.java b/src/main/java/com/gxwebsoft/shop/service/ShopMerchantApplyService.java new file mode 100644 index 0000000..7eeaf21 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopMerchantApplyService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopMerchantApply; +import com.gxwebsoft.shop.param.ShopMerchantApplyParam; + +import java.util.List; + +/** + * 商户入驻申请Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopMerchantApplyService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopMerchantApplyParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopMerchantApplyParam param); + + /** + * 根据id查询 + * + * @param applyId ID + * @return ShopMerchantApply + */ + ShopMerchantApply getByIdRel(Integer applyId); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopMerchantService.java b/src/main/java/com/gxwebsoft/shop/service/ShopMerchantService.java new file mode 100644 index 0000000..f3fb956 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopMerchantService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopMerchant; +import com.gxwebsoft.shop.param.ShopMerchantParam; + +import java.util.List; + +/** + * 商户Service + * + * @author 科技小王子 + * @since 2025-08-10 20:43:33 + */ +public interface ShopMerchantService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopMerchantParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopMerchantParam param); + + /** + * 根据id查询 + * + * @param merchantId ID + * @return ShopMerchant + */ + ShopMerchant getByIdRel(Long merchantId); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopMerchantTypeService.java b/src/main/java/com/gxwebsoft/shop/service/ShopMerchantTypeService.java new file mode 100644 index 0000000..e0922d2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopMerchantTypeService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopMerchantType; +import com.gxwebsoft.shop.param.ShopMerchantTypeParam; + +import java.util.List; + +/** + * 商户类型Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopMerchantTypeService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopMerchantTypeParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopMerchantTypeParam param); + + /** + * 根据id查询 + * + * @param id ID + * @return ShopMerchantType + */ + ShopMerchantType getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopOrderDeliveryGoodsService.java b/src/main/java/com/gxwebsoft/shop/service/ShopOrderDeliveryGoodsService.java new file mode 100644 index 0000000..55699ac --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopOrderDeliveryGoodsService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopOrderDeliveryGoods; +import com.gxwebsoft.shop.param.ShopOrderDeliveryGoodsParam; + +import java.util.List; + +/** + * 发货单商品Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopOrderDeliveryGoodsService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopOrderDeliveryGoodsParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopOrderDeliveryGoodsParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ShopOrderDeliveryGoods + */ + ShopOrderDeliveryGoods getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopOrderDeliveryService.java b/src/main/java/com/gxwebsoft/shop/service/ShopOrderDeliveryService.java new file mode 100644 index 0000000..1253f5b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopOrderDeliveryService.java @@ -0,0 +1,48 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.shop.entity.ShopOrder; +import com.gxwebsoft.shop.entity.ShopOrderDelivery; +import com.gxwebsoft.shop.param.ShopOrderDeliveryParam; + +import java.util.List; +import java.util.Map; + +/** + * 发货单Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopOrderDeliveryService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopOrderDeliveryParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopOrderDeliveryParam param); + + /** + * 根据id查询 + * + * @param deliveryId 发货单ID + * @return ShopOrderDelivery + */ + ShopOrderDelivery getByIdRel(Integer deliveryId); + + ShopOrderDelivery getByOrderId(Integer orderId); + + Map setExpress(User user, ShopOrderDelivery orderDelivery, ShopOrder order) throws Exception; +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopOrderExtractService.java b/src/main/java/com/gxwebsoft/shop/service/ShopOrderExtractService.java new file mode 100644 index 0000000..d0a3bd6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopOrderExtractService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopOrderExtract; +import com.gxwebsoft.shop.param.ShopOrderExtractParam; + +import java.util.List; + +/** + * 自提订单联系方式Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopOrderExtractService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopOrderExtractParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopOrderExtractParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ShopOrderExtract + */ + ShopOrderExtract getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopOrderGoodsService.java b/src/main/java/com/gxwebsoft/shop/service/ShopOrderGoodsService.java new file mode 100644 index 0000000..d9a7e9a --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopOrderGoodsService.java @@ -0,0 +1,50 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopOrderGoods; +import com.gxwebsoft.shop.param.ShopOrderGoodsParam; + +import java.util.List; + +/** + * 商品信息Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopOrderGoodsService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopOrderGoodsParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopOrderGoodsParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return ShopOrderGoods + */ + ShopOrderGoods getByIdRel(Integer id); + + List getListByOrderId(Integer orderId); + + /** + * 根据订单ID查询订单商品列表(忽略租户隔离) + * @param orderId 订单ID + * @return List + */ + List getListByOrderIdIgnoreTenant(Integer orderId); +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopOrderInfoLogService.java b/src/main/java/com/gxwebsoft/shop/service/ShopOrderInfoLogService.java new file mode 100644 index 0000000..9ede6f7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopOrderInfoLogService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopOrderInfoLog; +import com.gxwebsoft.shop.param.ShopOrderInfoLogParam; + +import java.util.List; + +/** + * 订单核销Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopOrderInfoLogService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopOrderInfoLogParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopOrderInfoLogParam param); + + /** + * 根据id查询 + * + * @param id + * @return ShopOrderInfoLog + */ + ShopOrderInfoLog getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopOrderInfoService.java b/src/main/java/com/gxwebsoft/shop/service/ShopOrderInfoService.java new file mode 100644 index 0000000..f5a53fa --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopOrderInfoService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopOrderInfo; +import com.gxwebsoft.shop.param.ShopOrderInfoParam; + +import java.util.List; + +/** + * 场地Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopOrderInfoService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopOrderInfoParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopOrderInfoParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return ShopOrderInfo + */ + ShopOrderInfo getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopOrderService.java b/src/main/java/com/gxwebsoft/shop/service/ShopOrderService.java new file mode 100644 index 0000000..e2ebdea --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopOrderService.java @@ -0,0 +1,89 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.dto.UserOrderStats; +import com.gxwebsoft.shop.entity.ShopOrder; +import com.gxwebsoft.shop.param.ShopOrderParam; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.List; + +/** + * 订单Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopOrderService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopOrderParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopOrderParam param); + + /** + * 根据id查询 + * + * @param orderId 订单号 + * @return ShopOrder + */ + ShopOrder getByIdRel(Integer orderId); + + HashMap createWxOrder(ShopOrder shopOrder); + + ShopOrder getByOutTradeNo(String outTradeNo); + + Boolean queryOrderByOutTradeNo(ShopOrder shopOrder); + + void updateByOutTradeNo(ShopOrder order); + + /** + * 统计订单总金额 + * + * @return 订单总金额 + */ + BigDecimal total(); + + /** + * 根据订单号查询订单 + * + * @param orderNo 订单号 + * @param tenantId 租户ID + * @return ShopOrder + */ + ShopOrder getByOrderNo(String orderNo, Integer tenantId); + + /** + * 同步支付状态 + * + * @param orderNo 订单号 + * @param paymentStatus 支付状态:1=支付成功,0=支付失败 + * @param transactionId 微信交易号 + * @param payTime 支付时间 + * @param tenantId 租户ID + * @return 是否更新成功 + */ + boolean syncPaymentStatus(String orderNo, Integer paymentStatus, String transactionId, String payTime, Integer tenantId); + + /** + * 获取当前用户订单状态统计(一次聚合查询,避免前端用分页接口串行拉取多个状态数量) + * + * @param userId 用户ID + * @param tenantId 租户ID(可为空,优先走租户插件) + * @param type 订单类型(可为空) + */ + UserOrderStats getUserOrderStats(Integer userId, Integer tenantId, Integer type); +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopOrderUpdate10550Service.java b/src/main/java/com/gxwebsoft/shop/service/ShopOrderUpdate10550Service.java new file mode 100644 index 0000000..2399a6d --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopOrderUpdate10550Service.java @@ -0,0 +1,21 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopOrder; +import com.gxwebsoft.shop.entity.ShopOrderDelivery; +import com.gxwebsoft.shop.param.ShopOrderDeliveryParam; + +import java.util.List; + +/** + * 发货单Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopOrderUpdate10550Service { + + + void update(ShopOrder shopOrder); +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopRechargeOrderService.java b/src/main/java/com/gxwebsoft/shop/service/ShopRechargeOrderService.java new file mode 100644 index 0000000..dcb936a --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopRechargeOrderService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopRechargeOrder; +import com.gxwebsoft.shop.param.ShopRechargeOrderParam; + +import java.util.List; + +/** + * 会员充值订单表Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +public interface ShopRechargeOrderService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopRechargeOrderParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopRechargeOrderParam param); + + /** + * 根据id查询 + * + * @param orderId 订单ID + * @return ShopRechargeOrder + */ + ShopRechargeOrder getByIdRel(Integer orderId); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopSpecService.java b/src/main/java/com/gxwebsoft/shop/service/ShopSpecService.java new file mode 100644 index 0000000..2db6368 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopSpecService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopSpec; +import com.gxwebsoft.shop.param.ShopSpecParam; + +import java.util.List; + +/** + * 规格Service + * + * @author 科技小王子 + * @since 2025-05-01 09:44:00 + */ +public interface ShopSpecService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopSpecParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopSpecParam param); + + /** + * 根据id查询 + * + * @param specId 规格ID + * @return ShopSpec + */ + ShopSpec getByIdRel(Integer specId); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopSpecValueService.java b/src/main/java/com/gxwebsoft/shop/service/ShopSpecValueService.java new file mode 100644 index 0000000..f16f347 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopSpecValueService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopSpecValue; +import com.gxwebsoft.shop.param.ShopSpecValueParam; + +import java.util.List; + +/** + * 规格值Service + * + * @author 科技小王子 + * @since 2025-05-01 09:44:00 + */ +public interface ShopSpecValueService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopSpecValueParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopSpecValueParam param); + + /** + * 根据id查询 + * + * @param specValueId 规格值ID + * @return ShopSpecValue + */ + ShopSpecValue getByIdRel(Integer specValueId); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopSplashService.java b/src/main/java/com/gxwebsoft/shop/service/ShopSplashService.java new file mode 100644 index 0000000..0087a1e --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopSplashService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopSplash; +import com.gxwebsoft.shop.param.ShopSplashParam; + +import java.util.List; + +/** + * 开屏广告Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +public interface ShopSplashService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopSplashParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopSplashParam param); + + /** + * 根据id查询 + * + * @param id + * @return ShopSplash + */ + ShopSplash getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopStoreRiderService.java b/src/main/java/com/gxwebsoft/shop/service/ShopStoreRiderService.java new file mode 100644 index 0000000..cc958af --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopStoreRiderService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopStoreRider; +import com.gxwebsoft.shop.param.ShopStoreRiderParam; + +import java.util.List; + +/** + * 配送员Service + * + * @author 科技小王子 + * @since 2026-01-30 15:14:15 + */ +public interface ShopStoreRiderService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopStoreRiderParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopStoreRiderParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ShopStoreRider + */ + ShopStoreRider getByIdRel(Long id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopStoreService.java b/src/main/java/com/gxwebsoft/shop/service/ShopStoreService.java new file mode 100644 index 0000000..ed8d230 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopStoreService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopStore; +import com.gxwebsoft.shop.param.ShopStoreParam; + +import java.util.List; + +/** + * 门店Service + * + * @author 科技小王子 + * @since 2026-01-30 15:00:25 + */ +public interface ShopStoreService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopStoreParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopStoreParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return ShopStore + */ + ShopStore getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopStoreUserService.java b/src/main/java/com/gxwebsoft/shop/service/ShopStoreUserService.java new file mode 100644 index 0000000..62e3d46 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopStoreUserService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopStoreUser; +import com.gxwebsoft.shop.param.ShopStoreUserParam; + +import java.util.List; + +/** + * 店员Service + * + * @author 科技小王子 + * @since 2026-01-30 15:00:25 + */ +public interface ShopStoreUserService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopStoreUserParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopStoreUserParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ShopStoreUser + */ + ShopStoreUser getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopUserAddressService.java b/src/main/java/com/gxwebsoft/shop/service/ShopUserAddressService.java new file mode 100644 index 0000000..70880e4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopUserAddressService.java @@ -0,0 +1,58 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopUserAddress; +import com.gxwebsoft.shop.param.ShopUserAddressParam; + +import java.util.List; + +/** + * 收货地址Service + * + * @author 科技小王子 + * @since 2025-07-22 23:06:40 + */ +public interface ShopUserAddressService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopUserAddressParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopUserAddressParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ShopUserAddress + */ + ShopUserAddress getByIdRel(Integer id); + + /** + * 获取用户默认收货地址 + * + * @param userId 用户ID + * @return ShopUserAddress + */ + ShopUserAddress getDefaultAddress(Integer userId); + + /** + * 获取用户所有收货地址 + * + * @param userId 用户ID + * @return List + */ + List getUserAddresses(Integer userId); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopUserBalanceLogService.java b/src/main/java/com/gxwebsoft/shop/service/ShopUserBalanceLogService.java new file mode 100644 index 0000000..08e4087 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopUserBalanceLogService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopUserBalanceLog; +import com.gxwebsoft.shop.param.ShopUserBalanceLogParam; + +import java.util.List; + +/** + * 用户余额变动明细表Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +public interface ShopUserBalanceLogService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopUserBalanceLogParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopUserBalanceLogParam param); + + /** + * 根据id查询 + * + * @param logId 主键ID + * @return ShopUserBalanceLog + */ + ShopUserBalanceLog getByIdRel(Integer logId); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopUserCollectionService.java b/src/main/java/com/gxwebsoft/shop/service/ShopUserCollectionService.java new file mode 100644 index 0000000..bc74a59 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopUserCollectionService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopUserCollection; +import com.gxwebsoft.shop.param.ShopUserCollectionParam; + +import java.util.List; + +/** + * 我的收藏Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +public interface ShopUserCollectionService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopUserCollectionParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopUserCollectionParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ShopUserCollection + */ + ShopUserCollection getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopUserCouponService.java b/src/main/java/com/gxwebsoft/shop/service/ShopUserCouponService.java new file mode 100644 index 0000000..e237cca --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopUserCouponService.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopUserCoupon; +import com.gxwebsoft.shop.param.ShopUserCouponParam; + +import java.util.List; + +/** + * 用户优惠券Service + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +public interface ShopUserCouponService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopUserCouponParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopUserCouponParam param); + + /** + * 根据id查询 + * + * @param id id + * @return ShopUserCoupon + */ + ShopUserCoupon getByIdRel(Integer id); + + List userList(Integer userId); +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopUserRefereeService.java b/src/main/java/com/gxwebsoft/shop/service/ShopUserRefereeService.java new file mode 100644 index 0000000..624627f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopUserRefereeService.java @@ -0,0 +1,43 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopUserReferee; +import com.gxwebsoft.shop.param.ShopUserRefereeParam; + +import java.util.List; + +/** + * 用户推荐关系表Service + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +public interface ShopUserRefereeService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopUserRefereeParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopUserRefereeParam param); + + /** + * 根据id查询 + * + * @param id 主键ID + * @return ShopUserReferee + */ + ShopUserReferee getByIdRel(Integer id); + + ShopUserReferee getByUserIdRel(Integer userId); +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopUserService.java b/src/main/java/com/gxwebsoft/shop/service/ShopUserService.java new file mode 100644 index 0000000..52d8fba --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopUserService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopUser; +import com.gxwebsoft.shop.param.ShopUserParam; + +import java.util.List; + +/** + * 用户记录表Service + * + * @author 科技小王子 + * @since 2025-10-03 13:41:09 + */ +public interface ShopUserService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopUserParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopUserParam param); + + /** + * 根据id查询 + * + * @param userId 用户id + * @return ShopUser + */ + ShopUser getByIdRel(Integer userId); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopWarehouseService.java b/src/main/java/com/gxwebsoft/shop/service/ShopWarehouseService.java new file mode 100644 index 0000000..f8f8c1d --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopWarehouseService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopWarehouse; +import com.gxwebsoft.shop.param.ShopWarehouseParam; + +import java.util.List; + +/** + * 仓库Service + * + * @author 科技小王子 + * @since 2026-01-30 17:46:48 + */ +public interface ShopWarehouseService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopWarehouseParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopWarehouseParam param); + + /** + * 根据id查询 + * + * @param id 自增ID + * @return ShopWarehouse + */ + ShopWarehouse getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopWebsiteService.java b/src/main/java/com/gxwebsoft/shop/service/ShopWebsiteService.java new file mode 100644 index 0000000..6b9bef6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopWebsiteService.java @@ -0,0 +1,27 @@ +package com.gxwebsoft.shop.service; + +import com.gxwebsoft.shop.vo.ShopVo; + +/** + * 商城网站服务接口 + * + * @author 科技小王子 + * @since 2025-08-13 + */ +public interface ShopWebsiteService { + + /** + * 获取商城基本信息(VO格式) + * + * @param tenantId 租户ID + * @return 商城信息VO + */ + ShopVo getShopInfo(Integer tenantId); + + /** + * 清除商城信息缓存 + * + * @param tenantId 租户ID + */ + void clearShopInfoCache(Integer tenantId); +} diff --git a/src/main/java/com/gxwebsoft/shop/service/ShopWechatDepositService.java b/src/main/java/com/gxwebsoft/shop/service/ShopWechatDepositService.java new file mode 100644 index 0000000..9c4b0ad --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/ShopWechatDepositService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopWechatDeposit; +import com.gxwebsoft.shop.param.ShopWechatDepositParam; + +import java.util.List; + +/** + * 押金Service + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +public interface ShopWechatDepositService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(ShopWechatDepositParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(ShopWechatDepositParam param); + + /** + * 根据id查询 + * + * @param id + * @return ShopWechatDeposit + */ + ShopWechatDeposit getByIdRel(Integer id); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/UserBalanceLogService.java b/src/main/java/com/gxwebsoft/shop/service/UserBalanceLogService.java new file mode 100644 index 0000000..af7a18a --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/UserBalanceLogService.java @@ -0,0 +1,42 @@ +package com.gxwebsoft.shop.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.common.system.entity.UserBalanceLog; +import com.gxwebsoft.common.system.param.UserBalanceLogParam; + +import java.util.List; + +/** + * 用户余额变动明细表Service + * + * @author 科技小王子 + * @since 2023-04-21 15:59:09 + */ +public interface UserBalanceLogService extends IService { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(UserBalanceLogParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(UserBalanceLogParam param); + + /** + * 根据id查询 + * + * @param logId 主键ID + * @return UserBalanceLog + */ + UserBalanceLog getByIdRel(Integer logId); + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/CouponStatusServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/CouponStatusServiceImpl.java new file mode 100644 index 0000000..1700188 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/CouponStatusServiceImpl.java @@ -0,0 +1,339 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.gxwebsoft.shop.entity.ShopUserCoupon; +import com.gxwebsoft.shop.entity.ShopCoupon; +import com.gxwebsoft.shop.entity.ShopCouponApplyItem; +import com.gxwebsoft.shop.service.CouponStatusService; +import com.gxwebsoft.shop.service.ShopUserCouponService; +import com.gxwebsoft.shop.service.ShopCouponService; +import com.gxwebsoft.shop.service.ShopCouponApplyItemService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 优惠券状态管理服务实现 + * + * @author WebSoft + * @since 2025-01-15 + */ +@Slf4j +@Service +public class CouponStatusServiceImpl implements CouponStatusService { + + @Autowired + private ShopUserCouponService shopUserCouponService; + + @Autowired + private ShopCouponService shopCouponService; + + @Autowired + private ShopCouponApplyItemService shopCouponApplyItemService; + + @Override + public List getAvailableCoupons(Integer userId) { + List allCoupons = getUserCoupons(userId); + return allCoupons.stream() + .filter(ShopUserCoupon::isAvailable) + .collect(Collectors.toList()); + } + + @Override + public List getUsedCoupons(Integer userId) { + return shopUserCouponService.list( + new LambdaQueryWrapper() + .eq(ShopUserCoupon::getUserId, userId) + .eq(ShopUserCoupon::getStatus, ShopUserCoupon.STATUS_USED) + .orderByDesc(ShopUserCoupon::getUseTime) + ); + } + + @Override + public List getExpiredCoupons(Integer userId) { + // 先更新过期状态 + updateExpiredCouponsForUser(userId); + + return shopUserCouponService.list( + new LambdaQueryWrapper() + .eq(ShopUserCoupon::getUserId, userId) + .eq(ShopUserCoupon::getStatus, ShopUserCoupon.STATUS_EXPIRED) + .orderByDesc(ShopUserCoupon::getEndTime) + ); + } + + @Override + public CouponStatusResult getUserCouponsGroupByStatus(Integer userId) { + List availableCoupons = getAvailableCoupons(userId); + List usedCoupons = getUsedCoupons(userId); + List expiredCoupons = getExpiredCoupons(userId); + + return new CouponStatusResult(availableCoupons, usedCoupons, expiredCoupons); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean useCoupon(Long userCouponId, Integer orderId, String orderNo) { + try { + ShopUserCoupon userCoupon = shopUserCouponService.getById(userCouponId); + if (userCoupon == null) { + log.warn("优惠券不存在: {}", userCouponId); + return false; + } + + if (!userCoupon.isAvailable()) { + log.warn("优惠券不可用: {}, 状态: {}", userCouponId, userCoupon.getStatusDesc()); + return false; + } + + // 标记为已使用 + userCoupon.markAsUsed(orderId, orderNo); + + return shopUserCouponService.updateById(userCoupon); + } catch (Exception e) { + log.error("使用优惠券失败: {}", userCouponId, e); + return false; + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean returnCoupon(Integer orderId) { + try { + ShopUserCoupon userCoupon = shopUserCouponService.getOne( + new LambdaQueryWrapper() + .eq(ShopUserCoupon::getOrderId, orderId) + .eq(ShopUserCoupon::getStatus, ShopUserCoupon.STATUS_USED) + ); + + if (userCoupon == null) { + log.info("订单没有使用优惠券: {}", orderId); + return true; + } + + // 检查是否已过期 + if (userCoupon.isExpired()) { + log.warn("优惠券已过期,无法退还: {}", userCoupon.getId()); + return false; + } + + // 恢复为未使用状态 + userCoupon.setStatus(ShopUserCoupon.STATUS_UNUSED); + userCoupon.setIsUse(0); + userCoupon.setUseTime(null); + userCoupon.setOrderId(null); + userCoupon.setOrderNo(null); + + return shopUserCouponService.updateById(userCoupon); + } catch (Exception e) { + log.error("退还优惠券失败, 订单ID: {}", orderId, e); + return false; + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public int updateExpiredCoupons() { + try { + // 查询所有未使用且已过期的优惠券 + List expiredCoupons = shopUserCouponService.list( + new LambdaQueryWrapper() + .eq(ShopUserCoupon::getStatus, ShopUserCoupon.STATUS_UNUSED) + .lt(ShopUserCoupon::getEndTime, LocalDateTime.now()) + ); + + if (expiredCoupons.isEmpty()) { + return 0; + } + + // 批量更新状态 + List expiredIds = expiredCoupons.stream() + .map(ShopUserCoupon::getId) + .collect(Collectors.toList()); + + boolean success = shopUserCouponService.update( + new LambdaUpdateWrapper() + .in(ShopUserCoupon::getId, expiredIds) + .set(ShopUserCoupon::getStatus, ShopUserCoupon.STATUS_EXPIRED) + .set(ShopUserCoupon::getIsExpire, 1) + ); + + int updatedCount = success ? expiredIds.size() : 0; + log.info("批量更新过期优惠券状态完成,更新数量: {}", updatedCount); + return updatedCount; + } catch (Exception e) { + log.error("批量更新过期优惠券状态失败", e); + return 0; + } + } + + @Override + public boolean checkAndUpdateCouponStatus(ShopUserCoupon userCoupon) { + if (userCoupon == null) { + return false; + } + + boolean statusChanged = false; + + // 检查是否过期 + if (userCoupon.getStatus() == ShopUserCoupon.STATUS_UNUSED && userCoupon.isExpired()) { + userCoupon.markAsExpired(); + statusChanged = true; + } + + // 如果状态发生变化,更新数据库 + if (statusChanged) { + try { + shopUserCouponService.updateById(userCoupon); + log.debug("更新优惠券状态: {} -> {}", userCoupon.getId(), userCoupon.getStatusDesc()); + } catch (Exception e) { + log.error("更新优惠券状态失败: {}", userCoupon.getId(), e); + return false; + } + } + + return statusChanged; + } + + @Override + public CouponValidationResult validateCouponForOrder(Long userCouponId, + BigDecimal totalAmount, + List goodsIds) { + try { + ShopUserCoupon userCoupon = shopUserCouponService.getById(userCouponId); + if (userCoupon == null) { + return new CouponValidationResult(false, "优惠券不存在"); + } + + // 检查优惠券状态 + if (!userCoupon.isAvailable()) { + return new CouponValidationResult(false, "优惠券" + userCoupon.getStatusDesc()); + } + + // 检查最低消费金额 + if (userCoupon.getMinPrice() != null && + totalAmount.compareTo(userCoupon.getMinPrice()) < 0) { + return new CouponValidationResult(false, + String.format("订单金额不满足最低消费要求,需满%s元", userCoupon.getMinPrice())); + } + + // 检查适用范围 + if (!validateApplyRange(userCoupon, goodsIds)) { + return new CouponValidationResult(false, "优惠券不适用于当前商品"); + } + + // 计算优惠金额 + BigDecimal discountAmount = calculateDiscountAmount(userCoupon, totalAmount); + + return new CouponValidationResult(true, "优惠券可用", discountAmount); + } catch (Exception e) { + log.error("验证优惠券失败: {}", userCouponId, e); + return new CouponValidationResult(false, "验证优惠券时发生错误"); + } + } + + /** + * 获取用户所有优惠券 + */ + private List getUserCoupons(Integer userId) { + List coupons = shopUserCouponService.list( + new LambdaQueryWrapper() + .eq(ShopUserCoupon::getUserId, userId) + .orderByAsc(ShopUserCoupon::getEndTime) + ); + + // 检查并更新状态 + coupons.forEach(this::checkAndUpdateCouponStatus); + + return coupons; + } + + /** + * 更新指定用户的过期优惠券 + */ + private void updateExpiredCouponsForUser(Integer userId) { + try { + shopUserCouponService.update( + new LambdaUpdateWrapper() + .eq(ShopUserCoupon::getUserId, userId) + .eq(ShopUserCoupon::getStatus, ShopUserCoupon.STATUS_UNUSED) + .lt(ShopUserCoupon::getEndTime, LocalDateTime.now()) + .set(ShopUserCoupon::getStatus, ShopUserCoupon.STATUS_EXPIRED) + .set(ShopUserCoupon::getIsExpire, 1) + ); + } catch (Exception e) { + log.error("更新用户过期优惠券失败, userId: {}", userId, e); + } + } + + /** + * 验证优惠券适用范围 + */ + private boolean validateApplyRange(ShopUserCoupon userCoupon, List goodsIds) { + if (userCoupon.getApplyRange() == null || userCoupon.getApplyRange() == ShopUserCoupon.APPLY_ALL) { + return true; // 全部商品适用 + } + + if (userCoupon.getApplyRange() == ShopUserCoupon.APPLY_GOODS) { + // 指定商品适用 + try { + List applyItems = shopCouponApplyItemService.list( + new LambdaQueryWrapper() + .eq(ShopCouponApplyItem::getCouponId, userCoupon.getCouponId()) + .eq(ShopCouponApplyItem::getType, 1) // 类型1表示商品 + ); + + // 如果数据库中还没有 goods_id 字段,暂时使用 pk 字段作为商品ID + List applicableGoodsIds = applyItems.stream() + .map(item -> { + if (item.getGoodsId() != null) { + return item.getGoodsId(); + } else if (item.getPk() != null) { + // 临时方案:使用 pk 字段作为商品ID + return item.getPk(); + } + return null; + }) + .filter(goodsId -> goodsId != null) + .collect(Collectors.toList()); + + return goodsIds.stream().anyMatch(applicableGoodsIds::contains); + } catch (Exception e) { + log.warn("查询优惠券适用商品失败,可能是数据库字段不存在: {}", e.getMessage()); + // 如果查询失败,默认返回true(允许使用) + return true; + } + } + + if (userCoupon.getApplyRange() == ShopUserCoupon.APPLY_CATEGORY) { + // 指定分类适用 - 这里需要根据商品ID查询分类ID,然后验证 + // 暂时返回true,实际项目中需要实现商品分类查询逻辑 + log.debug("分类适用范围验证暂未实现,默认通过"); + return true; + } + + return true; + } + + /** + * 计算优惠金额 + */ + private BigDecimal calculateDiscountAmount(ShopUserCoupon userCoupon, BigDecimal totalAmount) { + if (userCoupon.getType() == ShopUserCoupon.TYPE_REDUCE) { + // 满减券 + return userCoupon.getReducePrice(); + } else if (userCoupon.getType() == ShopUserCoupon.TYPE_DISCOUNT) { + // 折扣券 + BigDecimal discountRate = BigDecimal.valueOf(userCoupon.getDiscount()).divide(BigDecimal.valueOf(100)); + return totalAmount.multiply(BigDecimal.ONE.subtract(discountRate)); + } + return BigDecimal.ZERO; + } +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/KuaiDi100Impl.java b/src/main/java/com/gxwebsoft/shop/service/impl/KuaiDi100Impl.java new file mode 100644 index 0000000..62bfe6b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/KuaiDi100Impl.java @@ -0,0 +1,57 @@ +package com.gxwebsoft.shop.service.impl; + +import com.google.gson.Gson; +import com.gxwebsoft.shop.service.KuaiDi100; +import com.kuaidi100.sdk.api.QueryTrack; +import com.kuaidi100.sdk.contant.ApiInfoConstant; +import com.kuaidi100.sdk.core.BaseClient; +import com.kuaidi100.sdk.core.IBaseClient; +import com.kuaidi100.sdk.pojo.HttpResult; +import com.kuaidi100.sdk.request.*; +import com.kuaidi100.sdk.utils.SignUtils; +import org.springframework.stereotype.Service; + +@Service +public class KuaiDi100Impl implements KuaiDi100 { + private String key = "bekcrvqy1510"; + private String secret = "8c9dd34b6ff34cad9dd6a239bd0c4d26"; + private String customer = "2E5DE2DB6B39822D793FE45EDDFB00B1"; + + @Override + public HttpResult border(BOrderReq bOrderReq) throws Exception { + PrintReq printReq = new PrintReq(); + + String t = String.valueOf(System.currentTimeMillis()); + String param = new Gson().toJson(bOrderReq); + + printReq.setKey(key); + printReq.setSign(SignUtils.printSign(param, t, key, secret)); + printReq.setT(t); + printReq.setParam(param); + printReq.setMethod(ApiInfoConstant.B_ORDER_OFFICIAL_ORDER_METHOD); + System.out.println(printReq); +// IBaseClient bOrder = new BOrderOfficial(); + IBaseClient bOrder = new BaseClient() { + @Override + public String getApiUrl(BaseRequest baseRequest) { + return "https://api.kuaidi100.com/apiMock/border"; + } + }; + return bOrder.execute(printReq); + } + + @Override + public String pollList(String com, String num, String phone) throws Exception { + QueryTrackReq queryTrackReq = new QueryTrackReq(); + QueryTrackParam queryTrackParam = new QueryTrackParam(); + queryTrackParam.setCom(com); + queryTrackParam.setNum(num); + queryTrackParam.setPhone(phone); + String param = new Gson().toJson(queryTrackParam); + queryTrackReq.setSign(SignUtils.querySign(param, key, customer)); + queryTrackReq.setCustomer(customer); + queryTrackReq.setParam(param); + IBaseClient baseClient = new QueryTrack(); + return baseClient.execute(queryTrackReq).getBody(); + } +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/OrderCancelServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/OrderCancelServiceImpl.java new file mode 100644 index 0000000..825afbb --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/OrderCancelServiceImpl.java @@ -0,0 +1,231 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.core.annotation.IgnoreTenant; +import com.gxwebsoft.shop.entity.*; +import com.gxwebsoft.shop.service.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; + +/** + * 订单取消服务实现 + * + * @author WebSoft + * @since 2025-01-26 + */ +@Slf4j +@Service +public class OrderCancelServiceImpl implements OrderCancelService { + + @Autowired + private ShopOrderService shopOrderService; + + @Autowired + private ShopOrderGoodsService shopOrderGoodsService; + + @Autowired + private ShopGoodsService shopGoodsService; + + @Autowired + private ShopGoodsSkuService shopGoodsSkuService; + + @Autowired + private CouponStatusService couponStatusService; + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean cancelOrder(ShopOrder order) { + try { + log.info("开始取消订单,订单号:{},订单ID:{}", order.getOrderNo(), order.getOrderId()); + + // 1. 检查订单状态 + if (order.getPayStatus() != null && order.getPayStatus()) { + log.warn("订单已支付,无法取消,订单号:{}", order.getOrderNo()); + return false; + } + + if (order.getOrderStatus() != null && order.getOrderStatus() != 0) { + log.warn("订单状态不是待支付,无法取消,订单号:{},当前状态:{}", order.getOrderNo(), order.getOrderStatus()); + return false; + } + + // 2. 更新订单状态为已取消 + order.setOrderStatus(2); // 2表示已取消 + order.setCancelTime(LocalDateTime.now()); + order.setCancelReason("系统自动取消(超时未支付)"); + + boolean updateSuccess = shopOrderService.updateById(order); + if (!updateSuccess) { + log.error("更新订单状态失败,订单号:{}", order.getOrderNo()); + return false; + } + + // 3. 回退库存 + boolean stockRestored = restoreOrderStock(order); + if (!stockRestored) { + log.error("回退库存失败,订单号:{}", order.getOrderNo()); + // 注意:这里不直接返回false,因为订单状态已经更新,需要记录错误但继续处理 + } + + // 4. 退还优惠券 + boolean couponReturned = returnOrderCoupon(order); + if (!couponReturned) { + log.error("退还优惠券失败,订单号:{}", order.getOrderNo()); + // 同样不直接返回false + } + + log.info("订单取消成功,订单号:{},库存回退:{},优惠券退还:{}", + order.getOrderNo(), stockRestored, couponReturned); + return true; + + } catch (Exception e) { + log.error("取消订单失败,订单号:{}", order.getOrderNo(), e); + throw e; // 重新抛出异常,触发事务回滚 + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public int batchCancelOrders(List orders) { + if (orders == null || orders.isEmpty()) { + return 0; + } + + int successCount = 0; + for (ShopOrder order : orders) { + try { + if (cancelOrder(order)) { + successCount++; + } + } catch (Exception e) { + log.error("批量取消订单时发生错误,订单号:{}", order.getOrderNo(), e); + // 继续处理下一个订单 + } + } + + log.info("批量取消订单完成,总数:{},成功:{}", orders.size(), successCount); + return successCount; + } + + @Override + @IgnoreTenant("定时任务需要查询所有租户的超时订单") + public List findExpiredUnpaidOrders(Integer timeoutMinutes, Integer batchSize) { + LocalDateTime expireTime = LocalDateTime.now().minusMinutes(timeoutMinutes); + + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .eq(ShopOrder::getPayStatus, false) // 未支付 + .eq(ShopOrder::getOrderStatus, 0) // 待支付状态 + .lt(ShopOrder::getCreateTime, expireTime) // 创建时间小于过期时间 + .orderByAsc(ShopOrder::getCreateTime) + .last("LIMIT " + batchSize); + + final List list = shopOrderService.list(queryWrapper); + System.out.println("定时任务需要查询所有租户的超时订单 list = " + list.size()); + return shopOrderService.list(queryWrapper); + } + + @Override + @IgnoreTenant("定时任务需要查询特定租户的超时订单") + public List findExpiredUnpaidOrdersByTenant(Integer tenantId, Integer timeoutMinutes, Integer batchSize) { + LocalDateTime expireTime = LocalDateTime.now().minusMinutes(timeoutMinutes); + + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .eq(ShopOrder::getTenantId, tenantId) + .eq(ShopOrder::getPayStatus, false) // 未支付 + .eq(ShopOrder::getOrderStatus, 0) // 待支付状态 + .lt(ShopOrder::getCreateTime, expireTime) // 创建时间小于过期时间 + .orderByAsc(ShopOrder::getCreateTime) + .last("LIMIT " + batchSize); + + return shopOrderService.list(queryWrapper); + } + + @Override + public boolean restoreOrderStock(ShopOrder order) { + try { + // 获取订单商品信息 + List orderGoods = shopOrderGoodsService.list( + new LambdaQueryWrapper() + .eq(ShopOrderGoods::getOrderId, order.getOrderId()) + ); + + if (orderGoods == null || orderGoods.isEmpty()) { + log.warn("订单没有商品信息,订单号:{}", order.getOrderNo()); + return true; // 没有商品信息也算成功 + } + + for (ShopOrderGoods orderGood : orderGoods) { + if (orderGood.getSkuId() != null && orderGood.getSkuId() > 0) { + // 多规格商品,恢复SKU库存 + restoreSkuStock(orderGood); + } else { + // 单规格商品,恢复商品库存 + restoreGoodsStock(orderGood); + } + } + + log.info("订单库存回退成功,订单号:{},商品数量:{}", order.getOrderNo(), orderGoods.size()); + return true; + + } catch (Exception e) { + log.error("回退订单库存失败,订单号:{}", order.getOrderNo(), e); + return false; + } + } + + @Override + public boolean returnOrderCoupon(ShopOrder order) { + try { + if (order.getCouponId() == null || order.getCouponId() <= 0) { + log.debug("订单未使用优惠券,订单号:{}", order.getOrderNo()); + return true; // 没有使用优惠券也算成功 + } + + boolean success = couponStatusService.returnCoupon(order.getOrderId()); + if (success) { + log.info("订单优惠券退还成功,订单号:{},优惠券ID:{}", order.getOrderNo(), order.getCouponId()); + } else { + log.warn("订单优惠券退还失败,订单号:{},优惠券ID:{}", order.getOrderNo(), order.getCouponId()); + } + return success; + + } catch (Exception e) { + log.error("退还订单优惠券失败,订单号:{}", order.getOrderNo(), e); + return false; + } + } + + /** + * 恢复SKU库存 + */ + private void restoreSkuStock(ShopOrderGoods orderGoods) { + ShopGoodsSku sku = shopGoodsSkuService.getById(orderGoods.getSkuId()); + if (sku != null) { + int newStock = (sku.getStock() != null ? sku.getStock() : 0) + orderGoods.getTotalNum(); + sku.setStock(newStock); + shopGoodsSkuService.updateById(sku); + log.debug("恢复SKU库存 - SKU ID:{},恢复数量:{},当前库存:{}", + orderGoods.getSkuId(), orderGoods.getTotalNum(), newStock); + } + } + + /** + * 恢复商品库存 + */ + private void restoreGoodsStock(ShopOrderGoods orderGoods) { + ShopGoods goods = shopGoodsService.getById(orderGoods.getGoodsId()); + if (goods != null) { + int newStock = (goods.getStock() != null ? goods.getStock() : 0) + orderGoods.getTotalNum(); + goods.setStock(newStock); + shopGoodsService.updateById(goods); + log.debug("恢复商品库存 - 商品ID:{},恢复数量:{},当前库存:{}", + orderGoods.getGoodsId(), orderGoods.getTotalNum(), newStock); + } + } +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopArticleServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopArticleServiceImpl.java new file mode 100644 index 0000000..9e49324 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopArticleServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopArticleMapper; +import com.gxwebsoft.shop.service.ShopArticleService; +import com.gxwebsoft.shop.entity.ShopArticle; +import com.gxwebsoft.shop.param.ShopArticleParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 商品文章Service实现 + * + * @author 科技小王子 + * @since 2025-08-13 05:14:53 + */ +@Service +public class ShopArticleServiceImpl extends ServiceImpl implements ShopArticleService { + + @Override + public PageResult pageRel(ShopArticleParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopArticleParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopArticle getByIdRel(Integer articleId) { + ShopArticleParam param = new ShopArticleParam(); + param.setArticleId(articleId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopBrandServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopBrandServiceImpl.java new file mode 100644 index 0000000..5037b55 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopBrandServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopBrandMapper; +import com.gxwebsoft.shop.service.ShopBrandService; +import com.gxwebsoft.shop.entity.ShopBrand; +import com.gxwebsoft.shop.param.ShopBrandParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 品牌Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Service +public class ShopBrandServiceImpl extends ServiceImpl implements ShopBrandService { + + @Override + public PageResult pageRel(ShopBrandParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopBrandParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopBrand getByIdRel(Integer brandId) { + ShopBrandParam param = new ShopBrandParam(); + param.setBrandId(brandId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopCartServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopCartServiceImpl.java new file mode 100644 index 0000000..12d6b3a --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopCartServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopCartMapper; +import com.gxwebsoft.shop.service.ShopCartService; +import com.gxwebsoft.shop.entity.ShopCart; +import com.gxwebsoft.shop.param.ShopCartParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 购物车Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Service +public class ShopCartServiceImpl extends ServiceImpl implements ShopCartService { + + @Override + public PageResult pageRel(ShopCartParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopCartParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopCart getByIdRel(Long id) { + ShopCartParam param = new ShopCartParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopCategoryServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopCategoryServiceImpl.java new file mode 100644 index 0000000..fbe60af --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopCategoryServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopCategoryMapper; +import com.gxwebsoft.shop.service.ShopCategoryService; +import com.gxwebsoft.shop.entity.ShopCategory; +import com.gxwebsoft.shop.param.ShopCategoryParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 商品分类Service实现 + * + * @author 科技小王子 + * @since 2025-04-24 20:52:13 + */ +@Service +public class ShopCategoryServiceImpl extends ServiceImpl implements ShopCategoryService { + + @Override + public PageResult pageRel(ShopCategoryParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopCategoryParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopCategory getByIdRel(Integer id) { + ShopCategoryParam param = new ShopCategoryParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopChatConversationServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopChatConversationServiceImpl.java new file mode 100644 index 0000000..e482f7e --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopChatConversationServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopChatConversationMapper; +import com.gxwebsoft.shop.service.ShopChatConversationService; +import com.gxwebsoft.shop.entity.ShopChatConversation; +import com.gxwebsoft.shop.param.ShopChatConversationParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 聊天消息表Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Service +public class ShopChatConversationServiceImpl extends ServiceImpl implements ShopChatConversationService { + + @Override + public PageResult pageRel(ShopChatConversationParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopChatConversationParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopChatConversation getByIdRel(Integer id) { + ShopChatConversationParam param = new ShopChatConversationParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopChatMessageServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopChatMessageServiceImpl.java new file mode 100644 index 0000000..ca50663 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopChatMessageServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopChatMessageMapper; +import com.gxwebsoft.shop.service.ShopChatMessageService; +import com.gxwebsoft.shop.entity.ShopChatMessage; +import com.gxwebsoft.shop.param.ShopChatMessageParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 聊天消息表Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Service +public class ShopChatMessageServiceImpl extends ServiceImpl implements ShopChatMessageService { + + @Override + public PageResult pageRel(ShopChatMessageParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopChatMessageParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopChatMessage getByIdRel(Integer id) { + ShopChatMessageParam param = new ShopChatMessageParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopCommissionRoleServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopCommissionRoleServiceImpl.java new file mode 100644 index 0000000..26823a0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopCommissionRoleServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopCommissionRoleMapper; +import com.gxwebsoft.shop.service.ShopCommissionRoleService; +import com.gxwebsoft.shop.entity.ShopCommissionRole; +import com.gxwebsoft.shop.param.ShopCommissionRoleParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 分红角色Service实现 + * + * @author 科技小王子 + * @since 2025-05-01 10:01:15 + */ +@Service +public class ShopCommissionRoleServiceImpl extends ServiceImpl implements ShopCommissionRoleService { + + @Override + public PageResult pageRel(ShopCommissionRoleParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopCommissionRoleParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopCommissionRole getByIdRel(Integer id) { + ShopCommissionRoleParam param = new ShopCommissionRoleParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopCommunityServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopCommunityServiceImpl.java new file mode 100644 index 0000000..1dac6cd --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopCommunityServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopCommunityMapper; +import com.gxwebsoft.shop.service.ShopCommunityService; +import com.gxwebsoft.shop.entity.ShopCommunity; +import com.gxwebsoft.shop.param.ShopCommunityParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 小区Service实现 + * + * @author 科技小王子 + * @since 2026-01-29 20:48:32 + */ +@Service +public class ShopCommunityServiceImpl extends ServiceImpl implements ShopCommunityService { + + @Override + public PageResult pageRel(ShopCommunityParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopCommunityParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopCommunity getByIdRel(Integer id) { + ShopCommunityParam param = new ShopCommunityParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopCountServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopCountServiceImpl.java new file mode 100644 index 0000000..51fa64d --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopCountServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopCountMapper; +import com.gxwebsoft.shop.service.ShopCountService; +import com.gxwebsoft.shop.entity.ShopCount; +import com.gxwebsoft.shop.param.ShopCountParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 商城销售统计表Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Service +public class ShopCountServiceImpl extends ServiceImpl implements ShopCountService { + + @Override + public PageResult pageRel(ShopCountParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopCountParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopCount getByIdRel(Integer id) { + ShopCountParam param = new ShopCountParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponApplyCateServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponApplyCateServiceImpl.java new file mode 100644 index 0000000..c613194 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponApplyCateServiceImpl.java @@ -0,0 +1,56 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopCouponApplyCateMapper; +import com.gxwebsoft.shop.service.ShopCouponApplyCateService; +import com.gxwebsoft.shop.entity.ShopCouponApplyCate; +import com.gxwebsoft.shop.param.ShopCouponApplyCateParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 优惠券可用分类Service实现 + * + * @author 科技小王子 + * @since 2025-08-11 12:47:49 + */ +@Service +public class ShopCouponApplyCateServiceImpl extends ServiceImpl implements ShopCouponApplyCateService { + + @Override + public PageResult pageRel(ShopCouponApplyCateParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopCouponApplyCateParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopCouponApplyCate getByIdRel(Integer id) { + ShopCouponApplyCateParam param = new ShopCouponApplyCateParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public void removeByCouponId(Integer couponId) { + remove( + new LambdaQueryWrapper() + .eq(ShopCouponApplyCate::getCouponId, couponId) + ); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponApplyItemServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponApplyItemServiceImpl.java new file mode 100644 index 0000000..6baa5ea --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponApplyItemServiceImpl.java @@ -0,0 +1,56 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopCouponApplyItemMapper; +import com.gxwebsoft.shop.service.ShopCouponApplyItemService; +import com.gxwebsoft.shop.entity.ShopCouponApplyItem; +import com.gxwebsoft.shop.param.ShopCouponApplyItemParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 优惠券可用分类Service实现 + * + * @author 科技小王子 + * @since 2025-08-11 12:47:49 + */ +@Service +public class ShopCouponApplyItemServiceImpl extends ServiceImpl implements ShopCouponApplyItemService { + + @Override + public PageResult pageRel(ShopCouponApplyItemParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopCouponApplyItemParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopCouponApplyItem getByIdRel(Integer id) { + ShopCouponApplyItemParam param = new ShopCouponApplyItemParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public void removeByCouponId(Integer couponId) { + remove( + new LambdaQueryWrapper() + .eq(ShopCouponApplyItem::getCouponId, couponId) + ); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponServiceImpl.java new file mode 100644 index 0000000..29a17a3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponServiceImpl.java @@ -0,0 +1,71 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.entity.ShopCouponApplyCate; +import com.gxwebsoft.shop.entity.ShopCouponApplyItem; +import com.gxwebsoft.shop.mapper.ShopCouponMapper; +import com.gxwebsoft.shop.service.ShopCouponApplyCateService; +import com.gxwebsoft.shop.service.ShopCouponApplyItemService; +import com.gxwebsoft.shop.service.ShopCouponService; +import com.gxwebsoft.shop.entity.ShopCoupon; +import com.gxwebsoft.shop.param.ShopCouponParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 优惠券Service实现 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:23 + */ +@Service +public class ShopCouponServiceImpl extends ServiceImpl implements ShopCouponService { + @Resource + private ShopCouponApplyItemService couponApplyItemService; + @Resource + private ShopCouponApplyCateService couponApplyCateService; + + @Override + public PageResult pageRel(ShopCouponParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + for (ShopCoupon coupon : list) { + coupon.setCouponApplyCateList( + couponApplyCateService.list( + new LambdaQueryWrapper() + .eq(ShopCouponApplyCate::getCouponId, coupon.getId()) + ) + ); + coupon.setCouponApplyItemList( + couponApplyItemService.list( + new LambdaQueryWrapper() + .eq(ShopCouponApplyItem::getCouponId, coupon.getId()) + ) + ); + } + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopCouponParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopCoupon getByIdRel(Integer id) { + ShopCouponParam param = new ShopCouponParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerApplyServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerApplyServiceImpl.java new file mode 100644 index 0000000..ab445bf --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerApplyServiceImpl.java @@ -0,0 +1,62 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopDealerApplyMapper; +import com.gxwebsoft.shop.service.ShopDealerApplyService; +import com.gxwebsoft.shop.entity.ShopDealerApply; +import com.gxwebsoft.shop.param.ShopDealerApplyParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 分销商申请记录表Service实现 + * + * @author 科技小王子 + * @since 2025-08-11 23:50:18 + */ +@Service +public class ShopDealerApplyServiceImpl extends ServiceImpl implements ShopDealerApplyService { + + @Override + public PageResult pageRel(ShopDealerApplyParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopDealerApplyParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopDealerApply getByIdRel(Integer id) { + ShopDealerApplyParam param = new ShopDealerApplyParam(); + param.setApplyId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public ShopDealerApply getByUserIdRel(Integer userId) { + ShopDealerApplyParam param = new ShopDealerApplyParam(); + param.setUserId(userId); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public ShopDealerApply getByDealerNameRel(String dealerName) { + ShopDealerApplyParam param = new ShopDealerApplyParam(); + param.setDealerName(dealerName); + param.setType(4); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerBankServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerBankServiceImpl.java new file mode 100644 index 0000000..edc77c3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerBankServiceImpl.java @@ -0,0 +1,58 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopDealerBank; +import com.gxwebsoft.shop.mapper.ShopDealerBankMapper; +import com.gxwebsoft.shop.param.ShopDealerBankParam; +import com.gxwebsoft.shop.service.ShopDealerBankService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 分销商提现银行卡Service实现 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Service +public class ShopDealerBankServiceImpl extends ServiceImpl implements ShopDealerBankService { + + @Override + public PageResult pageRel(ShopDealerBankParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("is_default desc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopDealerBankParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("is_default desc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopDealerBank getByIdRel(Integer id) { + ShopDealerBankParam param = new ShopDealerBankParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public ShopDealerBank getDefaultBank(Integer userId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ShopDealerBank::getUserId, userId) + .eq(ShopDealerBank::getIsDefault, true) + .orderByDesc(ShopDealerBank::getCreateTime) + .last("LIMIT 1"); + return getOne(wrapper); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerCapitalServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerCapitalServiceImpl.java new file mode 100644 index 0000000..897fbed --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerCapitalServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopDealerCapitalMapper; +import com.gxwebsoft.shop.service.ShopDealerCapitalService; +import com.gxwebsoft.shop.entity.ShopDealerCapital; +import com.gxwebsoft.shop.param.ShopDealerCapitalParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 分销商资金明细表Service实现 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Service +public class ShopDealerCapitalServiceImpl extends ServiceImpl implements ShopDealerCapitalService { + + @Override + public PageResult pageRel(ShopDealerCapitalParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopDealerCapitalParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopDealerCapital getByIdRel(Integer id) { + ShopDealerCapitalParam param = new ShopDealerCapitalParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerOrderServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerOrderServiceImpl.java new file mode 100644 index 0000000..0bab68f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerOrderServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopDealerOrderMapper; +import com.gxwebsoft.shop.service.ShopDealerOrderService; +import com.gxwebsoft.shop.entity.ShopDealerOrder; +import com.gxwebsoft.shop.param.ShopDealerOrderParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 分销商订单记录表Service实现 + * + * @author 科技小王子 + * @since 2025-08-12 11:55:18 + */ +@Service +public class ShopDealerOrderServiceImpl extends ServiceImpl implements ShopDealerOrderService { + + @Override + public PageResult pageRel(ShopDealerOrderParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopDealerOrderParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopDealerOrder getByIdRel(Integer id) { + ShopDealerOrderParam param = new ShopDealerOrderParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerRecordServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerRecordServiceImpl.java new file mode 100644 index 0000000..1b875e7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerRecordServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopDealerRecord; +import com.gxwebsoft.shop.mapper.ShopDealerRecordMapper; +import com.gxwebsoft.shop.param.ShopDealerRecordParam; +import com.gxwebsoft.shop.service.ShopDealerRecordService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 客户跟进情况Service实现 + * + * @author 科技小王子 + * @since 2025-10-02 12:21:50 + */ +@Service +public class ShopDealerRecordServiceImpl extends ServiceImpl implements ShopDealerRecordService { + + @Override + public PageResult pageRel(ShopDealerRecordParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopDealerRecordParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopDealerRecord getByIdRel(Integer id) { + ShopDealerRecordParam param = new ShopDealerRecordParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerRefereeServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerRefereeServiceImpl.java new file mode 100644 index 0000000..f2fa821 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerRefereeServiceImpl.java @@ -0,0 +1,124 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.exception.BusinessException; +import com.gxwebsoft.shop.mapper.ShopDealerRefereeMapper; +import com.gxwebsoft.shop.entity.ShopDealerUser; +import com.gxwebsoft.shop.service.ShopDealerUserService; +import com.gxwebsoft.shop.service.ShopDealerRefereeService; +import com.gxwebsoft.shop.entity.ShopDealerReferee; +import com.gxwebsoft.shop.param.ShopDealerRefereeParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.dao.DataIntegrityViolationException; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.List; + +/** + * 分销商推荐关系表Service实现 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Service +public class ShopDealerRefereeServiceImpl extends ServiceImpl implements ShopDealerRefereeService { + + @Resource + private ShopDealerUserService shopDealerUserService; + + @Override + public PageResult pageRel(ShopDealerRefereeParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopDealerRefereeParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopDealerReferee getByIdRel(Integer id) { + ShopDealerRefereeParam param = new ShopDealerRefereeParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public ShopDealerReferee getByUserIdRel(Integer userId) { + ShopDealerRefereeParam param = new ShopDealerRefereeParam(); + param.setUserId(userId); + param.setLevel(1); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean bindFirstLevel(Integer dealerId, Integer userId, Integer tenantId, String source, String scene) { + if (dealerId == null || dealerId <= 0) { + throw new BusinessException("dealerId不能为空"); + } + if (userId == null || userId <= 0) { + throw new BusinessException("userId不能为空"); + } + if (tenantId == null || tenantId <= 0) { + throw new BusinessException("TenantId不能为空"); + } + if (dealerId.equals(userId)) { + throw new BusinessException("禁止绑定自己"); + } + + // 已绑定则直接返回(幂等,不改绑) + ShopDealerReferee existed = getOne(new LambdaQueryWrapper() + .eq(ShopDealerReferee::getTenantId, tenantId) + .eq(ShopDealerReferee::getUserId, userId) + .eq(ShopDealerReferee::getLevel, 1) + .last("limit 1")); + if (existed != null) { + return false; + } + + // 校验邀请人(分销商)存在且有效 + ShopDealerUser dealerUser = shopDealerUserService.getOne(new LambdaQueryWrapper() + .eq(ShopDealerUser::getTenantId, tenantId) + .eq(ShopDealerUser::getUserId, dealerId) + .eq(ShopDealerUser::getIsDelete, 0) + .last("limit 1")); + if (dealerUser == null) { + throw new BusinessException("邀请人不存在或已失效"); + } + + LocalDateTime now = LocalDateTime.now(); + ShopDealerReferee entity = new ShopDealerReferee(); + entity.setDealerId(dealerId); + entity.setUserId(userId); + entity.setLevel(1); + entity.setTenantId(tenantId); + entity.setSource(source); + entity.setScene(scene); + entity.setCreateTime(now); + entity.setUpdateTime(now); + + try { + // 并发下依赖唯一索引保证幂等;重复写入视为已绑定 + return save(entity); + } catch (DuplicateKeyException e) { + return false; + } catch (DataIntegrityViolationException e) { + return false; + } + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerSettingServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerSettingServiceImpl.java new file mode 100644 index 0000000..dcab483 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerSettingServiceImpl.java @@ -0,0 +1,66 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopDealerSettingMapper; +import com.gxwebsoft.shop.service.ShopDealerSettingService; +import com.gxwebsoft.shop.entity.ShopDealerSetting; +import com.gxwebsoft.shop.param.ShopDealerSettingParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.springframework.stereotype.Service; + +import java.util.Comparator; +import java.util.List; + +/** + * 分销商设置表Service实现 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Service +public class ShopDealerSettingServiceImpl extends ServiceImpl implements ShopDealerSettingService { + + @Override + public PageResult pageRel(ShopDealerSettingParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("update_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopDealerSettingParam param) { + List list = baseMapper.selectListRel(param); + if (list == null || list.size() < 2) { + return list; + } + list.sort(Comparator.comparing( + ShopDealerSetting::getUpdateTime, + Comparator.nullsLast(Integer::compareTo) + ).reversed()); + return list; + } + + @Override + public ShopDealerSetting getByIdRel(String key) { + ShopDealerSettingParam param = new ShopDealerSettingParam(); + param.setKey(key); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public boolean saveOrUpdateByKey(ShopDealerSetting setting) { + if (setting == null || setting.getKey() == null) { + return false; + } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ShopDealerSetting::getKey, setting.getKey()); + if (setting.getTenantId() != null) { + wrapper.eq(ShopDealerSetting::getTenantId, setting.getTenantId()); + } + return this.saveOrUpdate(setting, wrapper); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerUserServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerUserServiceImpl.java new file mode 100644 index 0000000..a5767d3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerUserServiceImpl.java @@ -0,0 +1,61 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopDealerUserMapper; +import com.gxwebsoft.shop.service.ShopDealerUserService; +import com.gxwebsoft.shop.entity.ShopDealerUser; +import com.gxwebsoft.shop.param.ShopDealerUserParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 分销商用户记录表Service实现 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Service +public class ShopDealerUserServiceImpl extends ServiceImpl implements ShopDealerUserService { + + @Override + public PageResult pageRel(ShopDealerUserParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopDealerUserParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopDealerUser getByIdRel(Integer id) { + ShopDealerUserParam param = new ShopDealerUserParam(); + param.setUserId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public ShopDealerUser getByUserIdRel(Integer userId) { + ShopDealerUserParam param = new ShopDealerUserParam(); + param.setUserId(userId); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public boolean updateByUserId(ShopDealerUser shopDealerUser) { + final int update = baseMapper.update(shopDealerUser, new LambdaQueryWrapper().eq(ShopDealerUser::getUserId, shopDealerUser.getUserId())); + return update > 0; + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerWithdrawServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerWithdrawServiceImpl.java new file mode 100644 index 0000000..9748034 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerWithdrawServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopDealerWithdrawMapper; +import com.gxwebsoft.shop.service.ShopDealerWithdrawService; +import com.gxwebsoft.shop.entity.ShopDealerWithdraw; +import com.gxwebsoft.shop.param.ShopDealerWithdrawParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 分销商提现明细表Service实现 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Service +public class ShopDealerWithdrawServiceImpl extends ServiceImpl implements ShopDealerWithdrawService { + + @Override + public PageResult pageRel(ShopDealerWithdrawParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopDealerWithdrawParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopDealerWithdraw getByIdRel(Integer id) { + ShopDealerWithdrawParam param = new ShopDealerWithdrawParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopExpressServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopExpressServiceImpl.java new file mode 100644 index 0000000..1a7cdbc --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopExpressServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopExpressMapper; +import com.gxwebsoft.shop.service.ShopExpressService; +import com.gxwebsoft.shop.entity.ShopExpress; +import com.gxwebsoft.shop.param.ShopExpressParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 物流公司Service实现 + * + * @author 科技小王子 + * @since 2025-08-12 12:07:03 + */ +@Service +public class ShopExpressServiceImpl extends ServiceImpl implements ShopExpressService { + + @Override + public PageResult pageRel(ShopExpressParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopExpressParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopExpress getByIdRel(Integer expressId) { + ShopExpressParam param = new ShopExpressParam(); + param.setExpressId(expressId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopExpressTemplateDetailServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopExpressTemplateDetailServiceImpl.java new file mode 100644 index 0000000..2c5ea8b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopExpressTemplateDetailServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopExpressTemplateDetailMapper; +import com.gxwebsoft.shop.service.ShopExpressTemplateDetailService; +import com.gxwebsoft.shop.entity.ShopExpressTemplateDetail; +import com.gxwebsoft.shop.param.ShopExpressTemplateDetailParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 运费模板Service实现 + * + * @author 科技小王子 + * @since 2025-08-12 12:07:03 + */ +@Service +public class ShopExpressTemplateDetailServiceImpl extends ServiceImpl implements ShopExpressTemplateDetailService { + + @Override + public PageResult pageRel(ShopExpressTemplateDetailParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopExpressTemplateDetailParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopExpressTemplateDetail getByIdRel(Integer id) { + ShopExpressTemplateDetailParam param = new ShopExpressTemplateDetailParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopExpressTemplateServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopExpressTemplateServiceImpl.java new file mode 100644 index 0000000..1858d49 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopExpressTemplateServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopExpressTemplateMapper; +import com.gxwebsoft.shop.service.ShopExpressTemplateService; +import com.gxwebsoft.shop.entity.ShopExpressTemplate; +import com.gxwebsoft.shop.param.ShopExpressTemplateParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 运费模板Service实现 + * + * @author 科技小王子 + * @since 2025-08-12 12:07:03 + */ +@Service +public class ShopExpressTemplateServiceImpl extends ServiceImpl implements ShopExpressTemplateService { + + @Override + public PageResult pageRel(ShopExpressTemplateParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopExpressTemplateParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopExpressTemplate getByIdRel(Integer id) { + ShopExpressTemplateParam param = new ShopExpressTemplateParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopGiftServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGiftServiceImpl.java new file mode 100644 index 0000000..55a067e --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGiftServiceImpl.java @@ -0,0 +1,71 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.entity.ShopGoods; +import com.gxwebsoft.shop.mapper.ShopGiftMapper; +import com.gxwebsoft.shop.service.ShopGiftService; +import com.gxwebsoft.shop.entity.ShopGift; +import com.gxwebsoft.shop.param.ShopGiftParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.service.ShopGoodsService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 礼品卡Service实现 + * + * @author 科技小王子 + * @since 2025-08-11 18:07:31 + */ +@Service +public class ShopGiftServiceImpl extends ServiceImpl implements ShopGiftService { + @Resource + private ShopGoodsService shopGoodsService; + + @Override + public PageResult pageRel(ShopGiftParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + if (!list.isEmpty()) { + Set goodsIds = list.stream().map(ShopGift::getGoodsId).collect(Collectors.toSet()); + List goodsList = shopGoodsService.listByIds(goodsIds); + for (ShopGift shopGift : list) { + ShopGoods shopGoods = goodsList.stream().filter(sG -> sG.getGoodsId().equals(shopGift.getGoodsId())).findFirst().orElse(null); + if (shopGoods != null) { + shopGift.setGoods(shopGoods); + } + } + } + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopGiftParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopGift getByIdRel(Integer id) { + ShopGiftParam param = new ShopGiftParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public ShopGift getByCode(String code) { + ShopGiftParam param = new ShopGiftParam(); + param.setCode(code); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsCategoryServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsCategoryServiceImpl.java new file mode 100644 index 0000000..170ab88 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsCategoryServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopGoodsCategoryMapper; +import com.gxwebsoft.shop.service.ShopGoodsCategoryService; +import com.gxwebsoft.shop.entity.ShopGoodsCategory; +import com.gxwebsoft.shop.param.ShopGoodsCategoryParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 商品分类Service实现 + * + * @author 科技小王子 + * @since 2025-05-01 00:36:45 + */ +@Service +public class ShopGoodsCategoryServiceImpl extends ServiceImpl implements ShopGoodsCategoryService { + + @Override + public PageResult pageRel(ShopGoodsCategoryParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopGoodsCategoryParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopGoodsCategory getByIdRel(Integer categoryId) { + ShopGoodsCategoryParam param = new ShopGoodsCategoryParam(); + param.setCategoryId(categoryId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsCommentServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsCommentServiceImpl.java new file mode 100644 index 0000000..7f203bd --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsCommentServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopGoodsCommentMapper; +import com.gxwebsoft.shop.service.ShopGoodsCommentService; +import com.gxwebsoft.shop.entity.ShopGoodsComment; +import com.gxwebsoft.shop.param.ShopGoodsCommentParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 评论表Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Service +public class ShopGoodsCommentServiceImpl extends ServiceImpl implements ShopGoodsCommentService { + + @Override + public PageResult pageRel(ShopGoodsCommentParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopGoodsCommentParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopGoodsComment getByIdRel(Integer id) { + ShopGoodsCommentParam param = new ShopGoodsCommentParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsIncomeConfigServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsIncomeConfigServiceImpl.java new file mode 100644 index 0000000..d4ca36e --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsIncomeConfigServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopGoodsIncomeConfigMapper; +import com.gxwebsoft.shop.service.ShopGoodsIncomeConfigService; +import com.gxwebsoft.shop.entity.ShopGoodsIncomeConfig; +import com.gxwebsoft.shop.param.ShopGoodsIncomeConfigParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 分润配置Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Service +public class ShopGoodsIncomeConfigServiceImpl extends ServiceImpl implements ShopGoodsIncomeConfigService { + + @Override + public PageResult pageRel(ShopGoodsIncomeConfigParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopGoodsIncomeConfigParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopGoodsIncomeConfig getByIdRel(Integer id) { + ShopGoodsIncomeConfigParam param = new ShopGoodsIncomeConfigParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsLogServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsLogServiceImpl.java new file mode 100644 index 0000000..0e2e46f --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsLogServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopGoodsLogMapper; +import com.gxwebsoft.shop.service.ShopGoodsLogService; +import com.gxwebsoft.shop.entity.ShopGoodsLog; +import com.gxwebsoft.shop.param.ShopGoodsLogParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 商品日志表Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Service +public class ShopGoodsLogServiceImpl extends ServiceImpl implements ShopGoodsLogService { + + @Override + public PageResult pageRel(ShopGoodsLogParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopGoodsLogParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopGoodsLog getByIdRel(Integer id) { + ShopGoodsLogParam param = new ShopGoodsLogParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsRelationServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsRelationServiceImpl.java new file mode 100644 index 0000000..eaf1166 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsRelationServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopGoodsRelationMapper; +import com.gxwebsoft.shop.service.ShopGoodsRelationService; +import com.gxwebsoft.shop.entity.ShopGoodsRelation; +import com.gxwebsoft.shop.param.ShopGoodsRelationParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 商品点赞和收藏表Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Service +public class ShopGoodsRelationServiceImpl extends ServiceImpl implements ShopGoodsRelationService { + + @Override + public PageResult pageRel(ShopGoodsRelationParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopGoodsRelationParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopGoodsRelation getByIdRel(Integer id) { + ShopGoodsRelationParam param = new ShopGoodsRelationParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsRoleCommissionServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsRoleCommissionServiceImpl.java new file mode 100644 index 0000000..95a72cc --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsRoleCommissionServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopGoodsRoleCommissionMapper; +import com.gxwebsoft.shop.service.ShopGoodsRoleCommissionService; +import com.gxwebsoft.shop.entity.ShopGoodsRoleCommission; +import com.gxwebsoft.shop.param.ShopGoodsRoleCommissionParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 商品绑定角色的分润金额Service实现 + * + * @author 科技小王子 + * @since 2025-05-01 09:53:38 + */ +@Service +public class ShopGoodsRoleCommissionServiceImpl extends ServiceImpl implements ShopGoodsRoleCommissionService { + + @Override + public PageResult pageRel(ShopGoodsRoleCommissionParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopGoodsRoleCommissionParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopGoodsRoleCommission getByIdRel(Integer id) { + ShopGoodsRoleCommissionParam param = new ShopGoodsRoleCommissionParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsServiceImpl.java new file mode 100644 index 0000000..4984d72 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsServiceImpl.java @@ -0,0 +1,75 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopGoodsMapper; +import com.gxwebsoft.shop.service.ShopGoodsService; +import com.gxwebsoft.shop.entity.ShopGoods; +import com.gxwebsoft.shop.param.ShopGoodsParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; +import lombok.extern.slf4j.Slf4j; + +import java.util.List; + +/** + * 商品Service实现 + * + * @author 科技小王子 + * @since 2025-04-24 20:52:13 + */ +@Slf4j +@Service +public class ShopGoodsServiceImpl extends ServiceImpl implements ShopGoodsService { + + @Override + public PageResult pageRel(ShopGoodsParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopGoodsParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopGoods getByIdRel(Integer goodsId) { + ShopGoodsParam param = new ShopGoodsParam(); + param.setGoodsId(goodsId); + return param.getOne(baseMapper.selectListRel(param)); + } + + @InterceptorIgnore(tenantLine = "true") + @Override + public boolean addSaleCount(Integer goodsId, Integer saleCount) { + try { + if (goodsId == null || saleCount == null || saleCount <= 0) { + log.warn("累加商品销量参数无效 - 商品ID: {}, 销量: {}", goodsId, saleCount); + return false; + } + + int affectedRows = baseMapper.addSaleCount(goodsId, saleCount); + boolean success = affectedRows > 0; + + if (success) { + log.info("商品销量累加成功 - 商品ID: {}, 累加数量: {}, 影响行数: {}", goodsId, saleCount, affectedRows); + } else { + log.warn("商品销量累加失败 - 商品ID: {}, 累加数量: {}, 影响行数: {}", goodsId, saleCount, affectedRows); + } + + return success; + } catch (Exception e) { + log.error("累加商品销量异常 - 商品ID: {}, 累加数量: {}", goodsId, saleCount, e); + return false; + } + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsSkuServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsSkuServiceImpl.java new file mode 100644 index 0000000..cc1739b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsSkuServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopGoodsSkuMapper; +import com.gxwebsoft.shop.service.ShopGoodsSkuService; +import com.gxwebsoft.shop.entity.ShopGoodsSku; +import com.gxwebsoft.shop.param.ShopGoodsSkuParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 商品sku列表Service实现 + * + * @author 科技小王子 + * @since 2025-05-01 09:43:31 + */ +@Service +public class ShopGoodsSkuServiceImpl extends ServiceImpl implements ShopGoodsSkuService { + + @Override + public PageResult pageRel(ShopGoodsSkuParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopGoodsSkuParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopGoodsSku getByIdRel(Integer id) { + ShopGoodsSkuParam param = new ShopGoodsSkuParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsSpecServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsSpecServiceImpl.java new file mode 100644 index 0000000..812a5b3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsSpecServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopGoodsSpecMapper; +import com.gxwebsoft.shop.service.ShopGoodsSpecService; +import com.gxwebsoft.shop.entity.ShopGoodsSpec; +import com.gxwebsoft.shop.param.ShopGoodsSpecParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 商品多规格Service实现 + * + * @author 科技小王子 + * @since 2025-05-01 09:43:31 + */ +@Service +public class ShopGoodsSpecServiceImpl extends ServiceImpl implements ShopGoodsSpecService { + + @Override + public PageResult pageRel(ShopGoodsSpecParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopGoodsSpecParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopGoodsSpec getByIdRel(Integer id) { + ShopGoodsSpecParam param = new ShopGoodsSpecParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantAccountServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantAccountServiceImpl.java new file mode 100644 index 0000000..6d39658 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantAccountServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopMerchantAccountMapper; +import com.gxwebsoft.shop.service.ShopMerchantAccountService; +import com.gxwebsoft.shop.entity.ShopMerchantAccount; +import com.gxwebsoft.shop.param.ShopMerchantAccountParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 商户账号Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Service +public class ShopMerchantAccountServiceImpl extends ServiceImpl implements ShopMerchantAccountService { + + @Override + public PageResult pageRel(ShopMerchantAccountParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopMerchantAccountParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopMerchantAccount getByIdRel(Integer id) { + ShopMerchantAccountParam param = new ShopMerchantAccountParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantApplyServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantApplyServiceImpl.java new file mode 100644 index 0000000..becb4aa --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantApplyServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopMerchantApplyMapper; +import com.gxwebsoft.shop.service.ShopMerchantApplyService; +import com.gxwebsoft.shop.entity.ShopMerchantApply; +import com.gxwebsoft.shop.param.ShopMerchantApplyParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 商户入驻申请Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Service +public class ShopMerchantApplyServiceImpl extends ServiceImpl implements ShopMerchantApplyService { + + @Override + public PageResult pageRel(ShopMerchantApplyParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopMerchantApplyParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopMerchantApply getByIdRel(Integer applyId) { + ShopMerchantApplyParam param = new ShopMerchantApplyParam(); + param.setApplyId(applyId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantServiceImpl.java new file mode 100644 index 0000000..9fb3e73 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopMerchantMapper; +import com.gxwebsoft.shop.service.ShopMerchantService; +import com.gxwebsoft.shop.entity.ShopMerchant; +import com.gxwebsoft.shop.param.ShopMerchantParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 商户Service实现 + * + * @author 科技小王子 + * @since 2025-08-10 20:43:33 + */ +@Service +public class ShopMerchantServiceImpl extends ServiceImpl implements ShopMerchantService { + + @Override + public PageResult pageRel(ShopMerchantParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopMerchantParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopMerchant getByIdRel(Long merchantId) { + ShopMerchantParam param = new ShopMerchantParam(); + param.setMerchantId(merchantId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantTypeServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantTypeServiceImpl.java new file mode 100644 index 0000000..38c87cd --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantTypeServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopMerchantTypeMapper; +import com.gxwebsoft.shop.service.ShopMerchantTypeService; +import com.gxwebsoft.shop.entity.ShopMerchantType; +import com.gxwebsoft.shop.param.ShopMerchantTypeParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 商户类型Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Service +public class ShopMerchantTypeServiceImpl extends ServiceImpl implements ShopMerchantTypeService { + + @Override + public PageResult pageRel(ShopMerchantTypeParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopMerchantTypeParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopMerchantType getByIdRel(Integer id) { + ShopMerchantTypeParam param = new ShopMerchantTypeParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderDeliveryGoodsServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderDeliveryGoodsServiceImpl.java new file mode 100644 index 0000000..c48c23a --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderDeliveryGoodsServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopOrderDeliveryGoodsMapper; +import com.gxwebsoft.shop.service.ShopOrderDeliveryGoodsService; +import com.gxwebsoft.shop.entity.ShopOrderDeliveryGoods; +import com.gxwebsoft.shop.param.ShopOrderDeliveryGoodsParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 发货单商品Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Service +public class ShopOrderDeliveryGoodsServiceImpl extends ServiceImpl implements ShopOrderDeliveryGoodsService { + + @Override + public PageResult pageRel(ShopOrderDeliveryGoodsParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopOrderDeliveryGoodsParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopOrderDeliveryGoods getByIdRel(Integer id) { + ShopOrderDeliveryGoodsParam param = new ShopOrderDeliveryGoodsParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderDeliveryServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderDeliveryServiceImpl.java new file mode 100644 index 0000000..41cd996 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderDeliveryServiceImpl.java @@ -0,0 +1,164 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.utils.JSONUtil; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.shop.entity.*; +import com.gxwebsoft.shop.mapper.ShopOrderDeliveryMapper; +import com.gxwebsoft.shop.service.*; +import com.gxwebsoft.shop.param.ShopOrderDeliveryParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.kuaidi100.sdk.pojo.HttpResult; +import com.kuaidi100.sdk.request.BOrderReq; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 发货单Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Service +public class ShopOrderDeliveryServiceImpl extends ServiceImpl implements ShopOrderDeliveryService { + @Resource + private ShopExpressService expressService; + @Resource + private KuaiDi100Impl kuaiDi100; + @Resource + private ShopOrderService shopOrderService; + @Resource + private ShopOrderGoodsService shopOrderGoodsService; + @Resource + private ShopGoodsService shopGoodsService; + @Resource + private ShopUserAddressService shopUserAddressService; + + @Override + public PageResult pageRel(ShopOrderDeliveryParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopOrderDeliveryParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopOrderDelivery getByIdRel(Integer deliveryId) { + ShopOrderDeliveryParam param = new ShopOrderDeliveryParam(); + param.setDeliveryId(deliveryId); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public ShopOrderDelivery getByOrderId(Integer orderId) { + return getOne( + new LambdaQueryWrapper() + .eq(ShopOrderDelivery::getOrderId, orderId) + .last("limit 1") + ); + } + + @Override + public Map setExpress(User user, ShopOrderDelivery orderDelivery, ShopOrder order) throws Exception { + ShopExpress express = expressService.getByIdRel(orderDelivery.getExpressId()); + ShopUserAddress userAddress = shopUserAddressService.getByIdRel(order.getAddressId()); + + BOrderReq bOrderReq = new BOrderReq(); + bOrderReq.setKuaidicom(express.getKuaidi100Code()); + bOrderReq.setSendManName(orderDelivery.getSendName()); + bOrderReq.setSendManMobile(orderDelivery.getSendPhone()); + bOrderReq.setSendManPrintAddr(order.getSendAddress()); + bOrderReq.setRecManName(userAddress.getName()); + bOrderReq.setRecManMobile(userAddress.getPhone()); + bOrderReq.setRecManPrintAddr(order.getAddress()); + bOrderReq.setCallBackUrl("https://cms-api.websoft.top/api/shop/order-delivery/notify"); + HttpResult res = kuaiDi100.border(bOrderReq); + if (res.getStatus() != 200) return new HashMap<>() {{ + put("res", false); + put("msg", "快递100接口异常"); + }}; + KuaiDi100Resp kuaiDi100Resp = JSONUtil.parseObject(res.getBody(), KuaiDi100Resp.class); + if (kuaiDi100Resp == null) return new HashMap<>() {{ + put("res", false); + put("msg", "快递100接口异常"); + }}; + + if (!kuaiDi100Resp.getResult()) + return new HashMap<>() {{ + put("res", false); + put("msg", kuaiDi100Resp.getMessage()); + }}; + Map bOrderData = (Map) kuaiDi100Resp.getData(); + orderDelivery.setExpressNo((String) bOrderData.get("kuaidinum")); + if (updateById(orderDelivery)) { + order.setDeliveryStatus(20); + order.setDeliveryTime(LocalDateTime.now()); + shopOrderService.updateById(order); + + if (order.getPayType().equals(1)) { + List orderGoodsList = shopOrderGoodsService.getListByOrderId(order.getOrderId()); + // 上传小程序发货信息 +// WxMaOrderShippingInfoUploadRequest uploadRequest = new WxMaOrderShippingInfoUploadRequest(); +// uploadRequest.setLogisticsType(1); +// uploadRequest.setDeliveryMode(1); +// +// OrderKeyBean orderKeyBean = new OrderKeyBean(); +// orderKeyBean.setOrderNumberType(2); +// orderKeyBean.setTransactionId(order.getTransactionId()); +// uploadRequest.setOrderKey(orderKeyBean); +// +// List shippingList = new ArrayList<>(); +// ShippingListBean shippingListBean = new ShippingListBean(); +// shippingListBean.setTrackingNo((String) bOrderData.get("kuaidinum")); +// shippingListBean.setExpressCompany(express.getWxCode()); +// ContactBean contactBean = new ContactBean(); +// contactBean.setReceiverContact(user.getMobile()); +// shippingListBean.setContact(contactBean); +// +// ShopGoods shopGoods = shopGoodsService.getById(orderGoodsList.get(0).getGoodsId()); +// +// String itemDesc = shopGoods.getName(); +// if (orderGoodsList.size() > 1) itemDesc += "等" + orderGoodsList.size() + "件商品"; +// shippingListBean.setItemDesc(itemDesc); +// shippingList.add(shippingListBean); +// uploadRequest.setShippingList(shippingList); +// +// uploadRequest.setUploadTime(new DateTime().toString(DatePattern.UTC_WITH_ZONE_OFFSET_PATTERN)); +// +// PayerBean payerBean = new PayerBean(); +// +// payerBean.setOpenid(user.getOpenid()); +// uploadRequest.setPayer(payerBean); +// +// WxMaService wxMaService = weChatController.wxMaService(); +// WxMaOrderShippingService wxMaOrderShippingService = new WxMaOrderShippingServiceImpl(wxMaService); +// WxMaOrderShippingInfoBaseResponse response = wxMaOrderShippingService.upload(uploadRequest); +// System.out.println("response" + response); + } + return new HashMap<>() {{ + put("res", true); + put("msg", "操作成功"); + }}; + } + return new HashMap<>() {{ + put("res", false); + put("msg", "未知错误"); + }}; + } +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderExtractServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderExtractServiceImpl.java new file mode 100644 index 0000000..91cfdab --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderExtractServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopOrderExtractMapper; +import com.gxwebsoft.shop.service.ShopOrderExtractService; +import com.gxwebsoft.shop.entity.ShopOrderExtract; +import com.gxwebsoft.shop.param.ShopOrderExtractParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 自提订单联系方式Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Service +public class ShopOrderExtractServiceImpl extends ServiceImpl implements ShopOrderExtractService { + + @Override + public PageResult pageRel(ShopOrderExtractParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopOrderExtractParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopOrderExtract getByIdRel(Integer id) { + ShopOrderExtractParam param = new ShopOrderExtractParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderGoodsServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderGoodsServiceImpl.java new file mode 100644 index 0000000..7019db0 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderGoodsServiceImpl.java @@ -0,0 +1,78 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopOrderGoodsMapper; +import com.gxwebsoft.shop.service.ShopOrderGoodsService; +import com.gxwebsoft.shop.entity.ShopOrderGoods; +import com.gxwebsoft.shop.param.ShopOrderGoodsParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; +import lombok.extern.slf4j.Slf4j; + +import java.util.List; + +/** + * 商品信息Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Slf4j +@Service +public class ShopOrderGoodsServiceImpl extends ServiceImpl implements ShopOrderGoodsService { + + @Override + public PageResult pageRel(ShopOrderGoodsParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopOrderGoodsParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopOrderGoods getByIdRel(Integer id) { + ShopOrderGoodsParam param = new ShopOrderGoodsParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public List getListByOrderId(Integer orderId) { + return list( + new LambdaQueryWrapper() + .eq(ShopOrderGoods::getOrderId, orderId) + ); + } + + @Override + public List getListByOrderIdIgnoreTenant(Integer orderId) { + try { + if (orderId == null) { + log.warn("查询订单商品列表参数无效 - 订单ID: {}", orderId); + return List.of(); + } + + List orderGoodsList = baseMapper.selectListByOrderIdIgnoreTenant(orderId); + + log.info("忽略租户隔离查询订单商品成功 - 订单ID: {}, 商品数量: {}", + orderId, orderGoodsList != null ? orderGoodsList.size() : 0); + + return orderGoodsList != null ? orderGoodsList : List.of(); + } catch (Exception e) { + log.error("忽略租户隔离查询订单商品异常 - 订单ID: {}", orderId, e); + return List.of(); + } + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderInfoLogServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderInfoLogServiceImpl.java new file mode 100644 index 0000000..fdd7f54 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderInfoLogServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopOrderInfoLogMapper; +import com.gxwebsoft.shop.service.ShopOrderInfoLogService; +import com.gxwebsoft.shop.entity.ShopOrderInfoLog; +import com.gxwebsoft.shop.param.ShopOrderInfoLogParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 订单核销Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Service +public class ShopOrderInfoLogServiceImpl extends ServiceImpl implements ShopOrderInfoLogService { + + @Override + public PageResult pageRel(ShopOrderInfoLogParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopOrderInfoLogParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopOrderInfoLog getByIdRel(Integer id) { + ShopOrderInfoLogParam param = new ShopOrderInfoLogParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderInfoServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderInfoServiceImpl.java new file mode 100644 index 0000000..6c2681b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderInfoServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopOrderInfoMapper; +import com.gxwebsoft.shop.service.ShopOrderInfoService; +import com.gxwebsoft.shop.entity.ShopOrderInfo; +import com.gxwebsoft.shop.param.ShopOrderInfoParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 场地Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Service +public class ShopOrderInfoServiceImpl extends ServiceImpl implements ShopOrderInfoService { + + @Override + public PageResult pageRel(ShopOrderInfoParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopOrderInfoParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopOrderInfo getByIdRel(Integer id) { + ShopOrderInfoParam param = new ShopOrderInfoParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderServiceImpl.java new file mode 100644 index 0000000..3c0e4d4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderServiceImpl.java @@ -0,0 +1,1214 @@ +package com.gxwebsoft.shop.service.impl; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.config.ConfigProperties; +import com.gxwebsoft.common.core.config.CertificateProperties; +import com.gxwebsoft.common.core.utils.*; +import com.gxwebsoft.common.core.service.PaymentCacheService; +import com.gxwebsoft.common.core.service.EnvironmentAwarePaymentService; +import com.gxwebsoft.common.core.config.SpringContextUtil; +import com.gxwebsoft.common.system.entity.Payment; +import com.gxwebsoft.shop.entity.*; +import com.gxwebsoft.shop.service.*; +import com.wechat.pay.java.core.RSAAutoCertificateConfig; +import lombok.extern.slf4j.Slf4j; +import com.gxwebsoft.common.system.service.PaymentService; +import com.gxwebsoft.common.system.service.SettingService; +import com.gxwebsoft.payment.constants.WechatPayType; +import com.gxwebsoft.shop.mapper.ShopOrderMapper; +import com.gxwebsoft.shop.param.ShopOrderParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.wechat.pay.java.core.Config; +import com.wechat.pay.java.core.RSAConfig; +import com.wechat.pay.java.core.RSAPublicKeyConfig; +import com.wechat.pay.java.core.exception.ServiceException; +import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension; +import com.wechat.pay.java.service.payments.jsapi.model.*; +import com.wechat.pay.java.service.payments.nativepay.NativePayService; +// Native支付的类将使用完全限定名避免冲突 +import com.wechat.pay.java.service.payments.model.Transaction; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.*; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +/** + * 订单Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Slf4j +@Service +public class ShopOrderServiceImpl extends ServiceImpl implements ShopOrderService { + @Value("${spring.profiles.active}") + String active; + @Resource + private ConfigProperties config; + @Resource + private RedisUtil redisUtil; + @Resource + private ShopOrderGoodsService shopOrderGoodsService; + @Resource + private ShopGoodsService shopGoodsService; + @Resource + private PaymentService paymentService; + @Resource + private SettingService settingService; + @Resource + private CertificateProperties certConfig; + @Resource + private CertificateLoader certificateLoader; + @Resource + private PaymentCacheService paymentCacheService; + @Resource + private WechatCertAutoConfig wechatCertAutoConfig; + @Resource + private WechatPayDiagnostic wechatPayDiagnostic; + @Resource + private WechatPayCertificateDiagnostic certificateDiagnostic; + @Resource + private ShopOrderUpdate10550Service shopOrderUpdate10550Service; + @Resource + private ShopUserCouponService shopUserCouponService; + @Resource + private ShopOrderDeliveryService shopOrderDeliveryService; + @Resource + private ShopExpressService shopExpressService; + + private static final long USER_ORDER_STATS_CACHE_SECONDS = 60L; + + + @Override + public PageResult pageRel(ShopOrderParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + + // 整理订单数据 + if (!CollectionUtils.isEmpty(list)) { + final Set orderIds = list.stream().map(ShopOrder::getOrderId).collect(Collectors.toSet()); + final List goodsList = shopOrderGoodsService.list(new LambdaQueryWrapper().in(ShopOrderGoods::getOrderId, orderIds)); + final Map> collect = goodsList.stream().collect(Collectors.groupingBy(ShopOrderGoods::getOrderId)); + list.forEach(d -> { + d.setOrderGoods(collect.get(d.getOrderId())); + + // 确保 realName 字段有值,优先使用关联查询的结果,如果为空则使用订单表中的 realName + if (StrUtil.isBlank(d.getRealName())) { + log.debug("订单 {} 的 realName 为空,尝试从其他字段获取", d.getOrderId()); + // 可以根据业务需求添加其他逻辑,比如从 nickname 或其他字段获取 + } + if (d.getDeliveryStatus() > 10 && d.getDeliveryType().equals(0)) { + ShopOrderDelivery shopOrderDelivery = shopOrderDeliveryService.getByOrderId(d.getOrderId()); + if (shopOrderDelivery != null) { + ShopExpress shopExpress = shopExpressService.getById(shopOrderDelivery.getExpressId()); + if (shopExpress != null) { + shopOrderDelivery.setExpressName(shopExpress.getExpressName()); + } + } + d.setShopOrderDelivery(shopOrderDelivery); + } + }); + } + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopOrderParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopOrder getByIdRel(Integer orderId) { + ShopOrderParam param = new ShopOrderParam(); + param.setOrderId(orderId); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public com.gxwebsoft.shop.dto.UserOrderStats getUserOrderStats(Integer userId, Integer tenantId, Integer type) { + if (userId == null) { + // 保持调用方逻辑简单:未登录场景由 controller 处理,这里返回全 0 + return new com.gxwebsoft.shop.dto.UserOrderStats(); + } + + String cacheKey = "ShopOrder:UserOrderStats:" + + (tenantId == null ? "0" : tenantId) + + ":" + userId + + ":" + (type == null ? "all" : type); + + com.gxwebsoft.shop.dto.UserOrderStats cached = redisUtil.get(cacheKey, com.gxwebsoft.shop.dto.UserOrderStats.class); + if (cached != null) { + return cached; + } + + Map raw = baseMapper.selectUserOrderStats(userId, tenantId, type); + if (raw == null) { + raw = Collections.emptyMap(); + } + com.gxwebsoft.shop.dto.UserOrderStats stats = new com.gxwebsoft.shop.dto.UserOrderStats(); + stats.setTotal(getLong(raw, "total")); + stats.setWaitPay(getLong(raw, "waitPay")); + stats.setWaitDeliver(getLong(raw, "waitDeliver")); + stats.setWaitVerify(getLong(raw, "waitVerify")); + stats.setWaitReceive(getLong(raw, "waitReceive")); + stats.setWaitComment(getLong(raw, "waitComment")); + stats.setCompleted(getLong(raw, "completed")); + stats.setRefund(getLong(raw, "refund")); + stats.setDeleted(getLong(raw, "deleted")); + stats.setCanceled(getLong(raw, "canceled")); + + Map statusFilter = new HashMap<>(); + statusFilter.put("0", stats.getWaitPay()); + statusFilter.put("1", stats.getWaitDeliver()); + statusFilter.put("2", stats.getWaitVerify()); + statusFilter.put("3", stats.getWaitReceive()); + statusFilter.put("4", stats.getWaitComment()); + statusFilter.put("5", stats.getCompleted()); + statusFilter.put("6", stats.getRefund()); + statusFilter.put("7", stats.getDeleted()); + statusFilter.put("8", stats.getCanceled()); + stats.setStatusFilter(statusFilter); + + redisUtil.set(cacheKey, stats, USER_ORDER_STATS_CACHE_SECONDS, TimeUnit.SECONDS); + return stats; + } + + private static Long getLong(Map raw, String key) { + Object value = raw.get(key); + if (value == null) { + value = raw.get(key.toUpperCase(Locale.ROOT)); + } + if (value == null) { + value = raw.get(key.toLowerCase(Locale.ROOT)); + } + return toLong(value); + } + + private static Long toLong(Object value) { + if (value == null) { + return 0L; + } + if (value instanceof Number) { + return ((Number) value).longValue(); + } + try { + return Long.parseLong(String.valueOf(value)); + } catch (Exception e) { + return 0L; + } + } + + @Override + public HashMap createWxOrder(ShopOrder order) { + Payment payment = null; // 声明在try块外面,这样catch块也能访问 + try { + System.out.println("=== 开始创建微信支付订单 ==="); + System.out.println("订单号: " + order.getOrderNo()); + System.out.println("租户ID: " + order.getTenantId()); + System.out.println("支付类型: " + order.getPayType()); + System.out.println("订单金额: " + order.getTotalPrice()); + System.out.println("用户OpenID: " + order.getOpenid()); + + // 检查订单基本信息 + if (order.getTenantId() == null) { + throw new RuntimeException("订单租户ID为null"); + } + if (order.getOrderNo() == null || order.getOrderNo().trim().isEmpty()) { + throw new RuntimeException("订单号为空"); + } + if (order.getTotalPrice() == null) { + throw new RuntimeException("订单金额为null"); + } + // 如果商品仅有一个则更新formId + if (order.getOrderGoods() != null && order.getOrderGoods().size() == 1) { + order.setFormId(order.getOrderGoods().get(0).getGoodsId()); + } + + // 根据支付类型检查OpenID + if (order.getPayType().equals(1)) { + // JSAPI支付需要OpenID + if (order.getOpenid() == null || order.getOpenid().trim().isEmpty()) { + throw new RuntimeException("JSAPI支付必须传openid"); + } + } + + // 后台微信支付配置信息 + payment = getPayment(order); + System.out.println("支付配置: " + (payment != null ? "已获取" : "未获取")); + + if (payment == null) { + throw new RuntimeException("支付配置为null,租户ID: " + order.getTenantId()); + } + + // 检查支付配置的关键字段 + if (payment.getAppId() == null || payment.getAppId().trim().isEmpty()) { + throw new RuntimeException("支付配置中应用ID为null或空"); + } + if (payment.getMchId() == null || payment.getMchId().trim().isEmpty()) { + throw new RuntimeException("支付配置中商户号为null或空"); + } + + // 返回的订单数据 + final HashMap orderInfo = new HashMap<>(); + + // 根据支付类型选择不同的处理逻辑 + if (order.getPayType().equals(102)) { + // Native支付处理(兼容旧的102类型) + System.out.println("⚠️ 检测到使用废弃的微信Native支付类型(102),建议升级到微信支付(1)"); + order.setWechatPayType(WechatPayType.NATIVE); + return createNativePayOrder(order, payment); + } else if (order.getPayType().equals(1)) { + // 微信支付处理 - 根据是否有openid判断使用JSAPI还是Native + String wechatType = WechatPayType.getAutoType(order.getOpenid()); + order.setWechatPayType(wechatType); + + if (WechatPayType.JSAPI.equals(wechatType)) { + // 有openid,使用JSAPI支付 + return createJsapiPayOrder(order, payment); + } else { + // 无openid,使用Native支付 + return createNativePayOrder(order, payment); + } + } else { + // 其他支付方式暂时使用JSAPI处理 + return createJsapiPayOrder(order, payment); + } + + } catch (Exception e) { + System.err.println("=== 创建微信支付订单失败 ==="); + System.err.println("错误信息: " + e.getMessage()); + System.err.println("错误类型: " + e.getClass().getName()); + + // 特殊处理签名验证失败的情况 + if (e.getMessage() != null && e.getMessage().contains("signature is incorrect")) { + System.err.println("🔍 签名验证失败诊断:"); + System.err.println("1. 检查商户证书序列号是否正确"); + System.err.println("2. 检查APIv3密钥是否正确"); + System.err.println("3. 检查私钥文件是否正确"); + System.err.println("4. 检查微信支付平台证书是否过期"); + System.err.println("5. 建议使用自动证书配置避免证书管理问题"); + System.err.println("当前支付配置:"); + System.err.println("租户ID: " + order.getTenantId()); + System.err.println("商户号: " + (payment != null ? payment.getMchId() : "null")); + System.err.println("应用ID: " + (payment != null ? payment.getAppId() : "null")); + } + + throw new RuntimeException("创建微信支付订单失败:" + e.getMessage(), e); + } + } + + /** + * 创建Native支付订单 + */ + private HashMap createNativePayOrder(ShopOrder order, Payment payment) throws Exception { + System.out.println("=== 使用Native支付模式 ==="); + + // 构建Native支付服务 + Config wxPayConfig = getWxPayConfig(order); + NativePayService nativeService = new NativePayService.Builder().config(wxPayConfig).build(); + + // 订单金额(转换为分) + BigDecimal decimal = order.getTotalPrice(); + final BigDecimal multiply = decimal.multiply(new BigDecimal(100)); + Integer money = multiply.intValue(); + + // 测试环境使用1分钱 + if (active.equals("dev")) { + money = 1; + } + + // 构建Native支付请求 + com.wechat.pay.java.service.payments.nativepay.model.PrepayRequest request = + new com.wechat.pay.java.service.payments.nativepay.model.PrepayRequest(); + com.wechat.pay.java.service.payments.nativepay.model.Amount amount = + new com.wechat.pay.java.service.payments.nativepay.model.Amount(); + amount.setTotal(money); + amount.setCurrency("CNY"); + request.setAmount(amount); + + request.setAppid(payment.getAppId()); + request.setMchid(payment.getMchId()); + + // 微信支付description字段限制127字节,需要截断处理 + String description = com.gxwebsoft.common.core.utils.WechatPayUtils.processDescription(order.getComments()); + request.setDescription(description); + request.setOutTradeNo(order.getOrderNo()); + request.setAttach(order.getTenantId().toString()); + + System.out.println("=== 关键信息确认 ==="); + System.out.println("发送给微信的订单号(OutTradeNo): " + order.getOrderNo()); + System.out.println("商户号(MchId): " + payment.getMchId()); + System.out.println("应用ID(AppId): " + payment.getAppId()); + + // 设置回调地址 + String notifyUrl = config.getServerUrl() + "/system/wx-pay/notify/" + order.getTenantId(); + if (active.equals("dev")) { + notifyUrl = "http://jimei-api.natapp1.cc/api/shop/wx-pay/notify/" + order.getTenantId(); + } + if (StrUtil.isNotBlank(payment.getNotifyUrl())) { + notifyUrl = payment.getNotifyUrl().concat("/").concat(order.getTenantId().toString()); + } + request.setNotifyUrl(notifyUrl); + + System.out.println("=== 发起Native支付请求 ==="); + System.out.println("请求参数: " + request); + + // 调用Native支付API + com.wechat.pay.java.service.payments.nativepay.model.PrepayResponse response = nativeService.prepay(request); + + System.out.println("=== Native支付响应成功 ==="); + System.out.println("二维码URL: " + response.getCodeUrl()); + + // 构建返回数据 + final HashMap orderInfo = new HashMap<>(); + orderInfo.put("provider", "wxpay"); + orderInfo.put("codeUrl", response.getCodeUrl()); // Native支付返回二维码URL + orderInfo.put("orderNo", order.getOrderNo()); + orderInfo.put("payType", WechatPayType.NATIVE); + orderInfo.put("wechatPayType", WechatPayType.NATIVE); + + return orderInfo; + } + + /** + * 创建JSAPI支付订单(原有逻辑) + */ + private HashMap createJsapiPayOrder(ShopOrder order, Payment payment) throws Exception { + System.out.println("=== 使用JSAPI支付模式 ==="); + + // JSAPI支付必须有OpenID + if (order.getOpenid() == null || order.getOpenid().trim().isEmpty()) { + throw new RuntimeException("JSAPI支付必须传openid"); + } + + // 构建JSAPI支付服务 + JsapiServiceExtension service = getWxService(order); + System.out.println("微信支付服务构建完成"); + + // 订单金额 + BigDecimal decimal = order.getPayPrice(); + final BigDecimal multiply = decimal.multiply(new BigDecimal(100)); + Integer money = multiply.intValue(); + + System.out.println("=== 构建支付请求参数 ==="); + + PrepayRequest request = new PrepayRequest(); + Amount amount = new Amount(); + amount.setTotal(money); + amount.setCurrency("CNY"); + request.setAmount(amount); + + System.out.println("设置应用ID: " + payment.getAppId()); + request.setAppid(payment.getAppId()); + + System.out.println("设置商户号: " + payment.getMchId()); + request.setMchid(payment.getMchId()); + + // 微信支付description字段限制127字节,需要截断处理 + String description = com.gxwebsoft.common.core.utils.WechatPayUtils.processDescription(order.getComments()); + System.out.println("设置描述: " + description); + request.setDescription(description); + + System.out.println("设置订单号: " + order.getOrderNo()); + request.setOutTradeNo(order.getOrderNo()); + + System.out.println("设置附加数据: " + order.getTenantId().toString()); + request.setAttach(order.getTenantId().toString()); + + final Payer payer = new Payer(); + System.out.println("设置用户OpenID: " + order.getOpenid()); + payer.setOpenid(order.getOpenid()); + request.setPayer(payer); + request.setNotifyUrl(config.getServerUrl() + "/system/wx-pay/notify/" + order.getTenantId()); // 默认回调地址 + // 测试环境 + if (active.equals("dev")) { + amount.setTotal(1); + request.setAmount(amount); + request.setNotifyUrl("http://jimei-api.natapp1.cc/api/shop/wx-pay/notify/" + order.getTenantId()); // 默认回调地址 + } + // 后台配置的回调地址 + if (StrUtil.isNotBlank(payment.getNotifyUrl())) { + request.setNotifyUrl(payment.getNotifyUrl().concat("/").concat(order.getTenantId().toString())); + System.out.println("后台配置的回调地址 = " + request.getNotifyUrl()); + } + System.out.println("=== 发起微信支付请求 ==="); + System.out.println("请求参数: " + request); + + PrepayWithRequestPaymentResponse response = service.prepayWithRequestPayment(request); + + System.out.println("=== 微信支付响应成功 ==="); + System.out.println("预支付ID: " + response.getPackageVal()); + + final HashMap orderInfo = new HashMap<>(); + orderInfo.put("provider", "wxpay"); + orderInfo.put("timeStamp", response.getTimeStamp()); + orderInfo.put("nonceStr", response.getNonceStr()); + orderInfo.put("package", response.getPackageVal()); + orderInfo.put("signType", "RSA"); + orderInfo.put("paySign", response.getPaySign()); + orderInfo.put("orderNo", order.getOrderNo()); + orderInfo.put("payType", WechatPayType.JSAPI); + orderInfo.put("wechatPayType", WechatPayType.JSAPI); + return orderInfo; + } + + @Override + public ShopOrder getByOutTradeNo(String outTradeNo) { + return baseMapper.getByOutTradeNo(outTradeNo); + } + + /** + * 修复订单支付状态 + * + * @param shopOrder + */ + @Override + public Boolean queryOrderByOutTradeNo(ShopOrder shopOrder) { + // 后台微信支付配置信息 + final Payment payment = getPayment(shopOrder); + QueryOrderByOutTradeNoRequest queryRequest = new QueryOrderByOutTradeNoRequest(); + queryRequest.setMchid(payment.getMchId()); + queryRequest.setOutTradeNo(shopOrder.getOrderNo()); + // 构建service + JsapiServiceExtension service = getWxService(shopOrder); + try { + Transaction result = service.queryOrderByOutTradeNo(queryRequest); + if (result.getTradeState().equals(Transaction.TradeStateEnum.SUCCESS)) { + shopOrder.setPayStatus(true); + shopOrder.setPayTime(LocalDateTime.now()); + shopOrder.setTransactionId(result.getTransactionId()); + updateById(shopOrder); + return true; + } + } catch (ServiceException e) { + // API返回失败, 例如ORDER_NOT_EXISTS + System.out.printf("code=[%s], message=[%s]\n", e.getErrorCode(), e.getErrorMessage()); + System.out.printf("reponse body=[%s]\n", e.getResponseBody()); + } + return false; + } + + @Override + public void updateByOutTradeNo(ShopOrder order) { + order.setExpirationTime(null); + baseMapper.updateByOutTradeNo(order); + + // 处理支付成功后的业务逻辑 + handlePaymentSuccess(order); + + if (order.getTenantId().equals(10550)) { + shopOrderUpdate10550Service.update(order); + } + } + + /** + * 处理支付成功后的业务逻辑 + */ + private void handlePaymentSuccess(ShopOrder order) { + try { + // 1. 使用优惠券 + if (order.getCouponId() != null && order.getCouponId() > 0) { + markCouponAsUsed(order); + } + + // 2. 累计商品销量 + updateGoodsSales(order); + + log.info("支付成功后业务逻辑处理完成 - 订单号:{}", order.getOrderNo()); + } catch (Exception e) { + log.error("处理支付成功后业务逻辑失败 - 订单号:{}", order.getOrderNo(), e); + // 不抛出异常,避免影响支付回调的成功响应 + } + } + + /** + * 标记优惠券为已使用 + */ + private void markCouponAsUsed(ShopOrder order) { + try { + // 注入 CouponStatusService 并使用其 useCoupon 方法 + // couponStatusService.useCoupon(order.getCouponId().longValue(), order.getOrderId(), order.getOrderNo()); + + // 临时保持原有逻辑,建议后续重构 + ShopUserCoupon coupon = shopUserCouponService.getById(order.getCouponId()); + if (coupon != null) { + coupon.markAsUsed(order.getOrderId(), order.getOrderNo()); + shopUserCouponService.updateById(coupon); + log.info("优惠券标记为已使用 - 优惠券ID:{},订单号:{}", order.getCouponId(), order.getOrderNo()); + } + } catch (Exception e) { + log.error("标记优惠券为已使用失败 - 优惠券ID:{},订单号:{}", order.getCouponId(), order.getOrderNo(), e); + } + } + + /** + * 累计商品销量 + */ + private void updateGoodsSales(ShopOrder order) { + try { + // 获取订单商品列表(忽略租户隔离) + final List orderGoodsList = shopOrderGoodsService.getListByOrderIdIgnoreTenant(order.getOrderId()); + + if (orderGoodsList.isEmpty()) { + log.warn("订单商品列表为空 - 订单号:{}", order.getOrderNo()); + return; + } + + // 累计每个商品的销量 + for (ShopOrderGoods orderGoods : orderGoodsList) { + updateSingleGoodsSales(orderGoods); + } + + log.info("商品销量累计完成 - 订单号:{},商品数量:{}", order.getOrderNo(), orderGoodsList.size()); + } catch (Exception e) { + log.error("累计商品销量失败 - 订单号:{}", order.getOrderNo(), e); + } + } + + /** + * 累计单个商品的销量 + * 使用新的addSaleCount方法,忽略租户隔离确保更新成功 + */ + private void updateSingleGoodsSales(ShopOrderGoods orderGoods) { + try { + if (orderGoods.getGoodsId() == null || orderGoods.getTotalNum() == null || orderGoods.getTotalNum() <= 0) { + log.warn("商品销量累计参数无效 - 商品ID:{},购买数量:{}", + orderGoods.getGoodsId(), orderGoods.getTotalNum()); + return; + } + + // 使用新的addSaleCount方法,忽略租户隔离 + boolean updated = shopGoodsService.addSaleCount(orderGoods.getGoodsId(), orderGoods.getTotalNum()); + + if (updated) { + log.info("商品销量累计成功 - 商品ID:{},商品名称:{},购买数量:{}", + orderGoods.getGoodsId(), orderGoods.getGoodsName(), orderGoods.getTotalNum()); + } else { + log.warn("商品销量累计失败 - 商品ID:{},商品名称:{},购买数量:{}", + orderGoods.getGoodsId(), orderGoods.getGoodsName(), orderGoods.getTotalNum()); + } + } catch (Exception e) { + log.error("累计单个商品销量异常 - 商品ID:{},商品名称:{},购买数量:{}", + orderGoods.getGoodsId(), orderGoods.getGoodsName(), orderGoods.getTotalNum(), e); + } + } + + /** + * 读取微信支付配置 + * 生产环境优先从缓存读取 Payment:1* 格式的商户信息 + * 开发环境自动使用本地回调地址 + * + * @param order + * @return + */ + public Payment getPayment(ShopOrder order) { + // 先清除可能的错误缓存 +// paymentCacheService.removePaymentConfig(order.getPayType().toString(), order.getTenantId()); + + // 使用环境感知的支付配置服务 + Payment payment; + try { + // 尝试使用环境感知服务 + EnvironmentAwarePaymentService envPaymentService = + SpringContextUtil.getBean(EnvironmentAwarePaymentService.class); + payment = envPaymentService.getEnvironmentAwarePaymentConfig(order.getPayType(), order.getTenantId()); + } catch (Exception e) { + // 如果环境感知服务不可用,回退到原有方式 + log.warn("环境感知支付服务不可用,使用原有配置方式: {}", e.getMessage()); + payment = paymentCacheService.getPaymentConfig(order.getPayType(), order.getTenantId()); + } + + // 添加详细的支付配置检查 + System.out.println("=== 支付配置检查 ==="); + System.out.println("订单支付类型: " + order.getPayType()); + System.out.println("租户ID: " + order.getTenantId()); + + if (payment == null) { + throw new RuntimeException("未找到支付配置,支付类型: " + order.getPayType() + ", 租户ID: " + order.getTenantId()); + } + + System.out.println("支付配置ID: " + payment.getId()); + System.out.println("支付方式名称: " + payment.getName()); + System.out.println("支付类型: " + payment.getType()); + System.out.println("支付代码: " + payment.getCode()); + System.out.println("应用ID: " + payment.getAppId()); + System.out.println("商户号: " + payment.getMchId()); + System.out.println("API密钥: " + (payment.getApiKey() != null ? "已配置(长度:" + payment.getApiKey().length() + ")" : "未配置")); + System.out.println("商户证书序列号: " + payment.getMerchantSerialNumber()); + System.out.println("状态: " + payment.getStatus()); + + return payment; + } + + /** + * 构建微信支付 + * + * @param order + * @return + */ + public JsapiServiceExtension getWxService(ShopOrder order) { + try { + final Payment payment = getPayment(order); + + // 提前声明所有需要的变量,避免重复定义 + String privateKey; + String apiclientCert = null; + String pubKey = null; + String tenantCertPath = null; + String privateKeyPath = null; + String pubKeyPath = null; + String apiclientCertPath = null; + String apiclientCertFile = null; + String pubKeyFile = null; + + // 运行配置诊断 + System.out.println("=== 运行微信支付配置诊断 ==="); + wechatPayDiagnostic.diagnosePaymentConfig(payment, null, active); + + // 运行证书诊断 + System.out.println("=== 运行证书诊断 ==="); + WechatPayCertificateDiagnostic.DiagnosticResult diagnosticResult = + certificateDiagnostic.diagnoseCertificateConfig(payment, order.getTenantId(), active); + System.out.println(diagnosticResult.getFullReport()); + + + + // 构建微信支付配置 + Config config = null; + if (active.equals("dev")) { + // 开发环境使用自动证书配置 + // 首先初始化私钥路径 + tenantCertPath = "dev/wechat/" + order.getTenantId(); + privateKeyPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getPrivateKeyFile(); + privateKey = certificateLoader.loadCertificatePath(privateKeyPath); + System.out.println("开发环境私钥路径: " + privateKeyPath); + System.out.println("开发环境私钥加载成功: " + privateKey); + + // 检查数据库配置是否完整 + if (payment.getMchId() == null || payment.getMchId().trim().isEmpty()) { + throw new RuntimeException("数据库中商户号(mchId)未配置"); + } + if (payment.getMerchantSerialNumber() == null || payment.getMerchantSerialNumber().trim().isEmpty()) { + throw new RuntimeException("数据库中商户证书序列号(merchantSerialNumber)未配置"); + } + if (payment.getApiKey() == null || payment.getApiKey().trim().isEmpty()) { + throw new RuntimeException("数据库中API密钥(apiKey)未配置"); + } + + System.out.println("=== 使用数据库支付配置 ==="); + System.out.println("商户号: " + payment.getMchId()); + System.out.println("序列号: " + payment.getMerchantSerialNumber()); + System.out.println("API密钥: 已配置(长度:" + payment.getApiKey().length() + ")"); + + // 临时使用RSA配置替代自动证书配置,避免404错误 + System.out.println("=== 注意:使用RSA配置替代自动证书配置 ==="); + System.out.println("原因:商户平台可能未开启API安全功能或未申请微信支付公钥"); + + // 首先检查是否配置了公钥,如果有则优先使用公钥模式 + if (payment.getPubKey() != null && !payment.getPubKey().isEmpty() && + payment.getPubKeyId() != null && !payment.getPubKeyId().isEmpty()) { + + try { + // 开发环境固定使用 wechatpay_public_key.pem + pubKeyPath = tenantCertPath + "/wechatpay_public_key.pem"; + + System.out.println("开发环境公钥文件路径: " + pubKeyPath); + + // 检查公钥文件是否存在 + if (certificateLoader.certificateExists(pubKeyPath)) { + System.out.println("=== 检测到公钥配置,使用RSA公钥模式 ==="); + System.out.println("公钥文件: " + payment.getPubKey()); + System.out.println("公钥ID: " + payment.getPubKeyId()); + + pubKeyFile = certificateLoader.loadCertificatePath(pubKeyPath); + System.out.println("✅ 开发环境公钥文件加载成功: " + pubKeyFile); + + config = new RSAPublicKeyConfig.Builder() + .merchantId(payment.getMchId()) + .privateKeyFromPath(privateKey) + .publicKeyFromPath(pubKeyFile) + .publicKeyId(payment.getPubKeyId()) + .merchantSerialNumber(payment.getMerchantSerialNumber()) + .apiV3Key(payment.getApiKey()) + .build(); + System.out.println("✅ 开发环境RSA公钥配置成功"); + } else { + System.out.println("⚠️ 开发环境公钥文件不存在,跳过公钥模式: " + pubKeyPath); + // 跳过公钥配置,继续后续的自动证书配置 + } + } catch (Exception e) { + System.err.println("❌ 开发环境公钥配置检查失败: " + e.getMessage()); + // 跳过公钥配置,继续后续的自动证书配置 + } + } + + // 如果没有公钥配置或公钥文件不存在,尝试自动证书配置 + if (config == null) { + // 没有公钥配置,尝试自动证书配置 + try { + System.out.println("=== 尝试创建自动证书配置 ==="); + System.out.println("商户号: " + payment.getMchId()); + System.out.println("私钥路径: " + privateKey); + System.out.println("序列号: " + payment.getMerchantSerialNumber()); + System.out.println("API密钥长度: " + (payment.getApiKey() != null ? payment.getApiKey().length() : 0)); + + config = wechatCertAutoConfig.createAutoConfig( + payment.getMchId(), + privateKey, + payment.getMerchantSerialNumber(), + payment.getApiKey() + ); + System.out.println("✅ 开发环境自动证书配置成功"); + } catch (Exception e) { + System.err.println("❌ 自动证书配置失败: " + e.getMessage()); + System.err.println("错误类型: " + e.getClass().getName()); + e.printStackTrace(); + + // 检查是否是证书相关的错误 + if (e.getMessage() != null && ( + e.getMessage().contains("certificate") || + e.getMessage().contains("X509Certificate") || + e.getMessage().contains("getSerialNumber") || + e.getMessage().contains("404") || + e.getMessage().contains("API安全"))) { + + System.err.println("🔍 证书问题诊断:"); + System.err.println("1. 检查商户平台是否已开启API安全功能"); + System.err.println("2. 检查是否已申请使用微信支付公钥"); + System.err.println("3. 检查网络连接是否正常"); + System.err.println("4. 检查商户证书序列号是否正确"); + System.err.println("5. 参考文档:https://pay.weixin.qq.com/doc/v3/merchant/4012153196"); + + // 开发环境回退到基础RSA配置 + System.err.println("⚠️ 开发环境回退到基础RSA配置..."); + try { + // 方案1:尝试使用RSA证书配置(需要商户证书文件) + apiclientCertPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getApiclientCertFile(); + + if (certificateLoader.certificateExists(apiclientCertPath)) { + apiclientCertFile = certificateLoader.loadCertificatePath(apiclientCertPath); + System.out.println("方案1: 使用RSA证书配置作为回退方案"); + System.out.println("商户证书路径: " + apiclientCertFile); + + try { + config = new RSAConfig.Builder() + .merchantId(payment.getMchId()) + .privateKeyFromPath(privateKey) + .merchantSerialNumber(payment.getMerchantSerialNumber()) + .wechatPayCertificatesFromPath(apiclientCertFile) + .build(); + System.out.println("✅ 开发环境RSA证书配置成功"); + } catch (Exception rsaException) { + System.err.println("RSA证书配置失败: " + rsaException.getMessage()); + throw rsaException; + } + } else { + System.err.println("❌ 商户证书文件不存在: " + apiclientCertPath); + System.err.println("⚠️ 尝试方案2: 使用最小化配置..."); + + // 方案2:使用最小化的RSA配置(仅私钥和序列号) + try { + // 创建一个最基础的配置,不依赖平台证书 + config = new com.wechat.pay.java.core.RSAConfig.Builder() + .merchantId(payment.getMchId()) + .privateKeyFromPath(privateKey) + .merchantSerialNumber(payment.getMerchantSerialNumber()) + .build(); + System.out.println("✅ 开发环境最小化RSA配置成功"); + } catch (Exception minimalException) { + System.err.println("最小化配置也失败: " + minimalException.getMessage()); + throw new RuntimeException("所有配置方案都失败,请检查私钥文件和商户配置", e); + } + } + } catch (Exception fallbackException) { + System.err.println("❌ 手动证书配置失败: " + fallbackException.getMessage()); + fallbackException.printStackTrace(); + + // 最后的回退:抛出详细错误信息 + System.err.println("=== 最终错误诊断 ==="); + System.err.println("1. 自动证书配置失败原因: " + e.getMessage()); + System.err.println("2. 手动证书配置失败原因: " + fallbackException.getMessage()); + System.err.println("3. 建议解决方案:"); + System.err.println(" - 检查微信商户平台是否开启API安全功能"); + System.err.println(" - 确认已申请使用微信支付公钥"); + System.err.println(" - 验证商户证书序列号是否正确"); + System.err.println(" - 检查私钥文件是否完整且格式正确"); + + throw new RuntimeException("微信支付配置失败,请检查商户平台API安全设置和证书配置。原始错误: " + e.getMessage() + ", 回退错误: " + fallbackException.getMessage(), e); + } + } else { + throw new RuntimeException("微信支付配置失败:" + e.getMessage(), e); + } + } + } + } else { + // 生产环境 - 首先初始化私钥 + final String certRootPath = certConfig.getCertRootPath(); + System.out.println("生产环境证书根路径: " + certRootPath); + + String privateKeyRelativePath = payment.getApiclientKey(); + System.out.println("数据库中的私钥相对路径: " + privateKeyRelativePath); + + // 生产环境已经没有/file目录,所有路径都直接拼接到根路径 + String privateKeyFullPath; + // 处理数据库中可能存在的历史路径格式 + String cleanPath = privateKeyRelativePath; + if (privateKeyRelativePath.startsWith("/file/")) { + // 去掉历史的 /file/ 前缀 + cleanPath = privateKeyRelativePath.substring(6); + } else if (privateKeyRelativePath.startsWith("file/")) { + // 去掉历史的 file/ 前缀 + cleanPath = privateKeyRelativePath.substring(5); + } + // 确保路径以 / 开头 + if (!cleanPath.startsWith("/")) { + cleanPath = "/" + cleanPath; + } + privateKeyFullPath = certRootPath + cleanPath; + + System.out.println("生产环境私钥完整路径: " + privateKeyFullPath); + privateKey = certificateLoader.loadCertificatePath(privateKeyFullPath); + System.out.println("✅ 生产环境私钥加载完成: " + privateKey); + + // 生产环境也优先检查公钥配置 + if (payment.getPubKey() != null && !payment.getPubKey().isEmpty() && + payment.getPubKeyId() != null && !payment.getPubKeyId().isEmpty()) { + + System.out.println("=== 生产环境检测到公钥配置,使用RSA公钥模式 ==="); + System.out.println("公钥文件路径: " + payment.getPubKey()); + System.out.println("公钥ID: " + payment.getPubKeyId()); + + try { + // 生产环境处理公钥路径 + String pubKeyRelativePath = payment.getPubKey(); + System.out.println("数据库中的公钥相对路径: " + pubKeyRelativePath); + + // 生产环境已经没有/file目录,所有路径都直接拼接到根路径 + String pubKeyFullPath; + // 处理数据库中可能存在的历史路径格式 + String cleanPubPath = pubKeyRelativePath; + if (pubKeyRelativePath.startsWith("/file/")) { + // 去掉历史的 /file/ 前缀 + cleanPubPath = pubKeyRelativePath.substring(6); + } else if (pubKeyRelativePath.startsWith("file/")) { + // 去掉历史的 file/ 前缀 + cleanPubPath = pubKeyRelativePath.substring(5); + } + // 确保路径以 / 开头 + if (!cleanPubPath.startsWith("/")) { + cleanPubPath = "/" + cleanPubPath; + } + pubKeyFullPath = certRootPath + cleanPubPath; + + System.out.println("生产环境公钥完整路径: " + pubKeyFullPath); + pubKeyFile = certificateLoader.loadCertificatePath(pubKeyFullPath); + System.out.println("✅ 生产环境公钥文件加载成功: " + pubKeyFile); + + config = new RSAPublicKeyConfig.Builder() + .merchantId(payment.getMchId()) + .privateKeyFromPath(privateKey) + .publicKeyFromPath(pubKeyFile) + .publicKeyId(payment.getPubKeyId()) + .merchantSerialNumber(payment.getMerchantSerialNumber()) + .apiV3Key(payment.getApiKey()) + .build(); + System.out.println("✅ 生产环境RSA公钥配置成功"); + } catch (Exception pubKeyException) { + System.err.println("❌ 生产环境RSA公钥配置失败: " + pubKeyException.getMessage()); + pubKeyException.printStackTrace(); + throw new RuntimeException("生产环境RSA公钥配置失败: " + pubKeyException.getMessage(), pubKeyException); + } + } else { + // 没有公钥配置,使用自动证书配置 + System.out.println("=== 生产环境使用自动证书配置 ==="); + System.out.println("商户号: " + payment.getMchId()); + System.out.println("序列号: " + payment.getMerchantSerialNumber()); + System.out.println("API密钥: 已配置(长度:" + payment.getApiKey().length() + ")"); + + try { + // 优先使用自动证书配置,避免证书过期和序列号不匹配问题 + config = wechatCertAutoConfig.createAutoConfig( + payment.getMchId(), + privateKey, + payment.getMerchantSerialNumber(), + payment.getApiKey() + ); + System.out.println("✅ 生产环境自动证书配置成功"); + } catch (Exception autoConfigException) { + System.err.println("⚠️ 自动证书配置失败,回退到手动证书配置"); + System.err.println("自动配置错误: " + autoConfigException.getMessage()); + System.err.println("错误类型: " + autoConfigException.getClass().getName()); + autoConfigException.printStackTrace(); + + // 检查是否是证书相关的错误 + if (autoConfigException.getMessage() != null && ( + autoConfigException.getMessage().contains("certificate") || + autoConfigException.getMessage().contains("X509Certificate") || + autoConfigException.getMessage().contains("getSerialNumber") || + autoConfigException.getMessage().contains("404") || + autoConfigException.getMessage().contains("API安全"))) { + + System.err.println("🔍 生产环境证书问题诊断:"); + System.err.println("1. 检查商户平台是否已开启API安全功能"); + System.err.println("2. 检查是否已申请使用微信支付公钥"); + System.err.println("3. 检查网络连接是否正常"); + System.err.println("4. 检查商户证书序列号是否正确"); + } + + try { + // 回退到手动证书配置 + if (payment.getPubKey() != null && !payment.getPubKey().isEmpty()) { + System.out.println("使用RSA公钥配置作为回退方案"); + config = new RSAPublicKeyConfig.Builder() + .merchantId(payment.getMchId()) + .privateKeyFromPath(privateKey) + .publicKeyFromPath(pubKey) + .publicKeyId(payment.getPubKeyId()) + .merchantSerialNumber(payment.getMerchantSerialNumber()) + .apiV3Key(payment.getApiKey()) + .build(); + System.out.println("✅ 生产环境RSA公钥配置成功"); + } else if (apiclientCert != null && !apiclientCert.isEmpty()) { + System.out.println("使用RSA证书配置作为回退方案"); + config = new RSAConfig.Builder() + .merchantId(payment.getMchId()) + .privateKeyFromPath(privateKey) + .merchantSerialNumber(payment.getMerchantSerialNumber()) + .wechatPayCertificatesFromPath(apiclientCert) + .build(); + System.out.println("✅ 生产环境RSA证书配置成功"); + } else { + throw new RuntimeException("生产环境缺少必要的证书文件,无法创建手动证书配置", autoConfigException); + } + } catch (Exception fallbackException) { + System.err.println("❌ 生产环境手动证书配置也失败: " + fallbackException.getMessage()); + throw new RuntimeException("生产环境微信支付配置失败,请检查商户平台API安全设置和证书配置", autoConfigException); + } + } + } + } + + // 构建service + return new JsapiServiceExtension.Builder().config(config).build(); + } catch (Exception e) { + System.err.println("=== 构建微信支付服务失败 ==="); + System.err.println("错误信息: " + e.getMessage()); + System.err.println("错误类型: " + e.getClass().getName()); + e.printStackTrace(); + throw new RuntimeException("构建微信支付服务失败:" + e.getMessage(), e); + } + } + + @Override + public BigDecimal total() { + try { + // 使用数据库聚合查询统计订单总金额,性能更高 + BigDecimal total = baseMapper.selectTotalAmount(); + + if (total == null) { + total = BigDecimal.ZERO; + } + + log.info("统计订单总金额完成,总金额:{}", total); + return total; + + } catch (Exception e) { + log.error("统计订单总金额失败", e); + return BigDecimal.ZERO; + } + } + + /** + * 获取Native支付的微信支付配置 + */ + private Config getWxPayConfig(ShopOrder order) throws Exception { + try { + final Payment payment = getPayment(order); + String privateKey; + String apiclientCert = null; + String pubKey = null; + + // 初始化证书路径 + if (active.equals("dev")) { + // 开发环境 - 构建包含租户号的证书路径 + String tenantCertPath = "dev/wechat/" + order.getTenantId(); + String privateKeyPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getPrivateKeyFile(); + + System.out.println("开发环境证书路径 - 租户ID: " + order.getTenantId()); + System.out.println("开发环境证书路径 - 私钥: " + privateKeyPath); + + privateKey = certificateLoader.loadCertificatePath(privateKeyPath); + System.out.println("私钥完整路径: " + privateKey); + + // 尝试加载公钥(如果配置了) + if (StrUtil.isNotBlank(payment.getPubKey()) && StrUtil.isNotBlank(payment.getPubKeyId())) { + try { + String pubKeyPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getWechatpayCertFile(); + pubKey = certificateLoader.loadCertificatePath(pubKeyPath); + System.out.println("✅ 开发环境公钥加载成功"); + } catch (Exception e) { + System.out.println("⚠️ 开发环境公钥加载失败,将使用自动证书配置: " + e.getMessage()); + } + } + } else { + // 生产环境 - 从数据库配置的路径加载 + final String certRootPath = certConfig.getCertRootPath(); + + System.out.println("生产环境证书路径 - 租户ID: " + order.getTenantId()); + System.out.println("生产环境证书根路径: " + certRootPath); + System.out.println("私钥文件名: " + payment.getApiclientKey()); + + String privateKeyRelativePath = payment.getApiclientKey(); + + // 生产环境已经没有/file目录,所有路径都直接拼接到根路径 + String privateKeyFullPath; + // 处理数据库中可能存在的历史路径格式 + String cleanPath2 = privateKeyRelativePath; + if (privateKeyRelativePath.startsWith("/file/")) { + // 去掉历史的 /file/ 前缀 + cleanPath2 = privateKeyRelativePath.substring(6); + } else if (privateKeyRelativePath.startsWith("file/")) { + // 去掉历史的 file/ 前缀 + cleanPath2 = privateKeyRelativePath.substring(5); + } + // 确保路径以 / 开头 + if (!cleanPath2.startsWith("/")) { + cleanPath2 = "/" + cleanPath2; + } + privateKeyFullPath = certRootPath + cleanPath2; + + System.out.println("私钥完整路径: " + privateKeyFullPath); + privateKey = certificateLoader.loadCertificatePath(privateKeyFullPath); + System.out.println("✅ 生产环境私钥加载完成: " + privateKey); + + // 尝试加载公钥(如果配置了) + if (StrUtil.isNotBlank(payment.getPubKey()) && StrUtil.isNotBlank(payment.getPubKeyId())) { + try { + String pubKeyRelativePath = payment.getPubKey(); + System.out.println("数据库中的公钥相对路径: " + pubKeyRelativePath); + + // 生产环境已经没有/file目录,所有路径都直接拼接到根路径 + String pubKeyFullPath; + // 处理数据库中可能存在的历史路径格式 + String cleanPubPath2 = pubKeyRelativePath; + if (pubKeyRelativePath.startsWith("/file/")) { + // 去掉历史的 /file/ 前缀 + cleanPubPath2 = pubKeyRelativePath.substring(6); + } else if (pubKeyRelativePath.startsWith("file/")) { + // 去掉历史的 file/ 前缀 + cleanPubPath2 = pubKeyRelativePath.substring(5); + } + // 确保路径以 / 开头 + if (!cleanPubPath2.startsWith("/")) { + cleanPubPath2 = "/" + cleanPubPath2; + } + pubKeyFullPath = certRootPath + cleanPubPath2; + + System.out.println("生产环境公钥完整路径: " + pubKeyFullPath); + pubKey = certificateLoader.loadCertificatePath(pubKeyFullPath); + System.out.println("✅ 生产环境公钥加载成功"); + } catch (Exception e) { + System.out.println("⚠️ 生产环境公钥加载失败,将使用自动证书配置: " + e.getMessage()); + } + } + } + + // 根据可用的证书类型选择配置方式 + Config config; + if (pubKey != null && StrUtil.isNotBlank(payment.getPubKeyId())) { + // 使用RSA公钥配置(推荐方式) + System.out.println("🔧 使用RSA公钥配置"); + config = new RSAPublicKeyConfig.Builder() + .merchantId(payment.getMchId()) + .privateKeyFromPath(privateKey) + .merchantSerialNumber(payment.getMerchantSerialNumber()) + .publicKeyFromPath(pubKey) + .publicKeyId(payment.getPubKeyId()) + .apiV3Key(payment.getApiKey()) + .build(); + } else { + // 使用自动证书配置 + System.out.println("🔧 使用RSA自动证书配置"); + config = new RSAAutoCertificateConfig.Builder() + .merchantId(payment.getMchId()) + .privateKeyFromPath(privateKey) + .merchantSerialNumber(payment.getMerchantSerialNumber()) + .apiV3Key(payment.getApiKey()) + .build(); + } + + System.out.println("✅ 微信支付配置构建成功"); + return config; + + } catch (Exception e) { + System.err.println("❌ 构建微信支付服务失败: " + e.getMessage()); + e.printStackTrace(); + throw new RuntimeException("构建微信支付服务失败:" + e.getMessage(), e); + } + } + + @Override + public ShopOrder getByOrderNo(String orderNo, Integer tenantId) { + return this.lambdaQuery() + .eq(ShopOrder::getOrderNo, orderNo) + .eq(ShopOrder::getTenantId, tenantId) + .one(); + } + + @Override + public boolean syncPaymentStatus(String orderNo, Integer paymentStatus, String transactionId, String payTime, Integer tenantId) { + try { + // 查询订单 + ShopOrder order = getByOrderNo(orderNo, tenantId); + if (order == null) { + log.warn("同步支付状态失败:订单不存在, orderNo={}, tenantId={}", orderNo, tenantId); + return false; + } + + // 如果订单已经是支付成功状态,不需要更新 + if (order.getPayStatus() && paymentStatus == 1) { + log.info("订单已经是支付成功状态,无需更新: orderNo={}", orderNo); + return true; + } + + // 更新订单状态 + boolean updated = this.lambdaUpdate() + .eq(ShopOrder::getOrderNo, orderNo) + .eq(ShopOrder::getTenantId, tenantId) + .set(ShopOrder::getPayStatus, paymentStatus == 1) + .set(transactionId != null, ShopOrder::getTransactionId, transactionId) + .set(payTime != null, ShopOrder::getPayTime, payTime) + .set(ShopOrder::getUpdateTime, LocalDateTime.now()) + .update(); + + if (updated) { + log.info("订单支付状态同步成功: orderNo={}, paymentStatus={}, transactionId={}", + orderNo, paymentStatus, transactionId); + } else { + log.warn("订单支付状态同步失败: orderNo={}, paymentStatus={}", orderNo, paymentStatus); + } + + return updated; + + } catch (Exception e) { + log.error("同步订单支付状态异常: orderNo={}, error={}", orderNo, e.getMessage(), e); + return false; + } + } + + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderUpdate10550ServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderUpdate10550ServiceImpl.java new file mode 100644 index 0000000..671ac42 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderUpdate10550ServiceImpl.java @@ -0,0 +1,298 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.common.system.entity.DictData; +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.entity.UserReferee; +import com.gxwebsoft.common.system.param.DictDataParam; +import com.gxwebsoft.common.system.service.DictDataService; +import com.gxwebsoft.common.system.service.UserRefereeService; +import com.gxwebsoft.common.system.service.UserService; +import com.gxwebsoft.shop.entity.*; +import com.gxwebsoft.shop.service.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.List; + +/** + * 订单更新业务处理Service实现 + * 处理特定租户(10550)的订单相关业务逻辑 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Slf4j +@Service +public class ShopOrderUpdate10550ServiceImpl implements ShopOrderUpdate10550Service { + + @Resource + private UserService userService; + @Resource + private DictDataService dictDataService; + @Resource + private UserRefereeService userRefereeService; + @Resource + private ShopDealerOrderService shopDealerOrderService; + @Resource + private ShopDealerCapitalService shopDealerCapitalService; + @Resource + private ShopOrderGoodsService shopOrderGoodsService; + @Resource + private ShopGoodsService shopGoodsService; + + @Override + public void update(ShopOrder order) { + try { + log.info("开始处理订单更新业务 - 订单ID: {}, 用户ID: {}, 租户ID: {}", + order.getOrderId(), order.getUserId(), order.getTenantId()); + + // 1. 获取合伙人条件配置 + BigDecimal partnerCondition = getPartnerCondition(); + if (partnerCondition == null) { + log.warn("未找到合伙人条件配置,跳过用户等级更新"); + return; + } + + // 2. 更新用户消费金额和等级 + updateUserGradeAndExpendMoney(order, partnerCondition); + + // 3. 处理分销业务(如果需要) + // processDistributionBusiness(order); + + log.info("订单更新业务处理完成 - 订单ID: {}", order.getOrderId()); + } catch (Exception e) { + log.error("处理订单更新业务异常 - 订单ID: {}", order.getOrderId(), e); + } + } + + /** + * 获取合伙人条件配置 + * @return 合伙人条件金额 + */ + private BigDecimal getPartnerCondition() { + try { + // 查询字典ID为1460的配置 + DictDataParam param = new DictDataParam(); + param.setDictId(1460); + List dictDataList = dictDataService.listRel(param); + + if (dictDataList != null && !dictDataList.isEmpty()) { + String dictDataCode = dictDataList.get(0).getDictDataCode(); + BigDecimal partnerCondition = new BigDecimal(dictDataCode); + log.info("获取合伙人条件配置成功 - 金额: {}", partnerCondition); + return partnerCondition; + } + } catch (Exception e) { + log.error("获取合伙人条件配置异常", e); + } + return null; + } + + /** + * 更新用户等级和消费金额 + * @param order 订单信息 + * @param partnerCondition 合伙人条件金额 + */ + private void updateUserGradeAndExpendMoney(ShopOrder order, BigDecimal partnerCondition) { + try { + // 查询用户信息(忽略租户隔离) + User user = userService.getByIdIgnoreTenant(order.getUserId()); + if (user == null) { + log.warn("用户不存在 - 用户ID: {}", order.getUserId()); + return; + } + + // 累加消费金额 + BigDecimal currentExpendMoney = user.getExpendMoney() != null ? user.getExpendMoney() : BigDecimal.ZERO; + BigDecimal newExpendMoney = currentExpendMoney.add(order.getPayPrice()); + user.setExpendMoney(newExpendMoney); + + // 检查是否达到合伙人条件 + boolean shouldUpgrade = newExpendMoney.compareTo(partnerCondition) >= 0 && !Integer.valueOf(3).equals(user.getGradeId()); + if (shouldUpgrade) { + user.setGradeId(3); + log.info("用户等级升级为合伙人 - 用户ID: {}, 消费金额: {}, 条件金额: {}", + user.getUserId(), newExpendMoney, partnerCondition); + } + + // 更新用户信息(使用忽略租户隔离的更新方法) + userService.updateByUserId(user); + + log.info("用户信息更新成功 - 用户ID: {}, 消费金额: {} -> {}, 等级: {}", + user.getUserId(), currentExpendMoney, newExpendMoney, user.getGradeId()); + + } catch (Exception e) { + log.error("更新用户等级和消费金额异常 - 用户ID: {}", order.getUserId(), e); + } + } + + /** + * 处理分销业务(暂时注释,如需启用请取消注释) + * @param order 订单信息 + */ + @SuppressWarnings("unused") + private void processDistributionBusiness(ShopOrder order) { + try { + // 获取推荐人信息 + User parent = getParentUser(order.getUserId()); + if (parent == null) { + log.info("用户无推荐人,跳过分销业务处理 - 用户ID: {}", order.getUserId()); + return; + } + + // 计算佣金 + BigDecimal commission = calculateCommission(order); + if (commission.compareTo(BigDecimal.ZERO) <= 0) { + log.info("佣金为0,跳过分销业务处理 - 订单ID: {}", order.getOrderId()); + return; + } + + // 更新推荐人余额 + updateParentBalance(parent, commission); + + // 创建分销订单记录 + createDealerOrder(parent, order, commission); + + // 创建分销资金明细 + createDealerCapital(parent, order); + + log.info("分销业务处理完成 - 订单ID: {}, 推荐人ID: {}, 佣金: {}", + order.getOrderId(), parent.getUserId(), commission); + + } catch (Exception e) { + log.error("处理分销业务异常 - 订单ID: {}", order.getOrderId(), e); + } + } + + /** + * 获取推荐人信息 + * @param userId 用户ID + * @return 推荐人信息 + */ + private User getParentUser(Integer userId) { + try { + UserReferee userReferee = userRefereeService.getByUserId(userId); + if (userReferee != null && userReferee.getDealerId() != null) { + return userService.getByIdIgnoreTenant(userReferee.getDealerId()); + } + } catch (Exception e) { + log.error("获取推荐人信息异常 - 用户ID: {}", userId, e); + } + return null; + } + + /** + * 计算佣金 + * @param order 订单信息 + * @return 总佣金 + */ + private BigDecimal calculateCommission(ShopOrder order) { + try { + // 获取订单商品列表(忽略租户隔离) + List orderGoodsList = shopOrderGoodsService.getListByOrderIdIgnoreTenant(order.getOrderId()); + if (orderGoodsList.isEmpty()) { + return BigDecimal.ZERO; + } + + // 获取商品信息 + List goodsIds = orderGoodsList.stream() + .map(ShopOrderGoods::getGoodsId) + .toList(); + List goodsList = shopGoodsService.listByIds(goodsIds); + + // 计算总佣金 + BigDecimal totalCommission = BigDecimal.ZERO; + for (ShopOrderGoods orderGoods : orderGoodsList) { + ShopGoods goods = goodsList.stream() + .filter(g -> g.getGoodsId().equals(orderGoods.getGoodsId())) + .findFirst() + .orElse(null); + + if (goods != null && goods.getCommission() != null) { + BigDecimal goodsCommission = goods.getCommission() + .multiply(BigDecimal.valueOf(orderGoods.getTotalNum())); + totalCommission = totalCommission.add(goodsCommission); + } + } + + log.info("佣金计算完成 - 订单ID: {}, 总佣金: {}", order.getOrderId(), totalCommission); + return totalCommission; + + } catch (Exception e) { + log.error("计算佣金异常 - 订单ID: {}", order.getOrderId(), e); + return BigDecimal.ZERO; + } + } + + /** + * 更新推荐人余额 + * @param parent 推荐人信息 + * @param commission 佣金金额 + */ + private void updateParentBalance(User parent, BigDecimal commission) { + try { + BigDecimal currentBalance = parent.getBalance() != null ? parent.getBalance() : BigDecimal.ZERO; + BigDecimal newBalance = currentBalance.add(commission); + parent.setBalance(newBalance); + + userService.updateByUserId(parent); + + log.info("推荐人余额更新成功 - 用户ID: {}, 余额: {} -> {}", + parent.getUserId(), currentBalance, newBalance); + + } catch (Exception e) { + log.error("更新推荐人余额异常 - 用户ID: {}", parent.getUserId(), e); + } + } + + /** + * 创建分销订单记录 + * @param parent 推荐人信息 + * @param order 订单信息 + * @param commission 佣金金额 + */ + private void createDealerOrder(User parent, ShopOrder order, BigDecimal commission) { + try { + ShopDealerOrder dealerOrder = new ShopDealerOrder(); + dealerOrder.setUserId(parent.getUserId()); + dealerOrder.setOrderNo(order.getOrderNo()); + dealerOrder.setOrderPrice(order.getTotalPrice()); + dealerOrder.setFirstUserId(order.getUserId()); + dealerOrder.setFirstMoney(commission); + dealerOrder.setIsSettled(1); + dealerOrder.setSettleTime(LocalDateTime.now()); + + shopDealerOrderService.save(dealerOrder); + + log.info("分销订单记录创建成功 - 推荐人ID: {}, 订单ID: {}", parent.getUserId(), order.getOrderId()); + + } catch (Exception e) { + log.error("创建分销订单记录异常 - 推荐人ID: {}, 订单ID: {}", parent.getUserId(), order.getOrderId(), e); + } + } + + /** + * 创建分销资金明细 + * @param parent 推荐人信息 + * @param order 订单信息 + */ + private void createDealerCapital(User parent, ShopOrder order) { + try { + ShopDealerCapital dealerCapital = new ShopDealerCapital(); + dealerCapital.setUserId(parent.getUserId()); + dealerCapital.setOrderNo(order.getOrderNo()); + dealerCapital.setFlowType(10); // 分销收入 + + shopDealerCapitalService.save(dealerCapital); + + log.info("分销资金明细创建成功 - 推荐人ID: {}, 订单ID: {}", parent.getUserId(), order.getOrderId()); + + } catch (Exception e) { + log.error("创建分销资金明细异常 - 推荐人ID: {}, 订单ID: {}", parent.getUserId(), order.getOrderId(), e); + } + } +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopRechargeOrderServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopRechargeOrderServiceImpl.java new file mode 100644 index 0000000..ee0d9c3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopRechargeOrderServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopRechargeOrderMapper; +import com.gxwebsoft.shop.service.ShopRechargeOrderService; +import com.gxwebsoft.shop.entity.ShopRechargeOrder; +import com.gxwebsoft.shop.param.ShopRechargeOrderParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 会员充值订单表Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:12 + */ +@Service +public class ShopRechargeOrderServiceImpl extends ServiceImpl implements ShopRechargeOrderService { + + @Override + public PageResult pageRel(ShopRechargeOrderParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopRechargeOrderParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopRechargeOrder getByIdRel(Integer orderId) { + ShopRechargeOrderParam param = new ShopRechargeOrderParam(); + param.setOrderId(orderId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopSpecServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopSpecServiceImpl.java new file mode 100644 index 0000000..708f1c9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopSpecServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopSpecMapper; +import com.gxwebsoft.shop.service.ShopSpecService; +import com.gxwebsoft.shop.entity.ShopSpec; +import com.gxwebsoft.shop.param.ShopSpecParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 规格Service实现 + * + * @author 科技小王子 + * @since 2025-05-01 09:44:00 + */ +@Service +public class ShopSpecServiceImpl extends ServiceImpl implements ShopSpecService { + + @Override + public PageResult pageRel(ShopSpecParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopSpecParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopSpec getByIdRel(Integer specId) { + ShopSpecParam param = new ShopSpecParam(); + param.setSpecId(specId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopSpecValueServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopSpecValueServiceImpl.java new file mode 100644 index 0000000..9e39e23 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopSpecValueServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopSpecValueMapper; +import com.gxwebsoft.shop.service.ShopSpecValueService; +import com.gxwebsoft.shop.entity.ShopSpecValue; +import com.gxwebsoft.shop.param.ShopSpecValueParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 规格值Service实现 + * + * @author 科技小王子 + * @since 2025-05-01 09:44:00 + */ +@Service +public class ShopSpecValueServiceImpl extends ServiceImpl implements ShopSpecValueService { + + @Override + public PageResult pageRel(ShopSpecValueParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopSpecValueParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopSpecValue getByIdRel(Integer specValueId) { + ShopSpecValueParam param = new ShopSpecValueParam(); + param.setSpecValueId(specValueId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopSplashServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopSplashServiceImpl.java new file mode 100644 index 0000000..b6d3f8d --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopSplashServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopSplashMapper; +import com.gxwebsoft.shop.service.ShopSplashService; +import com.gxwebsoft.shop.entity.ShopSplash; +import com.gxwebsoft.shop.param.ShopSplashParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 开屏广告Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +@Service +public class ShopSplashServiceImpl extends ServiceImpl implements ShopSplashService { + + @Override + public PageResult pageRel(ShopSplashParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopSplashParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopSplash getByIdRel(Integer id) { + ShopSplashParam param = new ShopSplashParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopStoreRiderServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopStoreRiderServiceImpl.java new file mode 100644 index 0000000..e233fc3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopStoreRiderServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopStoreRiderMapper; +import com.gxwebsoft.shop.service.ShopStoreRiderService; +import com.gxwebsoft.shop.entity.ShopStoreRider; +import com.gxwebsoft.shop.param.ShopStoreRiderParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 配送员Service实现 + * + * @author 科技小王子 + * @since 2026-01-30 15:14:15 + */ +@Service +public class ShopStoreRiderServiceImpl extends ServiceImpl implements ShopStoreRiderService { + + @Override + public PageResult pageRel(ShopStoreRiderParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopStoreRiderParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopStoreRider getByIdRel(Long id) { + ShopStoreRiderParam param = new ShopStoreRiderParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopStoreServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopStoreServiceImpl.java new file mode 100644 index 0000000..3e9f2f4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopStoreServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopStoreMapper; +import com.gxwebsoft.shop.service.ShopStoreService; +import com.gxwebsoft.shop.entity.ShopStore; +import com.gxwebsoft.shop.param.ShopStoreParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 门店Service实现 + * + * @author 科技小王子 + * @since 2026-01-30 15:00:25 + */ +@Service +public class ShopStoreServiceImpl extends ServiceImpl implements ShopStoreService { + + @Override + public PageResult pageRel(ShopStoreParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopStoreParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopStore getByIdRel(Integer id) { + ShopStoreParam param = new ShopStoreParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopStoreUserServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopStoreUserServiceImpl.java new file mode 100644 index 0000000..4152b7d --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopStoreUserServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopStoreUserMapper; +import com.gxwebsoft.shop.service.ShopStoreUserService; +import com.gxwebsoft.shop.entity.ShopStoreUser; +import com.gxwebsoft.shop.param.ShopStoreUserParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 店员Service实现 + * + * @author 科技小王子 + * @since 2026-01-30 15:00:25 + */ +@Service +public class ShopStoreUserServiceImpl extends ServiceImpl implements ShopStoreUserService { + + @Override + public PageResult pageRel(ShopStoreUserParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopStoreUserParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopStoreUser getByIdRel(Integer id) { + ShopStoreUserParam param = new ShopStoreUserParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserAddressServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserAddressServiceImpl.java new file mode 100644 index 0000000..cf599c6 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserAddressServiceImpl.java @@ -0,0 +1,68 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopUserAddressMapper; +import com.gxwebsoft.shop.service.ShopUserAddressService; +import com.gxwebsoft.shop.entity.ShopUserAddress; +import com.gxwebsoft.shop.param.ShopUserAddressParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 收货地址Service实现 + * + * @author 科技小王子 + * @since 2025-07-22 23:06:40 + */ +@Service +public class ShopUserAddressServiceImpl extends ServiceImpl implements ShopUserAddressService { + + @Override + public PageResult pageRel(ShopUserAddressParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopUserAddressParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopUserAddress getByIdRel(Integer id) { + ShopUserAddressParam param = new ShopUserAddressParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public ShopUserAddress getDefaultAddress(Integer userId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ShopUserAddress::getUserId, userId) + .eq(ShopUserAddress::getIsDefault, true) + .orderByDesc(ShopUserAddress::getCreateTime) + .last("LIMIT 1"); + return getOne(wrapper); + } + + @Override + public List getUserAddresses(Integer userId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(ShopUserAddress::getUserId, userId) + .orderByDesc(ShopUserAddress::getIsDefault) + .orderByAsc(ShopUserAddress::getSortNumber) + .orderByDesc(ShopUserAddress::getCreateTime); + return list(wrapper); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserBalanceLogServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserBalanceLogServiceImpl.java new file mode 100644 index 0000000..483b7b3 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserBalanceLogServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopUserBalanceLogMapper; +import com.gxwebsoft.shop.service.ShopUserBalanceLogService; +import com.gxwebsoft.shop.entity.ShopUserBalanceLog; +import com.gxwebsoft.shop.param.ShopUserBalanceLogParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 用户余额变动明细表Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +@Service +public class ShopUserBalanceLogServiceImpl extends ServiceImpl implements ShopUserBalanceLogService { + + @Override + public PageResult pageRel(ShopUserBalanceLogParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopUserBalanceLogParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopUserBalanceLog getByIdRel(Integer logId) { + ShopUserBalanceLogParam param = new ShopUserBalanceLogParam(); + param.setLogId(logId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserCollectionServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserCollectionServiceImpl.java new file mode 100644 index 0000000..5d6dd6b --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserCollectionServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopUserCollectionMapper; +import com.gxwebsoft.shop.service.ShopUserCollectionService; +import com.gxwebsoft.shop.entity.ShopUserCollection; +import com.gxwebsoft.shop.param.ShopUserCollectionParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 我的收藏Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +@Service +public class ShopUserCollectionServiceImpl extends ServiceImpl implements ShopUserCollectionService { + + @Override + public PageResult pageRel(ShopUserCollectionParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopUserCollectionParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopUserCollection getByIdRel(Integer id) { + ShopUserCollectionParam param = new ShopUserCollectionParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserCouponServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserCouponServiceImpl.java new file mode 100644 index 0000000..fb3d5ed --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserCouponServiceImpl.java @@ -0,0 +1,57 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopUserCouponMapper; +import com.gxwebsoft.shop.service.ShopUserCouponService; +import com.gxwebsoft.shop.entity.ShopUserCoupon; +import com.gxwebsoft.shop.param.ShopUserCouponParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 用户优惠券Service实现 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Service +public class ShopUserCouponServiceImpl extends ServiceImpl implements ShopUserCouponService { + + @Override + public PageResult pageRel(ShopUserCouponParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopUserCouponParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopUserCoupon getByIdRel(Integer id) { + ShopUserCouponParam param = new ShopUserCouponParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + + @Override + public List userList(Integer userId) { + return list( + new LambdaQueryWrapper() + .eq(ShopUserCoupon::getUserId, userId) + ); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserRefereeServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserRefereeServiceImpl.java new file mode 100644 index 0000000..1d6dae9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserRefereeServiceImpl.java @@ -0,0 +1,55 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopUserRefereeMapper; +import com.gxwebsoft.shop.service.ShopUserRefereeService; +import com.gxwebsoft.shop.entity.ShopUserReferee; +import com.gxwebsoft.shop.param.ShopUserRefereeParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 用户推荐关系表Service实现 + * + * @author 科技小王子 + * @since 2025-08-11 23:51:41 + */ +@Service +public class ShopUserRefereeServiceImpl extends ServiceImpl implements ShopUserRefereeService { + + @Override + public PageResult pageRel(ShopUserRefereeParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopUserRefereeParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopUserReferee getByIdRel(Integer id) { + ShopUserRefereeParam param = new ShopUserRefereeParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + + @Override + public ShopUserReferee getByUserIdRel(Integer userId) { + ShopUserRefereeParam param = new ShopUserRefereeParam(); + param.setUserId(userId); + param.setLevel(1); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserServiceImpl.java new file mode 100644 index 0000000..9d7cde5 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import com.gxwebsoft.shop.entity.ShopUser; +import com.gxwebsoft.shop.mapper.ShopUserMapper; +import com.gxwebsoft.shop.param.ShopUserParam; +import com.gxwebsoft.shop.service.ShopUserService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 用户记录表Service实现 + * + * @author 科技小王子 + * @since 2025-10-03 13:41:09 + */ +@Service +public class ShopUserServiceImpl extends ServiceImpl implements ShopUserService { + + @Override + public PageResult pageRel(ShopUserParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopUserParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopUser getByIdRel(Integer userId) { + ShopUserParam param = new ShopUserParam(); + param.setUserId(userId); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopWarehouseServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopWarehouseServiceImpl.java new file mode 100644 index 0000000..6b9e727 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopWarehouseServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopWarehouseMapper; +import com.gxwebsoft.shop.service.ShopWarehouseService; +import com.gxwebsoft.shop.entity.ShopWarehouse; +import com.gxwebsoft.shop.param.ShopWarehouseParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 仓库Service实现 + * + * @author 科技小王子 + * @since 2026-01-30 17:46:48 + */ +@Service +public class ShopWarehouseServiceImpl extends ServiceImpl implements ShopWarehouseService { + + @Override + public PageResult pageRel(ShopWarehouseParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopWarehouseParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopWarehouse getByIdRel(Integer id) { + ShopWarehouseParam param = new ShopWarehouseParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopWebsiteServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopWebsiteServiceImpl.java new file mode 100644 index 0000000..d111c10 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopWebsiteServiceImpl.java @@ -0,0 +1,87 @@ +package com.gxwebsoft.shop.service.impl; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.gxwebsoft.cms.service.CmsWebsiteService; +import com.gxwebsoft.common.core.utils.JSONUtil; +import com.gxwebsoft.common.core.utils.RedisUtil; +import com.gxwebsoft.shop.service.ShopWebsiteService; +import com.gxwebsoft.shop.vo.ShopVo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.concurrent.TimeUnit; + +/** + * 商城网站服务实现类 + * + * @author 科技小王子 + * @since 2025-08-13 + */ +@Slf4j +@Service +public class ShopWebsiteServiceImpl implements ShopWebsiteService { + + @Autowired + private CmsWebsiteService cmsWebsiteService; + + @Autowired + private RedisUtil redisUtil; + + /** + * 商城信息缓存键前缀 + */ + private static final String SHOP_INFO_KEY_PREFIX = "ShopInfo:"; + + @Override + public ShopVo getShopInfo(Integer tenantId) { + // 参数验证 + if (ObjectUtil.isEmpty(tenantId)) { + throw new IllegalArgumentException("租户ID不能为空"); + } + + // 商城专用缓存键 + String cacheKey = SHOP_INFO_KEY_PREFIX + tenantId; + String shopInfo = redisUtil.get(cacheKey); + if (StrUtil.isNotBlank(shopInfo)) { + try { + ShopVo cacheVo = JSONUtil.parseObject(shopInfo, ShopVo.class); + if (cacheVo != null) { + log.info("从缓存获取商城信息,租户ID: {}", tenantId); + return cacheVo; + } + } catch (Exception e) { + log.warn("商城缓存解析失败,清理缓存后重新获取: {}", e.getMessage()); + redisUtil.delete(cacheKey); + } + } + + // 直接调用 CMS 服务获取站点信息,然后使用商城专用缓存 + ShopVo shopVO = cmsWebsiteService.getSiteInfo(tenantId); + if (shopVO == null) { + throw new RuntimeException("请先创建商城"); + } + + // 缓存结果(商城信息缓存时间设置为1小时) + try { + redisUtil.set(cacheKey, shopVO, 1L, TimeUnit.HOURS); + } catch (Exception e) { + log.warn("缓存商城信息失败: {}", e.getMessage()); + } + + log.info("获取商城信息成功,租户ID: {}", tenantId); + return shopVO; + } + + @Override + public void clearShopInfoCache(Integer tenantId) { + if (tenantId != null) { + String cacheKey = SHOP_INFO_KEY_PREFIX + tenantId; + redisUtil.delete(cacheKey); + log.info("清除商城信息缓存成功,租户ID: {}", tenantId); + } + } + + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopWechatDepositServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopWechatDepositServiceImpl.java new file mode 100644 index 0000000..9bf85d2 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopWechatDepositServiceImpl.java @@ -0,0 +1,47 @@ +package com.gxwebsoft.shop.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gxwebsoft.shop.mapper.ShopWechatDepositMapper; +import com.gxwebsoft.shop.service.ShopWechatDepositService; +import com.gxwebsoft.shop.entity.ShopWechatDeposit; +import com.gxwebsoft.shop.param.ShopWechatDepositParam; +import com.gxwebsoft.common.core.web.PageParam; +import com.gxwebsoft.common.core.web.PageResult; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 押金Service实现 + * + * @author 科技小王子 + * @since 2025-01-11 10:45:13 + */ +@Service +public class ShopWechatDepositServiceImpl extends ServiceImpl implements ShopWechatDepositService { + + @Override + public PageResult pageRel(ShopWechatDepositParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("sort_number asc, create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(ShopWechatDepositParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam page = new PageParam<>(); + page.setDefaultOrder("sort_number asc, create_time desc"); + return page.sortRecords(list); + } + + @Override + public ShopWechatDeposit getByIdRel(Integer id) { + ShopWechatDepositParam param = new ShopWechatDepositParam(); + param.setId(id); + return param.getOne(baseMapper.selectListRel(param)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/task/CouponExpireTask.java b/src/main/java/com/gxwebsoft/shop/task/CouponExpireTask.java new file mode 100644 index 0000000..9781bd9 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/task/CouponExpireTask.java @@ -0,0 +1,86 @@ +package com.gxwebsoft.shop.task; + +import com.gxwebsoft.shop.service.CouponStatusService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +/** + * 优惠券过期处理定时任务 + * + * @author WebSoft + * @since 2025-01-15 + */ +@Slf4j +@Component +public class CouponExpireTask { + + @Autowired + private CouponStatusService couponStatusService; + + @Value("${spring.profiles.active:dev}") + private String activeProfile; + + /** + * 每天凌晨2点执行过期优惠券处理 + * 生产环境:每天凌晨2点执行 + * 开发环境:每10分钟执行一次(用于测试) + */ + @Scheduled(cron = "${coupon.expire.cron:0 0 2 * * ?}") + public void processExpiredCoupons() { + log.info("开始执行过期优惠券处理任务..."); + + try { + long startTime = System.currentTimeMillis(); + + // 批量更新过期优惠券状态 + int updatedCount = couponStatusService.updateExpiredCoupons(); + + long endTime = System.currentTimeMillis(); + long duration = endTime - startTime; + + log.info("过期优惠券处理任务完成,更新数量: {},耗时: {}ms", updatedCount, duration); + + // 如果是开发环境,输出更详细的日志 + if ("dev".equals(activeProfile)) { + log.debug("开发环境 - 过期优惠券处理详情: 更新{}张优惠券", updatedCount); + } + + } catch (Exception e) { + log.error("过期优惠券处理任务执行失败", e); + } + } + + /** + * 每小时执行一次优惠券状态检查(可选) + * 用于及时发现和处理刚过期的优惠券 + */ + @Scheduled(cron = "0 0 * * * ?") + public void hourlyExpiredCouponsCheck() { + // 只在生产环境执行 + if (!"prod".equals(activeProfile)) { + return; + } + + log.debug("执行每小时优惠券状态检查..."); + + try { + int updatedCount = couponStatusService.updateExpiredCoupons(); + if (updatedCount > 0) { + log.info("每小时检查发现并更新了 {} 张过期优惠券", updatedCount); + } + } catch (Exception e) { + log.error("每小时优惠券状态检查失败", e); + } + } + + /** + * 手动触发过期优惠券处理(用于测试) + */ + public void manualProcessExpiredCoupons() { + log.info("手动触发过期优惠券处理任务..."); + processExpiredCoupons(); + } +} diff --git a/src/main/java/com/gxwebsoft/shop/task/OrderAutoCancelTask.java b/src/main/java/com/gxwebsoft/shop/task/OrderAutoCancelTask.java new file mode 100644 index 0000000..d1b71ff --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/task/OrderAutoCancelTask.java @@ -0,0 +1,196 @@ +package com.gxwebsoft.shop.task; + +import com.gxwebsoft.common.core.annotation.IgnoreTenant; +import com.gxwebsoft.shop.config.OrderConfigProperties; +import com.gxwebsoft.shop.entity.ShopOrder; +import com.gxwebsoft.shop.service.OrderCancelService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * 订单自动取消定时任务 + * + * @author WebSoft + * @since 2025-01-26 + */ +@Slf4j +@Component +@ConditionalOnProperty(prefix = "shop.order.auto-cancel", name = "enabled", havingValue = "true", matchIfMissing = true) +public class OrderAutoCancelTask { + + @Autowired + private OrderCancelService orderCancelService; + + @Autowired + private OrderConfigProperties orderConfig; + + @Value("${spring.profiles.active:dev}") + private String activeProfile; + + /** + * 自动取消超时订单 + * 生产环境:每5分钟执行一次 + * 开发环境:每1分钟执行一次(便于测试) + */ + @Scheduled(cron = "${shop.order.auto-cancel.cron:0 */5 * * * ?}") + @IgnoreTenant("定时任务需要处理所有租户的超时订单") + public void cancelExpiredOrders() { + if (!orderConfig.getAutoCancel().isEnabled()) { + log.debug("订单自动取消功能已禁用"); + return; + } + + log.info("开始执行订单自动取消任务..."); + + try { + long startTime = System.currentTimeMillis(); + int totalCancelledCount = 0; + + // 处理默认配置的订单 + int defaultCancelledCount = processDefaultTimeoutOrders(); + totalCancelledCount += defaultCancelledCount; + + // 处理租户特殊配置的订单 + int tenantCancelledCount = processTenantSpecificOrders(); + totalCancelledCount += tenantCancelledCount; + + long endTime = System.currentTimeMillis(); + long duration = endTime - startTime; + + log.info("订单自动取消任务完成,总取消数量: {},默认配置: {},租户配置: {},耗时: {}ms", + totalCancelledCount, defaultCancelledCount, tenantCancelledCount, duration); + + // 开发环境输出更详细的日志 + if ("dev".equals(activeProfile)) { + log.debug("开发环境 - 订单自动取消详情: 总共取消{}个订单", totalCancelledCount); + } + + } catch (Exception e) { + log.error("订单自动取消任务执行失败", e); + } + } + + /** + * 处理使用默认超时配置的订单 + */ + private int processDefaultTimeoutOrders() { + try { + Integer defaultTimeout = orderConfig.getAutoCancel().getDefaultTimeoutMinutes(); + Integer batchSize = orderConfig.getAutoCancel().getBatchSize(); + + log.debug("处理默认超时订单,超时时间: {}分钟,批量大小: {}", defaultTimeout, batchSize); + + List expiredOrders = orderCancelService.findExpiredUnpaidOrders(defaultTimeout, batchSize); + + if (expiredOrders.isEmpty()) { + log.debug("没有找到使用默认配置的超时订单"); + return 0; + } + + // 过滤掉有特殊租户配置的订单 + List ordersToCancel = filterOrdersWithoutTenantConfig(expiredOrders); + + if (ordersToCancel.isEmpty()) { + log.debug("过滤后没有需要使用默认配置取消的订单"); + return 0; + } + + int cancelledCount = orderCancelService.batchCancelOrders(ordersToCancel); + log.info("默认配置取消订单完成,找到: {}个,过滤后: {}个,成功取消: {}个", + expiredOrders.size(), ordersToCancel.size(), cancelledCount); + + return cancelledCount; + + } catch (Exception e) { + log.error("处理默认超时订单失败", e); + return 0; + } + } + + /** + * 处理租户特殊配置的订单 + */ + private int processTenantSpecificOrders() { + try { + List tenantConfigs = orderConfig.getAutoCancel().getTenantConfigs(); + if (tenantConfigs == null || tenantConfigs.isEmpty()) { + log.debug("没有配置租户特殊超时规则"); + return 0; + } + + int totalCancelledCount = 0; + Integer batchSize = orderConfig.getAutoCancel().getBatchSize(); + + for (OrderConfigProperties.TenantCancelConfig tenantConfig : tenantConfigs) { + if (!tenantConfig.isEnabled()) { + log.debug("租户{}的自动取消功能已禁用", tenantConfig.getTenantId()); + continue; + } + + log.debug("处理租户{}的超时订单,超时时间: {}分钟", + tenantConfig.getTenantId(), tenantConfig.getTimeoutMinutes()); + + List tenantExpiredOrders = orderCancelService.findExpiredUnpaidOrdersByTenant( + tenantConfig.getTenantId(), tenantConfig.getTimeoutMinutes(), batchSize); + + if (!tenantExpiredOrders.isEmpty()) { + int cancelledCount = orderCancelService.batchCancelOrders(tenantExpiredOrders); + totalCancelledCount += cancelledCount; + + log.info("租户{}取消订单完成,找到: {}个,成功取消: {}个", + tenantConfig.getTenantId(), tenantExpiredOrders.size(), cancelledCount); + } + } + + return totalCancelledCount; + + } catch (Exception e) { + log.error("处理租户特殊配置订单失败", e); + return 0; + } + } + + /** + * 过滤掉有租户特殊配置的订单 + */ + private List filterOrdersWithoutTenantConfig(List orders) { + List tenantConfigs = orderConfig.getAutoCancel().getTenantConfigs(); + if (tenantConfigs == null || tenantConfigs.isEmpty()) { + return orders; + } + + return orders.stream() + .filter(order -> { + // 检查该订单的租户是否有特殊配置 + return tenantConfigs.stream() + .noneMatch(config -> config.isEnabled() && config.getTenantId().equals(order.getTenantId())); + }) + .collect(java.util.stream.Collectors.toList()); + } + + /** + * 手动触发订单自动取消任务(用于测试) + */ + @IgnoreTenant("手动触发的定时任务需要处理所有租户的超时订单") + public void manualCancelExpiredOrders() { + log.info("手动触发订单自动取消任务..."); + cancelExpiredOrders(); + } + + /** + * 获取任务状态信息 + */ + public String getTaskStatus() { + return String.format("订单自动取消任务状态 - 启用: %s, 默认超时: %d分钟, 检查间隔: %d分钟, 批量大小: %d", + orderConfig.getAutoCancel().isEnabled(), + orderConfig.getAutoCancel().getDefaultTimeoutMinutes(), + orderConfig.getAutoCancel().getCheckIntervalMinutes(), + orderConfig.getAutoCancel().getBatchSize()); + } +} diff --git a/src/main/java/com/gxwebsoft/shop/task/RefundStatusQueryTask.java b/src/main/java/com/gxwebsoft/shop/task/RefundStatusQueryTask.java new file mode 100644 index 0000000..ecce124 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/task/RefundStatusQueryTask.java @@ -0,0 +1,133 @@ +package com.gxwebsoft.shop.task; + +import com.gxwebsoft.common.core.annotation.IgnoreTenant; +import com.gxwebsoft.payment.dto.PaymentResponse; +import com.gxwebsoft.payment.enums.PaymentType; +import com.gxwebsoft.payment.exception.PaymentException; +import com.gxwebsoft.payment.service.PaymentService; +import com.gxwebsoft.shop.entity.ShopOrder; +import com.gxwebsoft.shop.service.ShopOrderService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * 退款状态查询定时任务 + * 定期查询处理中的退款订单状态,并更新订单状态 + * + * @author WebSoft + * @since 2025-01-26 + */ +@Slf4j +@Component +@ConditionalOnProperty(prefix = "shop.order.refund-query", name = "enabled", havingValue = "true", matchIfMissing = true) +public class RefundStatusQueryTask { + + @Autowired + private ShopOrderService shopOrderService; + + @Autowired + private PaymentService paymentService; + + /** + * 查询退款状态并更新订单 + * 生产环境:每10分钟执行一次 + * 开发环境:每2分钟执行一次(便于测试) + */ + @Scheduled(cron = "${shop.order.refund-query.cron:0 0/10 * * * ?}") + @IgnoreTenant("定时任务需要处理所有租户的退款订单") + public void queryRefundStatusAndUpdateOrders() { + log.info("开始执行退款状态查询任务..."); + + try { + long startTime = System.currentTimeMillis(); + int totalProcessedCount = 0; + + // 查询所有退款处理中的订单(状态为5) + List refundProcessingOrders = shopOrderService.lambdaQuery() + .eq(ShopOrder::getOrderStatus, 5) + .isNotNull(ShopOrder::getRefundOrder) + .list(); + + if (refundProcessingOrders.isEmpty()) { + log.info("没有找到退款处理中的订单"); + return; + } + + log.info("找到 {} 个退款处理中的订单,开始查询退款状态...", refundProcessingOrders.size()); + + int successCount = 0; + int failedCount = 0; + + for (ShopOrder order : refundProcessingOrders) { + try { + // 查询退款状态 + PaymentResponse response = paymentService.queryRefund( + order.getRefundOrder(), // 退款单号 + PaymentType.WECHAT_NATIVE, // 支付类型(这里假设是微信支付) + order.getTenantId() // 租户ID + ); + + if (response != null) { + // 根据退款状态更新订单 + if (response.getSuccess()) { + // 退款成功 + order.setOrderStatus(6); // 退款成功 + shopOrderService.updateById(order); + log.info("订单 {} 退款成功,更新订单状态为退款成功", order.getOrderNo()); + successCount++; + } else if (response.getPaymentStatus() != null) { + // 根据具体的退款状态处理 + switch (response.getPaymentStatus()) { + case REFUND_FAILED: + // 退款失败 + order.setOrderStatus(5); // 退款被拒绝(保持原状态或根据业务需要调整) + shopOrderService.updateById(order); + log.info("订单 {} 退款失败,更新订单状态", order.getOrderNo()); + failedCount++; + break; + case REFUNDING: + // 仍在退款中,无需处理 + log.debug("订单 {} 仍在退款中", order.getOrderNo()); + break; + default: + log.warn("订单 {} 未知的退款状态: {}", order.getOrderNo(), response.getPaymentStatus()); + break; + } + } + } else { + log.warn("订单 {} 退款状态查询返回空结果", order.getOrderNo()); + } + } catch (PaymentException e) { + log.error("查询订单 {} 退款状态时发生支付异常: {}", order.getOrderNo(), e.getMessage(), e); + failedCount++; + } catch (Exception e) { + log.error("查询订单 {} 退款状态时发生系统异常: {}", order.getOrderNo(), e.getMessage(), e); + failedCount++; + } + } + + long endTime = System.currentTimeMillis(); + long duration = endTime - startTime; + + log.info("退款状态查询任务完成,总处理数量: {},成功: {},失败: {},耗时: {}ms", + refundProcessingOrders.size(), successCount, failedCount, duration); + + } catch (Exception e) { + log.error("退款状态查询任务执行失败", e); + } + } + + /** + * 手动触发退款状态查询任务(用于测试) + */ + @IgnoreTenant("手动触发的定时任务需要处理所有租户的退款订单") + public void manualQueryRefundStatus() { + log.info("手动触发退款状态查询任务..."); + queryRefundStatusAndUpdateOrders(); + } +} \ No newline at end of file diff --git a/src/main/java/com/gxwebsoft/shop/util/UpstreamUserFinder.java b/src/main/java/com/gxwebsoft/shop/util/UpstreamUserFinder.java new file mode 100644 index 0000000..b26fd7a --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/util/UpstreamUserFinder.java @@ -0,0 +1,60 @@ +package com.gxwebsoft.shop.util; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.function.Function; +import java.util.function.Predicate; + +/** + * Utility to traverse an upstream "parent" chain and pick the nearest N users matching a predicate. + *

+ * Typical usage: starting from buyerUserId, walk level-1 referee chain upwards and pick the first + * two store-role users (type=1). + */ +public final class UpstreamUserFinder { + + private UpstreamUserFinder() { + } + + /** + * Walk the upstream chain starting from {@code startUserId} (exclusive), repeatedly resolving + * the parent via {@code parentResolver}. Collect the first {@code needCount} userIds that match + * {@code matcher}, preserving encounter order (nearest first). + */ + public static List findFirstNMatchingUpstreamUsers( + Integer startUserId, + int needCount, + int maxDepth, + Function parentResolver, + Predicate matcher + ) { + if (startUserId == null || needCount <= 0 || maxDepth <= 0 || parentResolver == null || matcher == null) { + return Collections.emptyList(); + } + + List result = new ArrayList<>(Math.min(needCount, 4)); + Set visited = new HashSet<>(); + + Integer current = startUserId; + for (int depth = 0; depth < maxDepth && current != null && result.size() < needCount; depth++) { + Integer parentId = parentResolver.apply(current); + if (parentId == null) { + break; + } + if (!visited.add(parentId)) { + break; + } + + if (matcher.test(parentId)) { + result.add(parentId); + } + current = parentId; + } + + return result; + } +} + diff --git a/src/main/java/com/gxwebsoft/shop/vo/MenuVo.java b/src/main/java/com/gxwebsoft/shop/vo/MenuVo.java new file mode 100644 index 0000000..5e13bde --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/vo/MenuVo.java @@ -0,0 +1,58 @@ +package com.gxwebsoft.shop.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 导航信息视图对象 + * 专门用于前端展示,只包含前端需要的字段 + * + * @author WebSoft + * @since 2025-01-12 + */ +@Data +@Schema(description = "导航信息视图对象") +public class MenuVo implements Serializable { + + @Schema(description = "导航ID") + private Integer navigationId; + + @Schema(description = "导航名称") + private String title; + + @Schema(description = "导航类型") + private String model; + + @Schema(description = "唯一标识") + private String code; + + @Schema(description = "路由地址") + private String path; + + @Schema(description = "导航图标") + private String icon; + + @Schema(description = "导航颜色") + private String color; + + @Schema(description = "父级ID") + private Integer parentId; + + @Schema(description = "排序") + private Integer sort; + + @Schema(description = "是否隐藏 0显示 1隐藏") + private Integer hide; + + @Schema(description = "位置 0顶部 1底部") + private Integer top; + + @Schema(description = "打开方式 0当前窗口 1新窗口") + private Integer target; + + @Schema(description = "子导航") + private List children; +} diff --git a/src/main/java/com/gxwebsoft/shop/vo/ShopVo.java b/src/main/java/com/gxwebsoft/shop/vo/ShopVo.java new file mode 100644 index 0000000..69885e7 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/vo/ShopVo.java @@ -0,0 +1,107 @@ +package com.gxwebsoft.shop.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; + +/** + * 应用信息 + * 专门用于前端展示,只包含前端需要的字段 + * + * @author WebSoft + * @since 2025-01-12 + */ +@Data +@Schema(description = "应用信息视图对象") +public class ShopVo implements Serializable { + + @Schema(description = "站点ID") + private Integer websiteId; + + @Schema(description = "站点名称") + private String websiteName; + + @Schema(description = "站点编号") + private String websiteCode; + + @Schema(description = "应用介绍") + private String description; + + @Schema(description = "网站关键词") + private String keywords; + + @Schema(description = "小程序二维码") + private String mpQrCode; + + @Schema(description = "标题") + private String title; + + @Schema(description = "LOGO") + private String logo; + + @Schema(description = "图标") + private String icon; + + @Schema(description = "域名") + private String domain; + + @Schema(description = "后台管理地址") + private String adminUrl; + + @Schema(description = "API地址") + private String apiUrl; + + @Schema(description = "运行状态 0未开通 1正常 2维护中 3违规关停") + private Integer running; + + @Schema(description = "应用版本 10免费版 20授权版 30永久授权") + private Integer version; + + @Schema(description = "服务到期时间") + private String expirationTime; + + @Schema(description = "创建时间") + private String createTime; + + @Schema(description = "是否到期 -1已过期 1未过期") + private Integer expired; + + @Schema(description = "剩余天数") + private Long expiredDays; + + @Schema(description = "即将过期 0否 1是") + private Integer soon; + + @Schema(description = "状态图标") + private String statusIcon; + + @Schema(description = "状态文本") + private String statusText; + + @Schema(description = "网站配置") + private Object config; + + @Schema(description = "服务器时间信息") + private HashMap serverTime; + + @Schema(description = "顶部导航") + private List topNavs; + + @Schema(description = "底部导航") + private List bottomNavs; + + @Schema(description = "网站设置") + private Object setting; + + @Schema(description = "应用ID") + private Integer appId; + + @Schema(description = "应用名称") + private String appName; + + @Schema(description = "应用编号") + private String appCode; +} diff --git a/src/main/java/com/gxwebsoft/shop/vo/UserTicketSummaryVo.java b/src/main/java/com/gxwebsoft/shop/vo/UserTicketSummaryVo.java new file mode 100644 index 0000000..27ec3f4 --- /dev/null +++ b/src/main/java/com/gxwebsoft/shop/vo/UserTicketSummaryVo.java @@ -0,0 +1,24 @@ +package com.gxwebsoft.shop.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * 用户套票汇总(可用/冻结) + */ +@Data +@Schema(name = "UserTicketSummaryVo对象", description = "用户套票汇总(可用/冻结)") +public class UserTicketSummaryVo { + @Schema(description = "可用数量") + private Integer availableQty; + + @Schema(description = "冻结数量") + private Integer frozenQty; + + @Schema(description = "已用数量") + private Integer usedQty; + + @Schema(description = "总数量") + private Integer totalQty; +} + diff --git a/src/main/java/lib/commons-codec-1.9.jar b/src/main/java/lib/commons-codec-1.9.jar new file mode 100644 index 0000000..ef35f1c Binary files /dev/null and b/src/main/java/lib/commons-codec-1.9.jar differ diff --git a/src/main/java/lib/json-20200518.jar b/src/main/java/lib/json-20200518.jar new file mode 100644 index 0000000..0b85b0e Binary files /dev/null and b/src/main/java/lib/json-20200518.jar differ diff --git a/src/main/resources/application-cms.yml b/src/main/resources/application-cms.yml new file mode 100644 index 0000000..aba37b5 --- /dev/null +++ b/src/main/resources/application-cms.yml @@ -0,0 +1,83 @@ +# 生产环境配置 + +# 服务器配置 +server: + port: 9100 + +# 数据源配置 +spring: + datasource: + url: jdbc:mysql://1Panel-mysql-Bqdt:3306/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai + username: modules + password: P7KsAyDXG8YdLnkA + driver-class-name: com.mysql.cj.jdbc.Driver + type: com.alibaba.druid.pool.DruidDataSource + druid: + remove-abandoned: true + + # redis + redis: + database: 0 + host: 1Panel-redis-Q1LE + port: 6379 + password: redis_WSDb88 + +# 日志配置 +logging: + file: + name: websoft-modules.log + level: + root: WARN + com.gxwebsoft: ERROR + com.baomidou.mybatisplus: ERROR + +socketio: + host: 0.0.0.0 #IP地址 + +# MQTT配置 +mqtt: + enabled: false # 启用MQTT服务 + host: tcp://132.232.214.96:1883 + username: swdev + password: Sw20250523 + client-id-prefix: hjm_car_ + topic: /SW_GPS/# + qos: 2 + connection-timeout: 10 + keep-alive-interval: 20 + auto-reconnect: true + +# 框架配置 +config: + # 文件服务器 + file-server: https://file-s209.shoplnk.cn + # 生产环境接口 + server-url: https://server.websoft.top/api + upload-path: /www/wwwroot/file.ws + + # 阿里云OSS云存储 + endpoint: https://oss-cn-shenzhen.aliyuncs.com + accessKeyId: LTAI4GKGZ9Z2Z8JZ77c3GNZP + accessKeySecret: BiDkpS7UXj72HWwDWaFZxiXjNFBNCM + bucketName: oss-gxwebsoft + bucketDomain: https://oss.wsdns.cn + aliyunDomain: https://oss-gxwebsoft.oss-cn-shenzhen.aliyuncs.com + +# 生产环境证书配置 +certificate: + load-mode: VOLUME # 生产环境从Docker挂载卷加载 + cert-root-path: /www/wwwroot/file.ws + +# 支付配置缓存 +payment: + cache: + # 支付配置缓存键前缀,生产环境使用 Payment:1* 格式 + key-prefix: "Payment:1" + # 缓存过期时间(小时) + expire-hours: 24 + +# 微信支付-商家转账(升级版)转账场景报备信息(必须与商户平台 transfer_scene_id=1005 的报备信息一致) +wechatpay: + transfer: + scene-id: 1005 + scene-report-infos-json: '[{"info_type":"岗位类型","info_content":"业务员"},{"info_type":"报酬说明","info_content":"配送费"}]' diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml new file mode 100644 index 0000000..8a221d2 --- /dev/null +++ b/src/main/resources/application-dev.yml @@ -0,0 +1,71 @@ +# 开发环境配置 + +# 服务器配置 +server: + port: 9200 + +# 数据源配置 +spring: + datasource: + url: jdbc:mysql://8.134.55.105:13306/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8 + username: modules + password: tYmmMGh5wpwXR3ae + driver-class-name: com.mysql.cj.jdbc.Driver + type: com.alibaba.druid.pool.DruidDataSource + + # redis + redis: + database: 0 + host: 8.134.55.105 + port: 16379 + password: redis_t74P8C + +# 日志配置 +logging: + level: + com.gxwebsoft: DEBUG + com.baomidou.mybatisplus: DEBUG + +socketio: + host: localhost #IP地址 + +# MQTT配置 +mqtt: + enabled: false # 添加开关来禁用MQTT服务 + host: tcp://132.232.214.96:1883 + username: swdev + password: Sw20250523 + client-id-prefix: hjm_car_ + topic: /SW_GPS/# + qos: 2 + connection-timeout: 10 + keep-alive-interval: 20 + auto-reconnect: true + +# 框架配置 +config: + # 开发环境接口 + server-url: https://glt-server.websoft.top/api + upload-path: /Users/gxwebsoft/Documents/uploads/ # window(D:\Temp) + +# 开发环境证书配置 +certificate: + load-mode: CLASSPATH # 开发环境从classpath加载 + wechat-pay: + dev: + private-key-file: "apiclient_key.pem" + apiclient-cert-file: "apiclient_cert.pem" + wechatpay-cert-file: "wechatpay_cert.pem" + +# 阿里云翻译配置 +aliyun: + translate: + access-key-id: LTAI5tEsyhW4GCKbds1qsopg + access-key-secret: zltFlQrYVAoq2KMFDWgLa3GhkMNeyO + endpoint: mt.cn-hangzhou.aliyuncs.com + +# 微信支付-商家转账(升级版)转账场景报备信息(必须与商户平台 transfer_scene_id=1005 的报备信息一致) +wechatpay: + transfer: + scene-id: 1005 + scene-report-infos-json: '[{"info_type":"岗位类型","info_content":"业务员"},{"info_type":"报酬说明","info_content":"配送费"}]' diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml new file mode 100644 index 0000000..91b17f0 --- /dev/null +++ b/src/main/resources/application-prod.yml @@ -0,0 +1,83 @@ +# 生产环境配置 + +# 数据源配置 +spring: + datasource: + url: jdbc:mysql://1Panel-mysql-Bqdt:3306/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai + username: modules + password: P7KsAyDXG8YdLnkA + driver-class-name: com.mysql.cj.jdbc.Driver + type: com.alibaba.druid.pool.DruidDataSource + druid: + remove-abandoned: true + + # redis + redis: + database: 0 + host: 1Panel-redis-Q1LE + port: 6379 + password: redis_WSDb88 + +# 日志配置 +logging: + file: + name: websoft-modules.log + level: + root: WARN + com.gxwebsoft: ERROR + com.baomidou.mybatisplus: ERROR + +socketio: + host: 0.0.0.0 #IP地址 + +# MQTT配置 +mqtt: + enabled: true # 启用MQTT服务 + host: tcp://132.232.214.96:1883 + username: swdev + password: Sw20250523 + client-id-prefix: hjm_car_ + topic: /SW_GPS/# + qos: 2 + connection-timeout: 10 + keep-alive-interval: 20 + auto-reconnect: true + +# 框架配置 +config: + # 文件服务器 + file-server: https://file-s209.shoplnk.cn + # 生产环境接口 + server-url: https://server.websoft.top/api + upload-path: /www/wwwroot/file.ws + + # 阿里云OSS云存储 + endpoint: https://oss-cn-shenzhen.aliyuncs.com + accessKeyId: LTAI4GKGZ9Z2Z8JZ77c3GNZP + accessKeySecret: BiDkpS7UXj72HWwDWaFZxiXjNFBNCM + bucketName: oss-gxwebsoft + bucketDomain: https://oss.wsdns.cn + aliyunDomain: https://oss-gxwebsoft.oss-cn-shenzhen.aliyuncs.com + +# 生产环境证书配置 +certificate: + load-mode: VOLUME # 生产环境从Docker挂载卷加载 + cert-root-path: /www/wwwroot/file.ws + +# 支付配置缓存 +payment: + cache: + # 支付配置缓存键前缀,生产环境使用 Payment:1* 格式 + key-prefix: "Payment:1" + # 缓存过期时间(小时) + expire-hours: 24 +# 阿里云翻译配置 +aliyun: + translate: + access-key-id: LTAI5tEsyhW4GCKbds1qsopg + access-key-secret: zltFlQrYVAoq2KMFDWgLa3GhkMNeyO + endpoint: mt.cn-hangzhou.aliyuncs.com +wechatpay: + transfer: + scene-id: 1005 + scene-report-infos-json: '[{"info_type":"岗位类型","info_content":"配送员"},{"info_type":"报酬说明","info_content":"12月份配送费"}]' diff --git a/src/main/resources/application-yd.yml b/src/main/resources/application-yd.yml new file mode 100644 index 0000000..834efcb --- /dev/null +++ b/src/main/resources/application-yd.yml @@ -0,0 +1,83 @@ +# 生产环境配置 + +# 服务器配置 +server: + port: 9400 + +# 数据源配置 +spring: + datasource: + url: jdbc:mysql://1Panel-mysql-Bqdt:3306/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai + username: modules + password: P7KsAyDXG8YdLnkA + driver-class-name: com.mysql.cj.jdbc.Driver + type: com.alibaba.druid.pool.DruidDataSource + druid: + remove-abandoned: true + + # redis + redis: + database: 0 + host: 1Panel-redis-Q1LE + port: 6379 + password: redis_WSDb88 + +# 日志配置 +logging: + file: + name: websoft-modules.log + level: + root: WARN + com.gxwebsoft: ERROR + com.baomidou.mybatisplus: ERROR + +socketio: + host: 0.0.0.0 #IP地址 + +# MQTT配置 +mqtt: + enabled: true # 启用MQTT服务 + host: tcp://132.232.214.96:1883 + username: swdev + password: Sw20250523 + client-id-prefix: hjm_car_ + topic: /SW_GPS/# + qos: 2 + connection-timeout: 10 + keep-alive-interval: 20 + auto-reconnect: true + +# 框架配置 +config: + # 文件服务器 + file-server: https://file-s209.shoplnk.cn + # 生产环境接口 + server-url: https://server.websoft.top/api + upload-path: /www/wwwroot/file.ws + + # 阿里云OSS云存储 + endpoint: https://oss-cn-shenzhen.aliyuncs.com + accessKeyId: LTAI4GKGZ9Z2Z8JZ77c3GNZP + accessKeySecret: BiDkpS7UXj72HWwDWaFZxiXjNFBNCM + bucketName: oss-gxwebsoft + bucketDomain: https://oss.wsdns.cn + aliyunDomain: https://oss-gxwebsoft.oss-cn-shenzhen.aliyuncs.com + +# 生产环境证书配置 +certificate: + load-mode: VOLUME # 生产环境从Docker挂载卷加载 + cert-root-path: /www/wwwroot/file.ws + +# 支付配置缓存 +payment: + cache: + # 支付配置缓存键前缀,生产环境使用 Payment:1* 格式 + key-prefix: "Payment:1" + # 缓存过期时间(小时) + expire-hours: 24 + +# 微信支付-商家转账(升级版)转账场景报备信息(必须与商户平台 transfer_scene_id=1005 的报备信息一致) +wechatpay: + transfer: + scene-id: 1005 + scene-report-infos-json: '[{"info_type":"岗位类型","info_content":"业务员"},{"info_type":"报酬说明","info_content":"配送费"}]' diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..368b20f --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,247 @@ +# 端口 +server: + port: 9200 +# 多环境配置 +spring: + profiles: + active: dev + + application: + name: server + + # 允许循环引用(临时解决方案) + main: + allow-circular-references: true + + # 修复 Springfox 与 Spring Boot 2.6+ 兼容性问题 + mvc: + pathmatch: + matching-strategy: ant_path_matcher + + # json时间格式设置 + jackson: + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + serialization: + write-dates-as-timestamps: false + deserialization: + fail-on-unknown-properties: false + # 确保启用Java 8时间支持 + modules: + - com.fasterxml.jackson.datatype.jsr310.JavaTimeModule + + # 连接池配置 + datasource: + druid: + initial-size: 5 + min-idle: 5 + max-active: 20 + max-wait: 30000 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 + test-while-idle: true + test-on-borrow: true + test-on-return: false + remove-abandoned: true + remove-abandoned-timeout: 1800 + #pool-prepared-statements: false + #max-pool-prepared-statement-per-connection-size: 20 + filters: stat, wall + validation-query: SELECT 'x' + aop-patterns: com.gxwebsoft.*.*.service.* + stat-view-servlet: + url-pattern: /druid/* + reset-enable: true + login-username: admin + login-password: admin + + # 设置上传文件大小 + servlet: + multipart: + max-file-size: 100MB + max-request-size: 100MB + + # 邮件服务器配置 + mail: + host: smtp.qq.com + username: 170083662@qq.com + password: mnfokualhfaucaie + default-encoding: UTF-8 + properties: + mail: + smtp: + auth: true + socketFactory: + class: javax.net.ssl.SSLSocketFactory + port: 465 + +# Mybatis-plus配置 +mybatis-plus: + mapper-locations: classpath*:com/gxwebsoft/**/*Mapper.xml + configuration: + map-underscore-to-camel-case: true + cache-enabled: true + global-config: + :banner: false + db-config: + id-type: auto + logic-delete-value: 1 + logic-not-delete-value: 0 + +# 框架配置 +config: + open-office-home: C:/OpenOffice4/ + swagger-base-package: com.gxwebsoft + swagger-title: 网宿软件 API文档 + swagger-description: websoft - 基于java spring、vue3、antd构建的前后端分离快速开发框架 + swagger-version: 2.0 + token-key: WLgNsWJ8rPjRtnjzX/Gx2RGS80Kwnm/ZeLbvIL+NrBs= + # 主服务器 + server-url: https://server.websoft.top/api + # 文件服务器 + file-server: https://file.websoft.top + # 其他 + api-url: https://server.websoft.top/api + upload-path: /Users/gxwebsoft/Documents/uploads + local-upload-path: /Users/gxwebsoft/Documents/uploads + + # 阿里云OSS云存储 + endpoint: https://oss-cn-shenzhen.aliyuncs.com + accessKeyId: LTAI4GKGZ9Z2Z8JZ77c3GNZP + accessKeySecret: BiDkpS7UXj72HWwDWaFZxiXjNFBNCM + bucketName: oss-gxwebsoft + bucketDomain: https://oss.wsdns.cn + aliyunDomain: https://oss-gxwebsoft.oss-cn-shenzhen.aliyuncs.com + +# 商城订单配置 +shop: + order: + # 测试账号配置 + test-account: + enabled: true # 禁用测试账号功能 + phone-numbers: + - "19163679581" # 改为其他测试手机号 + test-pay-amount: 0.01 + + # 租户特殊规则配置 + # tenant-rules: + # - tenant-id: 10324 + # tenant-name: "百色中学" + # min-amount: 10 + # min-amount-message: "捐款金额最低不能少于10元,感谢您的爱心捐赠^_^" + # enabled: true + + # 默认配置 + default-config: + default-title: "订单名称" + default-comments: "暂无" + min-order-amount: 0 + order-timeout-minutes: 30 + + # 订单自动取消配置 + auto-cancel: + # 是否启用自动取消功能 + enabled: true + # 默认超时时间(分钟) + default-timeout-minutes: 30 + # 定时任务检查间隔(分钟) + check-interval-minutes: 1 + # 批量处理大小 + batch-size: 100 + # 定时任务执行时间(cron表达式) + # 生产环境:每5分钟执行一次 + cron: "0 */5 * * * ?" + + # 租户特殊配置 + # tenant-configs: + # - tenant-id: 10324 + # tenant-name: "百色中学" + # timeout-minutes: 120 # 捐款订单给更长的支付时间 + # enabled: true + # 可以添加更多租户配置 + # - tenant-id: 10550 + # tenant-name: "其他租户" + # timeout-minutes: 15 + # enabled: true + +# 证书配置 +certificate: + # 证书加载模式: CLASSPATH, FILESYSTEM, VOLUME + load-mode: CLASSPATH + # Docker挂载卷证书路径 + cert-root-path: /app/certs + # 开发环境证书路径前缀 + dev-cert-path: dev + + # 微信支付证书配置 + wechat-pay: + dev: + api-v3-key: "0kF5OlPr482EZwtn9zGufUcqa7ovgxRL" + private-key-file: "apiclient_key.pem" + apiclient-cert-file: "apiclient_cert.pem" + wechatpay-cert-file: "wechatpay_cert.pem" + prod-base-path: "/file" + cert-dir: "wechat" + + # 支付宝证书配置 + alipay: + cert-dir: "alipay" + app-private-key-file: "app_private_key.pem" + app-cert-public-key-file: "appCertPublicKey.crt" + alipay-cert-public-key-file: "alipayCertPublicKey.crt" + alipay-root-cert-file: "alipayRootCert.crt" + +# 启用 SpringDoc OpenAPI +springdoc: + api-docs: + enabled: true + swagger-ui: + enabled: true + +# LED - 排班接口(业务中台)对接配置 +led: + bme: + base-url: ${LED_BME_BASE_URL:http://16.1.4.201:7979} + appid: ${LED_BME_APPID:BQ73n58Lf} + secret-key: ${LED_BME_SECRET_KEY:jk720-DCPnGq@5t8} + mechanism-id: ${LED_BME_MECHANISM_ID:10001} + default-ext-user-id: ${LED_BME_DEFAULT_EXT_USER_ID:txzhyy} + default-hospital-id: ${LED_BME_DEFAULT_HOSPITAL_ID:} + timeout-ms: ${LED_BME_TIMEOUT_MS:10000} + +# 启用 Knife4j +knife4j: + enable: true + +# 优惠券配置 +coupon: + # 过期处理定时任务配置 + expire: + # 定时任务执行时间(cron表达式) + # 生产环境:每天凌晨2点执行 + # 开发环境:每10分钟执行一次 + cron: "0 0 2 * * ?" + # 开发环境可以设置为: "0 */10 * * * ?" + + # 状态管理配置 + status: + # 是否启用自动状态更新 + auto-update: true + # 批量处理大小 + batch-size: 1000 + +# 支付配置 +payment: + # 开发环境配置 + dev: + # 开发环境回调地址(本地调试用) + notify-url: "http://frps-10550.s209.websoft.top/api/shop/shop-order/notify" + # 开发环境是否启用环境感知 + environment-aware: true + + # 生产环境配置 + prod: + # 生产环境回调地址 + notify-url: "https://cms-api.websoft.top/api/shop/shop-order/notify" + # 生产环境是否启用环境感知 + environment-aware: false diff --git a/src/test/java/com/gxwebsoft/RedisTest.java b/src/test/java/com/gxwebsoft/RedisTest.java new file mode 100644 index 0000000..e3fe105 --- /dev/null +++ b/src/test/java/com/gxwebsoft/RedisTest.java @@ -0,0 +1,30 @@ +package com.gxwebsoft; + +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.redis.core.StringRedisTemplate; + +import javax.annotation.Resource; + +@SpringBootTest +public class RedisTest { + @Resource + private StringRedisTemplate stringRedisTemplate; +// +// @Test +// public void test(){ +//// stringRedisTemplate.opsForValue().set("test:add:2",Long.toString(1L)); +//// stringRedisTemplate.opsForValue().increment("test:add:2",10L); +//// stringRedisTemplate.opsForValue().decrement("test:add:2",2L); +//// stringRedisTemplate.opsForValue().append("test:add:2","ssss"); +// HashMap map = new HashMap<>(); +// map.put("name","李四"); +// map.put("phone","13800138001"); +// HashMap map2 = new HashMap<>(); +// map2.put("name","赵六"); +// map2.put("phone","13800138001"); +// HashMap map3 = new HashMap<>(); +// map3.put("name","张三"); +// map3.put("phone","13800138001"); +// stringRedisTemplate.opsForSet().add("test:set:2", JSONUtil.toJSONString(map),JSONUtil.toJSONString(map2),JSONUtil.toJSONString(map3)); +// } +} diff --git a/src/test/java/com/gxwebsoft/TestMain.java b/src/test/java/com/gxwebsoft/TestMain.java new file mode 100644 index 0000000..5efb394 --- /dev/null +++ b/src/test/java/com/gxwebsoft/TestMain.java @@ -0,0 +1,95 @@ +package com.gxwebsoft; + +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.StrUtil; +import com.gxwebsoft.hjm.controller.PushCallback; +import com.gxwebsoft.hjm.entity.HjmCar; +import com.gxwebsoft.hjm.service.HjmCarService; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.test.context.SpringBootTest; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.text.NumberFormat; +import java.text.ParseException; + +/** + * Created by WebSoft on 2020-03-23 23:37 + */ +@SpringBootTest +public class TestMain { + private static final Logger logger = LoggerFactory.getLogger(PushCallback.class); + + @Resource + private HjmCarService hjmCarService; + + /** + * 生成唯一的key用于jwt工具类 + */ + @Test + public void testGenJwtKey() { + + BigDecimal bigDecimal = new BigDecimal(NumberUtil.decimalFormat("0.00", 1 * 0.01)); + System.out.println("实际付款金额111111111 = " + bigDecimal); + + final HjmCar byGpsNo = hjmCarService.getByGpsNo("gps1"); + System.out.println("byGpsNo = " + byGpsNo.getSpeed()); + if(StrUtil.isBlank(byGpsNo.getSpeed())){ + System.out.println("空的 = "); + } + if(byGpsNo.getSpeed() == null){ + System.out.println("getSpeed = "); + } +// System.out.println(JwtUtil.encodeKey(JwtUtil.randomKey())); + +// final String encrypt = CommonUtil.encrypt("123456"); +// System.out.println("encrypt = " + encrypt); +// +// final String decrypt = CommonUtil.decrypt(encrypt); +// System.out.println("decrypt = " + decrypt); + } + +// @Test +// public void mqtt() throws MqttException { +////tcp://MQTT安装的服务器地址:MQTT定义的端口号 +// String HOST = "tcp://1.14.159.185:1883"; +// +// //定义MQTT的ID,可以在MQTT服务配置中指定 +// String clientid = "mqttx_aec633ca2"; +// +// MqttClient client; +// String userName = "swdev"; +// String passWord = "Sw20250523"; +// +// client = new MqttClient(HOST, clientid, new MemoryPersistence()); +// +// final MqttConnectOptions mqttConnectOptions = new MqttConnectOptions(); +// mqttConnectOptions.setUserName(userName); +// mqttConnectOptions.setPassword(passWord.toCharArray()); +// mqttConnectOptions.setCleanSession(true); +// +// client.setCallback(new MqttCallback() { +// @Override +// public void connectionLost(Throwable throwable) { +// logger.info("连接丢失............."); +// } +// +// @Override +// public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception { +// logger.info("接收消息主题 : " + topic); +// logger.info("接收消息Qos : " + mqttMessage.getQos()); +// logger.info("接收消息内容 : " + new String(mqttMessage.getPayload())); +// } +// +// @Override +// public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) { +// logger.info("deliveryComplete............."); +// } +// }); +// client.connect(mqttConnectOptions); +// client.subscribe("/SW_GSP/#", 2); +// while (true); +// } +} diff --git a/src/test/java/com/gxwebsoft/WebSoftApplicationTests.java b/src/test/java/com/gxwebsoft/WebSoftApplicationTests.java new file mode 100644 index 0000000..5a024f5 --- /dev/null +++ b/src/test/java/com/gxwebsoft/WebSoftApplicationTests.java @@ -0,0 +1,13 @@ +package com.gxwebsoft; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +public class WebSoftApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/src/test/java/com/gxwebsoft/WxDev.java b/src/test/java/com/gxwebsoft/WxDev.java new file mode 100644 index 0000000..110a008 --- /dev/null +++ b/src/test/java/com/gxwebsoft/WxDev.java @@ -0,0 +1,110 @@ +package com.gxwebsoft; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import okhttp3.*; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.StringRedisTemplate; +import org.springframework.stereotype.Service; + +import java.io.IOException; +import java.time.Instant; +import java.util.concurrent.atomic.AtomicReference; + +@Service +public class WxDev { + + @Value("${wechat.appid}") + private String appId; + @Value("${wechat.secret}") + private String secret; + + private final StringRedisTemplate redisTemplate; + + private final OkHttpClient http = new OkHttpClient(); + private final ObjectMapper om = new ObjectMapper(); + + /** 简单本地缓存 access_token(生产建议放 Redis) */ + private final AtomicReference cachedToken = new AtomicReference<>(); + private volatile long tokenExpireEpoch = 0L; // 过期的 epoch 秒 + + public WxDev(StringRedisTemplate redisTemplate) { + this.redisTemplate = redisTemplate; + } + + /** 获取/刷新 access_token */ + public String getAccessToken() throws IOException { + long now = Instant.now().getEpochSecond(); + System.out.println("cachedToken.get = " + cachedToken.get()); + if (cachedToken.get() != null && now < tokenExpireEpoch - 60) { + return cachedToken.get(); + } + HttpUrl url = HttpUrl.parse("https://api.weixin.qq.com/cgi-bin/token") + .newBuilder() + .addQueryParameter("grant_type", "client_credential") + .addQueryParameter("appid", "wx51962d6ac21f2ed2") + .addQueryParameter("secret", "d821f98de8a6c1ba7bc7e0ee84bcbc8e") + .build(); + Request req = new Request.Builder().url(url).get().build(); + try (Response resp = http.newCall(req).execute()) { + String body = resp.body().string(); + JsonNode json = om.readTree(body); + if (json.has("access_token")) { + String token = json.get("access_token").asText(); + int expiresIn = json.get("expires_in").asInt(7200); + System.out.println("token1 = " + token); + cachedToken.set(token); + tokenExpireEpoch = now + expiresIn; + return token; + } else { + throw new IOException("Get access_token failed: " + body); + } + } + } + + /** 调用 getwxacodeunlimit,返回图片二进制 */ + public byte[] getUnlimitedCode(String scene, String page, Integer width, + Boolean isHyaline, String envVersion) throws IOException { + String accessToken = getAccessToken(); + System.out.println("accessToken = " + accessToken); + HttpUrl url = HttpUrl.parse("https://api.weixin.qq.com/wxa/getwxacodeunlimit") + .newBuilder() + .addQueryParameter("access_token", accessToken) + .build(); + + // 构造请求 JSON + // 注意:scene 仅支持可见字符,长度上限 32,尽量 URL-safe(字母数字下划线等) + // page 必须是已发布小程序内的路径(不带开头斜杠也可) + var root = om.createObjectNode(); + root.put("scene", scene); + if (page != null) root.put("page", page); + if (width != null) root.put("width", width); // 默认 430,建议 280~1280 + if (isHyaline != null) root.put("is_hyaline", isHyaline); + if (envVersion != null) root.put("env_version", envVersion); // release/trial/develop + + RequestBody reqBody = RequestBody.create( + root.toString(), MediaType.parse("application/json; charset=utf-8")); + Request req = new Request.Builder().url(url).post(reqBody).build(); + + try (Response resp = http.newCall(req).execute()) { + if (!resp.isSuccessful()) { + throw new IOException("HTTP " + resp.code() + " calling getwxacodeunlimit"); + } + MediaType ct = resp.body().contentType(); + byte[] bytes = resp.body().bytes(); + // 微信出错时返回 JSON,需要识别一下 + if (ct != null && ct.subtype() != null && ct.subtype().contains("json")) { + String err = new String(bytes); + throw new IOException("WeChat error: " + err); + } + return bytes; // 成功就是图片二进制(PNG) + } + } + + @Test + public void getQrCode() throws IOException { + final byte[] test = getUnlimitedCode("register", "pages/index/index",180,false,"develop"); + System.out.println("test = " + test); + } +} diff --git a/src/test/java/com/gxwebsoft/bszx/BszxOrderTotalTest.java b/src/test/java/com/gxwebsoft/bszx/BszxOrderTotalTest.java new file mode 100644 index 0000000..7f769d6 --- /dev/null +++ b/src/test/java/com/gxwebsoft/bszx/BszxOrderTotalTest.java @@ -0,0 +1,56 @@ +package com.gxwebsoft.bszx; + +import com.gxwebsoft.bszx.service.BszxPayService; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; + +import javax.annotation.Resource; +import java.math.BigDecimal; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * 百色中学订单总金额统计测试 + * + * @author 科技小王子 + * @since 2025-07-31 + */ +@SpringBootTest +@ActiveProfiles("test") +public class BszxOrderTotalTest { + + @Resource + private BszxPayService bszxPayService; + + @Test + void testBszxOrderTotal() { + // 测试百色中学订单总金额统计 + BigDecimal total = bszxPayService.total(); + + // 验证返回值不为null + assertNotNull(total, "百色中学订单总金额不应该为null"); + + // 验证返回值大于等于0 + assertTrue(total.compareTo(BigDecimal.ZERO) >= 0, "百色中学订单总金额应该大于等于0"); + + System.out.println("百色中学订单总金额统计结果:" + total); + } + + @Test + void testBszxOrderTotalPerformance() { + // 测试性能 + long startTime = System.currentTimeMillis(); + + BigDecimal total = bszxPayService.total(); + + long endTime = System.currentTimeMillis(); + long duration = endTime - startTime; + + System.out.println("百色中学订单总金额统计耗时:" + duration + "ms"); + System.out.println("统计结果:" + total); + + // 验证查询时间在合理范围内(小于5秒) + assertTrue(duration < 5000, "查询时间应该在5秒以内"); + } +} diff --git a/src/test/java/com/gxwebsoft/common/core/controller/QrCodeControllerTest.java b/src/test/java/com/gxwebsoft/common/core/controller/QrCodeControllerTest.java new file mode 100644 index 0000000..9677d80 --- /dev/null +++ b/src/test/java/com/gxwebsoft/common/core/controller/QrCodeControllerTest.java @@ -0,0 +1,102 @@ +package com.gxwebsoft.common.core.controller; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.gxwebsoft.common.core.dto.qr.CreateEncryptedQrCodeRequest; +import com.gxwebsoft.common.core.utils.EncryptedQrCodeUtil; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MockMvc; + +import java.util.HashMap; +import java.util.Map; + +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.when; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +/** + * QR码控制器测试 + * + * @author WebSoft + * @since 2025-08-18 + */ +@WebMvcTest(QrCodeController.class) +public class QrCodeControllerTest { + + @Autowired + private MockMvc mockMvc; + + @MockBean + private EncryptedQrCodeUtil encryptedQrCodeUtil; + + @Autowired + private ObjectMapper objectMapper; + + @Test + public void testCreateEncryptedQrCodeWithValidRequest() throws Exception { + // 准备测试数据 + CreateEncryptedQrCodeRequest request = new CreateEncryptedQrCodeRequest(); + request.setData("test data"); + request.setWidth(200); + request.setHeight(200); + request.setExpireMinutes(30L); + request.setBusinessType("TEST"); + + Map mockResult = new HashMap<>(); + mockResult.put("qrCodeBase64", "base64_encoded_image"); + mockResult.put("token", "test_token"); + + when(encryptedQrCodeUtil.generateEncryptedQrCode(anyString(), anyInt(), anyInt(), anyLong(), anyString())) + .thenReturn(mockResult); + + // 执行测试 + mockMvc.perform(post("/api/qr-code/create-encrypted-qr-code") + .contentType(MediaType.APPLICATION_JSON) + .content(objectMapper.writeValueAsString(request))) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.code").value(200)) + .andExpect(jsonPath("$.message").value("生成加密二维码成功")) + .andExpect(jsonPath("$.data.qrCodeBase64").value("base64_encoded_image")) + .andExpect(jsonPath("$.data.token").value("test_token")); + } + + @Test + public void testCreateEncryptedQrCodeWithInvalidRequest() throws Exception { + // 准备无效的测试数据(data为空) + CreateEncryptedQrCodeRequest request = new CreateEncryptedQrCodeRequest(); + request.setData(""); // 空字符串,应该触发验证失败 + request.setWidth(200); + request.setHeight(200); + request.setExpireMinutes(30L); + + // 执行测试 + mockMvc.perform(post("/api/qr-code/create-encrypted-qr-code") + .contentType(MediaType.APPLICATION_JSON) + .content(objectMapper.writeValueAsString(request))) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.code").value(500)) + .andExpect(jsonPath("$.message").value("数据不能为空")); + } + + @Test + public void testCreateEncryptedQrCodeWithInvalidSize() throws Exception { + // 准备无效的测试数据(尺寸超出范围) + CreateEncryptedQrCodeRequest request = new CreateEncryptedQrCodeRequest(); + request.setData("test data"); + request.setWidth(2000); // 超出最大值1000 + request.setHeight(200); + request.setExpireMinutes(30L); + + // 执行测试 + mockMvc.perform(post("/api/qr-code/create-encrypted-qr-code") + .contentType(MediaType.APPLICATION_JSON) + .content(objectMapper.writeValueAsString(request))) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.code").value(500)) + .andExpect(jsonPath("$.message").value("宽度不能大于1000像素")); + } +} diff --git a/src/test/java/com/gxwebsoft/common/core/utils/EncryptedQrCodeUtilTest.java b/src/test/java/com/gxwebsoft/common/core/utils/EncryptedQrCodeUtilTest.java new file mode 100644 index 0000000..bb0ebcd --- /dev/null +++ b/src/test/java/com/gxwebsoft/common/core/utils/EncryptedQrCodeUtilTest.java @@ -0,0 +1,136 @@ +package com.gxwebsoft.common.core.utils; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; + +import javax.annotation.Resource; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * 加密二维码工具类测试 + * + * @author WebSoft + * @since 2025-08-18 + */ +@SpringBootTest +@ActiveProfiles("dev") +public class EncryptedQrCodeUtilTest { + + @Resource + private EncryptedQrCodeUtil encryptedQrCodeUtil; + + @Test + public void testGenerateAndDecryptData() { + // 测试数据 + String originalData = "https://www.example.com/user/123"; + Long expireMinutes = 30L; + + // 生成加密数据 + Map encryptedInfo = encryptedQrCodeUtil.generateEncryptedData(originalData, expireMinutes); + + assertNotNull(encryptedInfo); + assertNotNull(encryptedInfo.get("token")); + assertNotNull(encryptedInfo.get("encryptedData")); + assertEquals(expireMinutes.toString(), encryptedInfo.get("expireMinutes")); + + // 解密数据 + String decryptedData = encryptedQrCodeUtil.decryptData( + encryptedInfo.get("token"), + encryptedInfo.get("encryptedData") + ); + + assertEquals(originalData, decryptedData); + } + + @Test + public void testGenerateEncryptedQrCode() { + // 测试数据 + String originalData = "测试二维码数据"; + int width = 300; + int height = 300; + Long expireMinutes = 60L; + + // 生成加密二维码 + Map result = encryptedQrCodeUtil.generateEncryptedQrCode( + originalData, width, height, expireMinutes + ); + + assertNotNull(result); + assertNotNull(result.get("qrCodeBase64")); + assertNotNull(result.get("token")); + assertEquals(originalData, result.get("originalData")); + assertEquals(expireMinutes.toString(), result.get("expireMinutes")); + } + + @Test + public void testTokenValidation() { + // 生成测试数据 + String originalData = "token验证测试"; + Map encryptedInfo = encryptedQrCodeUtil.generateEncryptedData(originalData, 30L); + String token = encryptedInfo.get("token"); + + // 验证token有效性 + assertTrue(encryptedQrCodeUtil.isTokenValid(token)); + + // 使token失效 + encryptedQrCodeUtil.invalidateToken(token); + + // 再次验证token应该无效 + assertFalse(encryptedQrCodeUtil.isTokenValid(token)); + } + + @Test + public void testInvalidToken() { + // 测试无效token + assertFalse(encryptedQrCodeUtil.isTokenValid("invalid_token")); + assertFalse(encryptedQrCodeUtil.isTokenValid("")); + assertFalse(encryptedQrCodeUtil.isTokenValid(null)); + } + + @Test + public void testDecryptWithInvalidToken() { + // 测试用无效token解密 + assertThrows(RuntimeException.class, () -> { + encryptedQrCodeUtil.decryptData("invalid_token", "encrypted_data"); + }); + } + + @Test + public void testGenerateEncryptedQrCodeWithBusinessType() { + // 测试数据 + String originalData = "用户登录数据"; + int width = 200; + int height = 200; + Long expireMinutes = 30L; + String businessType = "LOGIN"; + + // 生成带业务类型的加密二维码 + Map result = encryptedQrCodeUtil.generateEncryptedQrCode( + originalData, width, height, expireMinutes, businessType + ); + + assertNotNull(result); + assertNotNull(result.get("qrCodeBase64")); + assertNotNull(result.get("token")); + assertEquals(originalData, result.get("originalData")); + assertEquals(expireMinutes.toString(), result.get("expireMinutes")); + assertEquals(businessType, result.get("businessType")); + + System.out.println("=== 带BusinessType的二维码生成测试 ==="); + System.out.println("原始数据: " + originalData); + System.out.println("业务类型: " + businessType); + System.out.println("Token: " + result.get("token")); + System.out.println("二维码Base64长度: " + ((String)result.get("qrCodeBase64")).length()); + + // 验证不传businessType的情况 + Map resultWithoutType = encryptedQrCodeUtil.generateEncryptedQrCode( + originalData, width, height, expireMinutes + ); + + assertNull(resultWithoutType.get("businessType")); + System.out.println("不传BusinessType时的结果: " + resultWithoutType.get("businessType")); + } +} diff --git a/src/test/java/com/gxwebsoft/common/system/controller/WxLoginControllerTest.java b/src/test/java/com/gxwebsoft/common/system/controller/WxLoginControllerTest.java new file mode 100644 index 0000000..e879925 --- /dev/null +++ b/src/test/java/com/gxwebsoft/common/system/controller/WxLoginControllerTest.java @@ -0,0 +1,136 @@ +package com.gxwebsoft.common.system.controller; + +import com.gxwebsoft.common.system.entity.User; +import com.gxwebsoft.common.system.service.UserService; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; + +import javax.annotation.Resource; + +/** + * 微信登录控制器测试 + * + * @author WebSoft + * @since 2025-08-23 + */ +@Slf4j +@SpringBootTest +@ActiveProfiles("dev") +public class WxLoginControllerTest { + + @Resource + private UserService userService; + + /** + * 测试从scene参数解析租户ID的逻辑 + */ + @Test + public void testExtractTenantIdFromScene() { + log.info("=== 开始测试scene参数解析 ==="); + + // 测试用户ID 33103 + Integer testUserId = 33103; + + // 查询用户信息 + User user = userService.getByIdIgnoreTenant(testUserId); + if (user != null) { + log.info("用户ID {} 对应的租户ID: {}", testUserId, user.getTenantId()); + log.info("用户信息 - 用户名: {}, 手机: {}", user.getUsername(), user.getPhone()); + } else { + log.warn("未找到用户ID: {}", testUserId); + } + + // 测试不同的scene格式 + String[] testScenes = { + "uid_33103", + "uid_1", + "uid_999999", + "invalid_scene", + null + }; + + for (String scene : testScenes) { + log.info("测试scene: {} -> 预期解析结果", scene); + // 这里模拟解析逻辑 + if (scene != null && scene.startsWith("uid_")) { + try { + String userIdStr = scene.substring(4); + Integer userId = Integer.parseInt(userIdStr); + User testUser = userService.getByIdIgnoreTenant(userId); + if (testUser != null) { + log.info(" 解析成功: 用户ID {} -> 租户ID {}", userId, testUser.getTenantId()); + } else { + log.info(" 用户不存在: 用户ID {} -> 默认租户ID 10550", userId); + } + } catch (Exception e) { + log.info(" 解析异常: {} -> 默认租户ID 10550", e.getMessage()); + } + } else { + log.info(" 无效格式 -> 默认租户ID 10550"); + } + } + + log.info("=== scene参数解析测试完成 ==="); + } + + /** + * 测试查找特定用户 + */ + @Test + public void testFindSpecificUsers() { + log.info("=== 开始查找特定用户 ==="); + + // 查找租户10550的用户 + Integer[] testUserIds = {1, 2, 3, 33103, 10001, 10002}; + + for (Integer userId : testUserIds) { + User user = userService.getByIdIgnoreTenant(userId); + if (user != null) { + log.info("用户ID: {}, 租户ID: {}, 用户名: {}, 手机: {}", + userId, user.getTenantId(), user.getUsername(), user.getPhone()); + } else { + log.info("用户ID: {} - 不存在", userId); + } + } + + log.info("=== 特定用户查找完成 ==="); + } + + /** + * 测试URL解析 + */ + @Test + public void testUrlParsing() { + log.info("=== 开始测试URL解析 ==="); + + String testUrl = "127.0.0.1:9200/api/wx-login/getOrderQRCodeUnlimited/uid_33103"; + log.info("测试URL: {}", testUrl); + + // 提取scene部分 + String[] parts = testUrl.split("/"); + String scene = parts[parts.length - 1]; // 最后一部分 + log.info("提取的scene: {}", scene); + + // 解析用户ID + if (scene.startsWith("uid_")) { + String userIdStr = scene.substring(4); + try { + Integer userId = Integer.parseInt(userIdStr); + log.info("解析的用户ID: {}", userId); + + User user = userService.getByIdIgnoreTenant(userId); + if (user != null) { + log.info("对应的租户ID: {}", user.getTenantId()); + } else { + log.warn("用户不存在"); + } + } catch (NumberFormatException e) { + log.error("用户ID格式错误: {}", userIdStr); + } + } + + log.info("=== URL解析测试完成 ==="); + } +} diff --git a/src/test/java/com/gxwebsoft/common/system/service/UserIgnoreTenantTest.java b/src/test/java/com/gxwebsoft/common/system/service/UserIgnoreTenantTest.java new file mode 100644 index 0000000..d24bc1d --- /dev/null +++ b/src/test/java/com/gxwebsoft/common/system/service/UserIgnoreTenantTest.java @@ -0,0 +1,100 @@ +package com.gxwebsoft.common.system.service; + +import com.gxwebsoft.common.system.entity.User; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; + +import javax.annotation.Resource; + +/** + * 用户忽略租户隔离功能测试 + * + * @author WebSoft + * @since 2025-08-23 + */ +@Slf4j +@SpringBootTest +@ActiveProfiles("dev") +public class UserIgnoreTenantTest { + + @Resource + private UserService userService; + + /** + * 测试忽略租户隔离查询用户 + */ + @Test + public void testGetByIdIgnoreTenant() { + // 测试用户ID(请根据实际数据库中的用户ID进行调整) + Integer testUserId = 1; + + log.info("=== 开始测试忽略租户隔离查询用户功能 ==="); + + // 1. 使用普通方法查询用户(受租户隔离影响) + User userNormal = userService.getById(testUserId); + log.info("普通查询结果 - 用户ID: {}, 用户信息: {}", testUserId, + userNormal != null ? userNormal.getUsername() : "null"); + + // 2. 使用忽略租户隔离方法查询用户 + User userIgnoreTenant = userService.getByIdIgnoreTenant(testUserId); + log.info("忽略租户隔离查询结果 - 用户ID: {}, 用户信息: {}", testUserId, + userIgnoreTenant != null ? userIgnoreTenant.getUsername() : "null"); + + // 3. 验证结果 + if (userIgnoreTenant != null) { + log.info("✅ 忽略租户隔离查询成功!"); + log.info("用户详情 - ID: {}, 用户名: {}, 昵称: {}, 租户ID: {}", + userIgnoreTenant.getUserId(), + userIgnoreTenant.getUsername(), + userIgnoreTenant.getNickname(), + userIgnoreTenant.getTenantId()); + } else { + log.error("❌ 忽略租户隔离查询失败!"); + } + + log.info("=== 忽略租户隔离查询用户功能测试完成 ==="); + } + + /** + * 测试参数验证 + */ + @Test + public void testGetByIdIgnoreTenantValidation() { + log.info("=== 开始测试参数验证 ==="); + + // 测试null用户ID + User result1 = userService.getByIdIgnoreTenant(null); + log.info("null用户ID测试结果: {}", result1 == null ? "成功(返回null)" : "失败"); + + // 测试不存在的用户ID + User result2 = userService.getByIdIgnoreTenant(999999); + log.info("不存在用户ID测试结果: {}", result2 == null ? "成功(返回null)" : "失败"); + + log.info("=== 参数验证测试完成 ==="); + } + + /** + * 测试跨租户查询 + */ + @Test + public void testCrossTenantQuery() { + log.info("=== 开始测试跨租户查询 ==="); + + // 查询不同租户的用户(请根据实际数据调整) + Integer[] testUserIds = {1, 2, 3, 4, 5}; + + for (Integer userId : testUserIds) { + User user = userService.getByIdIgnoreTenant(userId); + if (user != null) { + log.info("用户ID: {}, 用户名: {}, 租户ID: {}", + user.getUserId(), user.getUsername(), user.getTenantId()); + } else { + log.info("用户ID: {} - 不存在", userId); + } + } + + log.info("=== 跨租户查询测试完成 ==="); + } +} diff --git a/src/test/java/com/gxwebsoft/common/system/service/WeixinConfigTest.java b/src/test/java/com/gxwebsoft/common/system/service/WeixinConfigTest.java new file mode 100644 index 0000000..1b915d0 --- /dev/null +++ b/src/test/java/com/gxwebsoft/common/system/service/WeixinConfigTest.java @@ -0,0 +1,174 @@ +package com.gxwebsoft.common.system.service; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.gxwebsoft.cms.entity.CmsWebsiteField; +import com.gxwebsoft.cms.service.CmsWebsiteFieldService; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 微信小程序配置测试 + * + * @author WebSoft + * @since 2025-08-23 + */ +@Slf4j +@SpringBootTest +@ActiveProfiles("dev") +public class WeixinConfigTest { + + @Resource + private SettingService settingService; + + @Resource + private CmsWebsiteFieldService cmsWebsiteFieldService; + + /** + * 测试从cms_website_field表获取微信小程序配置 + */ + @Test + public void testGetWeixinConfigFromWebsiteField() { + Integer tenantId = 10550; + + log.info("=== 开始测试从cms_website_field表获取微信小程序配置 ==="); + + // 1. 查看cms_website_field表中的所有配置 + List allFields = cmsWebsiteFieldService.list( + new LambdaQueryWrapper() + .eq(CmsWebsiteField::getTenantId, tenantId) + .eq(CmsWebsiteField::getDeleted, 0) + ); + + log.info("租户{}的所有cms_website_field配置:", tenantId); + for (CmsWebsiteField field : allFields) { + log.info(" - ID: {}, Name: {}, Value: {}", field.getId(), field.getName(), field.getValue()); + } + + // 2. 查找AppID配置 + CmsWebsiteField appIdField = cmsWebsiteFieldService.getOne( + new LambdaQueryWrapper() + .eq(CmsWebsiteField::getName, "AppID") + .eq(CmsWebsiteField::getTenantId, tenantId) + .eq(CmsWebsiteField::getDeleted, 0) + ); + + log.info("AppID配置: {}", appIdField); + + // 3. 查找AppSecret配置 + CmsWebsiteField appSecretField = cmsWebsiteFieldService.getOne( + new LambdaQueryWrapper() + .eq(CmsWebsiteField::getName, "AppSecret") + .eq(CmsWebsiteField::getTenantId, tenantId) + .eq(CmsWebsiteField::getDeleted, 0) + ); + + log.info("AppSecret配置: {}", appSecretField); + + // 4. 测试获取微信小程序配置 + try { + JSONObject config = settingService.getBySettingKeyIgnoreTenant("mp-weixin", tenantId); + log.info("✅ 成功获取微信小程序配置: {}", config); + } catch (Exception e) { + log.error("❌ 获取微信小程序配置失败: {}", e.getMessage()); + } + + log.info("=== 微信小程序配置测试完成 ==="); + } + + /** + * 测试不同name的查询 + */ + @Test + public void testDifferentNameQueries() { + Integer tenantId = 10550; + + log.info("=== 开始测试不同name的查询 ==="); + + String[] nameVariations = {"AppID", "appId", "APPID", "app_id", "AppSecret", "appSecret", "APPSECRET", "app_secret"}; + + for (String name : nameVariations) { + CmsWebsiteField field = cmsWebsiteFieldService.getOne( + new LambdaQueryWrapper() + .eq(CmsWebsiteField::getName, name) + .eq(CmsWebsiteField::getTenantId, tenantId) + .eq(CmsWebsiteField::getDeleted, 0) + ); + + if (field != null) { + log.info("找到配置 - Name: {}, Value: {}", name, field.getValue()); + } else { + log.info("未找到配置 - Name: {}", name); + } + } + + log.info("=== 不同name查询测试完成 ==="); + } + + /** + * 测试创建测试配置 + */ + @Test + public void testCreateTestConfig() { + Integer tenantId = 10550; + + log.info("=== 开始创建测试配置 ==="); + + // 创建AppID配置 + CmsWebsiteField appIdField = new CmsWebsiteField(); + appIdField.setName("AppID"); + appIdField.setValue("wx1234567890abcdef"); // 测试AppID + appIdField.setTenantId(tenantId); + appIdField.setType(0); // 文本类型 + appIdField.setComments("微信小程序AppID"); + appIdField.setDeleted(0); + + // 创建AppSecret配置 + CmsWebsiteField appSecretField = new CmsWebsiteField(); + appSecretField.setName("AppSecret"); + appSecretField.setValue("abcdef1234567890abcdef1234567890"); // 测试AppSecret + appSecretField.setTenantId(tenantId); + appSecretField.setType(0); // 文本类型 + appSecretField.setComments("微信小程序AppSecret"); + appSecretField.setDeleted(0); + + try { + // 检查是否已存在 + CmsWebsiteField existingAppId = cmsWebsiteFieldService.getOne( + new LambdaQueryWrapper() + .eq(CmsWebsiteField::getName, "AppID") + .eq(CmsWebsiteField::getTenantId, tenantId) + ); + + if (existingAppId == null) { + cmsWebsiteFieldService.save(appIdField); + log.info("✅ 创建AppID配置成功"); + } else { + log.info("AppID配置已存在,跳过创建"); + } + + CmsWebsiteField existingAppSecret = cmsWebsiteFieldService.getOne( + new LambdaQueryWrapper() + .eq(CmsWebsiteField::getName, "AppSecret") + .eq(CmsWebsiteField::getTenantId, tenantId) + ); + + if (existingAppSecret == null) { + cmsWebsiteFieldService.save(appSecretField); + log.info("✅ 创建AppSecret配置成功"); + } else { + log.info("AppSecret配置已存在,跳过创建"); + } + + } catch (Exception e) { + log.error("❌ 创建测试配置失败: {}", e.getMessage()); + } + + log.info("=== 创建测试配置完成 ==="); + } +} diff --git a/src/test/java/com/gxwebsoft/config/MqttPropertiesTest.java b/src/test/java/com/gxwebsoft/config/MqttPropertiesTest.java new file mode 100644 index 0000000..7570f9a --- /dev/null +++ b/src/test/java/com/gxwebsoft/config/MqttPropertiesTest.java @@ -0,0 +1,44 @@ +package com.gxwebsoft.config; + +import com.gxwebsoft.common.core.config.MqttProperties; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; + +import javax.annotation.Resource; + +/** + * MQTT配置属性测试类 + * + * @author 科技小王子 + * @since 2025-07-02 + */ +@SpringBootTest +@ActiveProfiles("dev") +public class MqttPropertiesTest { + + @Resource + private MqttProperties mqttProperties; + + @Test + public void testMqttPropertiesLoading() { + System.out.println("=== MQTT配置属性测试 ==="); + System.out.println("Host: " + mqttProperties.getHost()); + System.out.println("Username: " + mqttProperties.getUsername()); + System.out.println("Password: " + (mqttProperties.getPassword() != null ? "***" : "null")); + System.out.println("ClientIdPrefix: " + mqttProperties.getClientIdPrefix()); + System.out.println("Topic: " + mqttProperties.getTopic()); + System.out.println("QoS: " + mqttProperties.getQos()); + System.out.println("ConnectionTimeout: " + mqttProperties.getConnectionTimeout()); + System.out.println("KeepAliveInterval: " + mqttProperties.getKeepAliveInterval()); + System.out.println("AutoReconnect: " + mqttProperties.isAutoReconnect()); + System.out.println("CleanSession: " + mqttProperties.isCleanSession()); + + // 验证关键配置不为空 + assert mqttProperties.getHost() != null : "Host不能为空"; + assert mqttProperties.getClientIdPrefix() != null : "ClientIdPrefix不能为空"; + assert mqttProperties.getTopic() != null : "Topic不能为空"; + + System.out.println("MQTT配置属性测试通过!"); + } +} diff --git a/src/test/java/com/gxwebsoft/config/ServerUrlConfigTest.java b/src/test/java/com/gxwebsoft/config/ServerUrlConfigTest.java new file mode 100644 index 0000000..a85bbb9 --- /dev/null +++ b/src/test/java/com/gxwebsoft/config/ServerUrlConfigTest.java @@ -0,0 +1,51 @@ +package com.gxwebsoft.config; + +import com.gxwebsoft.common.core.config.ConfigProperties; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * 服务器URL配置测试 + * 验证server-url配置是否正确从配置文件读取 + */ +@SpringBootTest +@ActiveProfiles("dev") +public class ServerUrlConfigTest { + + @Autowired + private ConfigProperties configProperties; + + @Test + public void testServerUrlConfiguration() { + // 验证配置属性不为空 + assertNotNull(configProperties, "ConfigProperties should not be null"); + + // 验证server-url配置正确读取 + String serverUrl = configProperties.getServerUrl(); + assertNotNull(serverUrl, "Server URL should not be null"); + assertFalse(serverUrl.isEmpty(), "Server URL should not be empty"); + + // 在开发环境下,应该是本地地址 + assertTrue(serverUrl.contains("127.0.0.1") || serverUrl.contains("localhost"), + "In dev environment, server URL should contain localhost or 127.0.0.1"); + + System.out.println("当前配置的服务器URL: " + serverUrl); + } + + @Test + public void testServerUrlFormat() { + String serverUrl = configProperties.getServerUrl(); + + // 验证URL格式 + assertTrue(serverUrl.startsWith("http://") || serverUrl.startsWith("https://"), + "Server URL should start with http:// or https://"); + assertTrue(serverUrl.endsWith("/api"), + "Server URL should end with /api"); + + System.out.println("服务器URL格式验证通过: " + serverUrl); + } +} diff --git a/src/test/java/com/gxwebsoft/generator/ShopGenerator.java b/src/test/java/com/gxwebsoft/generator/ShopGenerator.java new file mode 100644 index 0000000..9d1224c --- /dev/null +++ b/src/test/java/com/gxwebsoft/generator/ShopGenerator.java @@ -0,0 +1,435 @@ +package com.gxwebsoft.generator; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.core.toolkit.StringPool; +import com.baomidou.mybatisplus.generator.AutoGenerator; +import com.baomidou.mybatisplus.generator.InjectionConfig; +import com.baomidou.mybatisplus.generator.config.*; +import com.baomidou.mybatisplus.generator.config.po.TableInfo; +import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; +import com.gxwebsoft.generator.engine.BeetlTemplateEnginePlus; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.io.*; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.regex.Pattern; +import java.util.regex.Matcher; + +/** + * CMS模块-代码生成工具 + * + * @author WebSoft + * @since 2021-09-05 00:31:14 + */ +public class ShopGenerator { + // 输出位置 + private static final String OUTPUT_LOCATION = System.getProperty("user.dir"); + //private static final String OUTPUT_LOCATION = "D:/codegen"; // 不想生成到项目中可以写磁盘路径 + // JAVA输出目录 + private static final String OUTPUT_DIR = "/src/main/java"; + // Vue文件输出位置 + private static final String OUTPUT_LOCATION_VUE = "/Users/gxwebsoft/VUE/mp-vue"; + // UniApp文件输出目录 + private static final String OUTPUT_LOCATION_UNIAPP = "/Users/gxwebsoft/VUE/template-10550"; + // Vue文件输出目录 + private static final String OUTPUT_DIR_VUE = "/src"; + // 作者名称 + private static final String AUTHOR = "科技小王子"; + // 是否在xml中添加二级缓存配置 + private static final boolean ENABLE_CACHE = false; + // 数据库连接配置 + private static final String DB_URL = "jdbc:mysql://8.134.169.209:13306/modules?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8"; + private static final String DB_DRIVER = "com.mysql.cj.jdbc.Driver"; + private static final String DB_USERNAME = "modules"; + private static final String DB_PASSWORD = "8YdLnk7KsPAyDXGA"; + // 包名 + private static final String PACKAGE_NAME = "com.gxwebsoft"; + // 模块名 + private static final String MODULE_NAME = "shop"; + // 需要生成的表 + private static final String[] TABLE_NAMES = new String[]{ +// "shop_spec", +// "shop_spec_value", +// "shop_goods", +// "shop_category", +// "shop_goods_spec", +// "shop_goods_sku", +// "shop_goods_category", +// "shop_coupon", +// "shop_goods_description", +// "shop_goods_log", +// "shop_goods_relation", +// "shop_goods_comment", +// "shop_goods_rule", +// "shop_brand", +// "shop_merchant", +// "shop_merchant_type", +// "shop_merchant_apply", +// "shop_merchant_account", +// "shop_chat_message", +// "shop_chat_conversation", +// "shop_user_collection", +// "shop_goods_role_commission" +// "shop_commission_role" +// "shop_order", +// "shop_order_info", +// "shop_order_info_log", +// "shop_order_goods", +// "shop_wechat_deposit", +// "shop_users", +// "shop_user_address", +// "shop_user_balance_log", +// "shop_recharge_order", + // 经销商表 +// "shop_dealer_apply", +// "shop_dealer_capital", +// "shop_dealer_order", +// "shop_dealer_referee", +// "shop_dealer_setting", +// "shop_dealer_user", +// "shop_user_referee", +// "shop_dealer_withdraw", +// "shop_user_coupon", +// "shop_cart", +// "shop_count", +// "shop_order_delivery", +// "shop_order_delivery_goods", +// "shop_order_extract", +// "shop_splash", +// "shop_goods_income_config" +// "shop_express", +// "shop_express_template", +// "shop_express_template_detail", +// "shop_gift" + "shop_article" + }; + // 需要去除的表前缀 + private static final String[] TABLE_PREFIX = new String[]{ + "tb_" + }; + // 不需要作为查询参数的字段 + private static final String[] PARAM_EXCLUDE_FIELDS = new String[]{ + "tenant_id", + "create_time", + "update_time" + }; + // 查询参数使用String的类型 + private static final String[] PARAM_TO_STRING_TYPE = new String[]{ + "Date", + "LocalDate", + "LocalTime", + "LocalDateTime" + }; + // 查询参数使用EQ的类型 + private static final String[] PARAM_EQ_TYPE = new String[]{ + "Integer", + "Boolean", + "BigDecimal" + }; + // 是否添加权限注解 + private static final boolean AUTH_ANNOTATION = true; + // 是否添加日志注解 + private static final boolean LOG_ANNOTATION = true; + // controller的mapping前缀 + private static final String CONTROLLER_MAPPING_PREFIX = "/api"; + // 模板所在位置 + private static final String TEMPLATES_DIR = "/src/test/java/com/gxwebsoft/generator/templates"; + + public static void main(String[] args) { + // 代码生成器 + AutoGenerator mpg = new AutoGenerator(); + + // 全局配置 + GlobalConfig gc = new GlobalConfig(); + gc.setOutputDir(OUTPUT_LOCATION + OUTPUT_DIR); + gc.setAuthor(AUTHOR); + gc.setOpen(false); + gc.setFileOverride(true); + gc.setEnableCache(ENABLE_CACHE); + gc.setSwagger2(true); + gc.setIdType(IdType.AUTO); + gc.setServiceName("%sService"); + mpg.setGlobalConfig(gc); + + // 数据源配置 + DataSourceConfig dsc = new DataSourceConfig(); + dsc.setUrl(DB_URL); + // dsc.setSchemaName("public"); + dsc.setDriverName(DB_DRIVER); + dsc.setUsername(DB_USERNAME); + dsc.setPassword(DB_PASSWORD); + mpg.setDataSource(dsc); + + // 包配置 + PackageConfig pc = new PackageConfig(); + pc.setModuleName(MODULE_NAME); + pc.setParent(PACKAGE_NAME); + mpg.setPackageInfo(pc); + + // 策略配置 + StrategyConfig strategy = new StrategyConfig(); + strategy.setNaming(NamingStrategy.underline_to_camel); + strategy.setColumnNaming(NamingStrategy.underline_to_camel); + strategy.setInclude(TABLE_NAMES); + strategy.setTablePrefix(TABLE_PREFIX); + strategy.setSuperControllerClass(PACKAGE_NAME + ".common.core.web.BaseController"); + strategy.setEntityLombokModel(true); + strategy.setRestControllerStyle(true); + strategy.setControllerMappingHyphenStyle(true); + strategy.setLogicDeleteFieldName("deleted"); + mpg.setStrategy(strategy); + + // 模板配置 + TemplateConfig templateConfig = new TemplateConfig(); + templateConfig.setController(TEMPLATES_DIR + "/controller.java"); + templateConfig.setEntity(TEMPLATES_DIR + "/entity.java"); + templateConfig.setMapper(TEMPLATES_DIR + "/mapper.java"); + templateConfig.setXml(TEMPLATES_DIR + "/mapper.xml"); + templateConfig.setService(TEMPLATES_DIR + "/service.java"); + templateConfig.setServiceImpl(TEMPLATES_DIR + "/serviceImpl.java"); + mpg.setTemplate(templateConfig); + mpg.setTemplateEngine(new BeetlTemplateEnginePlus()); + + // 自定义模板配置 + InjectionConfig cfg = new InjectionConfig() { + @Override + public void initMap() { + Map map = new HashMap<>(); + map.put("packageName", PACKAGE_NAME); + map.put("paramExcludeFields", PARAM_EXCLUDE_FIELDS); + map.put("paramToStringType", PARAM_TO_STRING_TYPE); + map.put("paramEqType", PARAM_EQ_TYPE); + map.put("authAnnotation", AUTH_ANNOTATION); + map.put("logAnnotation", LOG_ANNOTATION); + map.put("controllerMappingPrefix", CONTROLLER_MAPPING_PREFIX); + // 添加项目类型标识,用于模板中的条件判断 + map.put("isUniApp", false); // Vue 项目 + map.put("isVueAdmin", true); // 后台管理项目 + this.setMap(map); + } + }; + String templatePath = TEMPLATES_DIR + "/param.java.btl"; + List focList = new ArrayList<>(); + focList.add(new FileOutConfig(templatePath) { + @Override + public String outputFile(TableInfo tableInfo) { + return OUTPUT_LOCATION + OUTPUT_DIR + "/" + + PACKAGE_NAME.replace(".", "/") + + "/" + pc.getModuleName() + "/param/" + + tableInfo.getEntityName() + "Param" + StringPool.DOT_JAVA; + } + }); + /** + * 以下是生成VUE项目代码 + * 生成文件的路径 /api/shop/goods/index.ts + */ + templatePath = TEMPLATES_DIR + "/index.ts.btl"; + + focList.add(new FileOutConfig(templatePath) { + @Override + public String outputFile(TableInfo tableInfo) { + return OUTPUT_LOCATION_VUE + OUTPUT_DIR_VUE + + "/api/" + pc.getModuleName() + "/" + + tableInfo.getEntityPath() + "/" + "index.ts"; + } + }); + // UniApp 使用专门的模板 + String uniappTemplatePath = TEMPLATES_DIR + "/index.ts.uniapp.btl"; + focList.add(new FileOutConfig(uniappTemplatePath) { + @Override + public String outputFile(TableInfo tableInfo) { + return OUTPUT_LOCATION_UNIAPP + OUTPUT_DIR_VUE + + "/api/" + pc.getModuleName() + "/" + + tableInfo.getEntityPath() + "/" + "index.ts"; + } + }); + // 生成TS文件 (/api/shop/goods/model/index.ts) + templatePath = TEMPLATES_DIR + "/model.ts.btl"; + focList.add(new FileOutConfig(templatePath) { + @Override + public String outputFile(TableInfo tableInfo) { + return OUTPUT_LOCATION_VUE + OUTPUT_DIR_VUE + + "/api/" + pc.getModuleName() + "/" + + tableInfo.getEntityPath() + "/model/" + "index.ts"; + } + }); + // UniApp 使用专门的 model 模板 + String uniappModelTemplatePath = TEMPLATES_DIR + "/model.ts.uniapp.btl"; + focList.add(new FileOutConfig(uniappModelTemplatePath) { + @Override + public String outputFile(TableInfo tableInfo) { + return OUTPUT_LOCATION_UNIAPP + OUTPUT_DIR_VUE + + "/api/" + pc.getModuleName() + "/" + + tableInfo.getEntityPath() + "/model/" + "index.ts"; + } + }); + // 生成Vue文件(/views/shop/goods/index.vue) + templatePath = TEMPLATES_DIR + "/index.vue.btl"; + focList.add(new FileOutConfig(templatePath) { + @Override + public String outputFile(TableInfo tableInfo) { + return OUTPUT_LOCATION_VUE + OUTPUT_DIR_VUE + + "/views/" + pc.getModuleName() + "/" + + tableInfo.getEntityPath() + "/" + "index.vue"; + } + }); + + // 生成components文件(/views/shop/goods/components/edit.vue) + templatePath = TEMPLATES_DIR + "/components.edit.vue.btl"; + focList.add(new FileOutConfig(templatePath) { + @Override + public String outputFile(TableInfo tableInfo) { + return OUTPUT_LOCATION_VUE + OUTPUT_DIR_VUE + + "/views/" + pc.getModuleName() + "/" + + tableInfo.getEntityPath() + "/components/" + tableInfo.getEntityPath() + "Edit.vue"; + } + }); + + // 生成components文件(/views/shop/goods/components/search.vue) + templatePath = TEMPLATES_DIR + "/components.search.vue.btl"; + focList.add(new FileOutConfig(templatePath) { + @Override + public String outputFile(TableInfo tableInfo) { + return OUTPUT_LOCATION_VUE + OUTPUT_DIR_VUE + + "/views/" + pc.getModuleName() + "/" + + tableInfo.getEntityPath() + "/components/" + "search.vue"; + } + }); + + // ========== 移动端页面文件生成 ========== + // 生成移动端列表页面配置文件 (/src/shop/goods/index.config.ts) + templatePath = TEMPLATES_DIR + "/index.config.ts.btl"; + focList.add(new FileOutConfig(templatePath) { + @Override + public String outputFile(TableInfo tableInfo) { + return OUTPUT_LOCATION_UNIAPP + OUTPUT_DIR_VUE + + "/" + pc.getModuleName() + "/" + + tableInfo.getEntityPath() + "/" + "index.config.ts"; + } + }); + + // 生成移动端列表页面组件文件 (/src/shop/goods/index.tsx) + templatePath = TEMPLATES_DIR + "/index.tsx.btl"; + focList.add(new FileOutConfig(templatePath) { + @Override + public String outputFile(TableInfo tableInfo) { + return OUTPUT_LOCATION_UNIAPP + OUTPUT_DIR_VUE + + "/" + pc.getModuleName() + "/" + + tableInfo.getEntityPath() + "/" + "index.tsx"; + } + }); + + // 生成移动端新增/编辑页面配置文件 (/src/shop/goods/add.config.ts) + templatePath = TEMPLATES_DIR + "/add.config.ts.btl"; + focList.add(new FileOutConfig(templatePath) { + @Override + public String outputFile(TableInfo tableInfo) { + return OUTPUT_LOCATION_UNIAPP + OUTPUT_DIR_VUE + + "/" + pc.getModuleName() + "/" + + tableInfo.getEntityPath() + "/" + "add.config.ts"; + } + }); + + // 生成移动端新增/编辑页面组件文件 (/src/shop/goods/add.tsx) + templatePath = TEMPLATES_DIR + "/add.tsx.btl"; + focList.add(new FileOutConfig(templatePath) { + @Override + public String outputFile(TableInfo tableInfo) { + return OUTPUT_LOCATION_UNIAPP + OUTPUT_DIR_VUE + + "/" + pc.getModuleName() + "/" + + tableInfo.getEntityPath() + "/" + "add.tsx"; + } + }); + + cfg.setFileOutConfigList(focList); + mpg.setCfg(cfg); + + mpg.execute(); + + // 自动更新 app.config.ts + updateAppConfig(TABLE_NAMES, MODULE_NAME); + } + + /** + * 自动更新 app.config.ts 文件,添加新生成的页面路径 + */ + private static void updateAppConfig(String[] tableNames, String moduleName) { + String appConfigPath = OUTPUT_LOCATION_UNIAPP + OUTPUT_DIR_VUE + "/app.config.ts"; + + try { + // 读取原文件内容 + String content = new String(Files.readAllBytes(Paths.get(appConfigPath))); + + // 为每个表生成页面路径 + StringBuilder newPages = new StringBuilder(); + for (String tableName : tableNames) { + String entityPath = tableName.replaceAll("_", ""); + // 转换为驼峰命名 + String[] parts = tableName.split("_"); + StringBuilder camelCase = new StringBuilder(parts[0]); + for (int i = 1; i < parts.length; i++) { + camelCase.append(parts[i].substring(0, 1).toUpperCase()).append(parts[i].substring(1)); + } + entityPath = camelCase.toString(); + + newPages.append(" '").append(entityPath).append("/index',\n"); + newPages.append(" '").append(entityPath).append("/add',\n"); + } + + // 查找对应模块的子包配置 + String modulePattern = "\"root\":\\s*\"" + moduleName + "\",\\s*\"pages\":\\s*\\[([^\\]]*)]"; + Pattern pattern = Pattern.compile(modulePattern, Pattern.DOTALL); + Matcher matcher = pattern.matcher(content); + + if (matcher.find()) { + String existingPages = matcher.group(1); + + // 检查页面是否已存在,避免重复添加 + boolean needUpdate = false; + String[] newPageArray = newPages.toString().split("\n"); + for (String newPage : newPageArray) { + if (!newPage.trim().isEmpty() && !existingPages.contains(newPage.trim().replace(" ", "").replace(",", ""))) { + needUpdate = true; + break; + } + } + + if (needUpdate) { + // 备份原文件 + String backupPath = appConfigPath + ".backup." + System.currentTimeMillis(); + Files.copy(Paths.get(appConfigPath), Paths.get(backupPath)); + System.out.println("已备份原文件到: " + backupPath); + + // 在现有页面列表末尾添加新页面 + String updatedPages = existingPages.trim(); + if (!updatedPages.endsWith(",")) { + updatedPages += ","; + } + updatedPages += "\n" + newPages.toString().trim(); + + // 替换内容 + String updatedContent = content.replace(matcher.group(1), updatedPages); + + // 写入更新后的内容 + Files.write(Paths.get(appConfigPath), updatedContent.getBytes()); + + System.out.println("✅ 已自动更新 app.config.ts,添加了以下页面路径:"); + System.out.println(newPages.toString()); + } else { + System.out.println("ℹ️ app.config.ts 中已包含所有页面路径,无需更新"); + } + } else { + System.out.println("⚠️ 未找到 " + moduleName + " 模块的子包配置,请手动添加页面路径"); + } + + } catch (Exception e) { + System.err.println("❌ 更新 app.config.ts 失败: " + e.getMessage()); + e.printStackTrace(); + } + } + +} diff --git a/src/test/java/com/gxwebsoft/generator/engine/BeetlTemplateEnginePlus.java b/src/test/java/com/gxwebsoft/generator/engine/BeetlTemplateEnginePlus.java new file mode 100644 index 0000000..1a73826 --- /dev/null +++ b/src/test/java/com/gxwebsoft/generator/engine/BeetlTemplateEnginePlus.java @@ -0,0 +1,50 @@ +package com.gxwebsoft.generator.engine; + +import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder; +import com.baomidou.mybatisplus.generator.engine.AbstractTemplateEngine; +import org.beetl.core.Configuration; +import org.beetl.core.GroupTemplate; +import org.beetl.core.Template; +import org.beetl.core.resource.FileResourceLoader; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Map; + +/** + * Beetl模板引擎实现文件输出 + * + * @author WebSoft + * @since 2021-09-05 00:30:28 + */ +public class BeetlTemplateEnginePlus extends AbstractTemplateEngine { + private GroupTemplate groupTemplate; + + @Override + public AbstractTemplateEngine init(ConfigBuilder configBuilder) { + super.init(configBuilder); + try { + Configuration cfg = Configuration.defaultConfiguration(); + groupTemplate = new GroupTemplate(new FileResourceLoader(), cfg); + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + return this; + } + + @Override + public void writer(Map objectMap, String templatePath, String outputFile) throws Exception { + Template template = groupTemplate.getTemplate(templatePath); + try (FileOutputStream fileOutputStream = new FileOutputStream(outputFile)) { + template.binding(objectMap); + template.renderTo(fileOutputStream); + } + logger.debug("模板:" + templatePath + "; 文件:" + outputFile); + } + + @Override + public String templateFilePath(String filePath) { + return filePath + ".btl"; + } + +} diff --git a/src/test/java/com/gxwebsoft/generator/templates/add.config.ts.btl b/src/test/java/com/gxwebsoft/generator/templates/add.config.ts.btl new file mode 100644 index 0000000..a93cafd --- /dev/null +++ b/src/test/java/com/gxwebsoft/generator/templates/add.config.ts.btl @@ -0,0 +1,4 @@ +export default definePageConfig({ + navigationBarTitleText: '新增${table.comment!'数据'}', + navigationBarTextStyle: 'black' +}) diff --git a/src/test/java/com/gxwebsoft/generator/templates/add.tsx.btl b/src/test/java/com/gxwebsoft/generator/templates/add.tsx.btl new file mode 100644 index 0000000..73055da --- /dev/null +++ b/src/test/java/com/gxwebsoft/generator/templates/add.tsx.btl @@ -0,0 +1,115 @@ +import {useEffect, useState, useRef} from "react"; +import {useRouter} from '@tarojs/taro' +import {Button, Loading, CellGroup, Input, TextArea, Form} from '@nutui/nutui-react-taro' +import Taro from '@tarojs/taro' +import {View} from '@tarojs/components' +import {${entity}} from "@/api/${package.ModuleName}/${table.entityPath}/model"; +import {get${entity}, list${entity}, update${entity}, add${entity}} from "@/api/${package.ModuleName}/${table.entityPath}"; + +const Add${entity} = () => { + const {params} = useRouter(); + const [loading, setLoading] = useState(true) + const [FormData, setFormData] = useState<${entity}>({}) + const formRef = useRef(null) + + const reload = async () => { + if (params.id) { + const data = await get${entity}(Number(params.id)) + setFormData(data) + } else { + setFormData({}) + } + } + + // 提交表单 + const submitSucceed = async (values: any) => { + try { + if (params.id) { + // 编辑模式 + await update${entity}({ + ...values, + id: Number(params.id) + }) + } else { + // 新增模式 + await add${entity}(values) + } + + Taro.showToast({ + title: `操作成功`, + icon: 'success' + }) + + setTimeout(() => { + return Taro.navigateBack() + }, 1000) + } catch (error) { + Taro.showToast({ + title: `操作失败`, + icon: 'error' + }); + } + } + + const submitFailed = (error: any) => { + console.log(error, 'err...') + } + + useEffect(() => { + reload().then(() => { + setLoading(false) + }) + }, []); + + if (loading) { + return 加载中 + } + + return ( + <> +

submitSucceed(values)} + onFinishFailed={(errors) => submitFailed(errors)} + footer={ +
+ +
+ } + > + +<% for(field in table.fields){ %> +<% if(field.propertyName != 'id' && field.propertyName != 'createTime' && field.propertyName != 'updateTime'){ %> + +<% if(field.propertyType == 'String' && field.comment?? && (field.comment?contains('描述') || field.comment?contains('备注') || field.comment?contains('内容'))){ %> +