commit
c32ef2b7e8
410 changed files with 18763 additions and 0 deletions
@ -0,0 +1,33 @@ |
|||||||
|
HELP.md |
||||||
|
target/ |
||||||
|
!.mvn/wrapper/maven-wrapper.jar |
||||||
|
!**/src/main/**/target/ |
||||||
|
!**/src/test/**/target/ |
||||||
|
|
||||||
|
### 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/ |
||||||
|
!**/src/main/**/build/ |
||||||
|
!**/src/test/**/build/ |
||||||
|
|
||||||
|
### VS Code ### |
||||||
|
.vscode/ |
||||||
@ -0,0 +1,179 @@ |
|||||||
|
# 项目交接文档 |
||||||
|
|
||||||
|
## 1. 项目概述 |
||||||
|
|
||||||
|
- **项目名称**:InvestBoot 政府投资报审系统 |
||||||
|
- **项目描述**:政府投资项目报审管理系统,提供项目审批、预警管理、价格信息管理等功能 |
||||||
|
- **项目组**:com.biutag.supervision |
||||||
|
|
||||||
|
## 2. 技术栈 |
||||||
|
|
||||||
|
### 2.1 核心框架 |
||||||
|
- Spring Boot 3.3.2 |
||||||
|
- MyBatis Plus 3.5.7 |
||||||
|
- Dynamic Datasource 4.3.1(多数据源) |
||||||
|
- Redis Reactive |
||||||
|
|
||||||
|
### 2.2 数据库 |
||||||
|
- MySQL(主要数据库) |
||||||
|
- PostgreSQL(邮箱相关) |
||||||
|
- 支持多种数据库:达梦(DM)、SQL Server、GBase |
||||||
|
|
||||||
|
### 2.3 文件存储 |
||||||
|
- FastDFS 分布式文件系统 |
||||||
|
|
||||||
|
### 2.4 API文档 |
||||||
|
- Knife4j OpenAPI3(基于Swagger) |
||||||
|
|
||||||
|
### 2.5 工具类 |
||||||
|
- Hutool 5.8.29 |
||||||
|
- EasyExcel 4.0.1 |
||||||
|
- Fastjson 2.0.53 |
||||||
|
- Aspose.Words 15.8.0(Word文档处理) |
||||||
|
|
||||||
|
### 2.6 其他组件 |
||||||
|
- Lombok |
||||||
|
- Druid 连接池 |
||||||
|
- Freemarker 模板引擎 |
||||||
|
- Logstash 日志编码 |
||||||
|
- JIT AuthSDK 3.0.3(数字证书) |
||||||
|
|
||||||
|
## 3. 环境配置 |
||||||
|
|
||||||
|
### 3.1 开发环境 |
||||||
|
- JDK 17 |
||||||
|
- Maven 3.6+ |
||||||
|
- IDE:推荐 IntelliJ IDEA |
||||||
|
|
||||||
|
### 3.2 配置文件 |
||||||
|
- 主配置文件:`application.yml` |
||||||
|
- 环境配置文件: |
||||||
|
- `application-local.yml`(本地开发环境) |
||||||
|
- `application-dev.yml`(开发环境) |
||||||
|
- `application-prod.yml`(生产环境) |
||||||
|
|
||||||
|
### 3.3 数据库配置 |
||||||
|
- 主数据源(master):MySQL |
||||||
|
- 从数据源(多个):用于不同业务模块 |
||||||
|
- Redis:缓存,端口6379 |
||||||
|
|
||||||
|
### 3.4 文件服务配置 |
||||||
|
- FastDFS:分布式文件存储 |
||||||
|
- 预览URL配置:`http://172.31.217.20:31664` |
||||||
|
|
||||||
|
## 4. 项目结构 |
||||||
|
|
||||||
|
``` |
||||||
|
src/main/java/com/biutag/supervision/ |
||||||
|
├── InvestBootApplication.java # 应用启动类 |
||||||
|
├── common/ # 通用类 |
||||||
|
├── config/ # 配置类 |
||||||
|
├── constants/ # 常量定义 |
||||||
|
├── controller/ # 控制器层 |
||||||
|
├── exception/ # 异常处理 |
||||||
|
├── flow/ # 流程相关 |
||||||
|
├── job/ # 定时任务 |
||||||
|
├── mapper/ # 数据访问层 |
||||||
|
├── pojo/ # 数据模型 |
||||||
|
│ ├── domain/ # 领域模型 |
||||||
|
│ ├── dto/ # 数据传输对象 |
||||||
|
│ ├── entity/ # 实体类 |
||||||
|
│ ├── enums/ # 枚举类 |
||||||
|
│ ├── model/ # 模型类 |
||||||
|
│ ├── param/ # 参数类 |
||||||
|
│ └── vo/ # 视图对象 |
||||||
|
├── service/ # 业务逻辑层 |
||||||
|
├── support/ # 支持类 |
||||||
|
└── util/ # 工具类 |
||||||
|
``` |
||||||
|
|
||||||
|
## 5. 核心功能模块 |
||||||
|
|
||||||
|
### 5.1 认证与授权 |
||||||
|
- 登录认证:`LoginController` |
||||||
|
- 用户角色权限管理:基于RBAC模型 |
||||||
|
- Token管理:Redis存储,有效期168小时 |
||||||
|
|
||||||
|
### 5.2 文件管理 |
||||||
|
- 文件上传下载:`FileController` |
||||||
|
- 文件分类管理:`FileClassService` |
||||||
|
- 文件存储:FastDFS分布式存储 |
||||||
|
|
||||||
|
### 5.3 项目预警管理 |
||||||
|
- 预警信息处理 |
||||||
|
- 预警相关接口:`controller/warning/` |
||||||
|
|
||||||
|
### 5.4 价格信息库管理 |
||||||
|
- 价格信息录入与查询 |
||||||
|
- 相关接口:`controller/price/` |
||||||
|
|
||||||
|
### 5.5 项目报审、报表管理 |
||||||
|
- 相关接口:`controller/report/ReportProjectController.java` |
||||||
|
|
||||||
|
### 5.6 工作流管理 |
||||||
|
- 相关接口:`controller/report/ReportFlowController.java` |
||||||
|
|
||||||
|
### 5.7 服务单位管理 |
||||||
|
- 服务单位信息维护 |
||||||
|
- 相关接口:`controller/serviceUnit/` |
||||||
|
|
||||||
|
## 6. API文档 |
||||||
|
|
||||||
|
### 6.1 访问地址 |
||||||
|
|
||||||
|
|
||||||
|
### 6.2 接口分组 |
||||||
|
- plugin:插件相关接口 |
||||||
|
- 各功能模块独立接口组 |
||||||
|
|
||||||
|
## 7. 关键配置项 |
||||||
|
|
||||||
|
### 7.1 服务器配置 |
||||||
|
- 端口:8080 |
||||||
|
- 时区:Asia/Shanghai |
||||||
|
|
||||||
|
### 7.2 文件上传配置 |
||||||
|
- 最大文件大小:100MB |
||||||
|
- 最大请求大小:100MB |
||||||
|
|
||||||
|
### 7.3 缓存配置 |
||||||
|
- Redis数据库索引:1 |
||||||
|
- 连接超时:10s |
||||||
|
|
||||||
|
### 7.4 FastDFS配置 |
||||||
|
- Tracker列表:172.31.217.20:32060, 172.31.217.20:31882 |
||||||
|
- 连接超时:10000ms |
||||||
|
|
||||||
|
## 8. 部署说明 |
||||||
|
|
||||||
|
### 8.1 打包方式 |
||||||
|
- Maven打包:`mvn clean package` |
||||||
|
- 最终生成JAR包:`investBoot.jar` |
||||||
|
|
||||||
|
### 8.2 环境切换 |
||||||
|
- 本地:`-Dspring.profiles.active=local` |
||||||
|
- 开发:`-Dspring.profiles.active=dev` |
||||||
|
- 生产:`-Dspring.profiles.active=prod` |
||||||
|
|
||||||
|
### 8.3 运行命令 |
||||||
|
``` |
||||||
|
java -jar investBoot.jar --spring.profiles.active=环境名称 |
||||||
|
``` |
||||||
|
|
||||||
|
## 9. 注意事项 |
||||||
|
|
||||||
|
### 9.1 数据库配置 |
||||||
|
- 首次部署需要执行SQL脚本初始化数据库 |
||||||
|
- SQL脚本位置:`sql/`目录 |
||||||
|
|
||||||
|
### 9.2 外部依赖 |
||||||
|
- 需确保Redis服务正常运行 |
||||||
|
- 需确保FastDFS服务正常运行 |
||||||
|
- 部分证书相关功能依赖JIT AuthSDK |
||||||
|
|
||||||
|
### 9.3 特殊配置 |
||||||
|
- Word文档处理功能依赖Aspose.Words,需注意许可证配置 |
||||||
|
- 视频检查相关功能依赖外部服务 |
||||||
|
|
||||||
|
## 10. 联系人信息 |
||||||
|
|
||||||
Binary file not shown.
@ -0,0 +1 @@ |
|||||||
|
mvn install:install-file -DgroupId=cn.com.jit -DartifactId=authSDK -Dversion=3.0.3 -Dfile="authSDK-3.0.3.jar" -Dpackaging=jar |
||||||
@ -0,0 +1 @@ |
|||||||
|
mvn install:install-file -DgroupId=com.aspose -DartifactId=aspose-words -Dversion=15.8.0 -Dfile="words-15.8.0.jar" -Dpackaging=jar |
||||||
Binary file not shown.
@ -0,0 +1,299 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
<parent> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-parent</artifactId> |
||||||
|
<version>3.3.2</version> |
||||||
|
<relativePath/> <!-- lookup parent from repository --> |
||||||
|
</parent> |
||||||
|
<groupId>com.biutag</groupId> |
||||||
|
<artifactId>InvestBoot</artifactId> |
||||||
|
<version>0.0.1-SNAPSHOT</version> |
||||||
|
<name>InvestBoot</name> |
||||||
|
<description>政府投资报审</description> |
||||||
|
<url/> |
||||||
|
<licenses> |
||||||
|
<license/> |
||||||
|
</licenses> |
||||||
|
<developers> |
||||||
|
<developer/> |
||||||
|
</developers> |
||||||
|
<scm> |
||||||
|
<connection/> |
||||||
|
<developerConnection/> |
||||||
|
<tag/> |
||||||
|
<url/> |
||||||
|
</scm> |
||||||
|
<properties> |
||||||
|
<java.version>17</java.version> |
||||||
|
</properties> |
||||||
|
<dependencies> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-validation</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-data-redis-reactive</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!-- 达梦数据库驱动 --> |
||||||
|
<!-- 达梦数据库驱动 --> |
||||||
|
<dependency> |
||||||
|
<groupId>com.dameng</groupId> |
||||||
|
<artifactId>DmJdbcDriver18</artifactId> |
||||||
|
<version>8.1.3.140</version> |
||||||
|
</dependency> |
||||||
|
<!-- <dependency>--> |
||||||
|
<!-- <groupId>org.springframework.boot</groupId>--> |
||||||
|
<!-- <artifactId>spring-boot-devtools</artifactId>--> |
||||||
|
<!-- <scope>runtime</scope>--> |
||||||
|
<!-- <optional>true</optional>--> |
||||||
|
<!-- </dependency>--> |
||||||
|
|
||||||
|
|
||||||
|
<!-- mysql JDBC驱动 --> |
||||||
|
<dependency> |
||||||
|
<groupId>com.mysql</groupId> |
||||||
|
<artifactId>mysql-connector-j</artifactId> |
||||||
|
<scope>runtime</scope> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!-- SQL Server JDBC驱动 --> |
||||||
|
<dependency> |
||||||
|
<groupId>com.microsoft.sqlserver</groupId> |
||||||
|
<artifactId>mssql-jdbc</artifactId> |
||||||
|
<version>12.8.1.jre11</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>javax.xml.bind</groupId> |
||||||
|
<artifactId>jaxb-api</artifactId> |
||||||
|
<version>2.3.0</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.sun.xml.bind</groupId> |
||||||
|
<artifactId>jaxb-impl</artifactId> |
||||||
|
<version>2.3.0</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>com.sun.xml.bind</groupId> |
||||||
|
<artifactId>jaxb-core</artifactId> |
||||||
|
<version>2.3.0</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>javax.activation</groupId> |
||||||
|
<artifactId>activation</artifactId> |
||||||
|
<version>1.1.1</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!-- gbase数据库 JDBC驱动 --> |
||||||
|
<dependency> |
||||||
|
<groupId>com.gbase</groupId> |
||||||
|
<artifactId>gbase-jdbc</artifactId> |
||||||
|
<scope>system</scope> |
||||||
|
<version>8.3.81.53-build55.2.1-bin</version> |
||||||
|
<systemPath>${project.basedir}/src/main/resources/lib/gbase-connector-java-8.3.81.53-build52.8-bin.jar |
||||||
|
</systemPath> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!-- dm数据库 JDBC驱动 --> |
||||||
|
<dependency> |
||||||
|
<groupId>com.dameng</groupId> |
||||||
|
<artifactId>DmJdbcDriver18</artifactId> |
||||||
|
<version>8.1.3.140</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!-- postgresql JDBC驱动 --> |
||||||
|
<dependency> |
||||||
|
<groupId>org.postgresql</groupId> |
||||||
|
<artifactId>postgresql</artifactId> |
||||||
|
<version>42.7.4</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>com.alibaba</groupId> |
||||||
|
<artifactId>druid-spring-boot-starter</artifactId> |
||||||
|
<version>1.2.22</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>org.projectlombok</groupId> |
||||||
|
<artifactId>lombok</artifactId> |
||||||
|
<optional>true</optional> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-test</artifactId> |
||||||
|
<scope>test</scope> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>com.baomidou</groupId> |
||||||
|
<artifactId>mybatis-plus-spring-boot3-starter</artifactId> |
||||||
|
<version>3.5.7</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>com.alibaba</groupId> |
||||||
|
<artifactId>easyexcel</artifactId> |
||||||
|
<version>4.0.1</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>commons-io</groupId> |
||||||
|
<artifactId>commons-io</artifactId> |
||||||
|
<version>2.17.0</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>cn.hutool</groupId> |
||||||
|
<artifactId>hutool-core</artifactId> |
||||||
|
<version>5.8.29</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>cn.hutool</groupId> |
||||||
|
<artifactId>hutool-http</artifactId> |
||||||
|
<version>5.8.29</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>com.baomidou</groupId> |
||||||
|
<artifactId>dynamic-datasource-spring-boot3-starter</artifactId> |
||||||
|
<version>4.3.1</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>org.freemarker</groupId> |
||||||
|
<artifactId>freemarker</artifactId> |
||||||
|
<version>2.3.32</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.security</groupId> |
||||||
|
<artifactId>spring-security-crypto</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>com.github.tobato</groupId> |
||||||
|
<artifactId>fastdfs-client</artifactId> |
||||||
|
<version>1.27.2</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!--knife4j--> |
||||||
|
<dependency> |
||||||
|
<groupId>com.github.xiaoymin</groupId> |
||||||
|
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId> |
||||||
|
<version>4.1.0</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>com.alibaba</groupId> |
||||||
|
<artifactId>fastjson</artifactId> |
||||||
|
<version>2.0.53</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<dependency> |
||||||
|
<groupId>net.logstash.logback</groupId> |
||||||
|
<artifactId>logstash-logback-encoder</artifactId> |
||||||
|
<version>4.9</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!-- word转换 --> |
||||||
|
<dependency> |
||||||
|
<groupId>com.aspose</groupId> |
||||||
|
<artifactId>aspose-words</artifactId> |
||||||
|
<version>15.8.0</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
<!-- 数字证书 --> |
||||||
|
<dependency> |
||||||
|
<groupId>cn.com.jit</groupId> |
||||||
|
<artifactId>authSDK</artifactId> |
||||||
|
<version>3.0.3</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>commons-httpclient</groupId> |
||||||
|
<artifactId>commons-httpclient</artifactId> |
||||||
|
<version>3.0.1</version> |
||||||
|
</dependency> |
||||||
|
|
||||||
|
</dependencies> |
||||||
|
|
||||||
|
<build> |
||||||
|
<resources> |
||||||
|
<resource> |
||||||
|
<directory>src/main/resources</directory> |
||||||
|
<filtering>false</filtering> |
||||||
|
<!-- 本地跑时改成true,打包时改成false--> |
||||||
|
</resource> |
||||||
|
<resource> |
||||||
|
<directory>src/main/resources</directory> |
||||||
|
<includes> |
||||||
|
<include>application.yml</include> |
||||||
|
</includes> |
||||||
|
<filtering>true</filtering> |
||||||
|
</resource> |
||||||
|
</resources> |
||||||
|
|
||||||
|
<plugins> |
||||||
|
<plugin> |
||||||
|
<!--打包跳过测试--> |
||||||
|
<groupId>org.apache.maven.plugins</groupId> |
||||||
|
<artifactId>maven-surefire-plugin</artifactId> |
||||||
|
<version>3.2.5</version> |
||||||
|
<configuration> |
||||||
|
<skipTests>true</skipTests> |
||||||
|
</configuration> |
||||||
|
</plugin> |
||||||
|
<plugin> |
||||||
|
<groupId>org.springframework.boot</groupId> |
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId> |
||||||
|
<configuration> |
||||||
|
<includeSystemScope>true</includeSystemScope> |
||||||
|
<excludes> |
||||||
|
<exclude> |
||||||
|
<groupId>org.projectlombok</groupId> |
||||||
|
<artifactId>lombok</artifactId> |
||||||
|
</exclude> |
||||||
|
</excludes> |
||||||
|
</configuration> |
||||||
|
</plugin> |
||||||
|
</plugins> |
||||||
|
|
||||||
|
<finalName>investBoot</finalName> |
||||||
|
</build> |
||||||
|
|
||||||
|
<profiles> |
||||||
|
<profile> |
||||||
|
<id>dev</id> |
||||||
|
<properties> |
||||||
|
<!-- 环境标识,需要与配置文件的名称相对应 --> |
||||||
|
<profiles.active>dev</profiles.active> |
||||||
|
</properties> |
||||||
|
<activation> |
||||||
|
<!-- 默认环境 --> |
||||||
|
<activeByDefault>true</activeByDefault> |
||||||
|
</activation> |
||||||
|
</profile> |
||||||
|
<profile> |
||||||
|
<id>prod</id> |
||||||
|
<properties> |
||||||
|
<profiles.active>prod</profiles.active> |
||||||
|
</properties> |
||||||
|
</profile> |
||||||
|
</profiles> |
||||||
|
|
||||||
|
</project> |
||||||
Binary file not shown.
@ -0,0 +1,21 @@ |
|||||||
|
package com.biutag.supervision; |
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication; |
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||||
|
import org.springframework.cache.annotation.EnableCaching; |
||||||
|
import org.springframework.context.annotation.EnableAspectJAutoProxy; |
||||||
|
import org.springframework.scheduling.annotation.EnableAsync; |
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling; |
||||||
|
|
||||||
|
@EnableAsync |
||||||
|
@EnableCaching |
||||||
|
@EnableScheduling |
||||||
|
@SpringBootApplication |
||||||
|
@EnableAspectJAutoProxy |
||||||
|
public class InvestBootApplication { |
||||||
|
|
||||||
|
public static void main(String[] args) { |
||||||
|
SpringApplication.run(InvestBootApplication.class, args); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,34 @@ |
|||||||
|
package com.biutag.supervision.common; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import cn.hutool.http.Header; |
||||||
|
import com.biutag.supervision.constants.RedisKeyConstants; |
||||||
|
import com.biutag.supervision.exception.AuthException; |
||||||
|
import com.biutag.supervision.pojo.model.UserAuth; |
||||||
|
import com.biutag.supervision.util.SpringUtil; |
||||||
|
import jakarta.servlet.http.HttpServletRequest; |
||||||
|
import org.springframework.data.redis.core.RedisTemplate; |
||||||
|
import org.springframework.web.context.request.RequestContextHolder; |
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes; |
||||||
|
|
||||||
|
public class UserContextHolder { |
||||||
|
|
||||||
|
public static String getCurrentToken() { |
||||||
|
HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest(); |
||||||
|
return request.getHeader(Header.AUTHORIZATION.getValue()); |
||||||
|
} |
||||||
|
|
||||||
|
public static UserAuth getCurrentUser() { |
||||||
|
String authorization = getCurrentToken(); |
||||||
|
if (StrUtil.isBlank(authorization)) { |
||||||
|
throw new AuthException(); |
||||||
|
} |
||||||
|
UserAuth userAuth = (UserAuth) SpringUtil.getBean("redisTemplate", RedisTemplate.class).opsForValue().get(String.format(RedisKeyConstants.LOGIN_USERINFO_KEY, authorization)); |
||||||
|
return userAuth; |
||||||
|
} |
||||||
|
|
||||||
|
public static String getCurrentUserId() { |
||||||
|
return getCurrentUser().getUserId(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
package com.biutag.supervision.common.validation; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/11/7 |
||||||
|
*/ |
||||||
|
public interface AddGroup { |
||||||
|
} |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
package com.biutag.supervision.common.validation; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/11/7 |
||||||
|
*/ |
||||||
|
public interface EditGroup { |
||||||
|
} |
||||||
@ -0,0 +1,33 @@ |
|||||||
|
package com.biutag.supervision.config; |
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
import org.springframework.web.cors.CorsConfiguration; |
||||||
|
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; |
||||||
|
import org.springframework.web.filter.CorsFilter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2025/4/12 |
||||||
|
*/ |
||||||
|
@Configuration |
||||||
|
public class CorsConfig { |
||||||
|
|
||||||
|
private CorsConfiguration corsConfig() { |
||||||
|
CorsConfiguration corsConfiguration = new CorsConfiguration(); |
||||||
|
corsConfiguration.addAllowedOriginPattern("*"); //允许所有域名访问
|
||||||
|
corsConfiguration.addAllowedHeader("*"); //允许所有请求头
|
||||||
|
corsConfiguration.addAllowedMethod("*"); //允许所有的请求类型
|
||||||
|
corsConfiguration.setMaxAge(3600L); |
||||||
|
corsConfiguration.setAllowCredentials(true); //允许请求携带验证信息(cookie)
|
||||||
|
return corsConfiguration; |
||||||
|
} |
||||||
|
|
||||||
|
@Bean |
||||||
|
public CorsFilter corsFilter() { |
||||||
|
//存储request与跨域配置信息的容器,基于url的映射
|
||||||
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); |
||||||
|
source.registerCorsConfiguration("/**", corsConfig()); |
||||||
|
return new CorsFilter(source); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
package com.biutag.supervision.config; |
||||||
|
|
||||||
|
import com.github.tobato.fastdfs.domain.conn.TrackerConnectionManager; |
||||||
|
import jakarta.annotation.PostConstruct; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.context.annotation.ComponentScan; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
|
||||||
|
@ComponentScan("com.github.tobato.fastdfs") |
||||||
|
@Configuration |
||||||
|
public class FastDFSConfig { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private TrackerConnectionManager trackerConnectionManager; |
||||||
|
|
||||||
|
@PostConstruct |
||||||
|
public void init() { |
||||||
|
trackerConnectionManager.initTracker(); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,62 @@ |
|||||||
|
package com.biutag.supervision.config; |
||||||
|
|
||||||
|
import com.biutag.supervision.exception.AuthException; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import jakarta.validation.ValidationException; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.dao.DataAccessException; |
||||||
|
import org.springframework.http.HttpStatus; |
||||||
|
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 org.springframework.web.bind.annotation.ResponseStatus; |
||||||
|
|
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@ControllerAdvice |
||||||
|
public class GlobalExceptionHandler { |
||||||
|
|
||||||
|
@ResponseStatus(HttpStatus.OK) |
||||||
|
@ExceptionHandler(Exception.class) |
||||||
|
@ResponseBody |
||||||
|
public Result<Object> handleException(Exception e) { |
||||||
|
log.error("系统异常: {}", e.getMessage(), e); |
||||||
|
return Result.failed(e.getMessage()); |
||||||
|
} |
||||||
|
|
||||||
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) |
||||||
|
@ExceptionHandler(DataAccessException.class) |
||||||
|
@ResponseBody |
||||||
|
public Result<Object> handleDataAccessException(DataAccessException e) { |
||||||
|
log.error("数据库异常: {}", e.getMessage(), e); |
||||||
|
return Result.failed(String.format("数据库异常:%s", e.getMessage())); |
||||||
|
} |
||||||
|
|
||||||
|
@ResponseStatus(HttpStatus.UNAUTHORIZED) |
||||||
|
@ExceptionHandler(AuthException.class) |
||||||
|
@ResponseBody |
||||||
|
public Result<Object> handleAuthException(AuthException e) { |
||||||
|
log.error("未授权", e); |
||||||
|
return Result.failed(HttpStatus.UNAUTHORIZED.value(), HttpStatus.UNAUTHORIZED.getReasonPhrase()); |
||||||
|
} |
||||||
|
|
||||||
|
@ResponseStatus(HttpStatus.BAD_REQUEST) |
||||||
|
@ExceptionHandler(MethodArgumentNotValidException.class) |
||||||
|
@ResponseBody |
||||||
|
public Result<Object> handleMethodArgumentNotValidException(MethodArgumentNotValidException e) { |
||||||
|
String message = e.getBindingResult().getFieldErrors().stream().map(item -> "不能为空".equals(item.getDefaultMessage()) ? item.getField() + "-" + item.getDefaultMessage() : item.getDefaultMessage()).collect(Collectors.joining("; ")); |
||||||
|
log.error("参数错误: {}", message, e); |
||||||
|
return Result.failed(HttpStatus.BAD_REQUEST.value(), String.format("参数错误:%s", message)); |
||||||
|
} |
||||||
|
|
||||||
|
@ResponseStatus(HttpStatus.BAD_REQUEST) |
||||||
|
@ExceptionHandler(ValidationException.class) |
||||||
|
@ResponseBody |
||||||
|
public Result<Object> handleValidationException(ValidationException e) { |
||||||
|
log.error("参数错误", e); |
||||||
|
return Result.failed(HttpStatus.BAD_REQUEST.value(), e.getMessage()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,92 @@ |
|||||||
|
package com.biutag.supervision.config; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import cn.hutool.http.Header; |
||||||
|
import com.biutag.supervision.common.UserContextHolder; |
||||||
|
import com.biutag.supervision.constants.RedisKeyConstants; |
||||||
|
import com.biutag.supervision.exception.AuthException; |
||||||
|
import com.biutag.supervision.pojo.model.UserAuth; |
||||||
|
import com.biutag.supervision.util.SpringUtil; |
||||||
|
import jakarta.servlet.http.HttpServletRequest; |
||||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.beans.factory.annotation.Value; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
import org.springframework.data.redis.core.RedisTemplate; |
||||||
|
import org.springframework.web.servlet.HandlerInterceptor; |
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry; |
||||||
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Objects; |
||||||
|
import java.util.concurrent.TimeUnit; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/1/8 |
||||||
|
*/ |
||||||
|
@Slf4j |
||||||
|
@Configuration |
||||||
|
public class InterceptorConfig implements WebMvcConfigurer { |
||||||
|
|
||||||
|
@Value("${token.timeout}") |
||||||
|
private Integer tokenTimeout; |
||||||
|
|
||||||
|
@Override |
||||||
|
public void addInterceptors(InterceptorRegistry registry) { |
||||||
|
registry.addInterceptor(new DefaultInterceptor()) |
||||||
|
.addPathPatterns("/**") |
||||||
|
.excludePathPatterns("/api/**") |
||||||
|
.excludePathPatterns("/crx/ajhc/**") |
||||||
|
// 登录
|
||||||
|
.excludePathPatterns("/login", "/jit/**", "/app/login") |
||||||
|
.excludePathPatterns("/file/stream/**", "/templates/**") |
||||||
|
.excludePathPatterns("/datav/risk/**") |
||||||
|
.excludePathPatterns("/score/**") |
||||||
|
.excludePathPatterns("/common/**") |
||||||
|
.excludePathPatterns("/app/**") |
||||||
|
// excel导出
|
||||||
|
.excludePathPatterns("/serviceUnit/export","/reportProject/excelConditionVo","/data/petitionComplaint12337/export/result","/err","/sampling/export/samplingPoling", "/negative/books/export/**","/data/petitionComplaint/export/**","/confinement/export","/books/dataThread/export") |
||||||
|
.excludePathPatterns(List.of("/doc.html", "/webjars/**", "/favicon.ico", "/v3/api-docs/**")); |
||||||
|
registry.addInterceptor(new ApiInterceptor()) |
||||||
|
.addPathPatterns("/api/jwdc/**"); |
||||||
|
} |
||||||
|
|
||||||
|
class DefaultInterceptor implements HandlerInterceptor { |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { |
||||||
|
log.info("请求地址:{}", request.getRequestURI()); |
||||||
|
String authorization = request.getHeader(Header.AUTHORIZATION.getValue()); |
||||||
|
RedisTemplate<Object, Object> redisTemplate = SpringUtil.getBean("redisTemplate", RedisTemplate.class); |
||||||
|
try { |
||||||
|
if (StrUtil.isBlank(authorization) || Objects.isNull(redisTemplate.opsForValue().get(String.format(RedisKeyConstants.LOGIN_USERINFO_KEY, authorization)))) { |
||||||
|
throw new AuthException(); |
||||||
|
} |
||||||
|
} catch (RuntimeException e) { |
||||||
|
throw new AuthException(e.getMessage()); |
||||||
|
} |
||||||
|
// 更新 会话 有效期
|
||||||
|
redisTemplate.expire(String.format(RedisKeyConstants.LOGIN_USERINFO_KEY, authorization), tokenTimeout, TimeUnit.HOURS); |
||||||
|
UserAuth user = UserContextHolder.getCurrentUser(); |
||||||
|
log.info("请求用户:{}", user.getNickName()); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
static class ApiInterceptor implements HandlerInterceptor { |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { |
||||||
|
log.info("请求地址【API】:{}", request.getRequestURI()); |
||||||
|
String authorization = request.getHeader("Authorization"); |
||||||
|
if (!"565318a8ea367e03904e1c241048dd6c".equals(authorization)) { |
||||||
|
throw new AuthException(); |
||||||
|
} |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,22 @@ |
|||||||
|
package com.biutag.supervision.config; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.DbType; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
||||||
|
import org.mybatis.spring.annotation.MapperScan; |
||||||
|
import org.springframework.context.annotation.Bean; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
|
||||||
|
@Configuration |
||||||
|
@MapperScan("com.biutag.supervision.mapper") |
||||||
|
public class MybatisPlusConfig { |
||||||
|
|
||||||
|
@Bean |
||||||
|
public MybatisPlusInterceptor mybatisPlusInterceptor() { |
||||||
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
||||||
|
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); // 如果配置多个插件, 切记分页最后添加
|
||||||
|
// 如果有多数据源可以不配具体类型, 否则都建议配上具体的 DbType
|
||||||
|
return interceptor; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,31 @@ |
|||||||
|
package com.biutag.supervision.config; |
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
import org.springframework.data.redis.cache.RedisCacheConfiguration; |
||||||
|
import org.springframework.data.redis.cache.RedisCacheManager; |
||||||
|
import org.springframework.data.redis.connection.RedisConnectionFactory; |
||||||
|
|
||||||
|
import java.time.Duration; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Auther: sh |
||||||
|
* @Date: 2024/12/13 11:03 |
||||||
|
* @Description: 针对首页大屏的缓存 |
||||||
|
*/ |
||||||
|
@Configuration |
||||||
|
public class RedisCacheConfig { |
||||||
|
|
||||||
|
@Bean |
||||||
|
public RedisCacheManager cacheManager(RedisConnectionFactory redisConnectionFactory) { |
||||||
|
// 配置统一的缓存过期时间
|
||||||
|
RedisCacheConfiguration cacheConfiguration = RedisCacheConfiguration.defaultCacheConfig() |
||||||
|
.entryTtl(Duration.ofHours(24)); //
|
||||||
|
|
||||||
|
// 创建一个缓存管理器,使用默认配置,并为所有缓存设置统一的过期时间
|
||||||
|
RedisCacheManager res = RedisCacheManager.builder(redisConnectionFactory) |
||||||
|
.cacheDefaults(cacheConfiguration) // 设置所有缓存的默认过期时间
|
||||||
|
.build(); |
||||||
|
return res; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,22 @@ |
|||||||
|
package com.biutag.supervision.config; |
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
import org.springframework.scheduling.TaskScheduler; |
||||||
|
import org.springframework.scheduling.config.ScheduledTaskRegistrar; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/10/17 |
||||||
|
*/ |
||||||
|
@Configuration |
||||||
|
public class ScheduledConfig { |
||||||
|
|
||||||
|
@Bean |
||||||
|
public ScheduledTaskRegistrar scheduledTaskRegistrar(TaskScheduler taskScheduler) { |
||||||
|
ScheduledTaskRegistrar scheduledTaskRegistrar = new ScheduledTaskRegistrar(); |
||||||
|
scheduledTaskRegistrar.setTaskScheduler(taskScheduler); |
||||||
|
return scheduledTaskRegistrar; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,26 @@ |
|||||||
|
package com.biutag.supervision.config; |
||||||
|
|
||||||
|
import io.swagger.v3.oas.models.ExternalDocumentation; |
||||||
|
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.info.License; |
||||||
|
import org.springframework.context.annotation.Bean; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
|
||||||
|
@Configuration |
||||||
|
public class SwaggerConfig { |
||||||
|
|
||||||
|
@Bean |
||||||
|
public OpenAPI springShopOpenAPI() { |
||||||
|
return new OpenAPI() |
||||||
|
.info(new Info().title("长沙公安数字督察一体化平台接口文档") |
||||||
|
.contact(new Contact()) |
||||||
|
.description("长沙公安数字督察一体化平台接口文档") |
||||||
|
.version("v1") |
||||||
|
.license(new License().name("长沙市公安局").url(""))) |
||||||
|
.externalDocs(new ExternalDocumentation() |
||||||
|
.description("接口文档")); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,32 @@ |
|||||||
|
package com.biutag.supervision.constants; |
||||||
|
|
||||||
|
public class AppConstants { |
||||||
|
|
||||||
|
public static final Integer TREE_ROOT_ID = 0; |
||||||
|
|
||||||
|
// 单位
|
||||||
|
public static final String DICT_CONTENT_ROOT_PARENT_CODE = "-1"; |
||||||
|
|
||||||
|
public static final String DICT_PROBLEM_SOURCE_ROOT_PARENT_CODE = "-1"; |
||||||
|
|
||||||
|
// 管理员类型类型(超级管理员)
|
||||||
|
public static final String USER_TYPE_SUPER = "super"; |
||||||
|
|
||||||
|
|
||||||
|
// 单位
|
||||||
|
public static final String DEPART_ROOT_PID = "0"; |
||||||
|
|
||||||
|
|
||||||
|
// 单位根节点ID(长沙市公安局)
|
||||||
|
public static final String ROOT_DEPART_ID = "12630"; |
||||||
|
|
||||||
|
public static final String ROOT_DEPART_NAME = "长沙市公安局"; |
||||||
|
|
||||||
|
|
||||||
|
public static final String SIGN_RETURN_ACTION_NAME = "已退回"; |
||||||
|
|
||||||
|
public static final String UN_DEL = "0"; |
||||||
|
|
||||||
|
public static final String DEL = "1"; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,6 @@ |
|||||||
|
package com.biutag.supervision.constants; |
||||||
|
|
||||||
|
public class RedisKeyConstants { |
||||||
|
|
||||||
|
public final static String LOGIN_USERINFO_KEY = "login:userinfo:%s"; |
||||||
|
} |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
package com.biutag.supervision.constants; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Auther: sh |
||||||
|
* @Date: 2025/1/14 10:27 |
||||||
|
* @Description: 动作动态常量 |
||||||
|
*/ |
||||||
|
public class WorkDynamicConstants { |
||||||
|
public static final String DCGZDT = "督察工作动态"; |
||||||
|
public static final String SJGZDT = "审计工作动态"; |
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,32 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/11/28 |
||||||
|
*/ |
||||||
|
@AllArgsConstructor |
||||||
|
public enum AccountabilityTargetEnum { |
||||||
|
|
||||||
|
PERSONAL("1", "涉及个人"), |
||||||
|
DEPARTMENT("2", "涉及单位"), |
||||||
|
PERSONAL_AND_DEPARTMENT("3", "涉及个人及单位"); |
||||||
|
|
||||||
|
@Getter |
||||||
|
private String value; |
||||||
|
|
||||||
|
@Getter |
||||||
|
private String label; |
||||||
|
|
||||||
|
public static String getLabel(String value) { |
||||||
|
for (AccountabilityTargetEnum targetEnum : values()) { |
||||||
|
if (targetEnum.getValue().equals(value)) { |
||||||
|
return targetEnum.getLabel(); |
||||||
|
} |
||||||
|
} |
||||||
|
return ""; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,25 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
@Getter |
||||||
|
@AllArgsConstructor |
||||||
|
public enum ApprovalFlowEnum { |
||||||
|
|
||||||
|
// 二级审批 所队一>二级机构
|
||||||
|
SECOND_APPROVAL("2", "二级审批"), |
||||||
|
// 三级审批 所队一>二級机构一>市局
|
||||||
|
THREE_APPROVAL("3", "三级审批"); |
||||||
|
|
||||||
|
private String value; |
||||||
|
private String label; |
||||||
|
public static String getLabel(String value) { |
||||||
|
for (ApprovalFlowEnum flowEnum : values()) { |
||||||
|
if (flowEnum.getValue().equals(value)) { |
||||||
|
return flowEnum.getLabel(); |
||||||
|
} |
||||||
|
} |
||||||
|
return ""; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,7 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
public enum ApproveStateEnum { |
||||||
|
|
||||||
|
approved, |
||||||
|
rejected |
||||||
|
} |
||||||
@ -0,0 +1,10 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/11/28 |
||||||
|
*/ |
||||||
|
public enum BlameType { |
||||||
|
personal, |
||||||
|
department |
||||||
|
} |
||||||
@ -0,0 +1,49 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
@AllArgsConstructor |
||||||
|
@Getter |
||||||
|
public enum BusinessTypeEnum { |
||||||
|
|
||||||
|
JCJ_110("110接处警", "1", "110"), |
||||||
|
JCJ_122("122接处警", "2", "122"), |
||||||
|
RJCKFW("人境窗口服务", "3", "RJ"), |
||||||
|
CJGFF("车驾管服务", "4", "CJG"), |
||||||
|
JJCF("交警执法", "5", "JJ"), |
||||||
|
ZFBA("执法办案", "6", "CF"), |
||||||
|
ZXGZ("专项工作", "7", "ZX"), |
||||||
|
ABWW("安保维稳", "8", "AB"), |
||||||
|
JAFK("治安防控", "9", "ZA"), |
||||||
|
XZGL("行政管理", "10", "XZ"), |
||||||
|
FFJC("服务基层", "11", "FF"), |
||||||
|
DWGL("队伍管理", "12", "DW"), |
||||||
|
JWBZ("警务保障", "14", "SJ"), |
||||||
|
QT("其他", "13", "QT"); |
||||||
|
|
||||||
|
private String label; |
||||||
|
|
||||||
|
private String value; |
||||||
|
|
||||||
|
private String key; |
||||||
|
|
||||||
|
public static BusinessTypeEnum get(String value) { |
||||||
|
for (BusinessTypeEnum businessTypeEnum : values()) { |
||||||
|
if (businessTypeEnum.value.equals(value)) { |
||||||
|
return businessTypeEnum; |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public static BusinessTypeEnum getByLabel(String label) { |
||||||
|
for (BusinessTypeEnum businessTypeEnum : values()) { |
||||||
|
if (businessTypeEnum.label.equals(label)) { |
||||||
|
return businessTypeEnum; |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/10/29 |
||||||
|
*/ |
||||||
|
@AllArgsConstructor |
||||||
|
public enum CaseVerifProblemNatureEnum { |
||||||
|
|
||||||
|
ZFBA("执法办案"), |
||||||
|
FWGL("服务管理"), |
||||||
|
JJJG("警纪警规"); |
||||||
|
|
||||||
|
@Getter |
||||||
|
private String laebl; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,11 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2025/1/8 |
||||||
|
*/ |
||||||
|
public enum CaseVerifSource { |
||||||
|
|
||||||
|
excel_import, |
||||||
|
plugin |
||||||
|
} |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2025/2/11 |
||||||
|
*/ |
||||||
|
public enum ComfortStatus { |
||||||
|
|
||||||
|
approval, |
||||||
|
// 已退回
|
||||||
|
returned, |
||||||
|
|
||||||
|
// 待呈报
|
||||||
|
to_be_reported, |
||||||
|
completed |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,11 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/11/26 |
||||||
|
*/ |
||||||
|
public enum CountersignState { |
||||||
|
|
||||||
|
uncompleted, |
||||||
|
completed |
||||||
|
} |
||||||
@ -0,0 +1,9 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
public enum DataUpdateMethodEnum { |
||||||
|
|
||||||
|
// 增量更新
|
||||||
|
incremental, |
||||||
|
// 覆盖更新
|
||||||
|
overwrite |
||||||
|
} |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/10/29 |
||||||
|
*/ |
||||||
|
@AllArgsConstructor |
||||||
|
@Getter |
||||||
|
public enum DepartGroupEnum { |
||||||
|
|
||||||
|
COUNTY_CITY_BUREAUS(3, "分县市局"), |
||||||
|
BUREAU_AFFILIATED(4, "局属单位"); |
||||||
|
|
||||||
|
private Integer id; |
||||||
|
|
||||||
|
private String label; |
||||||
|
} |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2025/3/6 |
||||||
|
*/ |
||||||
|
@AllArgsConstructor |
||||||
|
public enum DepartGroupIdEnum { |
||||||
|
|
||||||
|
COUNTY_AND_CITY_BUREAUS("3"); |
||||||
|
|
||||||
|
@Getter |
||||||
|
private String value; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
@AllArgsConstructor |
||||||
|
@Getter |
||||||
|
public enum DepartLevelEnum { |
||||||
|
|
||||||
|
FIRST(0), |
||||||
|
SECOND_CATEGORY(1), |
||||||
|
SECOND(2), |
||||||
|
THREE(3); |
||||||
|
|
||||||
|
private Integer value; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,10 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/10/17 |
||||||
|
*/ |
||||||
|
public enum DistributionCycleEnum { |
||||||
|
day, |
||||||
|
weekly |
||||||
|
} |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/10/17 |
||||||
|
*/ |
||||||
|
@AllArgsConstructor |
||||||
|
@Getter |
||||||
|
public enum DistributionFlowEnum { |
||||||
|
|
||||||
|
SECOND("2"), |
||||||
|
THIRD("3"); |
||||||
|
private String value; |
||||||
|
} |
||||||
@ -0,0 +1,23 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/10/17 |
||||||
|
*/ |
||||||
|
@AllArgsConstructor |
||||||
|
@Getter |
||||||
|
public enum DistributionMethodEnum { |
||||||
|
|
||||||
|
// 问题下发
|
||||||
|
NEGATIVE_DISTRIBUTE("1"), |
||||||
|
// 数据保存
|
||||||
|
DATA_SAVE("2"), |
||||||
|
// 预警通知
|
||||||
|
WARNING_NOTIFICATION("3"); |
||||||
|
|
||||||
|
private String value; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,22 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/10/17 |
||||||
|
*/ |
||||||
|
@AllArgsConstructor |
||||||
|
public enum DistributionStateEnum { |
||||||
|
|
||||||
|
// 未分发
|
||||||
|
UNDISTRIBUTED("0"), |
||||||
|
// 已分发
|
||||||
|
DISTRIBUTED("1"), |
||||||
|
// 已处置
|
||||||
|
HANDLED("2"); |
||||||
|
|
||||||
|
@Getter |
||||||
|
private String value; |
||||||
|
} |
||||||
@ -0,0 +1,19 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
@AllArgsConstructor |
||||||
|
public enum FlowActionEnum { |
||||||
|
|
||||||
|
FIRST_DISTRIBUTE("first_distribute", "已下发"), |
||||||
|
SECOND_APPROVE("second_approve", "已审批"), |
||||||
|
FIRST_APPROVE("first_approve", "已审批"); |
||||||
|
|
||||||
|
@Getter |
||||||
|
private String key; |
||||||
|
|
||||||
|
@Getter |
||||||
|
private String name; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,42 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@AllArgsConstructor |
||||||
|
@Getter |
||||||
|
public enum FlowNodeEnum { |
||||||
|
|
||||||
|
FIRST_DISTRIBUTE("first_distribute"), |
||||||
|
SECOND_SIGN("second_sign"), |
||||||
|
SECOND_DISTRIBUTE("second_distribute"), |
||||||
|
THREE_SIGN("three_sign"), |
||||||
|
VERIFY("verify"), |
||||||
|
SECOND_APPROVE("second_approve"), |
||||||
|
FIRST_APPROVE("first_approve"), |
||||||
|
SECOND_EXTENSION_APPROVE("second_extension_approve"), |
||||||
|
FIRST_EXTENSION_APPROVE("first_extension_approve"), |
||||||
|
COUNTERSIGN("countersign"), |
||||||
|
COMPLETED("completed"); |
||||||
|
|
||||||
|
private String key; |
||||||
|
|
||||||
|
public static List<String> getSignFlowKeys() { |
||||||
|
return List.of(FIRST_DISTRIBUTE.getKey(), SECOND_SIGN.getKey(), SECOND_DISTRIBUTE.getKey(), THREE_SIGN.getKey()); |
||||||
|
} |
||||||
|
|
||||||
|
public static boolean isSignFlow(String flowKey) { |
||||||
|
return getSignFlowKeys().contains(flowKey); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 办结审批 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static List<String> getApproveFlowKeys() { |
||||||
|
return List.of(FIRST_DISTRIBUTE.getKey(), SECOND_SIGN.getKey(), SECOND_DISTRIBUTE.getKey(), THREE_SIGN.getKey()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,24 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
@Getter |
||||||
|
@AllArgsConstructor |
||||||
|
public enum HostLevelEnums { |
||||||
|
|
||||||
|
FIRST("1", "市局主办"), |
||||||
|
SECOND("2", "二级机构主办"), |
||||||
|
THREE("3", "三级机构主办"); |
||||||
|
|
||||||
|
private String value; |
||||||
|
private String label; |
||||||
|
public static String getLabel(String value) { |
||||||
|
for (HostLevelEnums hostLevelEnums : values()) { |
||||||
|
if (hostLevelEnums.getValue().equals(value)) { |
||||||
|
return hostLevelEnums.getLabel(); |
||||||
|
} |
||||||
|
} |
||||||
|
return ""; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,38 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author wxc |
||||||
|
* @date 2024/10/22 |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
@AllArgsConstructor |
||||||
|
public enum InitialPetition { |
||||||
|
|
||||||
|
THE_FIRST("1", "初访"), |
||||||
|
|
||||||
|
REPEAT("2", "重访"); |
||||||
|
|
||||||
|
private String value; |
||||||
|
|
||||||
|
public String label; |
||||||
|
|
||||||
|
public static String getValue(String str) { |
||||||
|
if ("初".equals(str)) { |
||||||
|
return THE_FIRST.getValue(); |
||||||
|
} |
||||||
|
if ("重".equals(str)) { |
||||||
|
return REPEAT.getValue(); |
||||||
|
} |
||||||
|
for (InitialPetition value : values()) { |
||||||
|
if (value.getLabel().equals(str)) { |
||||||
|
return value.getValue(); |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,26 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
@Getter |
||||||
|
@AllArgsConstructor |
||||||
|
public enum InspectCaseEnum { |
||||||
|
|
||||||
|
// 属实
|
||||||
|
TRUE("1", "属实"), |
||||||
|
// 部分属实
|
||||||
|
PARTIALLY_TRUE("2", "部分属实"), |
||||||
|
// 不属实
|
||||||
|
FALSE("3", "不属实"); |
||||||
|
|
||||||
|
private String value; |
||||||
|
|
||||||
|
private String label; |
||||||
|
|
||||||
|
public static boolean isItTure(String value) { |
||||||
|
return TRUE.getValue().equals(value) || PARTIALLY_TRUE.getValue().equals(value); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,21 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/12/4 |
||||||
|
*/ |
||||||
|
@AllArgsConstructor |
||||||
|
public enum InvolveProblemEnum { |
||||||
|
// 自动回访不满意
|
||||||
|
ZDHFBMY("1", "自动回访不满意"); |
||||||
|
|
||||||
|
|
||||||
|
@Getter |
||||||
|
private String value; |
||||||
|
|
||||||
|
private String laebl; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,16 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
// 是否整改
|
||||||
|
@AllArgsConstructor |
||||||
|
@Getter |
||||||
|
public enum IsRectifyEnum { |
||||||
|
|
||||||
|
NOT("0"), |
||||||
|
YES("1"); |
||||||
|
|
||||||
|
private String value; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,25 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
@Getter |
||||||
|
@AllArgsConstructor |
||||||
|
public enum MailTrendSourcesEnum { |
||||||
|
ONE(1, 21), |
||||||
|
TWO(2, 22), |
||||||
|
THREE(3, 23), |
||||||
|
FOUR(4, 24); |
||||||
|
|
||||||
|
private final int code; // 前端传来的code
|
||||||
|
private final int mappedCode; // 后端需要用到的code
|
||||||
|
|
||||||
|
public static int getMappedCodeByCode(int code) { |
||||||
|
for (MailTrendSourcesEnum value : MailTrendSourcesEnum.values()) { |
||||||
|
if (value.code == code) { |
||||||
|
return value.getMappedCode(); |
||||||
|
} |
||||||
|
} |
||||||
|
throw new IllegalArgumentException("Invalid sourcesCode: " + code); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
|
||||||
|
@AllArgsConstructor |
||||||
|
public enum MenuEnum { |
||||||
|
|
||||||
|
CATALOGUE("M"), |
||||||
|
MENU("C"), |
||||||
|
BUTTON("A"); |
||||||
|
|
||||||
|
private String value; |
||||||
|
|
||||||
|
public String value() { |
||||||
|
return value; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2025/3/7 |
||||||
|
*/ |
||||||
|
@AllArgsConstructor |
||||||
|
public enum ModelDataTypeEnum { |
||||||
|
|
||||||
|
// 预警问题
|
||||||
|
YJWT("1"), |
||||||
|
// 提醒通知
|
||||||
|
TXTZ("2"); |
||||||
|
|
||||||
|
@Getter |
||||||
|
private String value; |
||||||
|
} |
||||||
@ -0,0 +1,21 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2025/3/7 |
||||||
|
* 办理单位类型 |
||||||
|
*/ |
||||||
|
@AllArgsConstructor |
||||||
|
public enum ModelHandleDepartTypeEnum { |
||||||
|
|
||||||
|
// 涉及单位
|
||||||
|
SJDW("1"), |
||||||
|
// 指定单位
|
||||||
|
ZDDW("2"); |
||||||
|
|
||||||
|
@Getter |
||||||
|
private String value; |
||||||
|
} |
||||||
@ -0,0 +1,22 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/12/12 |
||||||
|
*/ |
||||||
|
@AllArgsConstructor |
||||||
|
public enum ModelTypeEnum { |
||||||
|
|
||||||
|
// 内部监督
|
||||||
|
NBJD("1"), |
||||||
|
|
||||||
|
// 个人极端
|
||||||
|
GRJD("2"); |
||||||
|
|
||||||
|
@Getter |
||||||
|
private String value; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,34 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/11/8 |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
@AllArgsConstructor |
||||||
|
public enum NegativeLevelEnum { |
||||||
|
|
||||||
|
GENERAL_IMPACT("一般影响", "1", 0.0), |
||||||
|
SERIOUS_IMPACT("严重影响", "2", 0.2), |
||||||
|
|
||||||
|
SIGNIFICANT_IMPACT("重大影响", "3", 0.5); |
||||||
|
|
||||||
|
private String lable; |
||||||
|
|
||||||
|
private String value; |
||||||
|
|
||||||
|
private Double score; |
||||||
|
|
||||||
|
public static Double getScore(String value) { |
||||||
|
for (NegativeLevelEnum negativeLevelEnum : values()) { |
||||||
|
if (negativeLevelEnum.value.equals(value)) { |
||||||
|
return negativeLevelEnum.score; |
||||||
|
} |
||||||
|
} |
||||||
|
return 0.0; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,21 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
@AllArgsConstructor |
||||||
|
public enum NegativeTaskCategoryEnum { |
||||||
|
|
||||||
|
// 批量导入
|
||||||
|
BATCH_IMPORT("0"), |
||||||
|
|
||||||
|
// 导入记录
|
||||||
|
IMPORT("1"), |
||||||
|
|
||||||
|
// 导出记录
|
||||||
|
EXPORT("2"); |
||||||
|
|
||||||
|
@Getter |
||||||
|
private String value; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,14 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
@AllArgsConstructor |
||||||
|
public enum NegativeTaskStatusEnum { |
||||||
|
SUCCESS("0"), |
||||||
|
FAIL("1"), |
||||||
|
PADDING("2"); |
||||||
|
|
||||||
|
@Getter |
||||||
|
private String value; |
||||||
|
} |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/11/8 |
||||||
|
*/ |
||||||
|
public enum OrderEnum { |
||||||
|
// 正序
|
||||||
|
ascending, |
||||||
|
// 倒叙
|
||||||
|
descending |
||||||
|
} |
||||||
@ -0,0 +1,55 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/11/1 |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
@AllArgsConstructor |
||||||
|
public enum PersonTypeEnum { |
||||||
|
|
||||||
|
police("1", "民警"), |
||||||
|
works("2", "职工"), |
||||||
|
aux("3", "辅警"), |
||||||
|
clerk("4", "文员"), |
||||||
|
xj("5", "协警"); |
||||||
|
private String value; |
||||||
|
private String label; |
||||||
|
|
||||||
|
public static List<String> getAuxPersonType() { |
||||||
|
return List.of(works.getValue(), aux.getValue(), clerk.getValue(), xj.getValue()); |
||||||
|
} |
||||||
|
|
||||||
|
public static PersonTypeEnum get(String value) { |
||||||
|
for (PersonTypeEnum personTypeEnum : values()) { |
||||||
|
if (personTypeEnum.getValue().equals(value)) { |
||||||
|
return personTypeEnum; |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public static PersonTypeEnum getByLabel(String value) { |
||||||
|
for (PersonTypeEnum personTypeEnum : values()) { |
||||||
|
if (personTypeEnum.getLabel().equals(value)) { |
||||||
|
return personTypeEnum; |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public static String getLabel(String value) { |
||||||
|
PersonTypeEnum personTypeEnum = get(value); |
||||||
|
if (Objects.isNull(personTypeEnum)) { |
||||||
|
return null; |
||||||
|
} |
||||||
|
return personTypeEnum.getLabel(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,37 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/12/26 |
||||||
|
*/ |
||||||
|
@AllArgsConstructor |
||||||
|
@Getter |
||||||
|
public enum PoliceTypeEnum { |
||||||
|
|
||||||
|
JL("警令", "1"), |
||||||
|
ZG("政工", "2"), |
||||||
|
JB("警保", "3"), |
||||||
|
ZJJC("纪检监察", "4"), |
||||||
|
JGDW("机关党委", "5"), |
||||||
|
JGJW("机关纪委", "6"), |
||||||
|
LDZX("六大中心", "7"), |
||||||
|
JX("警校", "8"), |
||||||
|
XZ("刑侦", "9"), |
||||||
|
ZA("治安", "10"); |
||||||
|
|
||||||
|
|
||||||
|
private String label; |
||||||
|
private String value; |
||||||
|
|
||||||
|
public static PoliceTypeEnum getByLabel(String label) { |
||||||
|
for (PoliceTypeEnum problemSourcesEnum : values()) { |
||||||
|
if (problemSourcesEnum.label.equals(label)) { |
||||||
|
return problemSourcesEnum; |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,59 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
@Getter |
||||||
|
@AllArgsConstructor |
||||||
|
public enum ProblemSourcesEnum { |
||||||
|
|
||||||
|
XCDC("现场督察", "13"), |
||||||
|
LMGZ("灵敏感知", "14"), |
||||||
|
ZXDC("专项督察", "15"), |
||||||
|
SPDC("视频督察", "16"), |
||||||
|
|
||||||
|
A12389("12389", "17"), |
||||||
|
SLDJB("市局领导交办", "18"), |
||||||
|
ZDDJB("支队领导交办", "19"), |
||||||
|
SJJB("上级交办", "20"), |
||||||
|
|
||||||
|
GJXFPT("国家信访平台", "21"), |
||||||
|
GABXF("公安部信访", "22"), |
||||||
|
JZXX("局长信箱", "23"), |
||||||
|
XF12337("12337信访", "24"), |
||||||
|
XF_QT("信访投诉/其他", "25"), |
||||||
|
|
||||||
|
SJJD("审计监督", "26"), |
||||||
|
ZFTZSJ("政府投资审计", "27"), |
||||||
|
ZFSACFSS("执法活动财物审计", "28"), |
||||||
|
JJZRSJ("经济责任审计", "29"), |
||||||
|
ZXSJ("专项审计", "30"), |
||||||
|
|
||||||
|
JWDC("民意感知", "2"), |
||||||
|
JYDC("警意调查", "3"), |
||||||
|
CFJD("持法监督", "4"), |
||||||
|
JCKH("检查考核", "8"), |
||||||
|
QT("其他", "9"); |
||||||
|
|
||||||
|
private String label; |
||||||
|
|
||||||
|
private String value; |
||||||
|
|
||||||
|
public static ProblemSourcesEnum get(String value) { |
||||||
|
for (ProblemSourcesEnum problemSourcesEnum : values()) { |
||||||
|
if (problemSourcesEnum.value.equals(value)) { |
||||||
|
return problemSourcesEnum; |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public static ProblemSourcesEnum getByLabel(String label) { |
||||||
|
for (ProblemSourcesEnum problemSourcesEnum : values()) { |
||||||
|
if (problemSourcesEnum.label.equals(label)) { |
||||||
|
return problemSourcesEnum; |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,26 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
@AllArgsConstructor |
||||||
|
public enum ProcessingStatusEnum { |
||||||
|
|
||||||
|
signing("签收中"), |
||||||
|
processing("办理中"), |
||||||
|
approval("审批中"), |
||||||
|
completed("已办结"); |
||||||
|
|
||||||
|
@Getter |
||||||
|
private String label; |
||||||
|
|
||||||
|
public static String getLabel(String name) { |
||||||
|
for (ProcessingStatusEnum value : values()) { |
||||||
|
if (value.name().equals(name)) { |
||||||
|
return value.getLabel(); |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,21 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
@AllArgsConstructor |
||||||
|
@Getter |
||||||
|
public enum RepeatEnum { |
||||||
|
|
||||||
|
FIRST_MAIL(1, "初访信件"), |
||||||
|
REPEAT_MAIL(2, "重访信件"); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private Integer id; |
||||||
|
|
||||||
|
private String label; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/12/7 |
||||||
|
*/ |
||||||
|
@AllArgsConstructor |
||||||
|
public enum ReplyStateEnum { |
||||||
|
|
||||||
|
UN_REPLIED("0"), |
||||||
|
REPLIED("1"); |
||||||
|
|
||||||
|
@Getter |
||||||
|
private String value; |
||||||
|
} |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
@AllArgsConstructor |
||||||
|
@Getter |
||||||
|
public enum RoleCodeEnum { |
||||||
|
|
||||||
|
ADMIN("admin"), |
||||||
|
FIRST_ADMIN("admin_1"), |
||||||
|
SECOND_ADMIN("admin_1_1_1_2"), |
||||||
|
THREE_ADMIN("admin_1_1_1_3"); |
||||||
|
|
||||||
|
private String code; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,25 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2025/2/7 |
||||||
|
*/ |
||||||
|
@AllArgsConstructor |
||||||
|
public enum RpcApplyTypeEnum { |
||||||
|
|
||||||
|
// 维权
|
||||||
|
RIGHTS_PROTECTION("1"), |
||||||
|
|
||||||
|
// 抚慰
|
||||||
|
COMFORT("2"), |
||||||
|
|
||||||
|
// 容错
|
||||||
|
FAULT_TOLERANT("3"); |
||||||
|
|
||||||
|
|
||||||
|
@Getter |
||||||
|
private String value; |
||||||
|
} |
||||||
@ -0,0 +1,19 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/12/24 |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
@AllArgsConstructor |
||||||
|
public enum SpecialSupervisionEnum { |
||||||
|
|
||||||
|
// 黄赌警情
|
||||||
|
HDJQ("1"); |
||||||
|
|
||||||
|
private String value; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
@Getter |
||||||
|
@AllArgsConstructor |
||||||
|
public enum StatusEnum { |
||||||
|
|
||||||
|
ENABLE("1"), |
||||||
|
DISABLE("0"); |
||||||
|
|
||||||
|
private String value; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,10 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2025/4/7 |
||||||
|
*/ |
||||||
|
public enum TaskStatusEnum { |
||||||
|
todo, |
||||||
|
done |
||||||
|
} |
||||||
@ -0,0 +1,23 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2025/4/7 |
||||||
|
*/ |
||||||
|
public enum TaskTypeEnum { |
||||||
|
|
||||||
|
// 测酒
|
||||||
|
testing_alcohol, |
||||||
|
|
||||||
|
// 督察任务
|
||||||
|
inspection, |
||||||
|
|
||||||
|
// 自查任务
|
||||||
|
selfexamination, |
||||||
|
|
||||||
|
risk_personal, |
||||||
|
|
||||||
|
// 问题随拍
|
||||||
|
problem_shooting |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,16 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
/** |
||||||
|
* 测酒状态 |
||||||
|
* @author wxc |
||||||
|
* @date 2025/4/7 |
||||||
|
*/ |
||||||
|
public enum TestingAlcoholStateEnum { |
||||||
|
|
||||||
|
// 未饮酒
|
||||||
|
not_drinking, |
||||||
|
|
||||||
|
// 已饮酒
|
||||||
|
drink |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,47 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
// 办理时限
|
||||||
|
@Getter |
||||||
|
@AllArgsConstructor |
||||||
|
public enum TimeLimitEnum { |
||||||
|
|
||||||
|
WORK_137("137工作制", "3+7", 1, 3, 7), |
||||||
|
WORK_177("177工作制", "7+7", 1, 7, 7), |
||||||
|
WORK_15_15("15+15工作制", "15+15", 1, 15, 15), |
||||||
|
WORK_30_30("30+30工作制", "30+30", 1, 30, 30), |
||||||
|
OTHER("其他", "other", null, null, null); |
||||||
|
|
||||||
|
private String label; |
||||||
|
|
||||||
|
private String value; |
||||||
|
|
||||||
|
// 签收时长(天)
|
||||||
|
private Integer maxSignDuration; |
||||||
|
|
||||||
|
// 办理时长(天)
|
||||||
|
private Integer maxHandleDuration; |
||||||
|
|
||||||
|
// 最大延期时长(天)
|
||||||
|
private Integer maxExtensionDuration; |
||||||
|
|
||||||
|
public static TimeLimitEnum get(String value) { |
||||||
|
for (TimeLimitEnum timeLimitEnum : values()) { |
||||||
|
if (timeLimitEnum.getValue().equals(value)) { |
||||||
|
return timeLimitEnum; |
||||||
|
} |
||||||
|
} |
||||||
|
throw new RuntimeException(String.format("办理时限字典[%s]未找到", value)); |
||||||
|
} |
||||||
|
|
||||||
|
public static String getLabel(String value) { |
||||||
|
try { |
||||||
|
return get(value).getLabel(); |
||||||
|
} catch (RuntimeException e) { |
||||||
|
return ""; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,29 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Auther: sh |
||||||
|
* @Date: 2024/11/16 19:34 |
||||||
|
* @Description: |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
@AllArgsConstructor |
||||||
|
public enum TrendEnum { |
||||||
|
|
||||||
|
|
||||||
|
DAY("日趋势", "1"), |
||||||
|
WEEK("周趋势", "2"), |
||||||
|
|
||||||
|
Month("月趋势", "3"); |
||||||
|
|
||||||
|
|
||||||
|
private String label; |
||||||
|
|
||||||
|
private String value; |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,7 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
public enum WorkStateEnum { |
||||||
|
|
||||||
|
todo, |
||||||
|
done |
||||||
|
} |
||||||
@ -0,0 +1,7 @@ |
|||||||
|
package com.biutag.supervision.constants.enums; |
||||||
|
|
||||||
|
public enum WorkStatusEnum { |
||||||
|
|
||||||
|
todo, |
||||||
|
done |
||||||
|
} |
||||||
@ -0,0 +1,73 @@ |
|||||||
|
package com.biutag.supervision.controller; |
||||||
|
|
||||||
|
import cn.hutool.http.HttpRequest; |
||||||
|
import cn.hutool.http.HttpResponse; |
||||||
|
import cn.hutool.http.Method; |
||||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.stereotype.Controller; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2025/4/18 |
||||||
|
*/ |
||||||
|
@Slf4j |
||||||
|
@RequestMapping("app") |
||||||
|
@Controller |
||||||
|
public class AppController { |
||||||
|
|
||||||
|
@Operation(summary = "数据入口") |
||||||
|
@ResponseBody |
||||||
|
@PostMapping("forward") |
||||||
|
public String forward(@RequestBody Request request) { |
||||||
|
log.info("APP 请求地址:{} 请求方式:{} 授权码:{}", request.getUrl(), request.getMethod(), request.getToken()); |
||||||
|
// if (Objects.nonNull(request.getBody())) {
|
||||||
|
// log.info("APP 请求参数:{}", request.getBody());
|
||||||
|
// }
|
||||||
|
HttpResponse httpResponse = HttpRequest.of(String.format("http://127.0.0.1:8080" + request.getUrl())) |
||||||
|
.method(getMethod(request.getMethod())) |
||||||
|
.auth(request.getToken()) |
||||||
|
.body(request.body) |
||||||
|
.execute(); |
||||||
|
return httpResponse.body(); |
||||||
|
} |
||||||
|
|
||||||
|
@Operation(summary = "文件预览") |
||||||
|
@GetMapping("file/stream/forward") |
||||||
|
public String fileSteamForward(String filepath) { |
||||||
|
log.info("APP 文件预览,文件路径:{}", filepath); |
||||||
|
return "forward:/file/stream" + filepath; |
||||||
|
} |
||||||
|
|
||||||
|
public Method getMethod(String method) { |
||||||
|
if ("GET".equals(method)) { |
||||||
|
return Method.GET; |
||||||
|
} |
||||||
|
if ("DELETE".equals(method)) { |
||||||
|
return Method.DELETE; |
||||||
|
} |
||||||
|
if ("PUT".equals(method)) { |
||||||
|
return Method.PUT; |
||||||
|
} |
||||||
|
return Method.POST; |
||||||
|
} |
||||||
|
|
||||||
|
@Setter |
||||||
|
@Getter |
||||||
|
public static class Request { |
||||||
|
|
||||||
|
private String url; |
||||||
|
|
||||||
|
private String method; |
||||||
|
|
||||||
|
private String token; |
||||||
|
|
||||||
|
private String body; |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,42 @@ |
|||||||
|
package com.biutag.supervision.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.biutag.supervision.common.UserContextHolder; |
||||||
|
import com.biutag.supervision.constants.AppConstants; |
||||||
|
import com.biutag.supervision.exception.AuthException; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.domain.Self; |
||||||
|
import com.biutag.supervision.pojo.entity.Menu; |
||||||
|
import com.biutag.supervision.pojo.model.UserAuth; |
||||||
|
import com.biutag.supervision.pojo.vo.MenuTree; |
||||||
|
import com.biutag.supervision.service.MenuService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
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 java.util.List; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("auth") |
||||||
|
@RestController |
||||||
|
public class AuthController { |
||||||
|
|
||||||
|
private final MenuService menuService; |
||||||
|
|
||||||
|
@GetMapping("self") |
||||||
|
public Result<Self> self() { |
||||||
|
String authorization = UserContextHolder.getCurrentToken(); |
||||||
|
if (StrUtil.isBlank(authorization)) { |
||||||
|
throw new AuthException(); |
||||||
|
} |
||||||
|
UserAuth user = UserContextHolder.getCurrentUser(); |
||||||
|
boolean superFlag = AppConstants.USER_TYPE_SUPER.equals(user.getUserType()); |
||||||
|
List<Menu> menus = superFlag ? menuService.listAll() : menuService.listMenuByCurrentUser(); |
||||||
|
List<String> perms = superFlag ? List.of("*") : menuService.listPermsByCurrentUser(); |
||||||
|
return Result.success(new Self().setUser(user).setMenus(MenuTree.buildTree(menus)).setPerms(perms)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,54 @@ |
|||||||
|
package com.biutag.supervision.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.biutag.supervision.common.UserContextHolder; |
||||||
|
import com.biutag.supervision.constants.AppConstants; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.entity.CommonOpinions; |
||||||
|
import com.biutag.supervision.pojo.model.UserAuth; |
||||||
|
import com.biutag.supervision.pojo.param.CommonOpinionsQueryParam; |
||||||
|
import com.biutag.supervision.service.CommonOpinionsService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@RequestMapping("commonOpinions") |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
public class CommonOpinionsControllers { |
||||||
|
|
||||||
|
private final CommonOpinionsService commonOpinionsService; |
||||||
|
|
||||||
|
@PostMapping |
||||||
|
public Result save(@RequestBody CommonOpinions commonOpinions){ |
||||||
|
UserAuth user = UserContextHolder.getCurrentUser(); |
||||||
|
|
||||||
|
commonOpinions.setCrtUser(user.getNickName()); |
||||||
|
commonOpinions.setCrtId(user.getUserName()); |
||||||
|
commonOpinions.setCrtTime(LocalDateTime.now()); |
||||||
|
commonOpinionsService.save(commonOpinions); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping |
||||||
|
public Result<List<CommonOpinions>> get(CommonOpinionsQueryParam queryParam){ |
||||||
|
UserAuth user = UserContextHolder.getCurrentUser(); |
||||||
|
List<CommonOpinions> commonOpinions= commonOpinionsService.list(new LambdaQueryWrapper<CommonOpinions>() |
||||||
|
.like(StrUtil.isNotBlank(queryParam.getContent()),CommonOpinions::getContent,queryParam.getContent() |
||||||
|
).eq(CommonOpinions::getCrtId,user.getUserName()).last("limit 100")); |
||||||
|
return Result.success(commonOpinions); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@DeleteMapping |
||||||
|
public Result del(@RequestBody CommonOpinions commonOpinions){ |
||||||
|
commonOpinionsService.remove(new LambdaQueryWrapper<CommonOpinions>().eq(CommonOpinions::getContent,commonOpinions.getContent())); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,91 @@ |
|||||||
|
package com.biutag.supervision.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.io.FileUtil; |
||||||
|
import cn.hutool.core.io.IoUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.biutag.supervision.mapper.FileBase64Mapper; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.dto.FileBase64Dto; |
||||||
|
import com.biutag.supervision.pojo.entity.FileBase64; |
||||||
|
import com.biutag.supervision.pojo.vo.FileVo; |
||||||
|
import com.biutag.supervision.service.FileService; |
||||||
|
import com.biutag.supervision.util.ImgUtils; |
||||||
|
import com.biutag.supervision.util.WordUtil; |
||||||
|
import jakarta.servlet.http.HttpServletRequest; |
||||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.stereotype.Controller; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
import org.springframework.web.multipart.MultipartFile; |
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream; |
||||||
|
import java.io.IOException; |
||||||
|
import java.io.InputStream; |
||||||
|
import java.util.Base64; |
||||||
|
import java.util.Objects; |
||||||
|
import java.util.Optional; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("file") |
||||||
|
@Controller |
||||||
|
public class FileController { |
||||||
|
|
||||||
|
private final FileService fileService; |
||||||
|
|
||||||
|
private final FileBase64Mapper fileBase64Mapper; |
||||||
|
|
||||||
|
@ResponseBody |
||||||
|
@PostMapping("upload") |
||||||
|
public Result<FileVo> upload(@RequestPart("file") MultipartFile file) throws IOException { |
||||||
|
log.info("文件上传 upload------------------------------"); |
||||||
|
String filePath = fileService.upload(file); |
||||||
|
return Result.success(new FileVo() |
||||||
|
.setFileName(file.getOriginalFilename()) |
||||||
|
.setFilePath(filePath)); |
||||||
|
} |
||||||
|
|
||||||
|
@ResponseBody |
||||||
|
@PostMapping("upload/base64") |
||||||
|
public Result<FileVo> upload(@RequestBody FileBase64Dto file) { |
||||||
|
log.info("文件BASE64上传 upload------------------------------"); |
||||||
|
return Result.success(new FileVo() |
||||||
|
.setFileName(file.getOriginalFilename()) |
||||||
|
.setFilePath(fileService.uploadBase64(file.getBase64(), file.getOriginalFilename()))); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("stream/**") |
||||||
|
public void download(HttpServletRequest request, HttpServletResponse response) throws IOException { |
||||||
|
String filePath = request.getRequestURI().substring(12); |
||||||
|
if (filePath.toLowerCase().endsWith(".pdf")) { |
||||||
|
response.setContentType("application/pdf"); |
||||||
|
} else { |
||||||
|
response.setContentType("application/octet-stream"); |
||||||
|
} |
||||||
|
InputStream is = fileService.download(filePath); |
||||||
|
if (filePath.toLowerCase().endsWith(".doc")) { |
||||||
|
is = WordUtil.convertDocx(is); |
||||||
|
} |
||||||
|
IoUtil.copy(is, response.getOutputStream()); |
||||||
|
} |
||||||
|
|
||||||
|
@ResponseBody |
||||||
|
@GetMapping("base64") |
||||||
|
public Result<String> getBase64(String filepath) throws IOException { |
||||||
|
if (StrUtil.isBlank(filepath)) { |
||||||
|
return Result.success(null); |
||||||
|
} |
||||||
|
FileBase64 fileBase64 = fileBase64Mapper.selectById(filepath); |
||||||
|
if (Objects.nonNull(fileBase64)) { |
||||||
|
return Result.success(fileBase64.getBase64()); |
||||||
|
} |
||||||
|
InputStream is = fileService.download(filepath); |
||||||
|
String base64 = Base64.getEncoder().encodeToString(is.readAllBytes()); |
||||||
|
if (ImgUtils.isImg(filepath)) { |
||||||
|
base64 = String.format("data:image/%s;base64,", FileUtil.extName(filepath).toLowerCase()) + base64; |
||||||
|
} |
||||||
|
return Result.success(base64); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,102 @@ |
|||||||
|
package com.biutag.supervision.controller; |
||||||
|
|
||||||
|
import cn.com.jit.JitAuthClient; |
||||||
|
import com.alibaba.fastjson2.JSON; |
||||||
|
import com.alibaba.fastjson2.JSONObject; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.domain.AppUser; |
||||||
|
import com.biutag.supervision.pojo.dto.AccountDto; |
||||||
|
import com.biutag.supervision.pojo.entity.BaseAccount; |
||||||
|
import com.biutag.supervision.pojo.entity.SupPolice; |
||||||
|
import com.biutag.supervision.pojo.vo.TokenVo; |
||||||
|
import com.biutag.supervision.service.BaseAccountService; |
||||||
|
import com.biutag.supervision.service.SupPoliceService; |
||||||
|
import com.biutag.supervision.service.UserLoginService; |
||||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.security.crypto.bcrypt.BCrypt; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@Tag(name = "登录接口") |
||||||
|
@Slf4j |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RestController |
||||||
|
public class LoginController { |
||||||
|
|
||||||
|
private final BaseAccountService accountService; |
||||||
|
|
||||||
|
private final UserLoginService userLoginService; |
||||||
|
|
||||||
|
private final SupPoliceService policeService; |
||||||
|
|
||||||
|
@Operation(summary = "登录") |
||||||
|
@PostMapping("login") |
||||||
|
public Result<TokenVo> login(@RequestBody AccountDto account) { |
||||||
|
List<BaseAccount> baseAccounts = accountService.getByLogin(account.getAccount()); |
||||||
|
if (baseAccounts.isEmpty()) { |
||||||
|
throw new RuntimeException("用户名或密码有误,请重新输入"); |
||||||
|
} |
||||||
|
BaseAccount baseAccount = baseAccounts.get(0); |
||||||
|
try { |
||||||
|
if (!BCrypt.checkpw(account.getPassword(), baseAccount.getPassword())) { |
||||||
|
throw new RuntimeException(); |
||||||
|
} |
||||||
|
} catch (RuntimeException e) { |
||||||
|
log.error(e.getMessage(), e); |
||||||
|
throw new RuntimeException("用户名或密码有误,请重新输入"); |
||||||
|
} |
||||||
|
String token = userLoginService.login(baseAccount.getAccount()); |
||||||
|
return Result.success(new TokenVo().setToken(token)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("logout") |
||||||
|
public Result<Void> logout() { |
||||||
|
userLoginService.logout(); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
@Operation(summary ="生成数字证书随机数") |
||||||
|
@GetMapping("jit/random") |
||||||
|
public Result<String> random() { |
||||||
|
String path = "/app/conf/jitMessage.properties"; |
||||||
|
JitAuthClient jitAuthClient = new JitAuthClient(path); |
||||||
|
String random = jitAuthClient.random(); |
||||||
|
return Result.success(random); |
||||||
|
} |
||||||
|
|
||||||
|
@Operation(summary ="数字证书登录") |
||||||
|
@PostMapping("jit/p7certAuth") |
||||||
|
public Result<TokenVo> p7certAuth(@RequestBody JSONObject body) { |
||||||
|
String path = "/app/conf/jitMessage.properties"; |
||||||
|
JitAuthClient jitAuthClient = new JitAuthClient(path); |
||||||
|
Map responseMap = jitAuthClient.authenP7(body.getString("random"), body.getString("signed_data"), ""); |
||||||
|
String responseStr = JSON.toJSONString(responseMap); |
||||||
|
log.info("返回的结果:{}", responseStr); |
||||||
|
JSONObject response = JSON.parseObject(responseStr); |
||||||
|
if (!response.getBoolean("isSuccess")) { |
||||||
|
throw new RuntimeException(response.getString("errDesc")); |
||||||
|
} |
||||||
|
String cerSubject = response.getJSONObject("certAttributeNodeMap").getString("_saml_cert_subject"); |
||||||
|
log.info("_saml_cert_subject:{}", cerSubject); |
||||||
|
String idCode = cerSubject.split(",")[0].split(" ")[1]; |
||||||
|
log.info("身份证:{}", idCode); |
||||||
|
String token = userLoginService.login(idCode); |
||||||
|
return Result.success(new TokenVo().setToken(token)); |
||||||
|
} |
||||||
|
|
||||||
|
@Operation(summary = "App登录") |
||||||
|
@PostMapping("app/login") |
||||||
|
public Result<AppUser> appLogin(String empNo) { |
||||||
|
SupPolice police = policeService.getByEmpNo(empNo); |
||||||
|
return Result.success(userLoginService.loginByApp(police.getIdCode())); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,54 @@ |
|||||||
|
package com.biutag.supervision.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.io.FileUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
||||||
|
import com.biutag.supervision.mapper.SupPoliceMapper; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.entity.SupPolice; |
||||||
|
import com.biutag.supervision.service.FileService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
import java.io.FileInputStream; |
||||||
|
import java.io.FileNotFoundException; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/12/24 |
||||||
|
*/ |
||||||
|
@RequestMapping("policeUpdateAvatar") |
||||||
|
@Slf4j |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RestController |
||||||
|
public class PoliceAvatarController { |
||||||
|
|
||||||
|
private final FileService fileService; |
||||||
|
|
||||||
|
private final SupPoliceMapper policeMapper; |
||||||
|
|
||||||
|
@RequestMapping |
||||||
|
public Result<String> update() throws FileNotFoundException { |
||||||
|
List<File> files = FileUtil.loopFiles("/work/POLICE"); |
||||||
|
for (File file : files) { |
||||||
|
try { |
||||||
|
String img = file.getPath().replace("/work/POLICE", ""); |
||||||
|
log.info(img); |
||||||
|
String idCode = policeMapper.getIdCodeByPoliceAvatar(img); |
||||||
|
if (StrUtil.isBlank(idCode) || !policeMapper.exists(new LambdaUpdateWrapper<SupPolice>().eq(SupPolice::getIdCode, idCode))) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
String filePath = fileService.upload(new FileInputStream(file), FileUtil.size(file), FileUtil.extName(file.getName())); |
||||||
|
policeMapper.update(new LambdaUpdateWrapper<SupPolice>().eq(SupPolice::getIdCode, idCode).set(SupPolice::getAvatarUrl, filePath)); |
||||||
|
log.info("{} 更新头像 {}", idCode, file.getName()); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage(), e); |
||||||
|
} |
||||||
|
} |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,129 @@ |
|||||||
|
package com.biutag.supervision.controller.invertRecord; |
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.biutag.supervision.common.UserContextHolder; |
||||||
|
import com.biutag.supervision.constants.AppConstants; |
||||||
|
import com.biutag.supervision.constants.enums.RoleCodeEnum; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.entity.InformMessage; |
||||||
|
import com.biutag.supervision.pojo.entity.InvertRecord; |
||||||
|
import com.biutag.supervision.pojo.entity.SupDepart; |
||||||
|
import com.biutag.supervision.pojo.entity.report.ReportProject; |
||||||
|
import com.biutag.supervision.pojo.entity.warning.WarningRecord; |
||||||
|
import com.biutag.supervision.pojo.model.UserAuth; |
||||||
|
import com.biutag.supervision.pojo.param.InvertRecord.InvertRecordQueryParam; |
||||||
|
import com.biutag.supervision.pojo.param.entryWindow.EntryWindowQueryParam; |
||||||
|
import com.biutag.supervision.pojo.vo.InvertRecord.InvertRecordVo; |
||||||
|
import com.biutag.supervision.pojo.vo.entryWindow.EntryWindowVo; |
||||||
|
import com.biutag.supervision.service.InformMessageService; |
||||||
|
import com.biutag.supervision.service.InvertRecord.InvertRecordService; |
||||||
|
import com.biutag.supervision.service.Report.ReportProjectService; |
||||||
|
import com.biutag.supervision.service.SupDepartService; |
||||||
|
import com.biutag.supervision.service.Warning.WarningRecordService; |
||||||
|
import com.biutag.supervision.util.BigDecimalUtils; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.transaction.annotation.Transactional; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.time.format.DateTimeFormatter; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
//预警项目相关接口
|
||||||
|
@RequiredArgsConstructor |
||||||
|
@RestController |
||||||
|
@RequestMapping("/invertRecor") |
||||||
|
public class invertRecordController { |
||||||
|
|
||||||
|
private final InvertRecordService invertRecordService; |
||||||
|
|
||||||
|
private final ReportProjectService projectService; |
||||||
|
|
||||||
|
private final WarningRecordService recordService; |
||||||
|
|
||||||
|
private final InformMessageService informMessageService; |
||||||
|
|
||||||
|
private final SupDepartService departService; |
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/page") |
||||||
|
public Result<Page<InvertRecordVo>> page(@RequestBody InvertRecordQueryParam query){ |
||||||
|
UserAuth user = UserContextHolder.getCurrentUser(); |
||||||
|
QueryWrapper<InvertRecord> wrapper=new QueryWrapper<>(); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 权限
|
||||||
|
if (!AppConstants.USER_TYPE_SUPER.equals(user.getUserType()) && !user.getRoleCodes().contains(RoleCodeEnum.FIRST_ADMIN.getCode())) { |
||||||
|
List<String> orgIds =new ArrayList<>(); |
||||||
|
// wrapper.in("r.applicant_id",user.getUserName());
|
||||||
|
if(!user.getAuthDepartIds().isEmpty()){ |
||||||
|
orgIds = departService.getAllNodeIds(user.getAuthDepartIds()); |
||||||
|
wrapper.in("r.project_unit_id", orgIds); |
||||||
|
}else{ |
||||||
|
orgIds = departService.getAllNodeIds(user.getDepartId()); |
||||||
|
wrapper.in("r.project_unit_id", orgIds); |
||||||
|
} |
||||||
|
// wrapper.in("r.project_unit_id", orgIds);
|
||||||
|
} |
||||||
|
if(StrUtil.isNotBlank(query.getName())){ |
||||||
|
wrapper.like(" r.report_name",query.getName()); |
||||||
|
} |
||||||
|
if(StrUtil.isNotBlank(query.getWarningState())){ |
||||||
|
wrapper.eq("i.warning_state",query.getWarningState()); |
||||||
|
} |
||||||
|
wrapper.orderByDesc("i.crt_time"); |
||||||
|
return Result.success(invertRecordService.queryPage(new Page<>(query.getCurrent(),query.getSize()),wrapper)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getDetail/{id}") |
||||||
|
public Result<InvertRecord> getDetail(@PathVariable("id")String id){ |
||||||
|
InvertRecord record = invertRecordService.getById(id); |
||||||
|
return Result.success(record); |
||||||
|
} |
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
@GetMapping("/upWarningStateById/{id}") |
||||||
|
public Result upWarningStateById(@PathVariable("id")String id){ |
||||||
|
UserAuth user = UserContextHolder.getCurrentUser(); |
||||||
|
InvertRecord record = invertRecordService.getById(id); |
||||||
|
LambdaUpdateWrapper<InvertRecord> updateWrapper=new LambdaUpdateWrapper<InvertRecord>(); |
||||||
|
updateWrapper.eq(InvertRecord::getId,id); |
||||||
|
if(record.getWarningState().equals("0")){ |
||||||
|
updateWrapper.set(InvertRecord::getWarningState,"1"); |
||||||
|
//发送通知
|
||||||
|
InvertRecord invertRecord = invertRecordService.getById(id); |
||||||
|
//获取项目信息
|
||||||
|
ReportProject project = projectService.getById(invertRecord.getReportId()); |
||||||
|
//获取预警监督人员
|
||||||
|
WarningRecord warningRecord = recordService.getById(invertRecord.getWarningId()); |
||||||
|
//格式化当前时间
|
||||||
|
LocalDateTime now = LocalDateTime.now(); |
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
||||||
|
String formattedDateTime = now.format(formatter); |
||||||
|
//初始化发送信息
|
||||||
|
InformMessage informMessage =new InformMessage(); |
||||||
|
informMessage.setNode("审计预警项目反馈"); |
||||||
|
String message = String.format("%s 于 %s 提交项目 %s",user.getNickName(),formattedDateTime,project.getReportName()); |
||||||
|
informMessage.setMessage(message); |
||||||
|
informMessage.setCrtUser(user.getNickName()); |
||||||
|
informMessage.setCrtUserId(user.getUserName()); |
||||||
|
informMessage.setCrtTime(LocalDateTime.now()); |
||||||
|
informMessage.setReportId(record.getReportId()); |
||||||
|
informMessage.setRecipient(warningRecord.getWarningSupervision()); |
||||||
|
informMessage.setRecipientId(warningRecord.getWarningSupervisionId()); |
||||||
|
informMessageService.save(informMessage); |
||||||
|
}else{ |
||||||
|
updateWrapper.set(InvertRecord::getWarningState,"0"); |
||||||
|
} |
||||||
|
invertRecordService.update(updateWrapper); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,137 @@ |
|||||||
|
package com.biutag.supervision.controller.price; |
||||||
|
|
||||||
|
import cn.hutool.core.io.FileUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.alibaba.excel.EasyExcel; |
||||||
|
import com.alibaba.excel.ExcelReader; |
||||||
|
import com.alibaba.excel.context.AnalysisContext; |
||||||
|
import com.alibaba.excel.read.listener.ReadListener; |
||||||
|
import com.alibaba.excel.read.metadata.ReadSheet; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.biutag.supervision.common.UserContextHolder; |
||||||
|
import com.biutag.supervision.constants.AppConstants; |
||||||
|
import com.biutag.supervision.constants.enums.RoleCodeEnum; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.entity.price.PriceFile; |
||||||
|
import com.biutag.supervision.pojo.entity.price.PriceInformation; |
||||||
|
import com.biutag.supervision.pojo.model.UserAuth; |
||||||
|
import com.biutag.supervision.pojo.param.Price.PriceInformationQueryParam; |
||||||
|
import com.biutag.supervision.pojo.vo.excel.ExcelPriceInformation; |
||||||
|
import com.biutag.supervision.pojo.vo.price.PriceInformationVo; |
||||||
|
import com.biutag.supervision.service.FileService; |
||||||
|
import com.biutag.supervision.service.Price.PriceFileService; |
||||||
|
import com.biutag.supervision.service.Price.PriceInformationService; |
||||||
|
import com.biutag.supervision.service.SupDepartService; |
||||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.transaction.annotation.Transactional; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
import org.springframework.web.multipart.MultipartFile; |
||||||
|
|
||||||
|
import java.io.IOException; |
||||||
|
import java.net.URLEncoder; |
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author weipeng |
||||||
|
*/ |
||||||
|
@Slf4j |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RestController |
||||||
|
@RequestMapping("/price") |
||||||
|
public class PriceInformationController { |
||||||
|
|
||||||
|
private final PriceInformationService service; |
||||||
|
private final FileService fileService; |
||||||
|
private final PriceFileService priceFileService; |
||||||
|
private final SupDepartService departService; |
||||||
|
|
||||||
|
@GetMapping |
||||||
|
public Result<Page<PriceInformationVo>> getPage(PriceInformationQueryParam queryParam){ |
||||||
|
UserAuth user = UserContextHolder.getCurrentUser(); |
||||||
|
QueryWrapper<PriceInformation> queryWrapper=new QueryWrapper<>(); |
||||||
|
if (!AppConstants.USER_TYPE_SUPER.equals(user.getUserType()) && !user.getRoleCodes().contains(RoleCodeEnum.FIRST_ADMIN.getCode())) { |
||||||
|
|
||||||
|
// wrapper.in("r.applicant_id",user.getUserName());
|
||||||
|
List<String> orgIds = departService.getAllNodeIds(user.getAuthDepartIds()); |
||||||
|
queryWrapper.in("pi.create_depart", orgIds); |
||||||
|
} |
||||||
|
queryWrapper.like(StrUtil.isNotBlank(queryParam.getContent()),"pi.information",queryParam.getContent()); |
||||||
|
return Result.success(service.queryPage(new Page<>(queryParam.getCurrent(),queryParam.getSize()),queryWrapper)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("/upData") |
||||||
|
public Result upData(@RequestBody PriceInformation information){ |
||||||
|
information.setInformationData(); |
||||||
|
if(service.updateById(information)){ |
||||||
|
return Result.success(); |
||||||
|
}else{ |
||||||
|
return Result.failed("操作失败"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("/{id}") |
||||||
|
public Result delById(@PathVariable("id") String id){ |
||||||
|
if(service.removeById(id)){ |
||||||
|
return Result.success(); |
||||||
|
}else{ |
||||||
|
return Result.failed("删除失败"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
@PostMapping("/import") |
||||||
|
public Result<List<PriceInformation>> importExcel(@RequestPart("file") MultipartFile file) throws IOException { |
||||||
|
log.info("文件导入中------------------------------"); |
||||||
|
|
||||||
|
UserAuth user = UserContextHolder.getCurrentUser(); |
||||||
|
String filePath = fileService.upload(file); |
||||||
|
String fileNameType = FileUtil.extName(file.getOriginalFilename()); |
||||||
|
PriceFile priceFile =new PriceFile(); |
||||||
|
priceFile.setFilePath(filePath); |
||||||
|
priceFile.setFileName(file.getOriginalFilename()); |
||||||
|
priceFile.setCreTime(LocalDateTime.now()); |
||||||
|
priceFile.setCreUser(user.getNickName()); |
||||||
|
priceFileService.save(priceFile); |
||||||
|
if (!"xls".equals(fileNameType) && !"xlsx".equals(fileNameType)) { |
||||||
|
throw new RuntimeException("仅支持 xls/xlsx 格式文件的导入"); |
||||||
|
} |
||||||
|
List<PriceInformation> list = new ArrayList<>(); |
||||||
|
ExcelReader excelReader = EasyExcel.read(file.getInputStream(), PriceInformation.class, new ReadListener<PriceInformation>() { |
||||||
|
@Override |
||||||
|
public void invoke(PriceInformation data, AnalysisContext analysisContext) { |
||||||
|
data.setFileId(priceFile.getId()); |
||||||
|
data.setCreateDepart(user.getDepartId()); |
||||||
|
data.setInformationData(); |
||||||
|
list.add(data); |
||||||
|
} |
||||||
|
@Override |
||||||
|
public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
||||||
|
} |
||||||
|
}).build(); |
||||||
|
ReadSheet sheet = EasyExcel.readSheet(0).headRowNumber(2).build(); |
||||||
|
excelReader.read(sheet); |
||||||
|
excelReader.close(); |
||||||
|
service.saveBatch(list); |
||||||
|
return Result.success(list); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/export") |
||||||
|
public void export(PriceInformationQueryParam queryParam, HttpServletResponse response) throws IOException{ |
||||||
|
queryParam.setCurrent(1); |
||||||
|
queryParam.setSize(100000); |
||||||
|
QueryWrapper<PriceInformation> queryWrapper=new QueryWrapper<>(); |
||||||
|
queryWrapper.eq(StrUtil.isNotBlank(queryParam.getContent()),"pi.information",queryParam.getContent()); |
||||||
|
Page<PriceInformationVo> page = service.queryPage(new Page<>(queryParam.getCurrent(),queryParam.getSize()),queryWrapper); |
||||||
|
List<PriceInformationVo> list = page.getRecords(); |
||||||
|
String headerValue = "attachment; filename=\"" + URLEncoder.encode("价格库信息.xlsx", "UTF-8") + "\""; |
||||||
|
response.setHeader("Content-Disposition", headerValue); |
||||||
|
response.setContentType("application/octet-stream"); |
||||||
|
EasyExcel.write(response.getOutputStream(), ExcelPriceInformation.class).inMemory(Boolean.TRUE).sheet("禁闭台帐").doWrite(list); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,80 @@ |
|||||||
|
package com.biutag.supervision.controller.report; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.entity.InformMessage; |
||||||
|
import com.biutag.supervision.pojo.param.ApprovalFlowQueryParam; |
||||||
|
import com.biutag.supervision.pojo.param.Report.FlowQueryParam; |
||||||
|
import com.biutag.supervision.service.InformMessageService; |
||||||
|
import com.biutag.supervision.service.Report.ReportFlowService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@RequiredArgsConstructor |
||||||
|
@RestController |
||||||
|
@RequestMapping("/reportFlow") |
||||||
|
public class ReportFlowController { |
||||||
|
|
||||||
|
private final ReportFlowService flowService; |
||||||
|
|
||||||
|
private final InformMessageService messageService; |
||||||
|
|
||||||
|
/** |
||||||
|
*审核 |
||||||
|
* */ |
||||||
|
@PostMapping("/audit") |
||||||
|
public Result audit(@RequestBody FlowQueryParam queryParam){ |
||||||
|
if(flowService.upFlowState(queryParam)){ |
||||||
|
return Result.success(); |
||||||
|
}else { |
||||||
|
return Result.failed("操作失败"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 审核(预警) |
||||||
|
* */ |
||||||
|
@PostMapping("/auditWarning") |
||||||
|
public Result auditWarning(@RequestBody FlowQueryParam queryParam){ |
||||||
|
if(flowService.upFlowWarning(queryParam)){ |
||||||
|
return Result.success(); |
||||||
|
}else{ |
||||||
|
return Result.failed("操作失败"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 审核(通知单位) |
||||||
|
* */ |
||||||
|
@PostMapping("/auditWarningInform") |
||||||
|
public Result auditWarningInform(@RequestBody FlowQueryParam queryParam){ |
||||||
|
if(flowService.upFlowWarningInform(queryParam)){ |
||||||
|
return Result.success(); |
||||||
|
}else{ |
||||||
|
return Result.failed("操作失败"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/getApprovalFlow") |
||||||
|
public Result getApprovalFlow(@RequestBody ApprovalFlowQueryParam param){ |
||||||
|
return Result.success(flowService.getFlowDta(param)); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 获取进退窗记录 |
||||||
|
* */ |
||||||
|
@PostMapping("/getEntryWindowRecord") |
||||||
|
public Result getEntryWindowRecord(@RequestBody ApprovalFlowQueryParam param){ |
||||||
|
List<String> nodes = new ArrayList<>(); |
||||||
|
nodes.add("进窗"); |
||||||
|
nodes.add("退窗"); |
||||||
|
LambdaQueryWrapper<InformMessage> messages = new LambdaQueryWrapper<InformMessage>(); |
||||||
|
messages.eq(InformMessage::getReportId,param.getId()) |
||||||
|
.in(InformMessage::getNode,nodes); |
||||||
|
return Result.success(messageService.list(messages)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,480 @@ |
|||||||
|
package com.biutag.supervision.controller.report; |
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil; |
||||||
|
import cn.hutool.core.collection.CollectionUtil; |
||||||
|
import cn.hutool.core.util.ObjectUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.alibaba.excel.EasyExcel; |
||||||
|
import com.alibaba.excel.ExcelWriter; |
||||||
|
import com.alibaba.excel.support.ExcelTypeEnum; |
||||||
|
import com.alibaba.excel.write.handler.CellWriteHandler; |
||||||
|
import com.alibaba.excel.write.handler.context.CellWriteHandlerContext; |
||||||
|
import com.alibaba.excel.write.metadata.WriteSheet; |
||||||
|
import com.alibaba.excel.write.metadata.fill.FillConfig; |
||||||
|
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.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.biutag.supervision.common.UserContextHolder; |
||||||
|
import com.biutag.supervision.constants.AppConstants; |
||||||
|
import com.biutag.supervision.constants.enums.FlowNodeEnum; |
||||||
|
import com.biutag.supervision.constants.enums.RoleCodeEnum; |
||||||
|
import com.biutag.supervision.mapper.Recessed.RecessedLogMapper; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.entity.InformMessage; |
||||||
|
import com.biutag.supervision.pojo.entity.recessed.RecessedLog; |
||||||
|
import com.biutag.supervision.pojo.entity.report.ReportFlow; |
||||||
|
import com.biutag.supervision.pojo.entity.report.ReportProject; |
||||||
|
import com.biutag.supervision.pojo.entity.report.ReportReview; |
||||||
|
import com.biutag.supervision.pojo.enums.FlowEnum; |
||||||
|
import com.biutag.supervision.pojo.model.UserAuth; |
||||||
|
import com.biutag.supervision.pojo.param.Recessed.RecessedParam; |
||||||
|
import com.biutag.supervision.pojo.param.Report.ReportProjectQueryParam; |
||||||
|
import com.biutag.supervision.pojo.param.entryWindow.EntryWindowQueryParam; |
||||||
|
import com.biutag.supervision.pojo.param.statement.StatementQueryParam; |
||||||
|
import com.biutag.supervision.pojo.vo.entryWindow.EntryWindowVo; |
||||||
|
import com.biutag.supervision.pojo.vo.excel.ExcelControlPriceVo; |
||||||
|
import com.biutag.supervision.pojo.vo.report.ReportHomeVo; |
||||||
|
import com.biutag.supervision.pojo.vo.report.ReportProjectVo; |
||||||
|
import com.biutag.supervision.pojo.vo.statement.ConditionExcelVo; |
||||||
|
import com.biutag.supervision.pojo.vo.statement.ConditionVo; |
||||||
|
import com.biutag.supervision.service.InformMessageService; |
||||||
|
import com.biutag.supervision.service.Report.ReportProjectService; |
||||||
|
import com.biutag.supervision.service.Report.ReportReviewService; |
||||||
|
import com.biutag.supervision.service.SupDepartService; |
||||||
|
import com.biutag.supervision.util.BigDecimalUtils; |
||||||
|
import com.biutag.supervision.util.CustomFontLoader; |
||||||
|
import jakarta.servlet.ServletOutputStream; |
||||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||||
|
import lombok.Getter; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.apache.poi.ss.usermodel.CellStyle; |
||||||
|
import org.apache.poi.ss.usermodel.CellType; |
||||||
|
import org.apache.poi.ss.usermodel.Workbook; |
||||||
|
import org.apache.poi.util.IOUtils; |
||||||
|
import org.springframework.core.io.ClassPathResource; |
||||||
|
import org.springframework.transaction.annotation.Transactional; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.io.IOException; |
||||||
|
import java.io.InputStream; |
||||||
|
import java.io.UnsupportedEncodingException; |
||||||
|
import java.math.BigDecimal; |
||||||
|
import java.math.RoundingMode; |
||||||
|
import java.net.URLEncoder; |
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.time.format.DateTimeFormatter; |
||||||
|
import java.util.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author weipeng |
||||||
|
*/ |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RestController |
||||||
|
@Slf4j |
||||||
|
@RequestMapping("reportProject") |
||||||
|
public class ReportProjectController { |
||||||
|
|
||||||
|
private final ReportProjectService reportProjectService; |
||||||
|
|
||||||
|
private final SupDepartService departService; |
||||||
|
|
||||||
|
|
||||||
|
private final RecessedLogMapper recessedLogMapper; |
||||||
|
|
||||||
|
private final InformMessageService informMessageService; |
||||||
|
|
||||||
|
@PostMapping("/page") |
||||||
|
public Result<Page<EntryWindowVo>> page(@RequestBody EntryWindowQueryParam query){ |
||||||
|
QueryWrapper<ReportProject> wrapper=new QueryWrapper<>(); |
||||||
|
wrapper.eq(StrUtil.isNotBlank(query.getReportType()),"p.report_type",query.getReportType()) |
||||||
|
.like(StrUtil.isNotBlank(query.getReportName()),"p.report_name",query.getReportName()) |
||||||
|
.eq(StrUtil.isNotBlank(query.getProjectType()),"p.project_type",query.getProjectType()) |
||||||
|
.eq(StrUtil.isNotBlank(query.getAuditUnitId()),"p.audit_unit_id",query.getAuditUnitId()) |
||||||
|
.like(StrUtil.isNotBlank(query.getProjectPrincipal()),"p.project_principal",query.getProjectPrincipal()) |
||||||
|
.like(StrUtil.isNotBlank(query.getProjectPhone()),"p.project_phone",query.getProjectPhone()) |
||||||
|
.eq(StrUtil.isNotBlank(query.getPurchaseMethod()),"p.purchase_method",query.getPurchaseMethod()) |
||||||
|
.like(BigDecimalUtils.isNotZeroAndNull(query.getReportMoney()),"p.report_money",query.getReportMoney()) |
||||||
|
.like(BigDecimalUtils.isNotZeroAndNull(query.getProjectApprovalMoney()),"p.project_approval_money",query.getProjectApprovalMoney()) |
||||||
|
.eq(StrUtil.isNotBlank(query.getPurchaseType()),"p.purchase_type",query.getPurchaseType()) |
||||||
|
.like(BigDecimalUtils.isNotZeroAndNull(query.getContractMount()),"p.contract_mount",query.getContractMount()) |
||||||
|
.eq(StrUtil.isNotBlank(query.getServiceUnit()),"p.service_unit",query.getServiceUnit()) |
||||||
|
.eq(StrUtil.isNotBlank(query.getApplicantId()),"p.applicant_id",query.getApplicantId()); |
||||||
|
//报审日期
|
||||||
|
if(CollectionUtil.isNotEmpty(query.getApplicantTime())){ |
||||||
|
wrapper.between("p.applicant_time",query.getApplicantTime().get(0),query.getApplicantTime().get(1)); |
||||||
|
} |
||||||
|
|
||||||
|
//立项日期
|
||||||
|
if(CollectionUtil.isNotEmpty(query.getProjectApprovalTime())){ |
||||||
|
wrapper.between("p.project_approval_time",query.getProjectApprovalTime().get(0),query.getProjectApprovalTime().get(1)); |
||||||
|
} |
||||||
|
//申报政府采购日期
|
||||||
|
if(CollectionUtil.isNotEmpty(query.getApplyGovernmentTime())){ |
||||||
|
wrapper.between("p.apply_government_time",query.getApplyGovernmentTime().get(0),query.getApplyGovernmentTime().get(1)); |
||||||
|
} |
||||||
|
//采购日期
|
||||||
|
if(CollectionUtil.isNotEmpty(query.getPurchaseTime())){ |
||||||
|
wrapper.between("p.purchase_time",query.getPurchaseTime().get(0),query.getPurchaseTime().get(1)); |
||||||
|
} |
||||||
|
//合同签订日期
|
||||||
|
if(CollectionUtil.isNotEmpty(query.getContractTime())){ |
||||||
|
wrapper.between("p.contract_time",query.getContractTime().get(0),query.getContractTime().get(1)); |
||||||
|
} |
||||||
|
//服务日期
|
||||||
|
if(query.getServiceStartTime()!= null & query.getServiceEndTime()!= null){ |
||||||
|
wrapper.ge("p.service_start_time",query.getServiceStartTime()); |
||||||
|
wrapper.le("p.service_end_time",query.getServiceEndTime()); |
||||||
|
} |
||||||
|
// wrapper.eq("f.approver_state","start" );
|
||||||
|
//是否退窗
|
||||||
|
if(StrUtil.isNotBlank(query.getCode()) &&!"all".equals(query.getCode()) ){ |
||||||
|
wrapper.eq("p.is_recessed",Integer.parseInt(query.getCode())); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//获取登陆人信息
|
||||||
|
UserAuth user = UserContextHolder.getCurrentUser(); |
||||||
|
log.info("user",user); |
||||||
|
boolean firstAuth = AppConstants.USER_TYPE_SUPER.equals(user.getUserType()) || user.getRoleCodes().contains(RoleCodeEnum.FIRST_ADMIN.getCode()); |
||||||
|
//非超级管理员 && 非市级管理员
|
||||||
|
if( !firstAuth ){ |
||||||
|
List<String> orgIds = new ArrayList<>(); |
||||||
|
|
||||||
|
if(!user.getAuthDepartIds().isEmpty()){ |
||||||
|
orgIds = departService.getAllNodeIds(user.getAuthDepartIds()); |
||||||
|
wrapper.in("p.project_unit_id", orgIds); |
||||||
|
}else{ |
||||||
|
orgIds = departService.getAllNodeIds(user.getDepartId()); |
||||||
|
wrapper.in("p.project_unit_id", orgIds); |
||||||
|
} |
||||||
|
} |
||||||
|
wrapper.orderByDesc("p.crt_time"); |
||||||
|
wrapper.groupBy("p.id"); |
||||||
|
return Result.success(reportProjectService.getPage(new Page<>(query.getCurrent(),query.getSize()),wrapper)); |
||||||
|
} |
||||||
|
|
||||||
|
//审计情况表报表
|
||||||
|
@PostMapping("/pageConditionVo") |
||||||
|
public Result<Page<ConditionVo>> pageConditionVo(@RequestBody StatementQueryParam queryParam){ |
||||||
|
QueryWrapper<ReportProject> wrapper=new QueryWrapper<>(); |
||||||
|
|
||||||
|
wrapper.eq(StrUtil.isNotBlank(queryParam.getNode()),"p.node",queryParam.getNode()) |
||||||
|
.like(StrUtil.isNotBlank(queryParam.getReportName()),"p.report_name",queryParam.getReportName()) |
||||||
|
.like(StrUtil.isNotBlank(queryParam.getProjectType()),"p.project_type",queryParam.getProjectType()) |
||||||
|
.eq(StrUtil.isNotBlank(queryParam.getAuditUnitId()),"p.audit_unit_id",queryParam.getAuditUnitId()) |
||||||
|
.eq(StrUtil.isNotBlank(queryParam.getProjectUnitId()),"p.project_unit_id",queryParam.getProjectUnitId()) |
||||||
|
.eq(StrUtil.isNotBlank(queryParam.getPurchaseMethod()),"p.purchase_method",queryParam.getPurchaseMethod()) |
||||||
|
.like(StrUtil.isNotBlank(queryParam.getReferenceNumber()),"p.reference_number",queryParam.getReferenceNumber()); |
||||||
|
if(StrUtil.isNotBlank(queryParam.getReportType()) && !"all".equals(queryParam.getReportType())) { |
||||||
|
wrapper.eq("p.report_type",queryParam.getReportType()); |
||||||
|
} |
||||||
|
if(CollectionUtil.isNotEmpty(queryParam.getArchivingTime())){ |
||||||
|
wrapper.between("p.archiving",queryParam.getArchivingTime().get(0),queryParam.getArchivingTime().get(1)); |
||||||
|
} |
||||||
|
if(CollectionUtil.isNotEmpty(queryParam.getPublicationTime())){ |
||||||
|
wrapper.between("p.publication_date",queryParam.getPublicationTime().get(0),queryParam.getPublicationTime().get(1)); |
||||||
|
} |
||||||
|
if(CollectionUtil.isNotEmpty(queryParam.getApplicantDateTime())){ |
||||||
|
wrapper.between("p.applicant_time",queryParam.getApplicantDateTime().get(0),queryParam.getApplicantDateTime().get(1)); |
||||||
|
} |
||||||
|
if(StrUtil.isNotBlank(queryParam.getCode())){ |
||||||
|
if(queryParam.getCode().equals("city")){ |
||||||
|
wrapper.le("p.report_money",new BigDecimal(200000)); |
||||||
|
}else{ |
||||||
|
wrapper.ge("p.report_money",new BigDecimal(200000)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
wrapper.groupBy("p.id"); |
||||||
|
return Result.success(reportProjectService.getConditionPage(new Page<>(queryParam.getCurrent(),queryParam.getSize()),wrapper)); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
//审计情况表导出
|
||||||
|
@GetMapping("/excelConditionVo") |
||||||
|
public void excelConditionVo(StatementQueryParam queryParam, HttpServletResponse response) throws Exception { |
||||||
|
|
||||||
|
ClassPathResource couponOrderTemplateResource = new ClassPathResource("/excelTemplate/政府投资项目审计情况备案表.xlsx"); |
||||||
|
InputStream inputStream =couponOrderTemplateResource.getInputStream(); |
||||||
|
ServletOutputStream outputStream = null; |
||||||
|
try{ |
||||||
|
queryParam.setCurrent(1); |
||||||
|
queryParam.setSize(10000); |
||||||
|
Result<Page<ConditionVo>> result = pageConditionVo(queryParam); |
||||||
|
if(result.getCode() != 200){ |
||||||
|
throw new RuntimeException("数据查询失败"); |
||||||
|
} |
||||||
|
List<ConditionVo> list = result.getData().getRecords(); |
||||||
|
List<ConditionExcelVo> dataList = BeanUtil.copyToList(list,ConditionExcelVo.class); |
||||||
|
dataList.stream().forEach(s->{ |
||||||
|
s.setReductionRate(s.getReductionRate().setScale(2,RoundingMode.HALF_UP)); |
||||||
|
s.setNode(FlowEnum.contains(s.getNode())); |
||||||
|
}); |
||||||
|
|
||||||
|
//报审金额(元)
|
||||||
|
BigDecimal reportMoneySum = dataList.stream().map(ConditionExcelVo::getReportMoney).filter(Objects::nonNull) |
||||||
|
.reduce(BigDecimal.ZERO,BigDecimal::add); |
||||||
|
//审定金额(元)
|
||||||
|
BigDecimal archivingMoneySum = dataList.stream().map(ConditionExcelVo::getArchivingMoney).filter(Objects::nonNull) |
||||||
|
.reduce(BigDecimal.ZERO,BigDecimal::add); |
||||||
|
//审减金额(元)
|
||||||
|
BigDecimal archivingReduceMoneySum=dataList.stream().map(ConditionExcelVo::getArchivingReduceMoney).filter(Objects::nonNull) |
||||||
|
.reduce(BigDecimal.ZERO,BigDecimal::add); |
||||||
|
//审减率
|
||||||
|
BigDecimal bigDecimal =new BigDecimal("100"); |
||||||
|
BigDecimal reductionRateSum = (reportMoneySum.compareTo(BigDecimal.ZERO) != 0 ? |
||||||
|
archivingReduceMoneySum.divide(reportMoneySum, 4,RoundingMode.HALF_UP): |
||||||
|
BigDecimal.ZERO).multiply(bigDecimal).setScale(2, RoundingMode.HALF_UP) ; |
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
ConditionExcelVo vo=new ConditionExcelVo(); |
||||||
|
vo.setProjectUnit("合计"); |
||||||
|
vo.setReportMoney(reportMoneySum); |
||||||
|
vo.setArchivingMoney(archivingMoneySum); |
||||||
|
vo.setArchivingReduceMoney(archivingReduceMoneySum); |
||||||
|
vo.setReductionRate(reductionRateSum); |
||||||
|
dataList.add(vo); |
||||||
|
|
||||||
|
|
||||||
|
String headerValue = "attachment; filename=\"" + URLEncoder.encode("政府投资项目审计情况备案表.xlsx", "UTF-8") + "\""; |
||||||
|
response.setHeader("Content-Disposition", headerValue); |
||||||
|
response.setContentType("application/octet-stream"); |
||||||
|
|
||||||
|
|
||||||
|
EasyExcel.write(response.getOutputStream(), ConditionExcelVo.class).inMemory(Boolean.TRUE).sheet("问题台账").doWrite(dataList); |
||||||
|
|
||||||
|
}catch (Exception e){ |
||||||
|
log.info("e",e.getMessage()); |
||||||
|
throw new RuntimeException(e.getMessage()); |
||||||
|
}finally { |
||||||
|
IOUtils.closeQuietly(outputStream); |
||||||
|
IOUtils.closeQuietly(inputStream); |
||||||
|
} |
||||||
|
|
||||||
|
// EasyExcel.write(response.getOutputStream(), ConditionVo.class).inMemory(Boolean.TRUE).sheet("政府投资项目审计情况备案表").doWrite(dataList);
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//进窗退窗
|
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
@PostMapping("RecessedData") |
||||||
|
public Result RecessedData(@RequestBody RecessedParam param){ |
||||||
|
UserAuth user = UserContextHolder.getCurrentUser(); |
||||||
|
ReportProject project = reportProjectService.getById(param.getId()); |
||||||
|
LambdaUpdateWrapper<ReportProject> updateWrapper =new LambdaUpdateWrapper<ReportProject>() |
||||||
|
.set(ReportProject::getIsRecessed,(project.getIsRecessed()==0? 1:0)).eq(ReportProject::getId,param.getId()); |
||||||
|
//当前时间
|
||||||
|
LocalDateTime now = LocalDateTime.now(); |
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
||||||
|
String formattedDateTime = now.format(formatter); |
||||||
|
|
||||||
|
//进窗退窗日志
|
||||||
|
RecessedLog recessedLog =new RecessedLog(); |
||||||
|
recessedLog.setReportId(param.getId()); |
||||||
|
recessedLog.setRecessedTime(LocalDateTime.now()); |
||||||
|
recessedLog.setCreateUser(user.getNickName()); |
||||||
|
recessedLog.setCreateId(user.getUserName()); |
||||||
|
recessedLog.setMessage(project.getIsRecessed()==0?(user.getNickName()+"于"+formattedDateTime+"退窗"+project.getReportName()):(user.getNickName()+"于"+formattedDateTime+"重新进窗"+project.getReportName())); |
||||||
|
recessedLogMapper.insert(recessedLog); |
||||||
|
//进窗退窗信息
|
||||||
|
InformMessage message=new InformMessage(); |
||||||
|
message.setReportId(param.getId()); |
||||||
|
message.setMessage((project.getIsRecessed()==0?param.getMessage():(project.getReportName()+"执行进窗操作"))); |
||||||
|
message.setCrtTime(LocalDateTime.now()); |
||||||
|
message.setCrtUser(user.getNickName()); |
||||||
|
//接收人
|
||||||
|
if(project.getIsRecessed()==0){ |
||||||
|
message.setNode("退窗"); |
||||||
|
message.setRecipientId(project.getApplicantId()); |
||||||
|
message.setRecipient(project.getApplicant()); |
||||||
|
}else{ |
||||||
|
RecessedLog logData = recessedLogMapper.selectOne( |
||||||
|
new LambdaQueryWrapper<RecessedLog>().eq(RecessedLog::getReportId,param.getId()) |
||||||
|
.like(RecessedLog::getMessage,"退窗") |
||||||
|
.orderByDesc(RecessedLog::getRecessedTime) |
||||||
|
.last("limit 1") |
||||||
|
); |
||||||
|
//退窗
|
||||||
|
message.setNode("重新进窗"); |
||||||
|
message.setRecipientId(logData.getCreateId()); |
||||||
|
message.setRecipient(logData.getCreateUser()); |
||||||
|
} |
||||||
|
informMessageService.save(message); |
||||||
|
return Result.success(reportProjectService.update(updateWrapper)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 查看详情 |
||||||
|
* */ |
||||||
|
@GetMapping |
||||||
|
public Result<ReportProjectVo> getDetail(ReportProjectQueryParam queryParam){ |
||||||
|
return Result.success(reportProjectService.getDetail(queryParam.getId())); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取首页数据 |
||||||
|
* */ |
||||||
|
@GetMapping("/getHomeVo/{id}") |
||||||
|
public Result<ReportHomeVo> getHomeVo(@PathVariable("id") String id){ |
||||||
|
return Result.success(reportProjectService.getReportHomeVo(id)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}") |
||||||
|
public Result delDetail(@PathVariable("id")String id){ |
||||||
|
reportProjectService.removeById(id); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getListByName") |
||||||
|
public Result<List<ReportProject>> getList(ReportProjectQueryParam queryParam){ |
||||||
|
return Result.success(reportProjectService.getProjectList(queryParam)); |
||||||
|
} |
||||||
|
/** |
||||||
|
* 新增或者修改 |
||||||
|
* @param queryParam |
||||||
|
* */ |
||||||
|
|
||||||
|
@PostMapping |
||||||
|
public Result save(@RequestBody ReportProjectQueryParam queryParam){ |
||||||
|
|
||||||
|
return Result.success(reportProjectService.addOrUpdate(queryParam)); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping |
||||||
|
public Result remove(@RequestBody ReportProjectQueryParam queryParam){ |
||||||
|
reportProjectService.delData(queryParam); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public Result getDataByPage(@RequestBody EntryWindowQueryParam query){ |
||||||
|
QueryWrapper<ReportProject> wrapper=new QueryWrapper<>(); |
||||||
|
wrapper.eq(StrUtil.isNotBlank(query.getReportType()),"p.report_type",query.getReportType()) |
||||||
|
.like(StrUtil.isNotBlank(query.getReportName()),"p.report_name",query.getReportName()) |
||||||
|
.eq(StrUtil.isNotBlank(query.getProjectType()),"p.project_type",query.getProjectType()) |
||||||
|
.eq(StrUtil.isNotBlank(query.getAuditUnitId()),"p.audit_unit_id",query.getAuditUnitId()) |
||||||
|
.like(StrUtil.isNotBlank(query.getProjectPrincipal()),"p.project_principal",query.getProjectPrincipal()) |
||||||
|
.like(StrUtil.isNotBlank(query.getProjectPhone()),"p.project_phone",query.getProjectPhone()) |
||||||
|
.eq(StrUtil.isNotBlank(query.getPurchaseMethod()),"p.purchase_method",query.getPurchaseMethod()) |
||||||
|
.like(BigDecimalUtils.isNotZeroAndNull(query.getReportMoney()),"p.report_money",query.getReportMoney()) |
||||||
|
.like(BigDecimalUtils.isNotZeroAndNull(query.getProjectApprovalMoney()),"p.project_approval_money",query.getProjectApprovalMoney()) |
||||||
|
.eq(StrUtil.isNotBlank(query.getPurchaseType()),"p.purchase_type",query.getPurchaseType()) |
||||||
|
.like(BigDecimalUtils.isNotZeroAndNull(query.getContractMount()),"p.contract_mount",query.getContractMount()) |
||||||
|
.eq(StrUtil.isNotBlank(query.getServiceUnit()),"p.service_unit",query.getServiceUnit()) |
||||||
|
.eq(StrUtil.isNotBlank(query.getApplicantId()),"p.applicant_id",query.getApplicantId()); |
||||||
|
//报审日期
|
||||||
|
if(CollectionUtil.isNotEmpty(query.getApplicantTime())){ |
||||||
|
wrapper.between("p.applicant_time",query.getApplicantTime().get(0),query.getApplicantTime().get(1)); |
||||||
|
} |
||||||
|
|
||||||
|
//立项日期
|
||||||
|
if(CollectionUtil.isNotEmpty(query.getProjectApprovalTime())){ |
||||||
|
wrapper.between("p.project_approval_time",query.getProjectApprovalTime().get(0),query.getProjectApprovalTime().get(1)); |
||||||
|
} |
||||||
|
//申报政府采购日期
|
||||||
|
if(CollectionUtil.isNotEmpty(query.getApplyGovernmentTime())){ |
||||||
|
wrapper.between("p.apply_government_time",query.getApplyGovernmentTime().get(0),query.getApplyGovernmentTime().get(1)); |
||||||
|
} |
||||||
|
//采购日期
|
||||||
|
if(CollectionUtil.isNotEmpty(query.getPurchaseTime())){ |
||||||
|
wrapper.between("p.purchase_time",query.getPurchaseTime().get(0),query.getPurchaseTime().get(1)); |
||||||
|
} |
||||||
|
//合同签订日期
|
||||||
|
if(CollectionUtil.isNotEmpty(query.getContractTime())){ |
||||||
|
wrapper.between("p.contract_time",query.getContractTime().get(0),query.getContractTime().get(1)); |
||||||
|
} |
||||||
|
//服务日期
|
||||||
|
if(query.getServiceStartTime()!= null & query.getServiceEndTime()!= null){ |
||||||
|
wrapper.ge("p.service_start_time",query.getServiceStartTime()); |
||||||
|
wrapper.le("p.service_end_time",query.getServiceEndTime()); |
||||||
|
} |
||||||
|
// wrapper.eq("f.approver_state","start" );
|
||||||
|
//是否退窗
|
||||||
|
if(StrUtil.isNotBlank(query.getCode()) &&!"all".equals(query.getCode()) ){ |
||||||
|
wrapper.eq("p.is_recessed",Integer.parseInt(query.getCode())); |
||||||
|
} |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//上传定案表
|
||||||
|
@PostMapping("/upFinalizationPath") |
||||||
|
public Result upFinalizationPath(@RequestBody ReportProjectQueryParam queryParam){ |
||||||
|
if(reportProjectService.upFinalizationPath(queryParam)){ |
||||||
|
return Result.success(); |
||||||
|
}else{ |
||||||
|
return Result.failed("上传失败"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/getExcelContrilPrice") |
||||||
|
public void getExcelContrilPriceFun(@RequestBody ReportProjectQueryParam queryParam, HttpServletResponse response) throws UnsupportedEncodingException { |
||||||
|
response.setContentType("application/vnd.ms-excel"); |
||||||
|
response.setCharacterEncoding("utf-8"); |
||||||
|
|
||||||
|
ExcelControlPriceVo priceVo = new ExcelControlPriceVo(); |
||||||
|
ReportProjectVo vo = reportProjectService.getDetail(queryParam.getId()); |
||||||
|
//非空
|
||||||
|
if(ObjectUtil.isNotEmpty(vo)){ |
||||||
|
ReportProject project = vo.getProject(); |
||||||
|
BeanUtil.copyProperties(project,priceVo); |
||||||
|
priceVo.setFirstAuditor(vo.getReview().getFirstAuditor()); |
||||||
|
priceVo.setSecondAuditor(vo.getReview().getSecondAuditor()); |
||||||
|
priceVo.setThirdlyAuditor(vo.getReview().getThirdlyAuditor()); |
||||||
|
} |
||||||
|
String filePathName ="控制价定案表"; |
||||||
|
if ("结算项目".equals(vo.getProject().getProjectType())){ |
||||||
|
filePathName = "结算定案表"; |
||||||
|
}else{ |
||||||
|
filePathName = "控制价定案表"; |
||||||
|
} |
||||||
|
|
||||||
|
String excelFileName =StrUtil.isNotEmpty(filePathName)? URLEncoder.encode(filePathName, "UTF-8"):URLEncoder.encode("定案表", "UTF-8"); |
||||||
|
response.setHeader("Content-disposition", "attachment;filename=" + excelFileName + ".xls"); |
||||||
|
ClassPathResource couponOrderTemplateResource = new ClassPathResource("/excelTemplate/"+filePathName+".xls"); |
||||||
|
|
||||||
|
if(! couponOrderTemplateResource.exists()){ |
||||||
|
throw new RuntimeException("模板不存在"); |
||||||
|
} |
||||||
|
InputStream templateInputStream = null; |
||||||
|
ServletOutputStream outputStream = null; |
||||||
|
ExcelWriter excelWriter = null; |
||||||
|
try{ |
||||||
|
outputStream = response.getOutputStream(); |
||||||
|
templateInputStream = couponOrderTemplateResource.getInputStream(); |
||||||
|
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); |
||||||
|
excelWriter = EasyExcel.write(outputStream).withTemplate(templateInputStream) |
||||||
|
.inMemory(true) |
||||||
|
.excelType(ExcelTypeEnum.XLS).build(); |
||||||
|
WriteSheet writeSheet = EasyExcel.writerSheet("汇总表").build(); |
||||||
|
excelWriter.fill(priceVo, fillConfig, writeSheet); |
||||||
|
//触发计算公式
|
||||||
|
Workbook workbook = excelWriter.writeContext().writeWorkbookHolder().getWorkbook(); |
||||||
|
workbook.getCreationHelper().createFormulaEvaluator().evaluateAll(); |
||||||
|
|
||||||
|
excelWriter.finish(); |
||||||
|
}catch (Exception e){ |
||||||
|
log.info("e",e.getMessage()); |
||||||
|
throw new RuntimeException(e.getMessage()); |
||||||
|
}finally { |
||||||
|
IOUtils.closeQuietly(outputStream); |
||||||
|
IOUtils.closeQuietly(templateInputStream); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,83 @@ |
|||||||
|
package com.biutag.supervision.controller.serviceUnit; |
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.alibaba.excel.EasyExcel; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.entity.price.PriceInformation; |
||||||
|
import com.biutag.supervision.pojo.entity.serviceUnit.ServiceUnit; |
||||||
|
import com.biutag.supervision.pojo.param.Price.PriceInformationQueryParam; |
||||||
|
import com.biutag.supervision.pojo.param.ServiceUnit.ServiceUnitQueryParam; |
||||||
|
import com.biutag.supervision.pojo.vo.ServiceUnit.ServiceUnitVo; |
||||||
|
import com.biutag.supervision.pojo.vo.excel.ExcelPriceInformation; |
||||||
|
import com.biutag.supervision.pojo.vo.excel.ExcelServiceUnit; |
||||||
|
import com.biutag.supervision.pojo.vo.price.PriceInformationVo; |
||||||
|
import com.biutag.supervision.service.ServiceUnit.ServiceUnitService; |
||||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.beans.BeanUtils; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.io.IOException; |
||||||
|
import java.net.URLEncoder; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("serviceUnit") |
||||||
|
public class ServiceUnitController { |
||||||
|
|
||||||
|
private final ServiceUnitService service; |
||||||
|
|
||||||
|
@GetMapping |
||||||
|
public Result<Page<ServiceUnitVo>> getPage(ServiceUnitQueryParam queryParam){ |
||||||
|
return Result.success(service.pageList(queryParam)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("/insertOrUpdate") |
||||||
|
public Result insertOrUpdate(@RequestBody ServiceUnit serviceUnit){ |
||||||
|
if(service.addOrUpData(serviceUnit)){ |
||||||
|
return Result.success(); |
||||||
|
}else{ |
||||||
|
return Result.failed("操作失败"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("/delData") |
||||||
|
public Result delData(@PathVariable("id")String id){ |
||||||
|
if(service.delServiceUnit(id)){ |
||||||
|
return Result.success(); |
||||||
|
}else { |
||||||
|
return Result.failed("操作失败"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/export") |
||||||
|
public void export(ServiceUnitQueryParam queryParam, HttpServletResponse response) throws IOException { |
||||||
|
queryParam.setCurrent(1); |
||||||
|
queryParam.setSize(100000); |
||||||
|
Page<ServiceUnitVo> page = service.pageListData(queryParam); |
||||||
|
List<ServiceUnitVo> list = page.getRecords(); |
||||||
|
log.info("服务单位信息库数据量:"+list.size()); |
||||||
|
List<ExcelServiceUnit> excelServiceUnitList = new ArrayList<>(); |
||||||
|
|
||||||
|
if(CollectionUtil.isNotEmpty(list)){ |
||||||
|
list.forEach((s)->{ |
||||||
|
ExcelServiceUnit unit=new ExcelServiceUnit(); |
||||||
|
BeanUtils.copyProperties( s,unit); |
||||||
|
excelServiceUnitList.add(unit); |
||||||
|
}); |
||||||
|
} |
||||||
|
String headerValue = "attachment; filename=\"" + URLEncoder.encode("服务单位信息库.xlsx", "UTF-8") + "\""; |
||||||
|
response.setHeader("Content-Disposition", headerValue); |
||||||
|
response.setContentType("application/octet-stream"); |
||||||
|
EasyExcel.write(response.getOutputStream(), ExcelServiceUnit.class).inMemory(Boolean.TRUE).sheet("服务单位信息库").doWrite(excelServiceUnitList); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,141 @@ |
|||||||
|
package com.biutag.supervision.controller.system; |
||||||
|
|
||||||
|
import cn.hutool.core.date.DatePattern; |
||||||
|
import cn.hutool.core.date.DateUtil; |
||||||
|
import cn.hutool.core.util.NumberUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.biutag.supervision.constants.AppConstants; |
||||||
|
import com.biutag.supervision.constants.enums.DepartGroupIdEnum; |
||||||
|
import com.biutag.supervision.constants.enums.DepartLevelEnum; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.entity.SupDepart; |
||||||
|
import com.biutag.supervision.pojo.param.DepartQueryParam; |
||||||
|
import com.biutag.supervision.pojo.param.DepartTreeListParam; |
||||||
|
import com.biutag.supervision.pojo.vo.DepartTree; |
||||||
|
import com.biutag.supervision.service.SupDepartService; |
||||||
|
import com.biutag.supervision.service.SupPoliceService; |
||||||
|
import jakarta.validation.ValidationException; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.beans.BeanUtils; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@RequestMapping("depart") |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RestController |
||||||
|
public class DepartController { |
||||||
|
|
||||||
|
private final SupDepartService departService; |
||||||
|
|
||||||
|
public final SupPoliceService policeService; |
||||||
|
|
||||||
|
@GetMapping |
||||||
|
public Result<List<DepartTree>> treeList(DepartTreeListParam departTreeListParam) { |
||||||
|
return Result.success(departService.buildTreeByParam(departTreeListParam)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("list") |
||||||
|
public Result<Page<SupDepart>> list(DepartQueryParam departQueryParam) { |
||||||
|
return Result.success(departService.page(departQueryParam)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("getDepartByIds") |
||||||
|
public Result<List<SupDepart>> getDepartByIds(DepartQueryParam departQueryParam){ |
||||||
|
return Result.success(departService.list(new LambdaQueryWrapper<SupDepart>().in(SupDepart::getId,departQueryParam.getIds()))); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@PostMapping |
||||||
|
public Result<Boolean> add(@RequestBody SupDepart supDepart) { |
||||||
|
if (departService.existsByName(supDepart.getName())) { |
||||||
|
throw new ValidationException("单位全称已存在"); |
||||||
|
} |
||||||
|
if (departService.existsByCode(supDepart.getCode())) { |
||||||
|
throw new ValidationException("单位编码已存在"); |
||||||
|
} |
||||||
|
SupDepart parent = departService.getById(supDepart.getPid()); |
||||||
|
supDepart.setId(String.valueOf(NumberUtil.nullToZero(departService.getMaxId()) + 1)); |
||||||
|
supDepart.setLevel(parent.getLevel() + 1); |
||||||
|
supDepart.setUpdatedAt(DateUtil.format(new Date(), DatePattern.NORM_DATETIME_FORMAT)); |
||||||
|
departService.save(supDepart); |
||||||
|
String pathTrace = departService.getPathTrace(supDepart); |
||||||
|
departService.update(new LambdaUpdateWrapper<SupDepart>().eq(SupDepart::getId, supDepart.getId()).set(SupDepart::getPathTrace, pathTrace)); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
@PutMapping |
||||||
|
public Result<Boolean> update(@RequestBody SupDepart supDepart) { |
||||||
|
if (departService.exists(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getName, supDepart.getName()).ne(SupDepart::getId, supDepart.getId()))) { |
||||||
|
throw new ValidationException("单位全称已存在"); |
||||||
|
} |
||||||
|
if (departService.exists(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getCode, supDepart.getCode()).ne(SupDepart::getId, supDepart.getId()))) { |
||||||
|
throw new ValidationException("单位编码已存在"); |
||||||
|
} |
||||||
|
SupDepart parent = departService.getById(supDepart.getPid()); |
||||||
|
supDepart.setLevel(parent.getLevel() + 1); |
||||||
|
supDepart.setUpdatedAt(DateUtil.format(new Date(), DatePattern.NORM_DATETIME_FORMAT)); |
||||||
|
String pathTrace = departService.getPathTrace(supDepart); |
||||||
|
supDepart.setPathTrace(pathTrace); |
||||||
|
return Result.success(departService.updateById(supDepart)); |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("{id}") |
||||||
|
public Result<Boolean> del(@PathVariable String id) { |
||||||
|
if (policeService.exists(id)) { |
||||||
|
throw new RuntimeException("该单位下还有警务人员,请移除后再删除"); |
||||||
|
} |
||||||
|
List<String> orgIds = departService.getAllNodeIds(id); |
||||||
|
return Result.success(departService.removeBatchByIds(orgIds)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("tree") |
||||||
|
public Result<List<DepartTree>> tree() { |
||||||
|
return Result.success(departService.buildTreeByAuth()); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("treeAll") |
||||||
|
public Result<List<DepartTree>> treeAll() { |
||||||
|
return Result.success(departService.buildTreeAll()); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("second") |
||||||
|
public Result<List<DepartTree>> seconds() { |
||||||
|
List<SupDepart> supDeparts = departService.listByLevel(List.of(DepartLevelEnum.SECOND_CATEGORY.getValue(), DepartLevelEnum.SECOND.getValue())); |
||||||
|
return Result.success(departService.buildTreeBySecond(supDeparts)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("firstHost") |
||||||
|
public Result<List<DepartTree>> firstHost() { |
||||||
|
return Result.success(departService.buildTreeByFirstHost()); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("{departId}/children") |
||||||
|
public Result<List<SupDepart>> children(@PathVariable String departId) { |
||||||
|
return Result.success(departService.list(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getPid, departId).orderByAsc(SupDepart::getOrderNo))); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取分县市局 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@GetMapping("tree/countyAndCityBureaus") |
||||||
|
public Result<List<DepartTree>> countyAndCityBureaus() { |
||||||
|
List<DepartTree> children = departService.list(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getStatisticsGroupId, DepartGroupIdEnum.COUNTY_AND_CITY_BUREAUS.getValue()) |
||||||
|
.orderByAsc(SupDepart::getOrderNo)) |
||||||
|
.stream().map(item -> { |
||||||
|
DepartTree departTree = new DepartTree(); |
||||||
|
BeanUtils.copyProperties(item, departTree); |
||||||
|
return departTree; |
||||||
|
}).toList(); |
||||||
|
DepartTree root = new DepartTree(); |
||||||
|
root.setShortName(AppConstants.ROOT_DEPART_NAME); |
||||||
|
root.setId(AppConstants.ROOT_DEPART_ID); |
||||||
|
root.setChildren(children); |
||||||
|
return Result.success(List.of(root)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,85 @@ |
|||||||
|
package com.biutag.supervision.controller.system; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.entity.SupDepart; |
||||||
|
import com.biutag.supervision.pojo.entity.SupExternalDepart; |
||||||
|
import com.biutag.supervision.pojo.param.DepartMapingQueryParam; |
||||||
|
import com.biutag.supervision.service.SupDepartService; |
||||||
|
|
||||||
|
import com.biutag.supervision.service.SupExternalDepartService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/12/30 |
||||||
|
*/ |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("depart/maping") |
||||||
|
@RestController |
||||||
|
public class DepartMapingController { |
||||||
|
|
||||||
|
private final SupExternalDepartService externalDepartService; |
||||||
|
|
||||||
|
private final SupDepartService departService; |
||||||
|
|
||||||
|
@GetMapping("{source}") |
||||||
|
public Result<Page<SupExternalDepart>> list(@PathVariable String source, DepartMapingQueryParam queryParam) { |
||||||
|
LambdaQueryWrapper<SupExternalDepart> queryWrapper = new LambdaQueryWrapper<>(); |
||||||
|
queryWrapper |
||||||
|
.eq(SupExternalDepart::getSource, source) |
||||||
|
.like(StrUtil.isNotBlank(queryParam.getExternalId()), SupExternalDepart::getExternalId, queryParam.getExternalId()) |
||||||
|
.like(StrUtil.isNotBlank(queryParam.getExternalName()), SupExternalDepart::getExternalName, queryParam.getExternalName()) |
||||||
|
.eq(StrUtil.isNotBlank(queryParam.getInternalId()), SupExternalDepart::getInternalId, queryParam.getInternalId()) |
||||||
|
.isNull("noMaping".equals(queryParam.getActiveMaping()), SupExternalDepart::getInternalId); |
||||||
|
Page<SupExternalDepart> page = externalDepartService.page(Page.of(queryParam.getCurrent(), queryParam.getSize()), queryWrapper); |
||||||
|
return Result.success(page); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping |
||||||
|
public Result<Void> add(@RequestBody SupExternalDepart data) { |
||||||
|
if (externalDepartService.exists(new LambdaQueryWrapper<SupExternalDepart>() |
||||||
|
.eq(SupExternalDepart::getSource, data.getSource()).eq(SupExternalDepart::getExternalId, data.getExternalId()))) { |
||||||
|
throw new RuntimeException(String.format("%s 单位编码【%s】已存在", data.getSource(), data.getExternalId())); |
||||||
|
} |
||||||
|
data.setUpdateTime(LocalDateTime.now()); |
||||||
|
data.setCreateTime(LocalDateTime.now()); |
||||||
|
SupDepart depart = departService.getById(data.getInternalId()); |
||||||
|
|
||||||
|
data.setInternalName(depart.getName()); |
||||||
|
data.setInternalShortName(depart.getShortName()); |
||||||
|
data.setPid(depart.getPid()); |
||||||
|
data.setLevel(depart.getLevel()); |
||||||
|
externalDepartService.save(data); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
@PutMapping |
||||||
|
public Result<Void> update(@RequestBody SupExternalDepart data) { |
||||||
|
if (externalDepartService.exists(new LambdaQueryWrapper<SupExternalDepart>() |
||||||
|
.eq(SupExternalDepart::getSource, data.getSource()).eq(SupExternalDepart::getExternalId, data.getExternalId()) |
||||||
|
.ne(SupExternalDepart::getId, data.getId()))) { |
||||||
|
throw new RuntimeException(String.format("%s 单位编码【%s】已存在", data.getSource(), data.getExternalId())); |
||||||
|
} |
||||||
|
data.setUpdateTime(LocalDateTime.now()); |
||||||
|
SupDepart depart = departService.getById(data.getInternalId()); |
||||||
|
data.setInternalName(depart.getName()); |
||||||
|
data.setInternalShortName(depart.getShortName()); |
||||||
|
data.setPid(depart.getPid()); |
||||||
|
data.setLevel(depart.getLevel()); |
||||||
|
externalDepartService.updateById(data); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("{id}") |
||||||
|
public Result<Void> del(@PathVariable Integer id) { |
||||||
|
externalDepartService.removeById(id); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,52 @@ |
|||||||
|
package com.biutag.supervision.controller.system; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.entity.SupDictProblemType; |
||||||
|
import com.biutag.supervision.pojo.vo.DictContentTree; |
||||||
|
import com.biutag.supervision.service.SupDictProblemTypeService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("dict/content") |
||||||
|
@RestController |
||||||
|
public class DictContentController { |
||||||
|
|
||||||
|
private final SupDictProblemTypeService dictContentService; |
||||||
|
|
||||||
|
@GetMapping("tree") |
||||||
|
public Result<List<DictContentTree>> list() { |
||||||
|
return Result.success(dictContentService.buildTree()); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping |
||||||
|
public Result<Void> add(@RequestBody SupDictProblemType dictContent) { |
||||||
|
dictContent.setUpdTime(LocalDateTime.now()); |
||||||
|
dictContent.setCrtTime(LocalDateTime.now()); |
||||||
|
dictContent.setStatus("0"); |
||||||
|
dictContentService.save(dictContent); |
||||||
|
dictContentService.update(new LambdaUpdateWrapper<SupDictProblemType>().eq(SupDictProblemType::getId, dictContent.getId()).set(SupDictProblemType::getCode, dictContent.getId())); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
@PutMapping |
||||||
|
public Result<Void> update(@RequestBody SupDictProblemType dictContent) { |
||||||
|
dictContent.setUpdTime(LocalDateTime.now()); |
||||||
|
dictContentService.updateById(dictContent); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("{id}") |
||||||
|
public Result<Void> update(@PathVariable Integer id) { |
||||||
|
if (dictContentService.exists(new LambdaQueryWrapper<SupDictProblemType>().eq(SupDictProblemType::getParentCode, id))) { |
||||||
|
throw new RuntimeException("该节点下还存在子节点,无法删除"); |
||||||
|
} |
||||||
|
dictContentService.removeById(id); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,137 @@ |
|||||||
|
package com.biutag.supervision.controller.system; |
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil; |
||||||
|
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.plugins.pagination.Page; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.dto.DictDataDto; |
||||||
|
import com.biutag.supervision.pojo.dto.DictTypeDto; |
||||||
|
import com.biutag.supervision.pojo.entity.SupDict12337HandleResult; |
||||||
|
import com.biutag.supervision.pojo.entity.SupDictData; |
||||||
|
import com.biutag.supervision.pojo.entity.SupDictType; |
||||||
|
import com.biutag.supervision.pojo.vo.DictProblemSourceTree; |
||||||
|
import com.biutag.supervision.pojo.vo.SelectOption; |
||||||
|
import com.biutag.supervision.pojo.vo.SelectOptionGroup; |
||||||
|
import com.biutag.supervision.service.SupDict12337HandleResultService; |
||||||
|
import com.biutag.supervision.service.SupDictDataService; |
||||||
|
import com.biutag.supervision.service.SupDictProblemSourceService; |
||||||
|
import com.biutag.supervision.service.SupDictTypeService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.util.Comparator; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("dict") |
||||||
|
@RestController |
||||||
|
public class DictController { |
||||||
|
|
||||||
|
private final SupDictTypeService dictTypeService; |
||||||
|
|
||||||
|
private final SupDictDataService dictDataService; |
||||||
|
|
||||||
|
private final SupDictProblemSourceService dictProblemSourceService; |
||||||
|
|
||||||
|
private final SupDict12337HandleResultService dict12337HandleResultService; |
||||||
|
|
||||||
|
@GetMapping |
||||||
|
public Result<Page<SupDictType>> page(Page<SupDictType> page, String dictName, String dictType) { |
||||||
|
LambdaQueryWrapper<SupDictType> queryWrapper = new LambdaQueryWrapper<SupDictType>() |
||||||
|
.like(StrUtil.isNotBlank(dictName), SupDictType::getDictName, dictName) |
||||||
|
.like(StrUtil.isNotBlank(dictType), SupDictType::getDictType, dictType) |
||||||
|
.orderByDesc(SupDictType::getUpdateTime); |
||||||
|
return Result.success(dictTypeService.page(page, queryWrapper)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping |
||||||
|
public Result<Boolean> add(@RequestBody DictTypeDto dictType) { |
||||||
|
return Result.success(dictTypeService.save(dictType)); |
||||||
|
} |
||||||
|
|
||||||
|
@PutMapping |
||||||
|
public Result<Boolean> update(@RequestBody DictTypeDto dictType) { |
||||||
|
SupDictType supDictType = new SupDictType(); |
||||||
|
BeanUtil.copyProperties(dictType, supDictType); |
||||||
|
supDictType.setUpdateTime(LocalDateTime.now()); |
||||||
|
LambdaQueryWrapper<SupDictType> queryWrapper = new LambdaQueryWrapper<SupDictType>().ne(SupDictType::getDictId, dictType.getDictId()).eq(SupDictType::getDictType, dictType.getDictType()); |
||||||
|
if (dictTypeService.exists(queryWrapper)) { |
||||||
|
throw new RuntimeException("字典类型已存在"); |
||||||
|
} |
||||||
|
SupDictType oldSupDictType = dictTypeService.getById(dictType.getDictId()); |
||||||
|
if (!oldSupDictType.getDictType().equals(supDictType.getDictType())) { |
||||||
|
// 更新
|
||||||
|
dictDataService.update(new LambdaUpdateWrapper<SupDictData>().eq(SupDictData::getDictType, oldSupDictType.getDictType()).set(SupDictData::getDictType, dictType.getDictType())); |
||||||
|
} |
||||||
|
return Result.success(dictTypeService.updateById(supDictType)); |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("{dictId}") |
||||||
|
public Result<Boolean> update(@PathVariable Integer dictId) { |
||||||
|
return Result.success(dictTypeService.removeById(dictId)); |
||||||
|
} |
||||||
|
@GetMapping("{dictType}/dictData") |
||||||
|
public Result<Page<SupDictData>> list(Page<SupDictData> page, @PathVariable String dictType) { |
||||||
|
return Result.success(dictDataService.page(page, new LambdaQueryWrapper<SupDictData>() |
||||||
|
.eq(SupDictData::getDictType, dictType) |
||||||
|
.orderByAsc(SupDictData::getDictSort))); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("{dictType}/dictData") |
||||||
|
public Result<Boolean> add(@RequestBody DictDataDto dictData) { |
||||||
|
return Result.success(dictDataService.save(dictData)); |
||||||
|
} |
||||||
|
|
||||||
|
@PutMapping("{dictType}/dictData") |
||||||
|
public Result<Boolean> update(@RequestBody DictDataDto dictData) { |
||||||
|
SupDictData supDictData = new SupDictData(); |
||||||
|
BeanUtil.copyProperties(dictData, supDictData); |
||||||
|
return Result.success(dictDataService.updateById(supDictData)); |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("{dictType}/dictData/{dictCode}") |
||||||
|
public Result<Boolean> del(@PathVariable Integer dictCode) { |
||||||
|
return Result.success(dictDataService.removeById(dictCode)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("data/{dictType}") |
||||||
|
public Result<List<SupDictData>> list(@PathVariable String dictType) { |
||||||
|
return Result.success(dictDataService.list(new LambdaQueryWrapper<SupDictData>() |
||||||
|
.eq(SupDictData::getDictType, dictType) |
||||||
|
.orderByAsc(SupDictData::getDictSort))); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("problemSource") |
||||||
|
public Result<List<DictProblemSourceTree>> listProblemSource() { |
||||||
|
return Result.success(dictProblemSourceService.buildTree()); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("12337HandleResult") |
||||||
|
public Result<List<SelectOptionGroup>> handleResult() { |
||||||
|
List<SupDict12337HandleResult> list = dict12337HandleResultService.list(); |
||||||
|
Map<String, List<SupDict12337HandleResult>> collect = list.stream().collect(Collectors.groupingBy(SupDict12337HandleResult::getGroupName)); |
||||||
|
List<String> groups = List.of("第一种形态", "第二种形态","第三种形态","第四种形态"); |
||||||
|
List<SelectOptionGroup> result = collect.keySet().stream() |
||||||
|
// 排序
|
||||||
|
.sorted(Comparator.comparingInt(groups::indexOf)) |
||||||
|
.map(label -> { |
||||||
|
SelectOptionGroup group = new SelectOptionGroup(); |
||||||
|
group.setLabel(label); |
||||||
|
group.setOptions(collect.get(label).stream().map(o -> { |
||||||
|
SelectOption option = new SelectOption(); |
||||||
|
option.setText(o.getName()); |
||||||
|
option.setValue(o.getName()); |
||||||
|
return option; |
||||||
|
}).toList()); |
||||||
|
return group; |
||||||
|
}).toList(); |
||||||
|
|
||||||
|
return Result.success(result); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,69 @@ |
|||||||
|
package com.biutag.supervision.controller.system; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.entity.SupDictHandleResultMaping; |
||||||
|
import com.biutag.supervision.pojo.param.DepartMapingQueryParam; |
||||||
|
import com.biutag.supervision.service.SupDictHandleResultMapingService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/12/31 |
||||||
|
*/ |
||||||
|
@RequestMapping("handleResultMaping") |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RestController |
||||||
|
public class HandleResultMapingController { |
||||||
|
|
||||||
|
private final SupDictHandleResultMapingService handleResultMapingService; |
||||||
|
|
||||||
|
@GetMapping |
||||||
|
public Result<Page<SupDictHandleResultMaping>> list(DepartMapingQueryParam param) { |
||||||
|
LambdaQueryWrapper<SupDictHandleResultMaping> queryWrapper = new LambdaQueryWrapper<>(); |
||||||
|
queryWrapper |
||||||
|
.eq(SupDictHandleResultMaping::getSource, param.getSource()) |
||||||
|
.like(StrUtil.isNotBlank(param.getExternalName()), SupDictHandleResultMaping::getExternalName, param.getExternalName()) |
||||||
|
.eq(StrUtil.isNotBlank(param.getInternalId()), SupDictHandleResultMaping::getInternalId, param.getInternalId()) |
||||||
|
.orderByDesc(SupDictHandleResultMaping::getCreateTime); |
||||||
|
return Result.success(handleResultMapingService.page(Page.of(param.getCurrent(), param.getSize()), queryWrapper)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping |
||||||
|
public Result<Void> add(@RequestBody SupDictHandleResultMaping data) { |
||||||
|
if (handleResultMapingService.exists(new LambdaQueryWrapper<SupDictHandleResultMaping>() |
||||||
|
.eq(SupDictHandleResultMaping::getExternalName, data.getExternalName()))) { |
||||||
|
throw new RuntimeException(String.format("处理结果【%s】已存在", StrUtil.trim(data.getExternalName()))); |
||||||
|
} |
||||||
|
data.setExternalName(StrUtil.trim(data.getExternalName())); |
||||||
|
data.setUpdateTime(LocalDateTime.now()); |
||||||
|
data.setCreateTime(LocalDateTime.now()); |
||||||
|
handleResultMapingService.save(data); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
@PutMapping |
||||||
|
public Result<Void> update(@RequestBody SupDictHandleResultMaping data) { |
||||||
|
if (handleResultMapingService.exists(new LambdaQueryWrapper<SupDictHandleResultMaping>() |
||||||
|
.eq(SupDictHandleResultMaping::getExternalName, data.getExternalName()) |
||||||
|
.eq(SupDictHandleResultMaping::getSource, data.getSource()) |
||||||
|
.ne(SupDictHandleResultMaping::getId, data.getId()))) { |
||||||
|
throw new RuntimeException(String.format("处理结果【%s】已存在", data.getExternalName())); |
||||||
|
} |
||||||
|
data.setUpdateTime(LocalDateTime.now()); |
||||||
|
handleResultMapingService.updateById(data); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("{id}") |
||||||
|
public Result<Void> del(@PathVariable String id) { |
||||||
|
handleResultMapingService.removeById(id); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,71 @@ |
|||||||
|
package com.biutag.supervision.controller.system; |
||||||
|
|
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.entity.Holiday; |
||||||
|
import com.biutag.supervision.service.HolidayService; |
||||||
|
import lombok.Getter; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import lombok.Setter; |
||||||
|
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 java.time.LocalDate; |
||||||
|
import java.time.temporal.TemporalAdjusters; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("holiday") |
||||||
|
@RestController |
||||||
|
public class HolidayController { |
||||||
|
|
||||||
|
private final HolidayService holidayService; |
||||||
|
|
||||||
|
public static final List<Integer> months = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); |
||||||
|
|
||||||
|
@GetMapping("{year}") |
||||||
|
public Result<List<HolidayVo>> list(@PathVariable Integer year) { |
||||||
|
List<Holiday> holidays = holidayService.list(year); |
||||||
|
List<HolidayVo> list = months.stream().map(month -> { |
||||||
|
HolidayVo holidayVo = new HolidayVo(); |
||||||
|
holidayVo.setMonth(month); |
||||||
|
LocalDate beginDay = LocalDate.of(year, month, 1); |
||||||
|
int beginDayOfWeek = beginDay.getDayOfWeek().getValue(); |
||||||
|
for (int i = 0; i < (beginDayOfWeek != 0 ? beginDayOfWeek - 1 : 6); i++) { |
||||||
|
holidayVo.getDays().add(new Day()); |
||||||
|
} |
||||||
|
LocalDate.of(year, month, 1); |
||||||
|
for (int i = 1; i <= beginDay.with(TemporalAdjusters.lastDayOfMonth()).getDayOfMonth(); i++) { |
||||||
|
String date = LocalDate.of(year, month, i).toString(); |
||||||
|
Boolean flag = holidays.stream().filter(item -> item.getDate().equals(date)).findFirst().map(Holiday::getFlag).orElse(false); |
||||||
|
holidayVo.getDays().add(Day.of(i, flag)); |
||||||
|
} |
||||||
|
return holidayVo; |
||||||
|
}).toList(); |
||||||
|
return Result.success(list); |
||||||
|
} |
||||||
|
|
||||||
|
@Setter |
||||||
|
@Getter |
||||||
|
public static class HolidayVo { |
||||||
|
private Integer month; |
||||||
|
private List<Day> days = new ArrayList<>(); |
||||||
|
} |
||||||
|
|
||||||
|
@Setter |
||||||
|
@Getter |
||||||
|
public static class Day { |
||||||
|
private Integer day; |
||||||
|
private Boolean flag = false; |
||||||
|
|
||||||
|
public static Day of(Integer day, Boolean flag) { |
||||||
|
Day obj = new Day(); |
||||||
|
obj.setDay(day); |
||||||
|
obj.setFlag(flag); |
||||||
|
return obj; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,51 @@ |
|||||||
|
package com.biutag.supervision.controller.system; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.dto.MenuDto; |
||||||
|
import com.biutag.supervision.pojo.entity.Menu; |
||||||
|
import com.biutag.supervision.pojo.vo.MenuTree; |
||||||
|
import com.biutag.supervision.service.MenuService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.beans.BeanUtils; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("menu") |
||||||
|
@RestController |
||||||
|
public class MenuController { |
||||||
|
|
||||||
|
private final MenuService menuService; |
||||||
|
|
||||||
|
@GetMapping |
||||||
|
public Result<List<MenuTree>> list() { |
||||||
|
List<Menu> menus = menuService.list(new LambdaQueryWrapper<Menu>().orderByAsc(Menu::getMenuSort)); |
||||||
|
return Result.success(MenuTree.buildTree(menus)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping |
||||||
|
public Result<Void> add(@RequestBody MenuDto menuDto) { |
||||||
|
Menu menu = new Menu(); |
||||||
|
BeanUtils.copyProperties(menuDto, menu); |
||||||
|
menuService.save(menu); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
@PutMapping |
||||||
|
public Result<List<MenuTree>> update(@RequestBody MenuDto menuDto) { |
||||||
|
Menu menu = new Menu(); |
||||||
|
BeanUtils.copyProperties(menuDto, menu); |
||||||
|
menu.setUpdateTime(LocalDateTime.now()); |
||||||
|
menuService.updateById(menu); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("{id}") |
||||||
|
public Result<Boolean> del(@PathVariable Integer id) { |
||||||
|
return Result.success(menuService.removeById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,291 @@ |
|||||||
|
package com.biutag.supervision.controller.system; |
||||||
|
|
||||||
|
import cn.hutool.core.date.DatePattern; |
||||||
|
import cn.hutool.core.date.DateUtil; |
||||||
|
import cn.hutool.core.io.FileUtil; |
||||||
|
import cn.hutool.core.util.IdUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.alibaba.excel.EasyExcel; |
||||||
|
import com.alibaba.excel.ExcelReader; |
||||||
|
import com.alibaba.excel.context.AnalysisContext; |
||||||
|
import com.alibaba.excel.read.listener.ReadListener; |
||||||
|
import com.alibaba.excel.read.metadata.ReadSheet; |
||||||
|
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.plugins.pagination.Page; |
||||||
|
import com.biutag.supervision.constants.AppConstants; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.domain.PoliceAuth; |
||||||
|
import com.biutag.supervision.pojo.dto.PoliceDto; |
||||||
|
import com.biutag.supervision.pojo.dto.PoliceImport; |
||||||
|
import com.biutag.supervision.pojo.dto.UserDto; |
||||||
|
import com.biutag.supervision.pojo.entity.*; |
||||||
|
import com.biutag.supervision.pojo.model.PoliceModel; |
||||||
|
import com.biutag.supervision.pojo.param.PoliceQueryParam; |
||||||
|
import com.biutag.supervision.pojo.vo.DepartTree; |
||||||
|
import com.biutag.supervision.service.*; |
||||||
|
import jakarta.validation.ConstraintViolation; |
||||||
|
import jakarta.validation.Valid; |
||||||
|
import jakarta.validation.Validator; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.apache.xmlbeans.UserType; |
||||||
|
import org.springframework.beans.BeanUtils; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
import org.springframework.web.multipart.MultipartFile; |
||||||
|
|
||||||
|
import java.io.IOException; |
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.util.*; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
@RequestMapping("police") |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RestController |
||||||
|
public class PoliceController { |
||||||
|
|
||||||
|
private final SupPoliceService policeService; |
||||||
|
|
||||||
|
private final SupDepartService departService; |
||||||
|
|
||||||
|
private final NegDepartAuthorityService negDepartAuthorityService; |
||||||
|
|
||||||
|
private final NegSourceAuthorityService negSourceAuthorityService; |
||||||
|
|
||||||
|
private final BaseUserService baseUserService; |
||||||
|
|
||||||
|
private final Validator validator; |
||||||
|
|
||||||
|
@GetMapping |
||||||
|
public Result<Page<PoliceModel>> list(PoliceQueryParam param) { |
||||||
|
return Result.success(policeService.page(param)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/getAllDepartNode") |
||||||
|
public Result<List<SupDepart>> getAllDepartNode(){ |
||||||
|
return Result.success(policeService.getALlDepartNode()); |
||||||
|
} |
||||||
|
|
||||||
|
// 异常人员
|
||||||
|
@GetMapping("abnormal") |
||||||
|
public Result<Page<PoliceModel>> abnormalList(PoliceQueryParam param) { |
||||||
|
return Result.success(policeService.pageByAbnormal(param)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping |
||||||
|
public Result<Boolean> add(@Valid @RequestBody PoliceDto policeDto) { |
||||||
|
SupPolice policeByEmpNo = policeService.getOne(new LambdaQueryWrapper<SupPolice>().eq(SupPolice::getEmpNo, policeDto.getEmpNo())); |
||||||
|
if (Objects.nonNull(policeByEmpNo)) { |
||||||
|
SupDepart depart = departService.getById(policeByEmpNo.getOrgId()); |
||||||
|
throw new RuntimeException(String.format("该人员[%s]已存在于“%s”单位中,请联系二级机构或市局管理员以进行人员调整。", policeDto.getEmpNo(), depart.getName())); |
||||||
|
} |
||||||
|
SupPolice one = policeService.getOne(new LambdaQueryWrapper<SupPolice>().eq(SupPolice::getIdCode, policeDto.getIdCode())); |
||||||
|
if (Objects.nonNull(one)) { |
||||||
|
SupDepart depart = departService.getById(one.getOrgId()); |
||||||
|
throw new RuntimeException(String.format("该人员[%s]已存在于“%s”单位中,请联系二级机构或市局管理员以进行人员调整。", policeDto.getIdCode(), depart.getName())); |
||||||
|
} |
||||||
|
SupPolice police = new SupPolice(); |
||||||
|
BeanUtils.copyProperties(policeDto, police); |
||||||
|
police.setId(IdUtil.getSnowflakeNextIdStr()); |
||||||
|
police.setUpdatedAt(DateUtil.format(new Date(), DatePattern.NORM_DATETIME_FORMAT)); |
||||||
|
police.setCreatedAt(DateUtil.format(new Date(), DatePattern.NORM_DATETIME_FORMAT)); |
||||||
|
policeService.save(police); |
||||||
|
if (policeDto.getCreateUserFlag() && !userService.exists(new LambdaQueryWrapper<BaseUser>().eq(BaseUser::getUserName, police.getIdCode()))) { |
||||||
|
UserDto userDto = new UserDto(); |
||||||
|
userDto.setUserName(police.getIdCode()); |
||||||
|
userDto.setNickName(police.getName()); |
||||||
|
userDto.setPassword(policeDto.getPassword()); |
||||||
|
userDto.setUserType("normal"); |
||||||
|
userDto.setRoleIds(new ArrayList<>()); |
||||||
|
baseUserService.save(userDto); |
||||||
|
} |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
@PutMapping |
||||||
|
public Result<Boolean> update(@RequestBody SupPolice police) { |
||||||
|
SupPolice policeByEmpNo = policeService.getOne(new LambdaQueryWrapper<SupPolice>().eq(SupPolice::getEmpNo, police.getEmpNo()).ne(SupPolice::getId, police.getId())); |
||||||
|
if (Objects.nonNull(policeByEmpNo)) { |
||||||
|
SupDepart depart = departService.getById(policeByEmpNo.getOrgId()); |
||||||
|
throw new RuntimeException(String.format("该人员[%s]已存在于“%s”单位中,请联系二级机构或市局管理员以进行人员调整。", police.getEmpNo(), depart.getName())); |
||||||
|
} |
||||||
|
SupPolice one = policeService.getOne(new LambdaQueryWrapper<SupPolice>().eq(SupPolice::getIdCode, police.getIdCode()).ne(SupPolice::getId, police.getId())); |
||||||
|
if (Objects.nonNull(one)) { |
||||||
|
SupDepart depart = departService.getById(one.getOrgId()); |
||||||
|
throw new RuntimeException(String.format("该人员[%s]已存在于“%s”单位中,请联系二级机构或市局管理员以进行人员调整。", police.getIdCode(), depart.getName())); |
||||||
|
} |
||||||
|
LambdaUpdateWrapper<SupPolice> updateWrapper = new LambdaUpdateWrapper<SupPolice>() |
||||||
|
.eq(SupPolice::getId, police.getId()) |
||||||
|
.set(SupPolice::getName, police.getName()) |
||||||
|
.set(SupPolice::getEmpNo, police.getEmpNo()) |
||||||
|
.set(SupPolice::getIdCode, police.getIdCode()) |
||||||
|
.set(SupPolice::getOrgId, police.getOrgId()) |
||||||
|
.set(SupPolice::getPersonType, police.getPersonType()) |
||||||
|
.set(SupPolice::getPosition, police.getPosition()) |
||||||
|
.set(SupPolice::getPoliceRole, police.getPoliceRole()) |
||||||
|
.set(SupPolice::getMobile, police.getMobile()) |
||||||
|
.set(SupPolice::getEmploymentDate, police.getEmploymentDate()) |
||||||
|
.set(SupPolice::getAvatarUrl, police.getAvatarUrl()) |
||||||
|
.set(SupPolice::getUpdatedAt, DateUtil.format(new Date(), DatePattern.NORM_DATETIME_FORMAT)); |
||||||
|
return Result.success(policeService.update(updateWrapper)); |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("{id}") |
||||||
|
public Result<Void> del(@PathVariable String id, @RequestBody JSONObject body) { |
||||||
|
policeService.update(new LambdaUpdateWrapper<SupPolice>().eq(SupPolice::getId, id).set(SupPolice::getDel, AppConstants.DEL) |
||||||
|
.set(SupPolice::getDelReason, body.getString("reason"))); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("{departId}/all") |
||||||
|
public Result<List<SupPolice>> all(@PathVariable String departId) { |
||||||
|
return Result.success(policeService.listAllByDepartId(departId)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("{departId}/leader") |
||||||
|
public Result<List<SupPolice>> leader(@PathVariable String departId) { |
||||||
|
return Result.success(policeService.listLeaderByDepartId(departId)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("auth/{idCode}") |
||||||
|
public Result<PoliceAuth> auth(@PathVariable String idCode) { |
||||||
|
PoliceAuth policeAuth = new PoliceAuth().setDeparts(negDepartAuthorityService.list(idCode).stream().map(NegDepartAuthority::getDepartId).toList()) |
||||||
|
.setSources(negSourceAuthorityService.list(idCode).stream().map(NegSourceAuthority::getSource).toList()) |
||||||
|
.setRoleIds(userService.getRoleIds(idCode)); |
||||||
|
return Result.success(policeAuth); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("auth/{idCode}") |
||||||
|
public Result<Void> auth(@PathVariable String idCode, @RequestBody PoliceAuth policeAuth) { |
||||||
|
negDepartAuthorityService.save(idCode, policeAuth.getDeparts()); |
||||||
|
negSourceAuthorityService.save(idCode, policeAuth.getSources()); |
||||||
|
userService.updateRoleCodeByUserName(idCode, policeAuth.getRoleIds()); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
private final BaseUserService userService; |
||||||
|
private final BaseAccountService accountService; |
||||||
|
private final SupDictProblemSourceService dictProblemSourceService; |
||||||
|
|
||||||
|
@PostMapping("import") |
||||||
|
public Result<List<PoliceImport>> importExcel(@RequestPart("file") MultipartFile file) throws IOException { |
||||||
|
String fileNameType = FileUtil.extName(file.getOriginalFilename()); |
||||||
|
if (!"xls".equals(fileNameType) && !"xlsx".equals(fileNameType)) { |
||||||
|
throw new RuntimeException("仅支持 xls/xlsx 格式文件的导入"); |
||||||
|
} |
||||||
|
List<PoliceImport> list = new ArrayList<>(); |
||||||
|
List<SupDictProblemSource> problemSources = dictProblemSourceService.list(); |
||||||
|
ExcelReader excelReader = EasyExcel.read(file.getInputStream(), PoliceImport.class, new ReadListener<PoliceImport>() { |
||||||
|
@Override |
||||||
|
public void invoke(PoliceImport data, AnalysisContext analysisContext) { |
||||||
|
Set<ConstraintViolation<PoliceImport>> validate = validator.validate(data); |
||||||
|
if (!validate.isEmpty()) { |
||||||
|
String message = validate.stream().map(ConstraintViolation::getMessage).collect(Collectors.joining("\n")); |
||||||
|
throw new RuntimeException(String.format("第%s条数据的异常:%s", list.size() + 1, message)); |
||||||
|
} |
||||||
|
list.add(data); |
||||||
|
} |
||||||
|
@Override |
||||||
|
public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
||||||
|
} |
||||||
|
}).build(); |
||||||
|
ReadSheet sheet = EasyExcel.readSheet(0).build(); |
||||||
|
excelReader.read(sheet); |
||||||
|
excelReader.close(); |
||||||
|
for (int i = 0; i < list.size(); i++) { |
||||||
|
PoliceImport police = list.get(i); |
||||||
|
SupDepart depart = departService.getOne(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getShortName, police.getSecondDepartName()).eq(SupDepart::getLevel, 2)); |
||||||
|
if (Objects.isNull(depart)) { |
||||||
|
throw new RuntimeException(String.format("%s 该单位在系统中未找到,请核实", police.getSecondDepartName())); |
||||||
|
} |
||||||
|
if (StrUtil.isNotBlank(police.getThirdDepartName())) { |
||||||
|
depart = departService.getOne(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getPid, depart.getId()) |
||||||
|
.eq(SupDepart::getShortName, police.getThirdDepartName()).eq(SupDepart::getLevel, 3)); |
||||||
|
if (Objects.isNull(depart)) { |
||||||
|
throw new RuntimeException(String.format("%s/%s 该单位在系统中未找到,请核实", police.getSecondDepartName(), police.getThirdDepartName())); |
||||||
|
} |
||||||
|
} |
||||||
|
SupPolice supPolice = policeService.getByIdCode(list.get(i).getIdCode()); |
||||||
|
if (supPolice == null) { |
||||||
|
supPolice = new SupPolice(); |
||||||
|
} |
||||||
|
supPolice.setName(police.getName()); |
||||||
|
supPolice.setIdCode(police.getIdCode()); |
||||||
|
supPolice.setEmpNo(police.getEmpNo()); |
||||||
|
supPolice.setOrgId(depart.getId()); |
||||||
|
if (police.getEmpNo().contains("A")) { |
||||||
|
supPolice.setPersonType("3"); |
||||||
|
} else { |
||||||
|
supPolice.setPersonType("1"); |
||||||
|
} |
||||||
|
policeService.saveOrUpdate(supPolice); |
||||||
|
if ("三级机构专班".equals(police.getRole()) || "二级机构专班".equals(police.getRole())) { |
||||||
|
String userId = saveOrUpdateUser(police); |
||||||
|
// 角色
|
||||||
|
addRoleUser(userId, police.getRole()); |
||||||
|
// 权限
|
||||||
|
addAuth(police.getIdCode(), supPolice.getOrgId(), problemSources); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
return Result.success(list); |
||||||
|
} |
||||||
|
|
||||||
|
public String saveOrUpdateUser(PoliceImport police) { |
||||||
|
BaseUser user = userService.getByUserName(police.getIdCode()); |
||||||
|
if (user != null) { |
||||||
|
return user.getUserId(); |
||||||
|
} |
||||||
|
BaseUser baseUser = new BaseUser(); |
||||||
|
baseUser.setUserName(police.getIdCode()); |
||||||
|
baseUser.setNickName(police.getName()); |
||||||
|
baseUser.setUserType("admin"); |
||||||
|
baseUser.setCreateTime(LocalDateTime.now()); |
||||||
|
baseUser.setUpdateTime(LocalDateTime.now()); |
||||||
|
userService.save(baseUser); |
||||||
|
BaseAccount account = new BaseAccount(); |
||||||
|
account.setAccount(police.getIdCode()); |
||||||
|
account.setUserId(baseUser.getUserId()); |
||||||
|
account.setAccountType("username"); |
||||||
|
account.setDomain("@admin.com"); |
||||||
|
account.setPassword("$2a$10$q0NbHH1fbkDotxJ1dT7PbOcV4G47R8n15uVxz2.imTiDqdCwAJYBC"); |
||||||
|
account.setDomain("@admin.com"); |
||||||
|
account.setCreateTime(LocalDateTime.now()); |
||||||
|
account.setUpdateTime(LocalDateTime.now()); |
||||||
|
accountService.save(account); |
||||||
|
return baseUser.getUserId(); |
||||||
|
} |
||||||
|
|
||||||
|
private final BaseRoleUserService roleUserService; |
||||||
|
public void addRoleUser(String userId, String role) { |
||||||
|
roleUserService.remove(new LambdaQueryWrapper<BaseRoleUser>().eq(BaseRoleUser::getUserId, userId)); |
||||||
|
BaseRoleUser baseRoleUser = new BaseRoleUser(); |
||||||
|
baseRoleUser.setUserId(userId); |
||||||
|
if ("三级机构专班".equals(role)) { |
||||||
|
baseRoleUser.setRoleId("5"); |
||||||
|
} |
||||||
|
if ("二级机构专班".equals(role)) { |
||||||
|
baseRoleUser.setRoleId("4"); |
||||||
|
} |
||||||
|
baseRoleUser.setCreateTime(LocalDateTime.now()); |
||||||
|
baseRoleUser.setUpdateTime(LocalDateTime.now()); |
||||||
|
roleUserService.save(baseRoleUser); |
||||||
|
} |
||||||
|
|
||||||
|
public void addAuth(String idCode, String orgId, List<SupDictProblemSource> problemSources) { |
||||||
|
negDepartAuthorityService.remove(new LambdaQueryWrapper<NegDepartAuthority>().eq(NegDepartAuthority::getIdCode, idCode)); |
||||||
|
NegDepartAuthority authority = new NegDepartAuthority(); |
||||||
|
authority.setDepartId(orgId); |
||||||
|
authority.setIdCode(idCode); |
||||||
|
negDepartAuthorityService.save(authority); |
||||||
|
negSourceAuthorityService.remove(new LambdaQueryWrapper<NegSourceAuthority>().eq(NegSourceAuthority::getIdCode, idCode)); |
||||||
|
|
||||||
|
List<NegSourceAuthority> list = problemSources.stream().map(item -> { |
||||||
|
NegSourceAuthority sourceAuthority = new NegSourceAuthority(); |
||||||
|
sourceAuthority.setIdCode(idCode); |
||||||
|
sourceAuthority.setSource(item.getId()); |
||||||
|
return sourceAuthority; |
||||||
|
}).toList(); |
||||||
|
negSourceAuthorityService.saveBatch(list); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,66 @@ |
|||||||
|
package com.biutag.supervision.controller.system; |
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.biutag.supervision.mapper.SupDictProblemTypeMapingMapper; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.entity.SupDictProblemTypeMaping; |
||||||
|
import com.biutag.supervision.pojo.param.DepartMapingQueryParam; |
||||||
|
import com.biutag.supervision.pojo.param.PoliceQueryParam; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author wxc |
||||||
|
* @date 2024/12/31 |
||||||
|
*/ |
||||||
|
@RequestMapping("problemTypeMaping") |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RestController |
||||||
|
public class ProblemTypeMapingController { |
||||||
|
|
||||||
|
private final SupDictProblemTypeMapingMapper problemTypeMapingMapper; |
||||||
|
|
||||||
|
@GetMapping |
||||||
|
public Result<Page<SupDictProblemTypeMaping>> list(DepartMapingQueryParam param) { |
||||||
|
LambdaQueryWrapper<SupDictProblemTypeMaping> queryWrapper = new LambdaQueryWrapper<>(); |
||||||
|
queryWrapper.like(StrUtil.isNotBlank(param.getExternalName()), SupDictProblemTypeMaping::getExternalName, param.getExternalName()) |
||||||
|
.eq(StrUtil.isNotBlank(param.getInternalId()), SupDictProblemTypeMaping::getInternalId, param.getInternalId()) |
||||||
|
.orderByDesc(SupDictProblemTypeMaping::getCreateTime); |
||||||
|
return Result.success(problemTypeMapingMapper.selectPage(Page.of(param.getCurrent(), param.getSize()), queryWrapper)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping |
||||||
|
public Result<Void> add(@RequestBody SupDictProblemTypeMaping data) { |
||||||
|
if (problemTypeMapingMapper.exists(new LambdaQueryWrapper<SupDictProblemTypeMaping>() |
||||||
|
.eq(SupDictProblemTypeMaping::getExternalName, data.getExternalName()))) { |
||||||
|
throw new RuntimeException(String.format("问题类型【%s】已存在", StrUtil.trim(data.getExternalName()))); |
||||||
|
} |
||||||
|
data.setExternalName(StrUtil.trim(data.getExternalName())); |
||||||
|
data.setUpdateTime(LocalDateTime.now()); |
||||||
|
data.setCreateTime(LocalDateTime.now()); |
||||||
|
problemTypeMapingMapper.insert(data); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
@PutMapping |
||||||
|
public Result<Void> update(@RequestBody SupDictProblemTypeMaping data) { |
||||||
|
if (problemTypeMapingMapper.exists(new LambdaQueryWrapper<SupDictProblemTypeMaping>() |
||||||
|
.eq(SupDictProblemTypeMaping::getExternalName, data.getExternalName()) |
||||||
|
.ne(SupDictProblemTypeMaping::getId, data.getId()))) { |
||||||
|
throw new RuntimeException(String.format("单位编码【%s】已存在", data.getExternalName())); |
||||||
|
} |
||||||
|
data.setUpdateTime(LocalDateTime.now()); |
||||||
|
problemTypeMapingMapper.updateById(data); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("{id}") |
||||||
|
public Result<Void> del(@PathVariable String id) { |
||||||
|
problemTypeMapingMapper.deleteById(id); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,62 @@ |
|||||||
|
package com.biutag.supervision.controller.system; |
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil; |
||||||
|
import com.biutag.supervision.constants.enums.StatusEnum; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.entity.BaseRole; |
||||||
|
import com.biutag.supervision.pojo.entity.RoleMenu; |
||||||
|
import com.biutag.supervision.pojo.param.RoleQueryParam; |
||||||
|
import com.biutag.supervision.service.BaseRoleService; |
||||||
|
import com.biutag.supervision.service.RoleMenuService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("role") |
||||||
|
@RestController |
||||||
|
public class RoleController { |
||||||
|
|
||||||
|
private final BaseRoleService baseRoleService; |
||||||
|
|
||||||
|
private final RoleMenuService roleMenuService; |
||||||
|
|
||||||
|
@GetMapping |
||||||
|
public Result<List<BaseRole>> list(RoleQueryParam roleQueryParam) { |
||||||
|
List<BaseRole> roles = baseRoleService.list(roleQueryParam); |
||||||
|
return Result.success(roles); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping |
||||||
|
public Result<Boolean> add(@RequestBody BaseRole role) { |
||||||
|
role.setRoleId(String.valueOf(IdUtil.getSnowflakeNextId())); |
||||||
|
role.setCreateTime(LocalDateTime.now()); |
||||||
|
role.setUpdateTime(LocalDateTime.now()); |
||||||
|
role.setStatus(StatusEnum.ENABLE.getValue()); |
||||||
|
return Result.success(baseRoleService.save(role)); |
||||||
|
} |
||||||
|
|
||||||
|
@PutMapping |
||||||
|
public Result<Boolean> update(@RequestBody BaseRole role) { |
||||||
|
role.setUpdateTime(LocalDateTime.now()); |
||||||
|
return Result.success(baseRoleService.updateById(role)); |
||||||
|
} |
||||||
|
|
||||||
|
@DeleteMapping("{id}") |
||||||
|
public Result<Boolean> del(@PathVariable String id) { |
||||||
|
return Result.success(baseRoleService.removeById(id)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("{roleCode}/menu") |
||||||
|
public Result<List<Integer>> add(@PathVariable String roleCode) { |
||||||
|
return Result.success(roleMenuService.list(roleCode).stream().map(RoleMenu::getMenuId).toList()); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("{roleCode}/menu") |
||||||
|
public Result<Boolean> add(@PathVariable String roleCode, @RequestBody List<Integer> menuIds) { |
||||||
|
return Result.success(roleMenuService.update(roleCode, menuIds)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,56 @@ |
|||||||
|
package com.biutag.supervision.controller.system; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.dto.UserDto; |
||||||
|
import com.biutag.supervision.pojo.dto.UserPasswordDto; |
||||||
|
import com.biutag.supervision.pojo.entity.BaseAccount; |
||||||
|
import com.biutag.supervision.pojo.model.UserModel; |
||||||
|
import com.biutag.supervision.pojo.param.UserQueryParam; |
||||||
|
import com.biutag.supervision.service.BaseAccountService; |
||||||
|
import com.biutag.supervision.service.BaseUserService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.security.crypto.bcrypt.BCrypt; |
||||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("user") |
||||||
|
@RestController |
||||||
|
public class UserController { |
||||||
|
|
||||||
|
private final BaseUserService baseUserService; |
||||||
|
|
||||||
|
private final BaseAccountService accountService; |
||||||
|
|
||||||
|
@GetMapping |
||||||
|
public Result<Page<UserModel>> list(UserQueryParam queryParam) { |
||||||
|
Page<UserModel> baseUserPage = baseUserService.page(queryParam); |
||||||
|
return Result.success(baseUserPage); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping |
||||||
|
public Result<Boolean> add(@RequestBody UserDto userDto) { |
||||||
|
return Result.success(baseUserService.save(userDto)); |
||||||
|
} |
||||||
|
|
||||||
|
@PutMapping |
||||||
|
public Result<Boolean> update(@RequestBody UserDto userDto) { |
||||||
|
return Result.success(baseUserService.update(userDto)); |
||||||
|
} |
||||||
|
|
||||||
|
@PutMapping("password") |
||||||
|
public Result<Boolean> updatePsd(@RequestBody UserPasswordDto userPasswordDto) { |
||||||
|
BaseAccount baseAccount = accountService.getByAccount(userPasswordDto.getAccount()); |
||||||
|
if (!BCrypt.checkpw(userPasswordDto.getPassword(), baseAccount.getPassword())) { |
||||||
|
throw new RuntimeException("密码错误!"); |
||||||
|
} |
||||||
|
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(); |
||||||
|
String passwordEncoder = encoder.encode(userPasswordDto.getNewPassword()); |
||||||
|
accountService.update(new LambdaUpdateWrapper<BaseAccount>().eq(BaseAccount::getAccount, userPasswordDto.getAccount()).set(BaseAccount::getPassword, passwordEncoder)); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,229 @@ |
|||||||
|
package com.biutag.supervision.controller.warning; |
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil; |
||||||
|
import cn.hutool.core.util.ObjectUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
|
||||||
|
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.plugins.pagination.Page; |
||||||
|
import com.biutag.supervision.common.UserContextHolder; |
||||||
|
import com.biutag.supervision.constants.AppConstants; |
||||||
|
import com.biutag.supervision.constants.enums.RoleCodeEnum; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.entity.InvertRecord; |
||||||
|
import com.biutag.supervision.pojo.entity.report.ReportFlow; |
||||||
|
import com.biutag.supervision.pojo.entity.report.ReportProject; |
||||||
|
import com.biutag.supervision.pojo.entity.report.ReportReview; |
||||||
|
import com.biutag.supervision.pojo.entity.warning.WarningContent; |
||||||
|
import com.biutag.supervision.pojo.entity.warning.WarningRecord; |
||||||
|
import com.biutag.supervision.pojo.enums.FlowEnum; |
||||||
|
import com.biutag.supervision.pojo.enums.FlowStateEnum; |
||||||
|
import com.biutag.supervision.pojo.enums.FlowWarningEnum; |
||||||
|
import com.biutag.supervision.pojo.model.UserAuth; |
||||||
|
import com.biutag.supervision.pojo.param.Warning.WarningQueryParam; |
||||||
|
import com.biutag.supervision.pojo.vo.entryWindow.EntryWindowVo; |
||||||
|
import com.biutag.supervision.pojo.vo.warning.WaringVo; |
||||||
|
import com.biutag.supervision.pojo.vo.warning.WarningInformData; |
||||||
|
import com.biutag.supervision.service.InvertRecord.InvertRecordService; |
||||||
|
import com.biutag.supervision.service.Report.ReportFlowService; |
||||||
|
import com.biutag.supervision.service.Report.ReportProjectService; |
||||||
|
import com.biutag.supervision.service.SupDepartService; |
||||||
|
import com.biutag.supervision.service.Warning.WarningContentService; |
||||||
|
import com.biutag.supervision.service.Warning.WarningRecordService; |
||||||
|
import io.lettuce.core.dynamic.annotation.Param; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.function.Function; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/warning") |
||||||
|
public class WarningController { |
||||||
|
|
||||||
|
private final ReportProjectService reportProjectService; |
||||||
|
private final WarningContentService contentService; |
||||||
|
private final WarningRecordService recordService; |
||||||
|
private final ReportFlowService reportFlowService; |
||||||
|
private final InvertRecordService invertRecordService; |
||||||
|
private final SupDepartService departService; |
||||||
|
|
||||||
|
//预警督察列表
|
||||||
|
@PostMapping("/getPage") |
||||||
|
public Result<Page<EntryWindowVo>> getPage(@RequestBody WarningQueryParam queryParam){ |
||||||
|
UserAuth user = UserContextHolder.getCurrentUser(); |
||||||
|
QueryWrapper<ReportProject> wrapper= new QueryWrapper<ReportProject>() |
||||||
|
.eq(StrUtil.isNotBlank(queryParam.getProjectUnitId()),"p.project_unit_id",queryParam.getProjectUnitId()) |
||||||
|
.eq(StrUtil.isNotBlank(queryParam.getAuditUnitId()),"p.audit_unit_id",queryParam.getAuditUnitId()) |
||||||
|
.eq(StrUtil.isNotBlank(queryParam.getReportName()),"p.report_name",queryParam.getReportName()) |
||||||
|
.eq("f.report_link","end") |
||||||
|
.eq("f.approver_state","end") |
||||||
|
.eq(StrUtil.isNotBlank(queryParam.getWarningState()),"p.warning_state",queryParam.getWarningState()) |
||||||
|
.eq("p.node",FlowStateEnum.End.getLabel()); |
||||||
|
if (!AppConstants.USER_TYPE_SUPER.equals(user.getUserType()) && !user.getRoleCodes().contains(RoleCodeEnum.FIRST_ADMIN.getCode())) { |
||||||
|
List<String> orgIds =new ArrayList<>(); |
||||||
|
if(!user.getAuthDepartIds().isEmpty()){ |
||||||
|
orgIds = departService.getAllNodeIds(user.getAuthDepartIds()); |
||||||
|
wrapper.in("p.project_unit_id", orgIds); |
||||||
|
}else{ |
||||||
|
orgIds = departService.getAllNodeIds(user.getDepartId()); |
||||||
|
wrapper.in("p.project_unit_id", orgIds); |
||||||
|
} |
||||||
|
// List<String> orgIds = departService.getAllNodeIds(user.getAuthDepartIds());
|
||||||
|
// wrapper.in("p.project_unit_id", orgIds);
|
||||||
|
} |
||||||
|
if(CollectionUtil.isNotEmpty(queryParam.getPublicationDate())){ |
||||||
|
wrapper.between(CollectionUtil.isNotEmpty(queryParam.getPublicationDate()),"p.publication_date",queryParam.getPublicationDate().get(0),queryParam.getPublicationDate().get(1)); |
||||||
|
} |
||||||
|
if(CollectionUtil.isNotEmpty(queryParam.getEndDate())){ |
||||||
|
wrapper.between(CollectionUtil.isNotEmpty(queryParam.getEndDate()),"p.archiving",queryParam.getEndDate().get(0),queryParam.getEndDate().get(1)); |
||||||
|
} |
||||||
|
wrapper.groupBy("p.id"); |
||||||
|
Page<EntryWindowVo> page= reportProjectService.getPageWarning(new Page<>(queryParam.getCurrent(),queryParam.getSize()),wrapper,queryParam.getWarningState()); |
||||||
|
List<EntryWindowVo> entryWindowVos = page.getRecords(); |
||||||
|
entryWindowVos.forEach(s->{ |
||||||
|
List<WarningRecord> list = recordService.list(new LambdaQueryWrapper<WarningRecord>().eq(WarningRecord::getReportId,s.getId())); |
||||||
|
if(CollectionUtil.isNotEmpty(list)) { |
||||||
|
//0的代表已下发问题
|
||||||
|
List<WarningRecord> records= list.stream().filter(x-> "0".equals(x.getFlowState())).toList(); |
||||||
|
//为空表示已提交审核
|
||||||
|
List<WarningRecord> auditNumber= list.stream().filter(x-> StrUtil.isEmpty(x.getFlowState())).toList(); |
||||||
|
//1 为 已下发问题 ,2 为已提交审核,0为常规
|
||||||
|
String stateData = CollectionUtil.isNotEmpty(records)?"1":(CollectionUtil.isNotEmpty(auditNumber)?"2":"0"); |
||||||
|
s.setStateData(stateData); |
||||||
|
List<String> ids = list.stream().map(x -> x.getId()).toList(); |
||||||
|
long counts = contentService.count(new LambdaQueryWrapper<WarningContent>().in(WarningContent::getWarningId, ids) |
||||||
|
.isNotNull(WarningContent::getRemark)); |
||||||
|
s.setWarningContent(counts); |
||||||
|
} |
||||||
|
}); |
||||||
|
page.setRecords(entryWindowVos); |
||||||
|
return Result.success(page); |
||||||
|
|
||||||
|
} |
||||||
|
/** |
||||||
|
* 获取最新的预警记录 |
||||||
|
* @param id 项目id |
||||||
|
* */ |
||||||
|
@GetMapping("/getWarningRecord/{id}") |
||||||
|
public Result<WarningRecord> getWarningRecord(@PathVariable("id")String id){ |
||||||
|
WarningRecord record =recordService.selectDataByDistinct(id); |
||||||
|
if(ObjectUtil.isNotEmpty(record)){ |
||||||
|
return Result.success(record); |
||||||
|
}else { |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("getWarningAudit/{id}") |
||||||
|
public Result< List<WarningRecord>> getWarningAudit(@PathVariable("id")String id){ |
||||||
|
//获取已下发的预警记录
|
||||||
|
List<WarningRecord> record = recordService.selectDataByAudit(id); |
||||||
|
return Result.success(record); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getRejectNode/{id}") |
||||||
|
public Result<List<ReportFlow>> getRejectNode(@PathVariable("id") String id){ |
||||||
|
WarningRecord record = recordService.getById(id); |
||||||
|
List<ReportFlow> flows =reportFlowService.list(new LambdaQueryWrapper<ReportFlow>().eq(ReportFlow::getReportId,id).eq(ReportFlow::getType,"warning")); |
||||||
|
flows=flows.stream().filter(s->!s.getApproverState().equals(FlowStateEnum.Reject.getLabel()) && isRejectNodeFlow(record.getNode()).contains(s.getReportLink())) |
||||||
|
.collect(Collectors.toMap( |
||||||
|
ReportFlow::getReportCode, |
||||||
|
Function.identity(), |
||||||
|
(existing, replacement) -> existing |
||||||
|
)).values().stream().toList(); |
||||||
|
|
||||||
|
return Result.success(flows); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//预警督察详情
|
||||||
|
@GetMapping("/{id}") |
||||||
|
public Result<WaringVo> getDetail(@PathVariable("id") String id){ |
||||||
|
WaringVo vo= recordService.getWarningVoFun(id); |
||||||
|
return Result.success(vo); |
||||||
|
} |
||||||
|
|
||||||
|
//保存或者修改 预警督察详情
|
||||||
|
@PostMapping("/addOrUpData") |
||||||
|
public Result addOrUpData(@RequestBody WaringVo vo){ |
||||||
|
vo.getRecord().setReportId(vo.getReportProject().getId()); |
||||||
|
UserAuth user = UserContextHolder.getCurrentUser(); |
||||||
|
String type="warning"; |
||||||
|
vo.getRecord().setCreateTime(LocalDateTime.now()); |
||||||
|
if("inform".equals(vo.getCode())){ |
||||||
|
type= "inform"; |
||||||
|
} |
||||||
|
if(StrUtil.isNotBlank(vo.getIsSubmit())){ |
||||||
|
if("inform".equals(vo.getCode())){ |
||||||
|
vo.getRecord().setInformNode(FlowWarningEnum.state.getLabel()); |
||||||
|
}else{ |
||||||
|
vo.getRecord().setNode(FlowWarningEnum.state.getLabel()); |
||||||
|
} |
||||||
|
|
||||||
|
recordService.saveOrUpdate(vo.getRecord()); |
||||||
|
|
||||||
|
List<ReportFlow> reportFlows = reportFlowService.list( |
||||||
|
new LambdaQueryWrapper<ReportFlow>().eq(ReportFlow::getReportId,vo.getRecord().getId()) |
||||||
|
.eq(ReportFlow::getReportLink,FlowWarningEnum.state.getLabel()) |
||||||
|
.eq(ReportFlow::getReportCode,FlowWarningEnum.state.getValue()) |
||||||
|
.eq(ReportFlow::getApproverState,FlowStateEnum.Start.getLabel()) |
||||||
|
.eq(ReportFlow::getType,type) |
||||||
|
); |
||||||
|
if(CollectionUtil.isEmpty(reportFlows)){ |
||||||
|
ReportFlow flow = new ReportFlow(); |
||||||
|
flow.setReportId(vo.getRecord().getId()); |
||||||
|
flow.setReportLink(FlowWarningEnum.state.getLabel()); |
||||||
|
flow.setReportCode(FlowWarningEnum.state.getValue()); |
||||||
|
flow.setAreportTime(LocalDateTime.now()); |
||||||
|
flow.setApproverState(FlowStateEnum.Start.getLabel()); |
||||||
|
flow.setApprover(user.getNickName()); |
||||||
|
flow.setApproverId(user.getUserName()); |
||||||
|
flow.setIsInit("1"); |
||||||
|
flow.setType(type); |
||||||
|
reportFlowService.save(flow); |
||||||
|
} |
||||||
|
}else{ |
||||||
|
recordService.saveOrUpdate(vo.getRecord()); |
||||||
|
} |
||||||
|
if(CollectionUtil.isNotEmpty(vo.getContents())){ |
||||||
|
vo.getContents().forEach(s->{ |
||||||
|
s.setWarningId(vo.getRecord().getId()); |
||||||
|
}); |
||||||
|
contentService.saveOrUpdateBatch(vo.getContents()); |
||||||
|
} |
||||||
|
return this.getDetail(vo.getRecord().getId()); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/getWarningInformList/{id}") |
||||||
|
public Result<List<WarningInformData>> getWarningInformList(@PathVariable("id")String id){ |
||||||
|
List<WarningInformData> list =recordService.getWarningInformData(id); |
||||||
|
return Result.success(list); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public List<String> isRejectNodeFlow(String node){ |
||||||
|
return switch (node) { |
||||||
|
case "leader" -> List.of( "state"); |
||||||
|
case "end" -> List.of("state", "leader"); |
||||||
|
default -> new ArrayList<>(); |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,97 @@ |
|||||||
|
package com.biutag.supervision.controller.work; |
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
||||||
|
import com.biutag.supervision.common.UserContextHolder; |
||||||
|
import com.biutag.supervision.constants.AppConstants; |
||||||
|
import com.biutag.supervision.constants.enums.RoleCodeEnum; |
||||||
|
import com.biutag.supervision.mapper.InformMessageMapper; |
||||||
|
import com.biutag.supervision.mapper.Report.ReportProjectMapper; |
||||||
|
import com.biutag.supervision.pojo.Result; |
||||||
|
import com.biutag.supervision.pojo.entity.InformMessage; |
||||||
|
import com.biutag.supervision.pojo.entity.SupPolice; |
||||||
|
import com.biutag.supervision.pojo.model.UserAuth; |
||||||
|
import com.biutag.supervision.pojo.param.Work.ProjectWorkQueryParam; |
||||||
|
import com.biutag.supervision.pojo.vo.work.MessageWorkVo; |
||||||
|
import com.biutag.supervision.pojo.vo.work.ProjectTabWorkVo; |
||||||
|
import com.biutag.supervision.pojo.vo.work.ProjectWorkVo; |
||||||
|
import com.biutag.supervision.service.InformMessageService; |
||||||
|
import com.biutag.supervision.service.Report.ReportProjectService; |
||||||
|
import com.biutag.supervision.service.SupPoliceService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@RequiredArgsConstructor |
||||||
|
@RestController |
||||||
|
@RequestMapping("/work") |
||||||
|
public class workController { |
||||||
|
|
||||||
|
private final SupPoliceService policeService; |
||||||
|
|
||||||
|
private final ReportProjectService projectService; |
||||||
|
|
||||||
|
private final InformMessageMapper informMessageMapper; |
||||||
|
//待办事项
|
||||||
|
@GetMapping("/{code}") |
||||||
|
public Result<List<ProjectWorkVo>> getWorkVoList(@PathVariable("code")String code){ |
||||||
|
ProjectWorkQueryParam queryParam =new ProjectWorkQueryParam(); |
||||||
|
queryParam.setCode(code); |
||||||
|
UserAuth user = UserContextHolder.getCurrentUser(); |
||||||
|
if(ObjectUtil.isNotEmpty(user)){ |
||||||
|
if(!AppConstants.USER_TYPE_SUPER.equals(user.getUserType())){ |
||||||
|
queryParam.setUserId(user.getUserName()); |
||||||
|
} |
||||||
|
} |
||||||
|
return Result.success(projectService.getProjectWork(queryParam)); |
||||||
|
} |
||||||
|
//tab数字
|
||||||
|
@GetMapping("/getWorkTab") |
||||||
|
public Result<ProjectTabWorkVo> getWorkTab(){ |
||||||
|
ProjectWorkQueryParam queryParam =new ProjectWorkQueryParam(); |
||||||
|
UserAuth user = UserContextHolder.getCurrentUser(); |
||||||
|
if(ObjectUtil.isNotEmpty(user)){ |
||||||
|
if(!AppConstants.USER_TYPE_SUPER.equals(user.getUserType())){ |
||||||
|
queryParam.setUserId(user.getUserName()); |
||||||
|
} |
||||||
|
} |
||||||
|
ProjectTabWorkVo workVo = projectService.getProjectTabWorkVo(queryParam); |
||||||
|
if(ObjectUtil.isEmpty(workVo)){ |
||||||
|
workVo=new ProjectTabWorkVo(); |
||||||
|
} |
||||||
|
workVo.setUnread(informMessageMapper.selectCount( |
||||||
|
new LambdaUpdateWrapper<InformMessage>().eq(InformMessage::getIsRead,"0") |
||||||
|
.eq(StrUtil.isNotBlank(queryParam.getUserId()),InformMessage::getRecipientId,queryParam.getUserId()) |
||||||
|
)); |
||||||
|
workVo.setRead(informMessageMapper.selectCount( |
||||||
|
new LambdaUpdateWrapper<InformMessage>().eq(InformMessage::getIsRead,"1") |
||||||
|
.eq(StrUtil.isNotBlank(queryParam.getUserId()),InformMessage::getRecipientId,queryParam.getUserId()) |
||||||
|
)); |
||||||
|
|
||||||
|
return Result.success(workVo); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/getMessageWorkList/{code}") |
||||||
|
public Result<List<MessageWorkVo>> getMessageWorkList(@PathVariable("code") String code){ |
||||||
|
UserAuth user = UserContextHolder.getCurrentUser(); |
||||||
|
ProjectWorkQueryParam queryParam=new ProjectWorkQueryParam(); |
||||||
|
if(ObjectUtil.isNotEmpty(user)){ |
||||||
|
if(!AppConstants.USER_TYPE_SUPER.equals(user.getUserType()) ){ |
||||||
|
queryParam.setUserId(user.getUserName()); |
||||||
|
} |
||||||
|
} |
||||||
|
queryParam.setCode(code); |
||||||
|
return Result.success(informMessageMapper.getMessageWorkReportList(queryParam)); |
||||||
|
} |
||||||
|
|
||||||
|
@GetMapping("/upMessageWork/{id}") |
||||||
|
public Result upMessageWork(@PathVariable("id") String id){ |
||||||
|
informMessageMapper.update(new LambdaUpdateWrapper<InformMessage>().set(InformMessage::getIsRead,"1").eq(InformMessage::getId,id)); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,11 @@ |
|||||||
|
package com.biutag.supervision.exception; |
||||||
|
|
||||||
|
public class AuthException extends RuntimeException { |
||||||
|
|
||||||
|
public AuthException() { |
||||||
|
} |
||||||
|
|
||||||
|
public AuthException(String message) { |
||||||
|
super(message); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,9 @@ |
|||||||
|
package com.biutag.supervision.flow.action; |
||||||
|
|
||||||
|
import com.biutag.supervision.pojo.dto.ActionDto; |
||||||
|
|
||||||
|
public interface Action { |
||||||
|
|
||||||
|
void next(ActionDto actionDto); |
||||||
|
|
||||||
|
} |
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue