Compare commits
10 Commits
2466d6c469
...
fd58282a4e
| Author | SHA1 | Date |
|---|---|---|
|
|
fd58282a4e | |
|
|
57ac9d44f0 | |
|
|
ac7e31bc23 | |
|
|
cdd4f29989 | |
|
|
e64f7a0de5 | |
|
|
d916e045ad | |
|
|
bb7740cc7b | |
|
|
195029761d | |
|
|
3e3e662333 | |
|
|
a167b6bd38 |
|
|
@ -1,4 +1,4 @@
|
||||||
# 漳河大坝安全api
|
# 歧义数据管理api
|
||||||
|
|
||||||
## 目录
|
## 目录
|
||||||
```
|
```
|
||||||
|
|
@ -41,3 +41,6 @@ resources
|
||||||
|_application-test.yml 测试环境配置文件
|
|_application-test.yml 测试环境配置文件
|
||||||
|_application-prod.yml 生产环境配置文件
|
|_application-prod.yml 生产环境配置文件
|
||||||
```
|
```
|
||||||
|
|
||||||
|
服务
|
||||||
|
10.10.2.75 yKRs4w7q9M
|
||||||
Binary file not shown.
113
pom.xml
113
pom.xml
|
|
@ -11,9 +11,9 @@
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>com.whdc</groupId>
|
<groupId>com.whdc</groupId>
|
||||||
<artifactId>zhdbaqapi</artifactId>
|
<artifactId>fxkh-txl-service</artifactId>
|
||||||
<version>1.0</version>
|
<version>1.0</version>
|
||||||
<description>漳河大坝安全api</description>
|
<description>防汛抗旱通讯录api</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
|
@ -22,19 +22,28 @@
|
||||||
<copy.jar.directory>target/release</copy.jar.directory>
|
<copy.jar.directory>target/release</copy.jar.directory>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<!-- 使用阿里 maven 库 -->
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>ali-maven</id>
|
<id>osgeo</id>
|
||||||
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
|
<name>OSGeo Release Repository</name>
|
||||||
|
<url>https://repo.osgeo.org/repository/release/</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
<releases>
|
<releases>
|
||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
</releases>
|
</releases>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>osgeo-snapshot</id>
|
||||||
|
<name>OSGeo Snapshot Repository</name>
|
||||||
|
<url>https://repo.osgeo.org/repository/snapshot/</url>
|
||||||
<snapshots>
|
<snapshots>
|
||||||
<enabled>true</enabled>
|
<enabled>true</enabled>
|
||||||
<updatePolicy>always</updatePolicy>
|
|
||||||
<checksumPolicy>fail</checksumPolicy>
|
|
||||||
</snapshots>
|
</snapshots>
|
||||||
|
<releases>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</releases>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
|
|
@ -53,6 +62,20 @@
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
<version>3.5.2</version>
|
<version>3.5.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.jeffreyning</groupId>
|
||||||
|
<artifactId>mybatisplus-plus</artifactId>
|
||||||
|
<version>1.7.2-RELEASE</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-validation</artifactId>
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
|
@ -72,17 +95,6 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- Sa-Token 权限认证, 在线文档:http://sa-token.dev33.cn/ -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.dev33</groupId>
|
|
||||||
<artifactId>sa-token-spring-boot-starter</artifactId>
|
|
||||||
<version>1.30.0</version>
|
|
||||||
</dependency><!-- Sa-Token 整合 Redis (使用 jackson 序列化方式) -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.dev33</groupId>
|
|
||||||
<artifactId>sa-token-dao-redis-jackson</artifactId>
|
|
||||||
<version>1.30.0</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- 提供Redis连接池 -->
|
<!-- 提供Redis连接池 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
|
|
@ -119,7 +131,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>fastjson</artifactId>
|
<artifactId>fastjson</artifactId>
|
||||||
<version>1.2.80</version>
|
<version>1.2.83</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- fastjson end-->
|
<!-- fastjson end-->
|
||||||
|
|
||||||
|
|
@ -134,12 +146,12 @@
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
将 jar 安装到本地库仓库,方便下面的打包插件统一处理
|
将 jar 安装到本地库仓库,方便下面的打包插件统一处理
|
||||||
mvn install:install-file -Dfile=C:/lisai/workspase/zhsk/zhdbaq-service/lib/DmJdbcDriver18.jar -DgroupId="com.dameng" -DartifactId=DmJdbcDriver18 -Dversion="8.1.2.114" -Dpackaging=jar
|
mvn install:install-file -Dfile=D:\Work\GS\Java\fxkh-txl-service\lib\DmJdbcDriver18.jar -DgroupId="com.dameng" -DartifactId=DmJdbcDriver18 -Dversion="8.1.2.114" -Dpackaging=jar
|
||||||
-->
|
-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.dameng</groupId>
|
<groupId>com.dameng</groupId>
|
||||||
<artifactId>DmJdbcDriver18</artifactId>
|
<artifactId>DmJdbcDriver18</artifactId>
|
||||||
<version>8.1.2.114</version>
|
<version>8.1.2.192</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--达梦数据库方言-->
|
<!--达梦数据库方言-->
|
||||||
|
|
@ -174,68 +186,19 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- joda-time end -->
|
<!-- joda-time end -->
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<!-- 1.生成的jar中,不要包含pom.xml和pom.properties这两个文件 -->
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<configuration>
|
<version>2.7.5</version>
|
||||||
<archive>
|
|
||||||
<addMavenDescriptor>false</addMavenDescriptor>
|
|
||||||
<manifest>
|
|
||||||
<!-- 是否要把第三方jar加入到类构建路径 -->
|
|
||||||
<addClasspath>true</addClasspath>
|
|
||||||
<!-- 外部依赖jar包的最终位置 -->
|
|
||||||
<classpathPrefix>lib/</classpathPrefix>
|
|
||||||
<!-- 项目启动类 -->
|
|
||||||
<mainClass>com.whdc.zhdbaqapi.ZhDbaqApiApplication</mainClass>
|
|
||||||
</manifest>
|
|
||||||
</archive>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<!--2.拷贝依赖到jar外面的lib目录-->
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-dependency-plugin</artifactId>
|
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>copy-lib</id>
|
|
||||||
<phase>package</phase>
|
|
||||||
<goals>
|
<goals>
|
||||||
<goal>copy-dependencies</goal>
|
<goal>repackage</goal>
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<outputDirectory>${copy.jar.directory}/lib</outputDirectory>
|
|
||||||
<excludeTransitive>false</excludeTransitive>
|
|
||||||
<stripVersion>false</stripVersion>
|
|
||||||
<includeScope>runtime</includeScope>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<!-- 3.把jar包拷贝到指定目录位置 -->
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-antrun-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>copy</id>
|
|
||||||
<phase>package</phase>
|
|
||||||
<configuration>
|
|
||||||
<target>
|
|
||||||
<copy todir="${copy.jar.directory}">
|
|
||||||
<fileset dir="${project.build.directory}">
|
|
||||||
<include name="${project.artifactId}.${project.version}.jar"/>
|
|
||||||
</fileset>
|
|
||||||
</copy>
|
|
||||||
</target>
|
|
||||||
</configuration>
|
|
||||||
<goals>
|
|
||||||
<goal>run</goal>
|
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,148 @@
|
||||||
|
CREATE TABLE "FXKH_TXL"."ADDRESS_BOOK"
|
||||||
|
(
|
||||||
|
"ID" INTEGER IDENTITY(1, 1) NOT NULL,
|
||||||
|
"NAME" VARCHAR(10) NOT NULL,
|
||||||
|
"PHONE" VARCHAR(11),
|
||||||
|
"TEL" VARCHAR(50),
|
||||||
|
"FAXES" VARCHAR(50),
|
||||||
|
"ORGANIZATION" VARCHAR(50),
|
||||||
|
"POSITION" VARCHAR(50),
|
||||||
|
"COMMENTS" VARCHAR(200),
|
||||||
|
"URL" VARCHAR(200),
|
||||||
|
"SORT" INTEGER DEFAULT 0,
|
||||||
|
"V" INTEGER DEFAULT 0,
|
||||||
|
"ROLE" CHAR(1) DEFAULT 0,
|
||||||
|
NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "MAIN", CLUSTERBTR) ;
|
||||||
|
|
||||||
|
COMMENT ON TABLE "FXKH_TXL"."ADDRESS_BOOK" IS '通讯录';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."ADDRESS_BOOK"."COMMENTS" IS '备注';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."ADDRESS_BOOK"."FAXES" IS '传真';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."ADDRESS_BOOK"."NAME" IS '姓名';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."ADDRESS_BOOK"."ORGANIZATION" IS '组织';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."ADDRESS_BOOK"."PHONE" IS '手机号';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."ADDRESS_BOOK"."POSITION" IS '职务';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."ADDRESS_BOOK"."ROLE" IS '0:普通管理员,1:政区管理员,99:系统管理员';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."ADDRESS_BOOK"."SORT" IS '序号';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."ADDRESS_BOOK"."TEL" IS '电话';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."ADDRESS_BOOK"."URL" IS '图片路径';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."ADDRESS_BOOK"."V" IS '版本';
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE "FXKH_TXL"."ADINFO"
|
||||||
|
(
|
||||||
|
"ADCD" CHAR(15) NOT NULL,
|
||||||
|
"ADNM" VARCHAR(32) NOT NULL,
|
||||||
|
NOT CLUSTER PRIMARY KEY("ADCD")) STORAGE(ON "MAIN", CLUSTERBTR) ;
|
||||||
|
|
||||||
|
COMMENT ON TABLE "FXKH_TXL"."ADINFO" IS '行政区划基础信息';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."ADINFO"."ADCD" IS '政区编码';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."ADINFO"."ADNM" IS '政区名称';
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE "FXKH_TXL"."UNIT_DICT"
|
||||||
|
(
|
||||||
|
"ID" INTEGER IDENTITY(1, 1) NOT NULL,
|
||||||
|
"NAME" VARCHAR(50) NOT NULL,
|
||||||
|
"SORT" INTEGER DEFAULT 0 NOT NULL,
|
||||||
|
"TYPE" CHAR(1) NOT NULL,
|
||||||
|
NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "MAIN", CLUSTERBTR) ;
|
||||||
|
|
||||||
|
COMMENT ON TABLE "FXKH_TXL"."UNIT_DICT" IS '单位字典表';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."UNIT_DICT"."NAME" IS '名称';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."UNIT_DICT"."SORT" IS '序号';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."UNIT_DICT"."TYPE" IS '1:联络名单, 2: 湖泊及涉湖泵站,3:重要提防,4:大型水库大坝';
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE "FXKH_TXL"."FC"
|
||||||
|
(
|
||||||
|
"ID" INTEGER IDENTITY(1, 1) NOT NULL,
|
||||||
|
"USER_ID" INTEGER NOT NULL,
|
||||||
|
"AB_ID" INTEGER NOT NULL,
|
||||||
|
"SORT" INTEGER DEFAULT 0,
|
||||||
|
"TYPE" CHAR(1),
|
||||||
|
NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "MAIN", CLUSTERBTR) ;
|
||||||
|
|
||||||
|
COMMENT ON TABLE "FXKH_TXL"."FC" IS '常用联系人';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."FC"."AB_ID" IS '通讯录编号';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."FC"."SORT" IS '序号';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."FC"."TYPE" IS '0:常用联系人,1:置顶联系人';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."FC"."USER_ID" IS '用户编号';
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE "FXKH_TXL"."LOGIN_INFO"
|
||||||
|
(
|
||||||
|
"ID" INTEGER IDENTITY(1, 1) NOT NULL,
|
||||||
|
"IP" VARCHAR(50),
|
||||||
|
"CREATE_ID" VARCHAR(50),
|
||||||
|
"CREATE_TIME" DATETIME(0),
|
||||||
|
"TYPE" CHAR(1) NOT NULL,
|
||||||
|
NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "MAIN", CLUSTERBTR) ;
|
||||||
|
|
||||||
|
COMMENT ON TABLE "FXKH_TXL"."LOGIN_INFO" IS '登录日志';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."LOGIN_INFO"."CREATE_ID" IS '新增人id';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."LOGIN_INFO"."CREATE_TIME" IS '新增时间';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."LOGIN_INFO"."TYPE" IS '0:密码登录 1:验证码登录';
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE "FXKH_TXL"."ORGANIZATION"
|
||||||
|
(
|
||||||
|
"ID" INTEGER IDENTITY(1, 1) NOT NULL,
|
||||||
|
"OBJ_ID" VARCHAR(50) NOT NULL,
|
||||||
|
"NAME" VARCHAR(50) NOT NULL,
|
||||||
|
"SORT" INTEGER DEFAULT 0,
|
||||||
|
"ADCD" CHAR(15) NOT NULL,
|
||||||
|
NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "MAIN", CLUSTERBTR) ;
|
||||||
|
|
||||||
|
COMMENT ON TABLE "FXKH_TXL"."ORGANIZATION" IS '组织表';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."ORGANIZATION"."ADCD" IS '政区编码';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."ORGANIZATION"."NAME" IS '名称';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."ORGANIZATION"."OBJ_ID" IS '编号';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."ORGANIZATION"."SORT" IS '序号';
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE "FXKH_TXL"."USER"
|
||||||
|
(
|
||||||
|
"ID" INTEGER IDENTITY(1, 1) NOT NULL,
|
||||||
|
"PASSWORD" VARCHAR(50) NOT NULL,
|
||||||
|
"SALT" VARCHAR(50),
|
||||||
|
"AB_ID" INTEGER,
|
||||||
|
NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "MAIN", CLUSTERBTR) ;
|
||||||
|
|
||||||
|
COMMENT ON TABLE "FXKH_TXL"."USER" IS '用户表';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."USER"."AB_ID" IS '通讯录id';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."USER"."PASSWORD" IS '密码';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."USER"."SALT" IS '盐值';
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE "FXKH_TXL"."VERSIONS"
|
||||||
|
(
|
||||||
|
"ID" INTEGER IDENTITY(1, 1) NOT NULL,
|
||||||
|
"JSON" VARCHAR(2000),
|
||||||
|
"AB_ID" INTEGER,
|
||||||
|
"VERSION" INTEGER DEFAULT 0,
|
||||||
|
"CREATE_ID" VARCHAR(50),
|
||||||
|
"CREATE_TIME" DATETIME(0),
|
||||||
|
"TYPE" CHAR(1) DEFAULT 0,
|
||||||
|
NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "MAIN", CLUSTERBTR) ;
|
||||||
|
|
||||||
|
COMMENT ON TABLE "FXKH_TXL"."VERSIONS" IS '通讯录日志';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."VERSIONS"."AB_ID" IS '通讯录编号';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."VERSIONS"."CREATE_ID" IS '新增人id';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."VERSIONS"."CREATE_TIME" IS '新增时间';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."VERSIONS"."JSON" IS '数据';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."VERSIONS"."TYPE" IS '0:添加用户,1:修改用户,2:修改权限,3:删除用户';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."VERSIONS"."VERSION" IS '版本号';
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE "FXKH_TXL"."AB_UD_R"
|
||||||
|
(
|
||||||
|
"AD_ID" INTEGER,
|
||||||
|
"DICT_ID" INTEGER,
|
||||||
|
"SORT" INTEGER) STORAGE(ON "MAIN", CLUSTERBTR) ;
|
||||||
|
|
||||||
|
COMMENT ON TABLE "FXKH_TXL"."AB_UD_R" IS '用户单位字典关联表';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."AB_UD_R"."AD_ID" IS '联系人id';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."AB_UD_R"."DICT_ID" IS '字典id';
|
||||||
|
COMMENT ON COLUMN "FXKH_TXL"."AB_UD_R"."SORT" IS '序号';
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.whdc.zhdbaqapi;
|
package com.whdc;
|
||||||
|
|
||||||
import cn.dev33.satoken.SaManager;
|
|
||||||
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
|
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
|
@ -21,14 +20,12 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
@EnableCaching
|
@EnableCaching
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@MapperScan("com.whdc.zhdbaqapi.mapper")
|
@MapperScan("com.whdc.mapper")
|
||||||
public class ZhDbaqApiApplication {
|
public class RuleApiApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
SpringApplication.run(ZhDbaqApiApplication.class, args);
|
SpringApplication.run(RuleApiApplication.class, args);
|
||||||
|
|
||||||
System.out.println("启动成功:Sa-Token 配置如下:" + SaManager.getConfig());
|
|
||||||
|
|
||||||
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>> 启动完成 <<<<<<<<<<<<<<<<<<<<<<<<<<<");
|
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>> 启动完成 <<<<<<<<<<<<<<<<<<<<<<<<<<<");
|
||||||
} catch (BeansException e) {
|
} catch (BeansException e) {
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.whdc.zhdbaqapi.annotation;
|
package com.whdc.annotation;
|
||||||
|
|
||||||
import javax.validation.Constraint;
|
import javax.validation.Constraint;
|
||||||
import javax.validation.Payload;
|
import javax.validation.Payload;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.whdc.zhdbaqapi.annotation;
|
package com.whdc.annotation;
|
||||||
|
|
||||||
import org.apache.commons.beanutils.BeanUtils;
|
import org.apache.commons.beanutils.BeanUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package com.whdc.zhdbaqapi.aspect;
|
package com.whdc.aspect;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.fastjson.support.spring.PropertyPreFilters;
|
import com.alibaba.fastjson.support.spring.PropertyPreFilters;
|
||||||
import com.whdc.zhdbaqapi.utils.ReqUtils;
|
import com.whdc.utils.ReqUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
|
|
@ -34,7 +34,7 @@ public class WebLogAspect {
|
||||||
log.info(fmt, str);
|
log.info(fmt, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Pointcut("execution(public * com.whdc.zhdbaqapi.controller.*Controller.*(..))")
|
@Pointcut("execution(public * com.whdc.controller.*Controller.*(..))")
|
||||||
public void controllerPointcut() {
|
public void controllerPointcut() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.whdc.zhdbaqapi.component;
|
package com.whdc.component;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.whdc.zhdbaqapi.config;
|
package com.whdc.config;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.whdc.zhdbaqapi.config;
|
package com.whdc.config;
|
||||||
|
|
||||||
import com.github.xiaoymin.knife4j.spring.extension.OpenApiExtensionResolver;
|
import com.github.xiaoymin.knife4j.spring.extension.OpenApiExtensionResolver;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -30,9 +30,9 @@ public class Knife4jConfiguration {
|
||||||
|
|
||||||
private ApiInfo getApiInfoBuilder() {
|
private ApiInfo getApiInfoBuilder() {
|
||||||
return new ApiInfoBuilder()
|
return new ApiInfoBuilder()
|
||||||
.title("漳河大坝安全api")
|
.title("歧义数据管理api")
|
||||||
.description("# 漳河大坝安全api RESTful APIs")
|
.description("# 歧义数据管理api RESTful APIs")
|
||||||
.termsOfServiceUrl("http://219.138.108.99:19000/dbaq")
|
.termsOfServiceUrl("http://219.138.108.99:19000/jszx")
|
||||||
.contact(new Contact("湖北纬皓端成", null, null))
|
.contact(new Contact("湖北纬皓端成", null, null))
|
||||||
.version("1.0")
|
.version("1.0")
|
||||||
.build();
|
.build();
|
||||||
|
|
@ -46,7 +46,7 @@ public class Knife4jConfiguration {
|
||||||
.groupName("v1.0")
|
.groupName("v1.0")
|
||||||
.select()
|
.select()
|
||||||
//这里指定Controller扫描包路径
|
//这里指定Controller扫描包路径
|
||||||
.apis(RequestHandlerSelectors.basePackage("com.whdc.zhdbaqapi.controller"))
|
.apis(RequestHandlerSelectors.basePackage("com.whdc.controller"))
|
||||||
.paths(PathSelectors.any())
|
.paths(PathSelectors.any())
|
||||||
.build()
|
.build()
|
||||||
.extensions(openApiExtensionResolver.buildExtensions("v1.0"));
|
.extensions(openApiExtensionResolver.buildExtensions("v1.0"));
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.whdc.zhdbaqapi.config;
|
package com.whdc.config;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.DbType;
|
import com.baomidou.mybatisplus.annotation.DbType;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
|
|
@ -12,7 +12,7 @@ import org.springframework.context.annotation.Configuration;
|
||||||
* @date 2022-04-08 0:33
|
* @date 2022-04-08 0:33
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@MapperScan("com.whdc.zhdbaqapi.mapper")
|
@MapperScan("com.whdc.mapper")
|
||||||
public class MyBatisPlusConfig {
|
public class MyBatisPlusConfig {
|
||||||
|
|
||||||
/* 旧版本配置
|
/* 旧版本配置
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
package com.whdc.config;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.ibatis.executor.Executor;
|
||||||
|
import org.apache.ibatis.mapping.MappedStatement;
|
||||||
|
import org.apache.ibatis.mapping.SqlCommandType;
|
||||||
|
import org.apache.ibatis.plugin.Interceptor;
|
||||||
|
import org.apache.ibatis.plugin.Intercepts;
|
||||||
|
import org.apache.ibatis.plugin.Invocation;
|
||||||
|
import org.apache.ibatis.plugin.Signature;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static com.whdc.model.MyConstant.REC;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@Intercepts({@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class})})
|
||||||
|
public class MybatisInterceptor implements Interceptor {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object intercept(Invocation invocation) throws Throwable {
|
||||||
|
MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0];
|
||||||
|
String sqlId = mappedStatement.getId();
|
||||||
|
log.debug("------sqlId------" + sqlId);
|
||||||
|
SqlCommandType sqlCommandType = mappedStatement.getSqlCommandType();
|
||||||
|
Object parameter = invocation.getArgs()[1];
|
||||||
|
log.debug("------sqlCommandType------" + sqlCommandType);
|
||||||
|
|
||||||
|
if (parameter == null) {
|
||||||
|
return invocation.proceed();
|
||||||
|
}
|
||||||
|
if (SqlCommandType.INSERT == sqlCommandType || SqlCommandType.UPDATE == sqlCommandType) {
|
||||||
|
Field[] fields = parameter.getClass().getDeclaredFields();
|
||||||
|
// Field[] fields = oConvertUtils.getAllFields(parameter);
|
||||||
|
for (Field field : fields) {
|
||||||
|
if (field.getType().equals(String.class)) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
Object o = field.get(parameter);
|
||||||
|
field.setAccessible(false);
|
||||||
|
String newVal = o == null ? "" : String.valueOf(o).trim();
|
||||||
|
field.setAccessible(true);
|
||||||
|
field.set(parameter, newVal);
|
||||||
|
field.setAccessible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 注入创建时间
|
||||||
|
if ("createtime".equals(field.getName())) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
Object local_createDate = field.get(parameter);
|
||||||
|
field.setAccessible(false);
|
||||||
|
if (local_createDate == null || "".equals(local_createDate)) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
field.set(parameter, new Date());
|
||||||
|
field.setAccessible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除标识
|
||||||
|
if ("del".equals(field.getName())) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
Object local_createDate = field.get(parameter);
|
||||||
|
field.setAccessible(false);
|
||||||
|
if (local_createDate == null || "".equals(local_createDate)) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
field.set(parameter, REC);
|
||||||
|
field.setAccessible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return invocation.proceed();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
package com.whdc.zhdbaqapi.config;
|
package com.whdc.config;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
|
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||||
|
|
@ -18,6 +22,7 @@ import java.util.Arrays;
|
||||||
@Configuration
|
@Configuration
|
||||||
public class RestTemplateConfig {
|
public class RestTemplateConfig {
|
||||||
|
|
||||||
|
@Order(1)
|
||||||
@Bean
|
@Bean
|
||||||
public RestTemplate restTemplate(@Qualifier("simpleClientHttpRequestFactory") ClientHttpRequestFactory factory){
|
public RestTemplate restTemplate(@Qualifier("simpleClientHttpRequestFactory") ClientHttpRequestFactory factory){
|
||||||
RestTemplate restTemplate = new RestTemplate(factory);
|
RestTemplate restTemplate = new RestTemplate(factory);
|
||||||
|
|
@ -30,6 +35,7 @@ public class RestTemplateConfig {
|
||||||
return restTemplate;
|
return restTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Order(2)
|
||||||
@Bean
|
@Bean
|
||||||
public RestTemplate restTemplate() {
|
public RestTemplate restTemplate() {
|
||||||
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
|
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
|
||||||
|
|
@ -38,4 +44,17 @@ public class RestTemplateConfig {
|
||||||
|
|
||||||
return new RestTemplate(requestFactory);
|
return new RestTemplate(requestFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Order(4)
|
||||||
|
@Bean("redisTemplate")
|
||||||
|
public RedisTemplate<String, String> redisTemplate(LettuceConnectionFactory lettuceConnectionFactory) {
|
||||||
|
RedisTemplate<String, String> template = new RedisTemplate<>();
|
||||||
|
template.setConnectionFactory(lettuceConnectionFactory);
|
||||||
|
// 设置键和值的序列化方式,默认使用JDK的序列化方式
|
||||||
|
template.setKeySerializer(new StringRedisSerializer());
|
||||||
|
template.setValueSerializer(new StringRedisSerializer());
|
||||||
|
return template;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.whdc.config;
|
||||||
|
|
||||||
|
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.scheduling.annotation.AsyncConfigurer;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author XuSan
|
||||||
|
* @date 2021/1/11 16:39
|
||||||
|
* @explain 线程池类
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
//@Slf4j
|
||||||
|
public class ThreadPools implements AsyncConfigurer {
|
||||||
|
|
||||||
|
|
||||||
|
// 全核心线程池
|
||||||
|
@Bean(value = "intensivePool", destroyMethod = "shutdown")
|
||||||
|
public ExecutorService intensive() {
|
||||||
|
return Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(), new ThreadFactoryBuilder()
|
||||||
|
.setNameFormat("fixed -- %d").build());
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static Void handleException(Throwable ex) {
|
||||||
|
// log.error("请求出现异常:" + ex.getMessage(), ex);
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,138 @@
|
||||||
|
package com.whdc.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.whdc.model.dto.FindRuleDto;
|
||||||
|
import com.whdc.model.entity.ERule;
|
||||||
|
import com.whdc.model.entity.EStationRules;
|
||||||
|
import com.whdc.model.group.Insert;
|
||||||
|
import com.whdc.model.group.Update;
|
||||||
|
import com.whdc.service.IERuleService;
|
||||||
|
import com.whdc.service.IEStationRulesService;
|
||||||
|
import com.whdc.utils.ResultJson;
|
||||||
|
import com.whdc.valid.bean.ItemType;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xusan
|
||||||
|
* @since 2023-03-19
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Api(tags = "规则管理 - Controller")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/eRule")
|
||||||
|
public class ERuleController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IERuleService ieRuleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IEStationRulesService ieStationRulesService;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "查询所有")
|
||||||
|
@PostMapping(value = "list")
|
||||||
|
public ResultJson list() {
|
||||||
|
|
||||||
|
return ResultJson.ok(ieRuleService.list());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "分页查询")
|
||||||
|
@PostMapping(value = "page")
|
||||||
|
public ResultJson page(@RequestBody FindRuleDto ruleDto) {
|
||||||
|
|
||||||
|
return ResultJson.ok(ieRuleService.page(ruleDto));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "添加")
|
||||||
|
@PostMapping(value = "save")
|
||||||
|
public ResultJson insert(@RequestBody @Validated(Insert.class) ERule model) {
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(
|
||||||
|
ieRuleService.lambdaQuery()
|
||||||
|
.eq(ERule::getName,String.valueOf(model.getName()).trim())
|
||||||
|
.list())
|
||||||
|
){
|
||||||
|
return ResultJson.error("该名称重复");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
Objects.isNull(model.getDiffMax())
|
||||||
|
&& Objects.isNull(model.getMin())
|
||||||
|
&& Objects.isNull(model.getMax())
|
||||||
|
&& Objects.isNull(model.getDuration())
|
||||||
|
&& Objects.isNull(model.getLagTime())
|
||||||
|
&& Objects.isNull(model.getLeadingTime())
|
||||||
|
){
|
||||||
|
return ResultJson.error("请设置规则");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ItemType.map().containsKey(model.getItem())) {
|
||||||
|
return ResultJson.error("规则类型不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResultJson.ok(ieRuleService.save(model));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "修改")
|
||||||
|
@PostMapping(value = "edit")
|
||||||
|
public ResultJson update(@RequestBody @Validated(Update.class) ERule model) {
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(
|
||||||
|
ieRuleService.lambdaQuery()
|
||||||
|
.eq(ERule::getName,String.valueOf(model.getName()).trim())
|
||||||
|
.ne(ERule::getId, model.getId())
|
||||||
|
.list())
|
||||||
|
){
|
||||||
|
return ResultJson.error("该名称重复");
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResultJson.ok(ieRuleService.updateById(model));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "删除")
|
||||||
|
@GetMapping(value = "del/{id}")
|
||||||
|
public ResultJson delete(@PathVariable("id") Integer id) {
|
||||||
|
|
||||||
|
|
||||||
|
if (Objects.isNull(ieRuleService.getById(id))) {
|
||||||
|
|
||||||
|
return ResultJson.error("当前数据不存在");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ieStationRulesService.lambdaUpdate()
|
||||||
|
.set(EStationRules::getDel,"0")
|
||||||
|
.eq(EStationRules::getRuleId,id)
|
||||||
|
.update()) {
|
||||||
|
|
||||||
|
log.info("规则关联删除失败");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResultJson.ok(ieRuleService.removeById(id));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取规则类型")
|
||||||
|
@GetMapping(value = "getItem")
|
||||||
|
public ResultJson getItem() {
|
||||||
|
return ResultJson.ok(ItemType.list());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,123 @@
|
||||||
|
package com.whdc.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.whdc.model.dto.ERuleDtoTest;
|
||||||
|
import com.whdc.model.dto.FindStationDto;
|
||||||
|
import com.whdc.model.entity.EStationRules;
|
||||||
|
import com.whdc.model.group.Insert;
|
||||||
|
import com.whdc.model.group.Update;
|
||||||
|
import com.whdc.service.IERuleService;
|
||||||
|
import com.whdc.service.IEStationRulesService;
|
||||||
|
import com.whdc.utils.ResultJson;
|
||||||
|
import com.whdc.valid.service.ValidateService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xusan
|
||||||
|
* @since 2023-03-19
|
||||||
|
*/
|
||||||
|
@Api(tags = "站点规则管理 - Controller")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/eStationRule")
|
||||||
|
public class EStationRulesController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IEStationRulesService ieStationRulesService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IERuleService ieruleService;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "查询全部")
|
||||||
|
@PostMapping(value = "find")
|
||||||
|
public ResultJson find(@RequestBody FindStationDto eStationRules) {
|
||||||
|
return ResultJson.ok(ieStationRulesService.find(eStationRules));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "分页查询")
|
||||||
|
@PostMapping(value = "page")
|
||||||
|
public ResultJson page(@RequestBody FindStationDto eStationRules) {
|
||||||
|
return ResultJson.ok(ieStationRulesService.page(eStationRules));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "新增测站规则")
|
||||||
|
@PostMapping(value = "save")
|
||||||
|
public ResultJson bind(@RequestBody @Validated({Insert.class}) EStationRules eStationRules) {
|
||||||
|
|
||||||
|
if (Objects.isNull(ieruleService.getById(eStationRules.getRuleId()))) {
|
||||||
|
return ResultJson.error("当前规则不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(
|
||||||
|
ieStationRulesService.lambdaQuery()
|
||||||
|
.eq(EStationRules::getStcd,eStationRules.getStcd())
|
||||||
|
.eq(EStationRules::getRuleId,eStationRules.getRuleId())
|
||||||
|
.list()
|
||||||
|
)){
|
||||||
|
return ResultJson.error("当前规则和测站已绑定");
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResultJson.ok(ieStationRulesService.save(eStationRules));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "修改测站规则")
|
||||||
|
@PostMapping(value = "update")
|
||||||
|
public ResultJson bindUpdate(@RequestBody @Validated({Update.class}) EStationRules eStationRules) {
|
||||||
|
|
||||||
|
if (Objects.isNull(ieStationRulesService.getById(eStationRules.getId()))) {
|
||||||
|
|
||||||
|
return ResultJson.error("当前数据不存在");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Objects.isNull(ieruleService.getById(eStationRules.getRuleId()))) {
|
||||||
|
return ResultJson.error("当前规则不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (CollectionUtils.isNotEmpty(
|
||||||
|
// ieStationRulesService.lambdaQuery()
|
||||||
|
// .eq(EStationRules::getStcd,eStationRules.getStcd())
|
||||||
|
// .eq(EStationRules::getRuleId,eStationRules.getRuleId())
|
||||||
|
// .ne(EStationRules::getId,eStationRules.getId())
|
||||||
|
// .list()
|
||||||
|
// )){
|
||||||
|
// return ResultJson.error("当前规则和测站已绑定");
|
||||||
|
// }
|
||||||
|
|
||||||
|
return ResultJson.ok(ieStationRulesService.updateById(eStationRules));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "删除")
|
||||||
|
@GetMapping(value = "del/{id}")
|
||||||
|
public ResultJson del(@PathVariable Integer id) {
|
||||||
|
|
||||||
|
EStationRules model = ieStationRulesService.getById(id);
|
||||||
|
if (Objects.isNull(model)) {
|
||||||
|
|
||||||
|
return ResultJson.error("当前数据不存在");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResultJson.ok(ieStationRulesService.removeById(id,model));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ValidateService validateService;
|
||||||
|
|
||||||
|
@ApiOperation(value = "规则测试 ")
|
||||||
|
@PostMapping(value = "testRule")
|
||||||
|
public ResultJson testRule(@RequestBody ERuleDtoTest test) {
|
||||||
|
return ResultJson.ok(validateService.validate(test.getStr() ,test.getOldStr()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.whdc.zhdbaqapi.exception;
|
package com.whdc.exception;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
||||||
|
|
@ -36,7 +36,6 @@ public class CustomErrorController extends BasicErrorController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 覆盖默认的JSON响应
|
* 覆盖默认的JSON响应
|
||||||
* 发送的请求类型是 json 时,出现异常时的返回
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Map<String, Object>> error(HttpServletRequest request) {
|
public ResponseEntity<Map<String, Object>> error(HttpServletRequest request) {
|
||||||
|
|
@ -55,7 +54,6 @@ public class CustomErrorController extends BasicErrorController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 覆盖默认的HTML响应
|
* 覆盖默认的HTML响应
|
||||||
* 发送的请求类型是 html 时,出现异常时的返回
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ModelAndView errorHtml(HttpServletRequest request, HttpServletResponse response) {
|
public ModelAndView errorHtml(HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.whdc.zhdbaqapi.exception;
|
package com.whdc.exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 李赛
|
* @author 李赛
|
||||||
|
|
@ -7,7 +7,7 @@ package com.whdc.zhdbaqapi.exception;
|
||||||
|
|
||||||
public class MyException extends RuntimeException {
|
public class MyException extends RuntimeException {
|
||||||
|
|
||||||
private String msg;
|
private final String msg;
|
||||||
|
|
||||||
public String getMsg() {
|
public String getMsg() {
|
||||||
return msg;
|
return msg;
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.whdc.zhdbaqapi.exception;
|
package com.whdc.exception;
|
||||||
|
|
||||||
import cn.dev33.satoken.exception.NotLoginException;
|
import com.whdc.utils.ResultJson;
|
||||||
import com.whdc.zhdbaqapi.utils.ResultJson;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.dao.DataIntegrityViolationException;
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
|
|
@ -87,12 +86,12 @@ public class MyExceptionHandler {
|
||||||
strbuf.append(err.getDefaultMessage());
|
strbuf.append(err.getDefaultMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultJson.error(ResultJson.PARAM_ERROR, "参数验证失败:" + strbuf.toString());
|
return ResultJson.error(ResultJson.PARAM_ERROR, "参数验证失败1:" + strbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultJson.error(ResultJson.PARAM_ERROR, "参数验证失败");
|
return ResultJson.error(ResultJson.PARAM_ERROR, "参数验证失败2");
|
||||||
} catch (Exception err) {
|
} catch (Exception err) {
|
||||||
return ResultJson.error(ResultJson.PARAM_ERROR, "参数验证失败," + err.getMessage());
|
return ResultJson.error(ResultJson.PARAM_ERROR, "参数验证失败3," + err.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,8 +119,8 @@ public class MyExceptionHandler {
|
||||||
Set<ConstraintViolation<?>> violations = e.getConstraintViolations();
|
Set<ConstraintViolation<?>> violations = e.getConstraintViolations();
|
||||||
ConstraintViolation<?> violation = violations.iterator().next();
|
ConstraintViolation<?> violation = violations.iterator().next();
|
||||||
String message = violation.getMessage();
|
String message = violation.getMessage();
|
||||||
log.error("参数验证失败 " + message, e);
|
log.error("参数验证失败4 " + message, e);
|
||||||
return ResultJson.error(ResultJson.PARAM_ERROR, "参数验证失败," + message);
|
return ResultJson.error(ResultJson.PARAM_ERROR, "参数验证失败5," + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -130,8 +129,9 @@ public class MyExceptionHandler {
|
||||||
@ResponseStatus(HttpStatus.OK)
|
@ResponseStatus(HttpStatus.OK)
|
||||||
@ExceptionHandler(ValidationException.class)
|
@ExceptionHandler(ValidationException.class)
|
||||||
public ResultJson handleValidationException(ValidationException e) {
|
public ResultJson handleValidationException(ValidationException e) {
|
||||||
log.error("参数验证失败 " + e.getMessage(), e);
|
log.error("参数验证失败6 " + e.getMessage());
|
||||||
return ResultJson.error(ResultJson.PARAM_ERROR, "参数验证失败");
|
e.printStackTrace();
|
||||||
|
return ResultJson.error(ResultJson.PARAM_ERROR, "参数验证失败7");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -196,11 +196,4 @@ public class MyExceptionHandler {
|
||||||
return ResultJson.error(ResultJson.FAIL, msg);
|
return ResultJson.error(ResultJson.FAIL, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseStatus(HttpStatus.OK)
|
|
||||||
@ExceptionHandler(NotLoginException.class)
|
|
||||||
public ResultJson handleNotLoginException(NotLoginException e) {
|
|
||||||
log.error("业务逻辑异常", e);
|
|
||||||
|
|
||||||
return ResultJson.error(ResultJson.UNAUTHORIZED, e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.whdc.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.whdc.model.entity.AbUdR;
|
||||||
|
|
||||||
|
public interface AbUdRMapper extends BaseMapper<AbUdR> {
|
||||||
|
int insert(AbUdR record);
|
||||||
|
|
||||||
|
int insertSelective(AbUdR record);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.whdc.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.whdc.model.entity.AddressBook;
|
||||||
|
|
||||||
|
public interface AddressBookMapper extends BaseMapper<AddressBook> {
|
||||||
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int insert(AddressBook record);
|
||||||
|
|
||||||
|
int insertSelective(AddressBook record);
|
||||||
|
|
||||||
|
AddressBook selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(AddressBook record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(AddressBook record);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.whdc.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.whdc.model.entity.Adinfo;
|
||||||
|
|
||||||
|
public interface AdinfoMapper extends BaseMapper<Adinfo> {
|
||||||
|
int deleteByPrimaryKey(String adcd);
|
||||||
|
|
||||||
|
int insert(Adinfo record);
|
||||||
|
|
||||||
|
int insertSelective(Adinfo record);
|
||||||
|
|
||||||
|
Adinfo selectByPrimaryKey(String adcd);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(Adinfo record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(Adinfo record);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.whdc.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.whdc.model.entity.Fc;
|
||||||
|
|
||||||
|
public interface FcMapper extends BaseMapper<Fc> {
|
||||||
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int insert(Fc record);
|
||||||
|
|
||||||
|
int insertSelective(Fc record);
|
||||||
|
|
||||||
|
Fc selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(Fc record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(Fc record);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.whdc.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.whdc.model.entity.LoginInfo;
|
||||||
|
|
||||||
|
public interface LoginInfoMapper extends BaseMapper<LoginInfo> {
|
||||||
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int insert(LoginInfo record);
|
||||||
|
|
||||||
|
int insertSelective(LoginInfo record);
|
||||||
|
|
||||||
|
LoginInfo selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(LoginInfo record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(LoginInfo record);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.whdc.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.whdc.model.entity.Organization;
|
||||||
|
|
||||||
|
public interface OrganizationMapper extends BaseMapper<Organization> {
|
||||||
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int insert(Organization record);
|
||||||
|
|
||||||
|
int insertSelective(Organization record);
|
||||||
|
|
||||||
|
Organization selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(Organization record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(Organization record);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.whdc.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.whdc.model.entity.Organization;
|
||||||
|
import com.whdc.model.entity.UnitDict;
|
||||||
|
|
||||||
|
public interface UnitDictMapper extends BaseMapper<UnitDict> {
|
||||||
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int insert(UnitDict record);
|
||||||
|
|
||||||
|
int insertSelective(UnitDict record);
|
||||||
|
|
||||||
|
UnitDict selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(UnitDict record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(UnitDict record);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.whdc.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.whdc.model.entity.UnitDict;
|
||||||
|
import com.whdc.model.entity.User;
|
||||||
|
|
||||||
|
public interface UserMapper extends BaseMapper<User> {
|
||||||
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int insert(User record);
|
||||||
|
|
||||||
|
int insertSelective(User record);
|
||||||
|
|
||||||
|
User selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(User record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(User record);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.whdc.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.whdc.model.entity.Versions;
|
||||||
|
|
||||||
|
public interface VersionsMapper extends BaseMapper<Versions> {
|
||||||
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int insert(Versions record);
|
||||||
|
|
||||||
|
int insertSelective(Versions record);
|
||||||
|
|
||||||
|
Versions selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(Versions record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(Versions record);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.whdc.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xusan
|
||||||
|
* @date 2023/4/27 9:41
|
||||||
|
*/
|
||||||
|
public class MyConstant {
|
||||||
|
|
||||||
|
public static final String
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
DEL = "0",
|
||||||
|
|
||||||
|
// 未删除
|
||||||
|
REC = "1",
|
||||||
|
|
||||||
|
|
||||||
|
// redis KEY
|
||||||
|
TOKEN_KEY = "SW_TOKEN_SJQX";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据-数据服务运维员 角色编码
|
||||||
|
*/
|
||||||
|
public static final String ROLE_PUSH = "data_zh_om";
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.whdc.model.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Max;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xusan
|
||||||
|
* @date 2023年3月20日08:57:22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ERuleDto {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键自增
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "主键自增", required = true, example = "0")
|
||||||
|
@ApiModelProperty(value = "主键自增", required = true, dataType = "Integer", example = "0")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则名称
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "规则名称", required = true, example = "规则名称")
|
||||||
|
@ApiModelProperty(value = "规则名称", required = true, dataType = "String", example = "规则名称")
|
||||||
|
@NotEmpty(message = "规则名称不能为空")
|
||||||
|
@Max(50)
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 1:正常值范围规则
|
||||||
|
* 2:最大差值规则
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "1:正常值范围规则 2:最大差值规则", required = false, example = "1:正常值范围规则 2:最大差值规则 ")
|
||||||
|
@ApiModelProperty(value = "1:正常值范围规则 2:最大差值规则, required = false ", dataType = "String", example = " 1:正常值范围规则 2:最大差值规则 ")
|
||||||
|
@NotEmpty(message = "规则类型不能为空")
|
||||||
|
private String ruleType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测站类型
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "测站类型", required = true, example = "测站类型")
|
||||||
|
@ApiModelProperty(value = "测站类型", required = true, dataType = "String", example = "测站类型")
|
||||||
|
@NotEmpty(message = "测站类型不能为空")
|
||||||
|
@Max(2)
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最小值
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "最小值", required = false, example = "最小值")
|
||||||
|
@ApiModelProperty(value = "最小值", required = false, dataType = "String", example = "最小值")
|
||||||
|
@Max(100)
|
||||||
|
private String min;
|
||||||
|
/**
|
||||||
|
* 最大值
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "最大值", required = false, example = "最大值")
|
||||||
|
@ApiModelProperty(value = "最大值", required = false, dataType = "String", example = "最大值")
|
||||||
|
@Max(100)
|
||||||
|
private String max;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 两条数据之间的差值
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "两条数据之间的差值", required = false, example = "两条数据之间的差值")
|
||||||
|
@ApiModelProperty(value = "两条数据之间的差值", required = false, dataType = "String", example = "两条数据之间的差值")
|
||||||
|
@Max(100)
|
||||||
|
private String lastDataMax;
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.whdc.zhdbaqapi.model.dto;
|
package com.whdc.model.dto;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
@ -9,19 +9,15 @@ import javax.validation.constraints.Pattern;
|
||||||
@Data
|
@Data
|
||||||
public class FindPageDto {
|
public class FindPageDto {
|
||||||
|
|
||||||
// 页数,从1开始,默认1
|
|
||||||
@ApiModelProperty(value = "当前页", example = "1")
|
@ApiModelProperty(value = "当前页", example = "1")
|
||||||
private Integer pageNumber = 1;
|
private Integer pageNumber = 1;
|
||||||
|
|
||||||
// 每页记录数,默认10
|
|
||||||
@ApiModelProperty(value = "每页条数", example = "10")
|
@ApiModelProperty(value = "每页条数", example = "10")
|
||||||
private Integer pageSize = 10;
|
private Integer pageSize = 10;
|
||||||
|
|
||||||
// 是否统计总数,默认 true
|
|
||||||
@ApiModelProperty(value = "是否统计总数。数据量大时,为了提高查询效率,可以将该字段置为 false", example = "10")
|
@ApiModelProperty(value = "是否统计总数。数据量大时,为了提高查询效率,可以将该字段置为 false", example = "10")
|
||||||
private Boolean searchCount = true;
|
private Boolean searchCount = true;
|
||||||
|
|
||||||
// 排序字段
|
|
||||||
@ApiModelProperty(value = "排序字段")
|
@ApiModelProperty(value = "排序字段")
|
||||||
private String sortField;
|
private String sortField;
|
||||||
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.whdc.model.dto;
|
||||||
|
|
||||||
|
import com.whdc.annotation.DateTimeRange;
|
||||||
|
import com.whdc.model.group.Find;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.Pattern;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xusan
|
||||||
|
* @date 2023年3月20日08:57:22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@DateTimeRange(message = "时间间隔不能超过 31 天", startField = "stm", endField = "etm", interval = 31, timeUnit = TimeUnit.DAYS)
|
||||||
|
public class FindRuleDto extends FindPageDto {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规则名称", dataType = "java.lang.String")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规则类型", dataType = "java.lang.String")
|
||||||
|
private String item;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "起始时间", example = "2023-03-20 10:00:00")
|
||||||
|
@NotEmpty(message = "起始时间不能为空", groups = Find.class)
|
||||||
|
@Pattern(regexp = "^[1-9]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\\s+(20|21|22|23|[0-1]\\d):[0-5]\\d:[0-5]\\d$",
|
||||||
|
message = "时间格式应为:yyyy-MM-dd HH:mm:ss", groups = Find.class)
|
||||||
|
private String stm;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "截止时间", example = "2023-03-20 10:00:00")
|
||||||
|
@NotEmpty(message = "截止时间不能为空", groups = Find.class)
|
||||||
|
@Pattern(regexp = "^[1-9]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\\s+(20|21|22|23|[0-1]\\d):[0-5]\\d:[0-5]\\d$",
|
||||||
|
message = "时间格式应为:yyyy-MM-dd HH:mm:ss", groups = Find.class)
|
||||||
|
private String etm;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.whdc.model.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xusan
|
||||||
|
* @date 2023年3月20日08:57:22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class FindStationDto extends FindPageDto {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规则名称", dataType = "java.lang.String")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "测站编码", dataType = "java.lang.String")
|
||||||
|
private String stcd;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "适用测站类型", dataType = "java.lang.String")
|
||||||
|
private String item;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.whdc.model.entity;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class AbUdR {
|
||||||
|
private Integer adId;
|
||||||
|
|
||||||
|
private Integer dictId;
|
||||||
|
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.whdc.model.entity;
|
||||||
|
|
||||||
|
public class AddressBook {
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
private String tel;
|
||||||
|
|
||||||
|
private String faxes;
|
||||||
|
|
||||||
|
private String organization;
|
||||||
|
|
||||||
|
private String position;
|
||||||
|
|
||||||
|
private String comments;
|
||||||
|
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
private Integer v;
|
||||||
|
|
||||||
|
private String role;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.whdc.model.entity;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class Adinfo {
|
||||||
|
private String adcd;
|
||||||
|
|
||||||
|
private String adnm;
|
||||||
|
|
||||||
|
private BigDecimal lgtd;
|
||||||
|
|
||||||
|
private BigDecimal lttd;
|
||||||
|
|
||||||
|
private Integer ptcount;
|
||||||
|
|
||||||
|
private Integer hhtcount;
|
||||||
|
|
||||||
|
private Integer htcount;
|
||||||
|
|
||||||
|
private BigDecimal land;
|
||||||
|
|
||||||
|
private BigDecimal pland;
|
||||||
|
|
||||||
|
private Integer ctype;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,147 @@
|
||||||
|
package com.whdc.model.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.whdc.model.group.Insert;
|
||||||
|
import com.whdc.model.group.Update;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Max;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import static com.whdc.model.MyConstant.DEL;
|
||||||
|
import static com.whdc.model.MyConstant.REC;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xusan
|
||||||
|
* @date 2023-03-19
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel(description = "正常范围规则表")
|
||||||
|
@TableName("SHZH_IOT.E_RULE")
|
||||||
|
public class ERule extends Model<ERule> implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键自增
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "主键自增", required = true)
|
||||||
|
@ApiModelProperty(value = "主键自增", required = true, dataType = "Integer")
|
||||||
|
@TableId(value = "ID", type = IdType.AUTO)
|
||||||
|
@NotNull(message = "主键不能为空", groups = {Update.class})
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则名称
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "规则名称", required = true, example = "")
|
||||||
|
@ApiModelProperty(value = "规则名称", required = true, dataType = "String")
|
||||||
|
@TableField(value = "NAME", updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||||
|
@NotEmpty(message = "规则名称不能为空", groups = {Insert.class,Update.class})
|
||||||
|
@Max(50)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测站类型
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "规则类型", required = true, example = "")
|
||||||
|
@ApiModelProperty(value = "规则类型", required = true, dataType = "String")
|
||||||
|
@TableField(value = "ITEM", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
@NotEmpty(message = "规则类型不能为空", groups = {Insert.class,Update.class})
|
||||||
|
@Max(50)
|
||||||
|
private String item;
|
||||||
|
|
||||||
|
public void setItem(String item) {
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(item)){
|
||||||
|
item = item.toUpperCase(Locale.ROOT);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最小值
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "最小值", required = false, example = "")
|
||||||
|
@ApiModelProperty(value = "最小值", required = false, dataType = "Numeric")
|
||||||
|
@TableField(value = "MIN", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
@Max(50)
|
||||||
|
private BigDecimal min;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大值
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "最大值", required = false, example = "")
|
||||||
|
@ApiModelProperty(value = "最大值", required = false, dataType = "Numeric")
|
||||||
|
@TableField(value = "MAX", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
@Max(50)
|
||||||
|
private BigDecimal max;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大值
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "两条数据之间的最大差值", required = false, example = "")
|
||||||
|
@ApiModelProperty(value = "两条数据之间的最大差值", required = false, dataType = "Numeric")
|
||||||
|
@TableField(value = "DIFF_MAX", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private BigDecimal diffMax;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大值
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "时间段, 单位 s", required = false, example = "")
|
||||||
|
@ApiModelProperty(value = "时间段, 单位 s", required = false, dataType = "Numeric")
|
||||||
|
@TableField(value = "DURATION", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
@Max(10)
|
||||||
|
private Integer duration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收超出时间,单位: s ,指接收时间超前范围
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "接收超前时间,单位: s ,指接收时间超前范围", required = false, example = "")
|
||||||
|
@ApiModelProperty(value = "接收超前时间,单位: s ,指接收时间超前范围", required = false, dataType = "Numeric")
|
||||||
|
@TableField(value = "LEADING_TIME", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
@Max(10)
|
||||||
|
private Integer leadingTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收滞后时间,单位: s ,指接收时间滞后范围
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "接收滞后时间,单位: s ,指接收时间滞后范围", required = false, example = "")
|
||||||
|
@ApiModelProperty(value = "接收滞后时间,单位: s ,指接收时间滞后范围", required = false, dataType = "Numeric")
|
||||||
|
@TableField(value = "LAG_TIME", updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
@Max(10)
|
||||||
|
private Integer lagTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "创建时间", required = false)
|
||||||
|
@ApiModelProperty(value = "创建时间", required = false, dataType = "Date")
|
||||||
|
@TableField(value = "CREATETIME", updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date createtime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1: 未删除 0: 删除
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "1: 未删除 0: 删除", required = false, example = "1")
|
||||||
|
@ApiModelProperty(value = "1: 未删除 0: 删除", required = false, dataType = "String", example = "1")
|
||||||
|
@TableField(value = "DEL", fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||||
|
@TableLogic(value = REC,delval = DEL)
|
||||||
|
@Max(2)
|
||||||
|
private String del;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.whdc.model.entity;
|
||||||
|
|
||||||
|
public class Fc {
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
private Integer abId;
|
||||||
|
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.whdc.model.entity;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class LoginInfo {
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
private String createId;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.whdc.model.entity;
|
||||||
|
|
||||||
|
public class Organization {
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String objId;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
private String adcd;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.whdc.model.entity;
|
||||||
|
|
||||||
|
public class UnitDict {
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.whdc.model.entity;
|
||||||
|
|
||||||
|
public class User {
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
private String salt;
|
||||||
|
|
||||||
|
private Integer abId;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.whdc.model.entity;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class Versions {
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String json;
|
||||||
|
|
||||||
|
private Integer abId;
|
||||||
|
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
private String createId;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.whdc.zhdbaqapi.model.group;
|
package com.whdc.model.group;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 李赛
|
* @author 李赛
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.whdc.zhdbaqapi.model.group;
|
package com.whdc.model.group;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 李赛
|
* @author 李赛
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.whdc.zhdbaqapi.model.group;
|
package com.whdc.model.group;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 李赛
|
* @author 李赛
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.whdc.model.group;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 李赛
|
||||||
|
* @date 2022-06-26 15:12
|
||||||
|
*/
|
||||||
|
public interface Update {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.whdc.model.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 李赛
|
||||||
|
* @date 2022-06-26 10:43
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true) // chain = true 实现链式调用
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) // 表示序列化非null属性
|
||||||
|
public class ERuleVo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "主键id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规则id")
|
||||||
|
private Integer ruleId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规则类型")
|
||||||
|
private String ruleType;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.whdc.model.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xusan
|
||||||
|
* @date 2023年3月28日14:07:28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true) // chain = true 实现链式调用
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) // 表示序列化非null属性
|
||||||
|
public class EStationRulesVo implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "主键id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规则id")
|
||||||
|
private Integer ruleId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "测站编码")
|
||||||
|
private String stcd;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规则类型")
|
||||||
|
private String item;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规则名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "顺序")
|
||||||
|
private String sort;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date createtime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.whdc.model.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 李赛
|
||||||
|
* @date 2022-06-26 10:43
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true) // chain = true 实现链式调用
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) // 表示序列化非null属性
|
||||||
|
public class ValidateVo implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "是否通过 1是可,0是否")
|
||||||
|
private Integer isPass = 1;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "提示信息")
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "验证不通过规则id")
|
||||||
|
private String npRuleCode;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规则id")
|
||||||
|
private List<String> ruleCodes = new ArrayList<>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.whdc.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.whdc.model.dto.FindRuleDto;
|
||||||
|
import com.whdc.model.entity.ERule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xusan
|
||||||
|
* @since 2023-03-19
|
||||||
|
*/
|
||||||
|
public interface IERuleService extends IService<ERule> {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param eData
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
IPage<ERule> page(FindRuleDto eData);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.whdc.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.whdc.model.dto.FindStationDto;
|
||||||
|
import com.whdc.model.entity.EStationRules;
|
||||||
|
import com.whdc.model.vo.EStationRulesVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xusan
|
||||||
|
* @since 2023-03-19
|
||||||
|
*/
|
||||||
|
public interface IEStationRulesService extends IService<EStationRules> {
|
||||||
|
|
||||||
|
// 获取所有规则分页
|
||||||
|
IPage<EStationRulesVo> page(FindStationDto ruleDto);
|
||||||
|
|
||||||
|
// 获取所有规则
|
||||||
|
List<EStationRulesVo> find(FindStationDto ruleDto);
|
||||||
|
|
||||||
|
boolean removeById(Integer id, EStationRules model);
|
||||||
|
|
||||||
|
void delRule(Integer eRuleId);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.whdc.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.whdc.mapper.ERuleMapper;
|
||||||
|
import com.whdc.model.dto.FindRuleDto;
|
||||||
|
import com.whdc.model.entity.ERule;
|
||||||
|
import com.whdc.service.IERuleService;
|
||||||
|
import com.whdc.service.IEStationRulesService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xusan
|
||||||
|
* @since 2023-03-19
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ERuleServiceImpl extends ServiceImpl<ERuleMapper, ERule> implements IERuleService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IEStationRulesService ieStationRulesService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<ERule> page(FindRuleDto findDto) {
|
||||||
|
return baseMapper.page(findDto.getPage(), findDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateById(ERule model){
|
||||||
|
|
||||||
|
boolean update = super.updateById(model);
|
||||||
|
if (update){
|
||||||
|
ieStationRulesService.delRule(model.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
package com.whdc.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.whdc.mapper.EStationRulesMapper;
|
||||||
|
import com.whdc.model.dto.FindStationDto;
|
||||||
|
import com.whdc.model.entity.EStationRules;
|
||||||
|
import com.whdc.model.vo.EStationRulesVo;
|
||||||
|
import com.whdc.service.IEStationRulesService;
|
||||||
|
import com.whdc.valid.component.RuleRedisService;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xusan
|
||||||
|
* @since 2023-03-19
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class EStationRulesServiceImpl extends ServiceImpl<EStationRulesMapper, EStationRules> implements IEStationRulesService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RuleRedisService ruleRedis;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<EStationRulesVo> page(FindStationDto ruleDto) {
|
||||||
|
return baseMapper.page(ruleDto.getPage(), ruleDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EStationRulesVo> find(FindStationDto ruleDto) {
|
||||||
|
|
||||||
|
return baseMapper.find(ruleDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateById(EStationRules model){
|
||||||
|
|
||||||
|
boolean update = super.updateById(model);
|
||||||
|
if (update){
|
||||||
|
ruleRedis.delRule(model.getStcd());
|
||||||
|
}
|
||||||
|
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean removeById( Integer id,EStationRules model){
|
||||||
|
|
||||||
|
boolean update = super.removeById(id);
|
||||||
|
if (update){
|
||||||
|
ruleRedis.delRule(model.getStcd());
|
||||||
|
}
|
||||||
|
|
||||||
|
return update;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delRule(Integer eRuleId) {
|
||||||
|
|
||||||
|
List<EStationRules> list = this.lambdaQuery().eq(EStationRules::getRuleId, eRuleId)
|
||||||
|
.list();
|
||||||
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
|
for (EStationRules rules : list) {
|
||||||
|
ruleRedis.delRule(rules.getStcd());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.whdc.strategy;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义环境角色(Context):用于连接上下文
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class SaveContext {
|
||||||
|
|
||||||
|
private final Map<String, SyncSaveInterface> strategyMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public SaveContext(Map<String, SyncSaveInterface> strategyMap) {
|
||||||
|
this.strategyMap.putAll(strategyMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增
|
||||||
|
public boolean syncSave(String channel, JSONObject jsonObject) {
|
||||||
|
return strategyMap.get(channel).syncSave(jsonObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.whdc.strategy;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xusan
|
||||||
|
* @date 2023/4/20 16:28
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface SyncSaveInterface {
|
||||||
|
|
||||||
|
boolean syncSave(JSONObject jsonObject);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.whdc.zhdbaqapi.utils;
|
package com.whdc.utils;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
@ -10,12 +11,18 @@ import java.math.RoundingMode;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 李赛
|
* @author 李赛
|
||||||
* @date 2022-07-22 8:46
|
* @date 2022-07-22 8:46
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
public class DataUtils {
|
public class DataUtils {
|
||||||
|
|
||||||
|
public static final BigDecimal MIN_VALUE = BigDecimal.valueOf(0.001);
|
||||||
|
|
||||||
|
|
||||||
private static Map<String, String> extension2Scheme = new HashMap<String, String>();
|
private static Map<String, String> extension2Scheme = new HashMap<String, String>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
@ -85,4 +92,38 @@ public class DataUtils {
|
||||||
|
|
||||||
System.out.println("清理图片缓存:" + filepath + (file1.delete() ? "成功" : "失败"));
|
System.out.println("清理图片缓存:" + filepath + (file1.delete() ? "成功" : "失败"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static Void handleException(Throwable ex) {
|
||||||
|
log.error("请求出现异常:" + ex.getMessage(), ex);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String handleExceptionStr(Throwable ex) {
|
||||||
|
log.error("请求出现异常:" + ex.getMessage(), ex);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Integer handleExceptionInt(Throwable ex) {
|
||||||
|
log.error("请求出现异常:" + ex.getMessage(), ex);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高程
|
||||||
|
* @param elValue
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static BigDecimal gcFormat(BigDecimal elValue){
|
||||||
|
if (Objects.isNull(elValue)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BigDecimal.ZERO.equals(elValue)){
|
||||||
|
return MIN_VALUE;
|
||||||
|
}
|
||||||
|
return elValue;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package com.whdc.zhdbaqapi.utils;
|
package com.whdc.utils;
|
||||||
|
|
||||||
import net.sf.jsqlparser.expression.DateTimeLiteralExpression;
|
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.SimpleTimeZone;
|
import java.util.SimpleTimeZone;
|
||||||
|
|
@ -18,11 +18,15 @@ public class DateUtils {
|
||||||
*/
|
*/
|
||||||
public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
|
public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|
||||||
|
|
||||||
public static final ThreadLocal<SimpleDateFormat> sdfhmsS = new ThreadLocal<SimpleDateFormat>() {
|
public static final ThreadLocal<SimpleDateFormat> sdfhmsS = new ThreadLocal<SimpleDateFormat>() {
|
||||||
protected SimpleDateFormat initialValue() {
|
protected SimpleDateFormat initialValue() {
|
||||||
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static final ThreadLocal<SimpleDateFormat> sdfYMDh = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy-MM-dd HH:mm"));
|
||||||
|
|
||||||
public static final ThreadLocal<SimpleDateFormat> sdfhms = new ThreadLocal<SimpleDateFormat>() {
|
public static final ThreadLocal<SimpleDateFormat> sdfhms = new ThreadLocal<SimpleDateFormat>() {
|
||||||
protected SimpleDateFormat initialValue() {
|
protected SimpleDateFormat initialValue() {
|
||||||
return new SimpleDateFormat(DATE_TIME_PATTERN);
|
return new SimpleDateFormat(DATE_TIME_PATTERN);
|
||||||
|
|
@ -39,6 +43,29 @@ public class DateUtils {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static final ThreadLocal<SimpleDateFormat> sdf_Str = ThreadLocal.withInitial(() -> new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static LocalDateTime strToLDT(String str,String format){
|
||||||
|
return LocalDateTime.parse(str, DateTimeFormatter.ofPattern(format));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String dateToStr(Date date){
|
||||||
|
return sdfhms.get().format(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Date dateToStr(String dateString){
|
||||||
|
try {
|
||||||
|
return sdf_Str.get().parse(dateString);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String dateToStr(Date date, ThreadLocal<SimpleDateFormat> format){
|
||||||
|
return format.get().format(date);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mongo 日期查询isodate
|
* mongo 日期查询isodate
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.whdc.utils;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xusan
|
||||||
|
* @date 2023/4/17 16:44
|
||||||
|
*/
|
||||||
|
public class JsonUtils {
|
||||||
|
|
||||||
|
public static boolean isJson(String str) {
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(str)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
JSONObject.parseObject(str);
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void updateJson(JSONObject jsonObject,String key){
|
||||||
|
String data = jsonObject.getString("DATA");
|
||||||
|
if (StringUtils.isNotBlank(data) && StringUtils.isBlank(jsonObject.getString(key))){
|
||||||
|
jsonObject.put(key,data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.whdc.utils;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xusan
|
||||||
|
* @date 2023/4/11 15:03
|
||||||
|
*/
|
||||||
|
public class NumUtils {
|
||||||
|
|
||||||
|
public static Pattern isNumber = Pattern.compile("^-?\\d+(\\.\\d+)?$");
|
||||||
|
|
||||||
|
public static boolean isNumber(String number) {
|
||||||
|
// 非空校验
|
||||||
|
if (StringUtils.isEmpty(number)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 数字校验(可以包含小数,可以是1,9,-1,1.1,-1.1,不能是+1.1,+1)
|
||||||
|
// 这个支持+1.1,+1
|
||||||
|
// Pattern pattern = Pattern.compile("[+-]?[@-9]+(\\\\.[0-9]+)?");
|
||||||
|
return isNumber.matcher(number).matches();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
package com.whdc.utils;
|
||||||
|
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xusan
|
||||||
|
* @date 2023/4/13 14:19
|
||||||
|
*/
|
||||||
|
public class RedisConfUtils {
|
||||||
|
|
||||||
|
public static StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
|
||||||
|
|
||||||
|
|
||||||
|
public static void setStringRedisSerializer(RedisTemplate<String, Object> redisTemplate) {
|
||||||
|
if (!Objects.isNull(redisTemplate)) {
|
||||||
|
|
||||||
|
if (!(redisTemplate.getKeySerializer() instanceof StringRedisSerializer)) {
|
||||||
|
redisTemplate.setKeySerializer(stringRedisSerializer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void setDefaultRedisSerializer(RedisTemplate<String, Object> redisTemplate) {
|
||||||
|
if (!Objects.isNull(redisTemplate)) {
|
||||||
|
|
||||||
|
if (redisTemplate.getKeySerializer() instanceof StringRedisSerializer) {
|
||||||
|
redisTemplate.setKeySerializer(redisTemplate.getHashKeySerializer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setStringRedisSeria(RedisTemplate<String, String> redisTemplate) {
|
||||||
|
if (!Objects.isNull(redisTemplate)) {
|
||||||
|
|
||||||
|
if (!(redisTemplate.getKeySerializer() instanceof StringRedisSerializer)) {
|
||||||
|
redisTemplate.setKeySerializer(stringRedisSerializer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void setDefaultRedisSeria(RedisTemplate<String, String> redisTemplate) {
|
||||||
|
if (!Objects.isNull(redisTemplate)) {
|
||||||
|
|
||||||
|
if (redisTemplate.getKeySerializer() instanceof StringRedisSerializer) {
|
||||||
|
redisTemplate.setKeySerializer(redisTemplate.getHashKeySerializer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static Object get(String key, RedisTemplate<String, Object> redisTemplate) {
|
||||||
|
try {
|
||||||
|
setStringRedisSerializer(redisTemplate);
|
||||||
|
return redisTemplate.opsForValue().get(key);
|
||||||
|
} finally {
|
||||||
|
setDefaultRedisSerializer(redisTemplate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void set(String key, Object o, RedisTemplate<String, Object> redisTemplate) {
|
||||||
|
try {
|
||||||
|
setStringRedisSerializer(redisTemplate);
|
||||||
|
redisTemplate.opsForValue().set(key, o);
|
||||||
|
} finally {
|
||||||
|
setDefaultRedisSerializer(redisTemplate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Set<String> getKeys(String key, RedisTemplate<String, Object> redisTemplate) {
|
||||||
|
try {
|
||||||
|
setStringRedisSerializer(redisTemplate);
|
||||||
|
return redisTemplate.keys(key + "*");
|
||||||
|
} finally {
|
||||||
|
setDefaultRedisSerializer(redisTemplate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean hasKey(String key, RedisTemplate<String, Object> redisTemplate) {
|
||||||
|
try {
|
||||||
|
setStringRedisSerializer(redisTemplate);
|
||||||
|
return redisTemplate.hasKey(key);
|
||||||
|
} finally {
|
||||||
|
setDefaultRedisSerializer(redisTemplate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void delete(String key, RedisTemplate<String, String> redisTemplate) {
|
||||||
|
try {
|
||||||
|
setStringRedisSeria(redisTemplate);
|
||||||
|
redisTemplate.delete(key);
|
||||||
|
} finally {
|
||||||
|
setDefaultRedisSeria(redisTemplate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void delete(Collection<String> keys, RedisTemplate<String, String> redisTemplate) {
|
||||||
|
try {
|
||||||
|
setStringRedisSeria(redisTemplate);
|
||||||
|
redisTemplate.delete(keys);
|
||||||
|
} finally {
|
||||||
|
setDefaultRedisSeria(redisTemplate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package com.whdc.zhdbaqapi.utils;
|
package com.whdc.utils;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
public class ReqUtils {
|
public class ReqUtils {
|
||||||
private static String dbPath = null;
|
private static final String dbPath = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户真实IP地址,不使用request.getRemoteAddr();的原因是有可能用户使用了代理软件方式避免真实IP地址,
|
* 获取用户真实IP地址,不使用request.getRemoteAddr();的原因是有可能用户使用了代理软件方式避免真实IP地址,
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.whdc.zhdbaqapi.utils;
|
package com.whdc.utils;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.whdc.valid.bean;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author xusan
|
||||||
|
* @date 2023年3月22日10:32:54
|
||||||
|
* @description: 雨量值时间规则
|
||||||
|
*/
|
||||||
|
public enum IntvType {
|
||||||
|
|
||||||
|
IT001(300, "0.05"),
|
||||||
|
IT002(300, "0.08"),
|
||||||
|
IT003(3600, "1");
|
||||||
|
|
||||||
|
private Integer name;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public Integer getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(Integer name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
IntvType(Integer name, String value) {
|
||||||
|
this.name = name;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<JSONObject> list() {
|
||||||
|
List<JSONObject> list = new ArrayList<>();
|
||||||
|
IntvType[] values = IntvType.values();
|
||||||
|
for (IntvType type : values) {
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
obj.put("name", type.getName());
|
||||||
|
obj.put("value", type.getValue());
|
||||||
|
list.add(obj);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, IntvType> map() {
|
||||||
|
Map<String, IntvType> map = new HashMap<>();
|
||||||
|
IntvType[] values = IntvType.values();
|
||||||
|
for (IntvType e : values) {
|
||||||
|
map.put(e.getValue(), e);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IntvType getByValue(String value) {
|
||||||
|
if (StringUtils.isEmpty(value)) return null;
|
||||||
|
return map().get(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.whdc.valid.bean;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author xusan
|
||||||
|
* @date 2023年3月22日10:32:54
|
||||||
|
* @description: 测站类型代码
|
||||||
|
*/
|
||||||
|
public enum ItemType {
|
||||||
|
|
||||||
|
YU_LIANG("雨量", "P"),
|
||||||
|
SHUI_WEI("水位", "Z"),
|
||||||
|
LIU_LIANG("流量", "Q"),
|
||||||
|
TONG_YONG("通用", "ALL");
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemType(String name, String value) {
|
||||||
|
this.name = name;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<JSONObject> list() {
|
||||||
|
List<JSONObject> list = new ArrayList<>();
|
||||||
|
ItemType[] values = ItemType.values();
|
||||||
|
for (ItemType type : values) {
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
obj.put("name", type.getName());
|
||||||
|
obj.put("value", type.getValue());
|
||||||
|
list.add(obj);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, ItemType> map() {
|
||||||
|
Map<String, ItemType> map = new HashMap<>();
|
||||||
|
ItemType[] values = ItemType.values();
|
||||||
|
for (ItemType e : values) {
|
||||||
|
map.put(e.getValue(), e);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemType getByValue(String value) {
|
||||||
|
if (StringUtils.isEmpty(value)) return null;
|
||||||
|
return map().get(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,115 @@
|
||||||
|
package com.whdc.valid.component;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.whdc.valid.mapper.ValidateMapper;
|
||||||
|
import com.whdc.valid.model.ValidateVo;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component("ruleRedis")
|
||||||
|
public class RuleRedisService {
|
||||||
|
|
||||||
|
|
||||||
|
private static final String VALIDATE_REDIS_KEY = "validate:";
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String, String> ruleRedisTemplate;
|
||||||
|
|
||||||
|
public List<ValidateVo> getRule(String stcd,ValidateMapper validateMapper) {
|
||||||
|
return getRule(null,null,stcd,validateMapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ValidateVo> getRule(String source,String countycode,String stcd,ValidateMapper validateMapper) {
|
||||||
|
|
||||||
|
List<ValidateVo> rules = null;
|
||||||
|
|
||||||
|
log.info("获取规则: {}" , stcd);
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(source)) {
|
||||||
|
source = "0";
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(countycode)) {
|
||||||
|
countycode = "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
String key = VALIDATE_REDIS_KEY + source +":"+ countycode + ":" + stcd;
|
||||||
|
|
||||||
|
if (Boolean.TRUE.equals(ruleRedisTemplate.hasKey(key))) {
|
||||||
|
|
||||||
|
List<String> json = ruleRedisTemplate.opsForList().range(key, 0, -1);
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(json)) {
|
||||||
|
|
||||||
|
rules = json.stream()
|
||||||
|
.filter(StringUtils::isNotBlank)
|
||||||
|
.map(s -> JSON.toJavaObject(JSON.parseObject(s), ValidateVo.class))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
rules = validateMapper.getRuleByStcd(source,countycode,stcd);
|
||||||
|
|
||||||
|
log.info("保存规则: " + rules.size());
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(rules)) {
|
||||||
|
rules = new ArrayList<>();
|
||||||
|
|
||||||
|
// 添加空号缓存
|
||||||
|
rules.add(new ValidateVo());
|
||||||
|
}
|
||||||
|
|
||||||
|
Long aLong = ruleRedisTemplate.opsForList().rightPushAll(key, rules.stream().map(JSON::toJSONString).collect(Collectors.toList()));
|
||||||
|
|
||||||
|
if (aLong != rules.size()) {
|
||||||
|
log.info("保存规则失败: " + key + "_" + rules.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (CollectionUtils.isNotEmpty(rules) && JSON.parseObject(JSON.toJSONString(rules.get(0))).isEmpty()){
|
||||||
|
rules.remove(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(rules)) {
|
||||||
|
// 查询通用规则
|
||||||
|
return this.getRule("ALL", validateMapper);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("获取规则条数: {}" , rules.size());
|
||||||
|
|
||||||
|
|
||||||
|
return rules;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void delRule(String stcd){
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(stcd)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String key = VALIDATE_REDIS_KEY + stcd;
|
||||||
|
|
||||||
|
if (Boolean.TRUE.equals(ruleRedisTemplate.hasKey(key))) {
|
||||||
|
|
||||||
|
Boolean delete = ruleRedisTemplate.delete(key);
|
||||||
|
if (!Boolean.TRUE.equals(delete)) {
|
||||||
|
|
||||||
|
log.info("删除失败, 主键: {}" ,key);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.whdc.valid.conf;
|
||||||
|
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@MapperScan("com.whdc.valid.mapper")
|
||||||
|
public class MapperScanConfig {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,118 @@
|
||||||
|
package com.whdc.valid.conf;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
|
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
|
||||||
|
import org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration;
|
||||||
|
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
||||||
|
import org.springframework.data.redis.connection.lettuce.LettucePoolingClientConfiguration;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
|
||||||
|
import org.springframework.data.redis.serializer.RedisSerializer;
|
||||||
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xusan
|
||||||
|
* @date 2023年9月8日11:09:47
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class RuleRestTemplateConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
|
||||||
|
# 数据清洗专用redis
|
||||||
|
redisRules:
|
||||||
|
database: 0
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: 6379
|
||||||
|
password:
|
||||||
|
timeout: 60000
|
||||||
|
lettuce:
|
||||||
|
pool:
|
||||||
|
max-active: 50
|
||||||
|
max-idle: 50
|
||||||
|
min-idle: 1
|
||||||
|
max-wait: 50000
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@Value("${spring.redisRules.host}")
|
||||||
|
private String host;
|
||||||
|
|
||||||
|
@Value("${spring.redisRules.port}")
|
||||||
|
private Integer port;
|
||||||
|
|
||||||
|
@Value("${spring.redisRules.password}")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@Value("${spring.redisRules.database}")
|
||||||
|
private int database;
|
||||||
|
|
||||||
|
@Value("${spring.redisRules.lettuce.pool.max-active}")
|
||||||
|
private String maxActive;
|
||||||
|
|
||||||
|
@Value("${spring.redisRules.lettuce.pool.max-idle}")
|
||||||
|
private String maxIdle;
|
||||||
|
|
||||||
|
@Value("${spring.redisRules.lettuce.pool.min-idle}")
|
||||||
|
private String minIdle;
|
||||||
|
|
||||||
|
@Value("${spring.redisRules.lettuce.pool.max-wait}")
|
||||||
|
private String maxWait;
|
||||||
|
|
||||||
|
@Value("${spring.redisRules.timeout}")
|
||||||
|
private String timeOut;
|
||||||
|
|
||||||
|
|
||||||
|
private LettuceConnectionFactory getConnectionOneFactory() {
|
||||||
|
RedisStandaloneConfiguration redisStandaloneConfiguration =
|
||||||
|
new RedisStandaloneConfiguration();
|
||||||
|
redisStandaloneConfiguration.setHostName(host);
|
||||||
|
redisStandaloneConfiguration.setDatabase(database);
|
||||||
|
redisStandaloneConfiguration.setPassword(password);
|
||||||
|
redisStandaloneConfiguration.setPort(port);
|
||||||
|
|
||||||
|
GenericObjectPoolConfig genericObjectPoolConfig =
|
||||||
|
new GenericObjectPoolConfig();
|
||||||
|
genericObjectPoolConfig.setMaxIdle(Integer.parseInt(maxIdle));
|
||||||
|
genericObjectPoolConfig.setMinIdle(Integer.parseInt(minIdle));
|
||||||
|
genericObjectPoolConfig.setMaxTotal(Integer.parseInt(maxActive));
|
||||||
|
genericObjectPoolConfig.setMaxWait(Duration.ofMillis(Integer.parseInt(maxWait)));
|
||||||
|
LettucePoolingClientConfiguration.LettucePoolingClientConfigurationBuilder
|
||||||
|
builder = LettucePoolingClientConfiguration.builder().
|
||||||
|
commandTimeout(Duration.ofMillis(Integer.parseInt(timeOut)));
|
||||||
|
builder.poolConfig(genericObjectPoolConfig);
|
||||||
|
LettuceClientConfiguration lettuceClientConfiguration = builder.build();
|
||||||
|
//根据配置和客户端配置创建连接
|
||||||
|
LettuceConnectionFactory lettuceConnectionFactory = new
|
||||||
|
LettuceConnectionFactory(redisStandaloneConfiguration,lettuceClientConfiguration);
|
||||||
|
lettuceConnectionFactory .afterPropertiesSet();
|
||||||
|
return lettuceConnectionFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean("ruleRedisTemplate")
|
||||||
|
public RedisTemplate<String, String> ruleRedisTemplate() {
|
||||||
|
LettuceConnectionFactory connectionFactory = getConnectionOneFactory();
|
||||||
|
RedisTemplate<String, String> redisTemplate = new RedisTemplate<>();
|
||||||
|
redisTemplate.setConnectionFactory(connectionFactory);
|
||||||
|
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<Object>(Object.class);
|
||||||
|
ObjectMapper om = new ObjectMapper();
|
||||||
|
om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
||||||
|
jackson2JsonRedisSerializer.setObjectMapper(om);
|
||||||
|
RedisSerializer<?> stringSerializer = new StringRedisSerializer();
|
||||||
|
redisTemplate.setKeySerializer(stringSerializer);
|
||||||
|
redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer);
|
||||||
|
redisTemplate.afterPropertiesSet();
|
||||||
|
redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);
|
||||||
|
redisTemplate.setHashKeySerializer(stringSerializer);
|
||||||
|
return redisTemplate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.whdc.valid.error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 李赛
|
||||||
|
* @date 2022-06-26 10:58
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class MyException extends RuntimeException {
|
||||||
|
|
||||||
|
private final String msg;
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyException(String msg, Throwable e) {
|
||||||
|
super(msg, e);
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MyException getException(String msg) {
|
||||||
|
return new MyException(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.whdc.valid.mapper;
|
||||||
|
|
||||||
|
import com.whdc.valid.model.ValidateVo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author XuSan
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ValidateMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stcd 查询 规则
|
||||||
|
* @param stcd
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Select("SELECT E.ITEM,E.MIN,E.MAX,E.DIFF_MAX,E.DURATION,E.LEADING_TIME,E.LAG_TIME,T.SORT FROM SHZH_IOT.E_STATION_RULES T LEFT JOIN SHZH_IOT.E_RULE E ON T.RULE_ID = E.ID WHERE T.DEL = 1 AND E.DEL = 1 AND T.SOURCE = #{source} AND T.COUNTYCODE = #{countycode} AND T.STCD = #{stcd} ORDER BY T.SORT ASC;")
|
||||||
|
List<ValidateVo> getRuleByStcd(String source,String countycode, String stcd);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.whdc.valid.model;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xusan
|
||||||
|
* @date 2023年3月20日08:57:22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ValidateDto implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "测站编码", dataType = "java.lang.String")
|
||||||
|
private String stcd;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "所在区域", dataType = "java.lang.String")
|
||||||
|
private String countycode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "所在区域", dataType = "java.lang.String")
|
||||||
|
private String source;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "监测时间", dataType = "java.lang.Date")
|
||||||
|
private Date tm;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "累计时间", dataType = "java.lang.Date")
|
||||||
|
private String intv;
|
||||||
|
|
||||||
|
private Data data;
|
||||||
|
|
||||||
|
@lombok.Data
|
||||||
|
public static class Data {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 雨量
|
||||||
|
*/
|
||||||
|
private BigDecimal p;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 水位
|
||||||
|
*/
|
||||||
|
private BigDecimal q;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流量
|
||||||
|
*/
|
||||||
|
private BigDecimal z;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.whdc.valid.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 李赛
|
||||||
|
* @date 2022-06-26 10:43
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true) // chain = true 实现链式调用
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) // 表示序列化非null属性
|
||||||
|
public class ValidateVo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测站类型
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "规则类型", required = true, example = "")
|
||||||
|
@ApiModelProperty(value = "规则类型", required = true, dataType = "String")
|
||||||
|
private String item;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最小值
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "最小值", required = false, example = "")
|
||||||
|
@ApiModelProperty(value = "最小值", required = false, dataType = "String")
|
||||||
|
private BigDecimal min;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大值
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "最大值", required = false, example = "")
|
||||||
|
@ApiModelProperty(value = "最大值", required = false, dataType = "String")
|
||||||
|
private BigDecimal max;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 差值
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "两条数据之间的最大差值", required = false, example = "")
|
||||||
|
@ApiModelProperty(value = "两条数据之间的最大差值", required = false, dataType = "String")
|
||||||
|
private BigDecimal diffMax;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收超出时间,单位: s ,指接收时间超前范围
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "接收超前时间,单位: s ,指接收时间超前范围", required = false, example = "")
|
||||||
|
@ApiModelProperty(value = "接收超前时间,单位: s ,指接收时间超前范围", required = false, dataType = "Integer")
|
||||||
|
private Integer leadingTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收滞后时间,单位: s ,指接收时间滞后范围
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "接收滞后时间,单位: s ,指接收时间滞后范围", required = false, example = "")
|
||||||
|
@ApiModelProperty(value = "接收滞后时间,单位: s ,指接收时间滞后范围", required = false, dataType = "Integer")
|
||||||
|
private Integer lagTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大值
|
||||||
|
*/
|
||||||
|
@ApiParam(value = "时间段, 单位 s", required = false, example = "")
|
||||||
|
@ApiModelProperty(value = "时间段, 单位 s", required = false, dataType = "Integer")
|
||||||
|
private Integer duration;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiParam(value = "排序", required = false, example = "")
|
||||||
|
@ApiModelProperty(value = "排序", required = false, dataType = "Integer")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.whdc.valid.service;
|
||||||
|
|
||||||
|
public interface ValidateService {
|
||||||
|
|
||||||
|
Boolean validate(String json);
|
||||||
|
|
||||||
|
Boolean validate(String json,String prevJson);
|
||||||
|
|
||||||
|
Boolean needPrev(String json);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,552 @@
|
||||||
|
package com.whdc.valid.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONException;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.whdc.valid.bean.IntvType;
|
||||||
|
import com.whdc.valid.bean.ItemType;
|
||||||
|
import com.whdc.valid.component.RuleRedisService;
|
||||||
|
import com.whdc.valid.mapper.ValidateMapper;
|
||||||
|
import com.whdc.valid.model.ValidateDto;
|
||||||
|
import com.whdc.valid.model.ValidateVo;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.whdc.valid.bean.ItemType.getByValue;
|
||||||
|
import static com.whdc.valid.error.MyException.getException;
|
||||||
|
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class ValidateServiceImpl implements ValidateService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ValidateMapper validateMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RuleRedisService ruleRedis;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 正常值判断
|
||||||
|
*
|
||||||
|
* @param json
|
||||||
|
* @return true: 通过 false: 不通过
|
||||||
|
*/
|
||||||
|
public Boolean validate(String json) {
|
||||||
|
return validate(json, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 弃用
|
||||||
|
*
|
||||||
|
* @param json
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Boolean validateV1(String json) {
|
||||||
|
|
||||||
|
ValidateDto dto = getValidateDto(json); //正常值
|
||||||
|
|
||||||
|
ValidateDto.Data data = dto.getData();
|
||||||
|
BigDecimal p = data.getP();
|
||||||
|
BigDecimal z = data.getZ();
|
||||||
|
BigDecimal q = data.getQ();
|
||||||
|
|
||||||
|
if (BigDecimal.ZERO.compareTo(p) < 0
|
||||||
|
&& BigDecimal.ZERO.compareTo(z) < 0
|
||||||
|
&& BigDecimal.ZERO.compareTo(q) < 0
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ValidateVo> rule = ruleRedis.getRule(dto.getStcd(), validateMapper); // 弃用
|
||||||
|
if (CollectionUtils.isEmpty(rule)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Map<String, List<ValidateVo>> items = rule.stream()
|
||||||
|
// .collect(Collectors.groupingBy(ValidateVo::getItem));
|
||||||
|
//
|
||||||
|
// List<ValidateVo> rules = new ArrayList<>();
|
||||||
|
//
|
||||||
|
// if (Objects.nonNull(p)) {
|
||||||
|
// List<ValidateVo> list = items.get("P");
|
||||||
|
// if (CollectionUtils.isNotEmpty(list)) {
|
||||||
|
// rules.addAll(list);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (Objects.nonNull(z)) {
|
||||||
|
// List<ValidateVo> list = items.get("Z");
|
||||||
|
// if (CollectionUtils.isNotEmpty(list)) {
|
||||||
|
// rules.addAll(list);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (Objects.nonNull(q)) {
|
||||||
|
// List<ValidateVo> list = items.get("Q");
|
||||||
|
// if (CollectionUtils.isNotEmpty(list)) {
|
||||||
|
// rules.addAll(list);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (CollectionUtils.isEmpty(rules)) {
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
Date tm = dto.getTm();
|
||||||
|
long currentTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
|
||||||
|
for (ValidateVo vo : rule) {
|
||||||
|
|
||||||
|
BigDecimal min = vo.getMin();
|
||||||
|
BigDecimal max = vo.getMax();
|
||||||
|
Integer leadingTime = vo.getLeadingTime();
|
||||||
|
Integer lagTime = vo.getLagTime();
|
||||||
|
|
||||||
|
if (Objects.nonNull(leadingTime)) {
|
||||||
|
if (tm.getTime() > currentTime + (leadingTime * 1000)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Objects.nonNull(lagTime)) {
|
||||||
|
if (tm.getTime() < currentTime - (lagTime * 1000)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String item = vo.getItem();
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(item)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Objects.isNull(min) && Objects.isNull(max)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemType itemType = getByValue(item);
|
||||||
|
|
||||||
|
if (Objects.isNull(itemType)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (itemType) {
|
||||||
|
case YU_LIANG: { // 雨量判断 P
|
||||||
|
if (!rangeRuleValidate(p, min, max)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SHUI_WEI: { // 水位判断 Z
|
||||||
|
|
||||||
|
if (!rangeRuleValidate(z, min, max)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case LIU_LIANG: { // 流量判断 Q
|
||||||
|
|
||||||
|
if (!rangeRuleValidate(q, min, max)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Boolean rangeRuleValidate(BigDecimal value, BigDecimal min, BigDecimal max) {
|
||||||
|
|
||||||
|
if (Objects.nonNull(value)) {
|
||||||
|
|
||||||
|
if (Objects.nonNull(min) && value.compareTo(min) < 0) {
|
||||||
|
log.info("对比值小于最小值: {} < {}", value, min);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Objects.nonNull(max) && value.compareTo(max) > 0) {
|
||||||
|
log.info("对比值大于最大值: {} < {}", max, value);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断差值
|
||||||
|
*
|
||||||
|
* @param json
|
||||||
|
* @param prevJson
|
||||||
|
* @return true: 通过 false: 不通过
|
||||||
|
*/
|
||||||
|
public Boolean validate(String json, String prevJson) {
|
||||||
|
|
||||||
|
ValidateDto dto = getValidateDto(json); //正常值
|
||||||
|
ValidateDto prevDto = null;
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(prevJson)) {
|
||||||
|
|
||||||
|
prevDto = getValidateDto(prevJson); // 老差值
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String intv = dto.getIntv();
|
||||||
|
|
||||||
|
ValidateDto.Data data = dto.getData();
|
||||||
|
BigDecimal p = data.getP();
|
||||||
|
BigDecimal z = data.getZ();
|
||||||
|
BigDecimal q = data.getQ();
|
||||||
|
|
||||||
|
if (BigDecimal.ZERO.compareTo(p) < 0
|
||||||
|
&& BigDecimal.ZERO.compareTo(z) < 0
|
||||||
|
&& BigDecimal.ZERO.compareTo(q) < 0
|
||||||
|
) {
|
||||||
|
log.info("对比值小于0: {} {} {}", p, z, q);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ValidateVo> rule = ruleRedis.getRule(dto.getSource(),dto.getCountycode(),dto.getStcd(), validateMapper);
|
||||||
|
if (CollectionUtils.isEmpty(rule)) {
|
||||||
|
log.info("规则为空: {}", rule);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Date tm = dto.getTm();
|
||||||
|
long currentTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
|
||||||
|
for (ValidateVo vo : rule) {
|
||||||
|
|
||||||
|
Integer duration = vo.getDuration();
|
||||||
|
|
||||||
|
BigDecimal min = vo.getMin();
|
||||||
|
BigDecimal max = vo.getMax();
|
||||||
|
Integer leadingTime = vo.getLeadingTime();
|
||||||
|
Integer lagTime = vo.getLagTime();
|
||||||
|
String item = vo.getItem();
|
||||||
|
ItemType itemType = getByValue(item);
|
||||||
|
|
||||||
|
if (Objects.nonNull(leadingTime)) {
|
||||||
|
long time = currentTime + (leadingTime * 1000);
|
||||||
|
if (tm.getTime() > time) {
|
||||||
|
log.info("时间大于最大差值时间: {} > {}", tm.getTime(), time);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Objects.nonNull(lagTime)) {
|
||||||
|
long time = currentTime - (lagTime * 1000);
|
||||||
|
if (tm.getTime() < time) {
|
||||||
|
log.info("时间小于最小差值时间: {} < {}", tm.getTime(), time);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Objects.nonNull(min) || Objects.nonNull(max)) {
|
||||||
|
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(item)) {
|
||||||
|
log.info("规则类型为空");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (Objects.isNull(itemType)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (itemType) {
|
||||||
|
case YU_LIANG: { // 雨量判断 P
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(intv) && Objects.nonNull(duration)){
|
||||||
|
IntvType intvType = IntvType.getByValue(intv);
|
||||||
|
|
||||||
|
if (Objects.nonNull(intvType)){
|
||||||
|
if (Objects.equals(intvType.getName(), duration)) {
|
||||||
|
if (!rangeRuleValidate(p, min, max)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
|
if (!rangeRuleValidate(p, min, max)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SHUI_WEI: { // 水位判断 Z
|
||||||
|
|
||||||
|
if (!rangeRuleValidate(z, min, max)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case LIU_LIANG: { // 流量判断 Q
|
||||||
|
|
||||||
|
if (!rangeRuleValidate(q, min, max)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (Objects.isNull(prevDto)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ValidateDto.Data oldData = prevDto.getData();
|
||||||
|
|
||||||
|
BigDecimal oldP = oldData.getP();
|
||||||
|
BigDecimal oldZ = oldData.getZ();
|
||||||
|
BigDecimal oldQ = oldData.getQ();
|
||||||
|
|
||||||
|
if (BigDecimal.ZERO.compareTo(oldP) < 0
|
||||||
|
&& BigDecimal.ZERO.compareTo(oldZ) < 0
|
||||||
|
&& BigDecimal.ZERO.compareTo(oldQ) < 0
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取时间
|
||||||
|
Date oldTm = prevDto.getTm();
|
||||||
|
|
||||||
|
BigDecimal diffMax = vo.getDiffMax();
|
||||||
|
|
||||||
|
|
||||||
|
if (Objects.nonNull(duration)) {
|
||||||
|
|
||||||
|
if (Math.abs(tm.getTime() - oldTm.getTime()) > duration * 1000) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (Objects.isNull(itemType)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Objects.isNull(diffMax)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (itemType) {
|
||||||
|
case YU_LIANG: { // 雨量判断 P
|
||||||
|
if (Objects.nonNull(p) && Objects.nonNull(oldP) && Math.abs(p.subtract(oldP).doubleValue()) > diffMax.doubleValue()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SHUI_WEI: { // 水位判断 Z
|
||||||
|
|
||||||
|
if (Objects.nonNull(z) && Objects.nonNull(oldZ) && Math.abs(z.subtract(oldZ).doubleValue()) > diffMax.doubleValue()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case LIU_LIANG: { // 流量判断 Q
|
||||||
|
|
||||||
|
if (Objects.nonNull(q) && Objects.nonNull(oldQ) && Math.abs(q.subtract(oldQ).doubleValue()) > diffMax.doubleValue()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean validateV1(String json, String prevJson) {
|
||||||
|
|
||||||
|
if (!validate(json)) { // 正常值判断
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ValidateDto dto = getValidateDto(json); // 差值
|
||||||
|
|
||||||
|
List<ValidateVo> rule = ruleRedis.getRule(dto.getStcd(), validateMapper); // 弃用
|
||||||
|
if (CollectionUtils.isEmpty(rule)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ValidateDto prevDto = getValidateDto(prevJson); // 老差值
|
||||||
|
|
||||||
|
|
||||||
|
ValidateDto.Data data = dto.getData();
|
||||||
|
|
||||||
|
BigDecimal p = data.getP();
|
||||||
|
BigDecimal z = data.getZ();
|
||||||
|
BigDecimal q = data.getQ();
|
||||||
|
|
||||||
|
if (BigDecimal.ZERO.compareTo(p) < 0
|
||||||
|
&& BigDecimal.ZERO.compareTo(z) < 0
|
||||||
|
&& BigDecimal.ZERO.compareTo(q) < 0
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ValidateDto.Data oldData = prevDto.getData();
|
||||||
|
BigDecimal oldP = oldData.getP();
|
||||||
|
BigDecimal oldZ = oldData.getZ();
|
||||||
|
BigDecimal oldQ = oldData.getQ();
|
||||||
|
|
||||||
|
if (BigDecimal.ZERO.compareTo(oldP) < 0
|
||||||
|
&& BigDecimal.ZERO.compareTo(oldZ) < 0
|
||||||
|
&& BigDecimal.ZERO.compareTo(oldQ) < 0
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 获取时间
|
||||||
|
Date tm = dto.getTm();
|
||||||
|
Date oldTm = prevDto.getTm();
|
||||||
|
|
||||||
|
for (ValidateVo vo : rule) {
|
||||||
|
|
||||||
|
BigDecimal diffMax = vo.getDiffMax();
|
||||||
|
Integer duration = vo.getDuration();
|
||||||
|
|
||||||
|
if (Objects.nonNull(duration)) {
|
||||||
|
|
||||||
|
if (Math.abs(tm.getTime() - oldTm.getTime()) > duration * 1000) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Objects.nonNull(p) && Objects.nonNull(oldP) && Math.abs(p.subtract(oldP).doubleValue()) > diffMax.doubleValue()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(z) && Objects.nonNull(oldZ) && Math.abs(z.subtract(oldZ).doubleValue()) > diffMax.doubleValue()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(q) && Objects.nonNull(oldQ) && Math.abs(q.subtract(oldQ).doubleValue()) > diffMax.doubleValue()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否需要传入多个值
|
||||||
|
*
|
||||||
|
* @param json
|
||||||
|
* @return true: 需要, false: 不需要
|
||||||
|
*/
|
||||||
|
public Boolean needPrev(String json) {
|
||||||
|
|
||||||
|
ValidateDto dto = getValidateDto(json); // 多个值
|
||||||
|
|
||||||
|
List<ValidateVo> rule = ruleRedis.getRule(dto.getSource(),dto.getCountycode(),dto.getStcd(), validateMapper);
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(rule)) {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(
|
||||||
|
|
||||||
|
rule.stream().map(ValidateVo::getDiffMax)
|
||||||
|
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
|
||||||
|
)) {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private ValidateDto getValidateDto(String json) {
|
||||||
|
JSONObject jsonObject;
|
||||||
|
try {
|
||||||
|
jsonObject = JSON.parseObject(json);
|
||||||
|
} catch (JSONException e) {
|
||||||
|
throw getException("格式错误: " + json);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (Objects.isNull(jsonObject)) {
|
||||||
|
throw getException("空数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
ValidateDto validateDto = JSON.toJavaObject(jsonObject, ValidateDto.class);
|
||||||
|
|
||||||
|
if (Objects.isNull(validateDto.getStcd())) {
|
||||||
|
throw getException("编码不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
Date tm = validateDto.getTm();
|
||||||
|
if (Objects.isNull(tm)) {
|
||||||
|
throw getException("时间不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ValidateDto.Data data = validateDto.getData();
|
||||||
|
|
||||||
|
if (Objects.isNull(data)) {
|
||||||
|
throw getException("数据不能为空");
|
||||||
|
} else {
|
||||||
|
if (Objects.isNull(data.getP())
|
||||||
|
&& Objects.isNull(data.getQ())
|
||||||
|
&& Objects.isNull(data.getZ())
|
||||||
|
) {
|
||||||
|
throw getException("数据内容不能为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return validateDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.component;
|
|
||||||
|
|
||||||
import com.whdc.zhdbaqapi.service.IDeviceDataService;
|
|
||||||
import com.whdc.zhdbaqapi.service.IDeviceSLDataService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-22 1:04
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class ScheduledTask {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IDeviceDataService iDeviceDataService;
|
|
||||||
@Autowired
|
|
||||||
private IDeviceSLDataService iDeviceSLDataService;
|
|
||||||
@Scheduled(fixedDelay = 60000)
|
|
||||||
public void scheduledTask() {
|
|
||||||
String OS = System.getProperty("os.name").toLowerCase();
|
|
||||||
|
|
||||||
// 简单粗暴的判断,在 linux 环境下运行时,为生成环境
|
|
||||||
if (OS.contains("linux")) {
|
|
||||||
iDeviceDataService.syncData();
|
|
||||||
iDeviceSLDataService.syncData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-06 10:39
|
|
||||||
*/
|
|
||||||
|
|
||||||
import cn.dev33.satoken.stp.StpInterface;
|
|
||||||
import com.whdc.zhdbaqapi.model.entity.SysUser;
|
|
||||||
import com.whdc.zhdbaqapi.service.ISysUserService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 自定义权限验证接口扩展
|
|
||||||
*/
|
|
||||||
@Component // 保证此类被SpringBoot扫描,完成Sa-Token的自定义权限验证扩展
|
|
||||||
public class StpInterfaceImpl implements StpInterface {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ISysUserService iSysUserService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getPermissionList(Object o, String s) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回一个账号所拥有的角色标识集合 (权限与角色可分开校验)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<String> getRoleList(Object loginId, String loginType) {
|
|
||||||
SysUser sysUser = iSysUserService.getById(Integer.valueOf(loginId.toString()));
|
|
||||||
|
|
||||||
// 实际项目中要根据具体业务逻辑来查询角色
|
|
||||||
List<String> list = new ArrayList<String>();
|
|
||||||
|
|
||||||
if(sysUser.getType() == 0){
|
|
||||||
list.add("super-admin");
|
|
||||||
}else if(sysUser.getType() == 1){
|
|
||||||
list.add("admin");
|
|
||||||
}else if(sysUser.getType() == 2){
|
|
||||||
list.add("user");
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.config;
|
|
||||||
|
|
||||||
import cn.dev33.satoken.interceptor.SaRouteInterceptor;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-06 7:52
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class SaTokenConfigure implements WebMvcConfigurer {
|
|
||||||
// 注册拦截器
|
|
||||||
@Override
|
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
|
||||||
// 注册 Sa-Token 的路由拦截器
|
|
||||||
registry.addInterceptor(new SaRouteInterceptor())
|
|
||||||
.addPathPatterns("/**")
|
|
||||||
.excludePathPatterns("/socket.io**")
|
|
||||||
.excludePathPatterns("/doc.html**")
|
|
||||||
.excludePathPatterns("/swagger-resources")
|
|
||||||
.excludePathPatterns("/webjars/**")
|
|
||||||
.excludePathPatterns("/v3/api-docs**")
|
|
||||||
.excludePathPatterns("/v1/sysuser/doLogin")
|
|
||||||
.excludePathPatterns("/v1/auth/getToken")
|
|
||||||
.excludePathPatterns("/v1/sysuser/registerByToken");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.constant;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-17 10:18
|
|
||||||
*/
|
|
||||||
public class Constants {
|
|
||||||
public static final String PASSWORD_SALT = "whdc";
|
|
||||||
|
|
||||||
|
|
||||||
public static final String CACHE_NAME = "DeviceInfoListAll";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.controller;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.whdc.zhdbaqapi.model.dto.FindDeviceDto;
|
|
||||||
import com.whdc.zhdbaqapi.model.vo.DeviceDataVo;
|
|
||||||
import com.whdc.zhdbaqapi.service.IDeviceDataService;
|
|
||||||
import com.whdc.zhdbaqapi.utils.ResultJson;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-22 0:47
|
|
||||||
*/
|
|
||||||
@Api(tags = "设备数据 - Controller")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/v1/deviceData")
|
|
||||||
public class DeviceDataController {
|
|
||||||
@Autowired
|
|
||||||
private IDeviceDataService iDeviceDataService;
|
|
||||||
|
|
||||||
@ApiOperation(value = "分页查询")
|
|
||||||
@PostMapping(value = "/page")
|
|
||||||
public ResultJson<IPage<DeviceDataVo>> page(@RequestBody FindDeviceDto findDto) {
|
|
||||||
return ResultJson.ok(iDeviceDataService.page(findDto));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,85 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.controller;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.whdc.zhdbaqapi.model.dto.FindDeviceDto;
|
|
||||||
import com.whdc.zhdbaqapi.model.dto.IntegerIdDto;
|
|
||||||
import com.whdc.zhdbaqapi.model.dto.StationCodeDto;
|
|
||||||
import com.whdc.zhdbaqapi.model.entity.DeviceInfo;
|
|
||||||
import com.whdc.zhdbaqapi.model.vo.DeviceInfoImpVo;
|
|
||||||
import com.whdc.zhdbaqapi.service.IDeviceInfoService;
|
|
||||||
import com.whdc.zhdbaqapi.utils.ResultJson;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-21 23:58
|
|
||||||
*/
|
|
||||||
@Api(tags = "设备信息 - Controller")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/v1/deviceInfo")
|
|
||||||
@Slf4j
|
|
||||||
public class DeviceInfoController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IDeviceInfoService iDeviceInfoService;
|
|
||||||
|
|
||||||
@ApiOperation(value = "获取单个对象")
|
|
||||||
@PostMapping("/get")
|
|
||||||
public ResultJson<DeviceInfo> get(@RequestBody @Validated IntegerIdDto idDto) {
|
|
||||||
return ResultJson.ok(iDeviceInfoService.get(idDto.getId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "新增")
|
|
||||||
@PostMapping("/save")
|
|
||||||
public ResultJson<Boolean> save(@RequestBody @Validated DeviceInfo bean) {
|
|
||||||
return ResultJson.ok(iDeviceInfoService.save(bean));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "删除")
|
|
||||||
@PostMapping("/del")
|
|
||||||
public ResultJson<Boolean> del(@RequestBody @Validated IntegerIdDto bean) {
|
|
||||||
return ResultJson.ok(iDeviceInfoService.removeById(bean.getId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "修改")
|
|
||||||
@PostMapping("/edit")
|
|
||||||
public ResultJson<Boolean> edit(@RequestBody @Validated DeviceInfo bean) {
|
|
||||||
return ResultJson.ok(iDeviceInfoService.updateById(bean));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "恢复")
|
|
||||||
@PostMapping("/restore")
|
|
||||||
public ResultJson<Boolean> edit(@RequestBody @Validated IntegerIdDto bean) {
|
|
||||||
return ResultJson.ok(iDeviceInfoService.restore(bean.getId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "列表查询")
|
|
||||||
@PostMapping(value = "/list")
|
|
||||||
public ResultJson<List<DeviceInfo>> list(@RequestBody StationCodeDto dto) {
|
|
||||||
return ResultJson.ok(iDeviceInfoService.list(dto.getStationCode()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "分页查询")
|
|
||||||
@PostMapping(value = "/page")
|
|
||||||
public ResultJson<IPage<DeviceInfo>> page(@RequestBody FindDeviceDto findDto) {
|
|
||||||
return ResultJson.ok(iDeviceInfoService.page(findDto));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "Excel数据导入")
|
|
||||||
@PostMapping("/imp")
|
|
||||||
public ResultJson<DeviceInfoImpVo> imp(@RequestParam(value = "file") @RequestPart MultipartFile file) throws Exception {
|
|
||||||
if (file == null) {
|
|
||||||
return ResultJson.error("无效文件");
|
|
||||||
}
|
|
||||||
|
|
||||||
return ResultJson.ok(iDeviceInfoService.imp(file.getInputStream()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.controller;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.whdc.zhdbaqapi.model.dto.FindDeviceDto;
|
|
||||||
import com.whdc.zhdbaqapi.model.vo.DeviceDataVo;
|
|
||||||
import com.whdc.zhdbaqapi.service.IDeviceDataService;
|
|
||||||
import com.whdc.zhdbaqapi.service.IDeviceSLDataService;
|
|
||||||
import com.whdc.zhdbaqapi.utils.ResultJson;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-22 0:47
|
|
||||||
*/
|
|
||||||
@Api(tags = "设备数据 - Controller")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/v1/deviceSLData")
|
|
||||||
public class DeviceSLDataController {
|
|
||||||
@Autowired
|
|
||||||
private IDeviceSLDataService iDeviceSLDataService;
|
|
||||||
|
|
||||||
@ApiOperation(value = "分页查询")
|
|
||||||
@PostMapping(value = "/page")
|
|
||||||
public ResultJson<IPage<DeviceDataVo>> page(@RequestBody FindDeviceDto findDto) {
|
|
||||||
return ResultJson.ok(iDeviceSLDataService.page(findDto));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,86 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.controller;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.whdc.zhdbaqapi.model.dto.FindDeviceDto;
|
|
||||||
import com.whdc.zhdbaqapi.model.dto.IntegerIdDto;
|
|
||||||
import com.whdc.zhdbaqapi.model.dto.StationCodeDto;
|
|
||||||
import com.whdc.zhdbaqapi.model.entity.DeviceInfo;
|
|
||||||
import com.whdc.zhdbaqapi.model.entity.DeviceSLInfo;
|
|
||||||
import com.whdc.zhdbaqapi.model.vo.DeviceInfoImpVo;
|
|
||||||
import com.whdc.zhdbaqapi.service.IDeviceSLInfoService;
|
|
||||||
import com.whdc.zhdbaqapi.utils.ResultJson;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-21 23:58
|
|
||||||
*/
|
|
||||||
@Api(tags = "设备信息 - Controller")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/v1/deviceSLInfo")
|
|
||||||
@Slf4j
|
|
||||||
public class DeviceSLInfoController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IDeviceSLInfoService iDeviceSLInfoService;
|
|
||||||
|
|
||||||
@ApiOperation(value = "获取单个对象")
|
|
||||||
@PostMapping("/get")
|
|
||||||
public ResultJson<DeviceInfo> get(@RequestBody @Validated IntegerIdDto idDto) {
|
|
||||||
return ResultJson.ok(iDeviceSLInfoService.get(idDto.getId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "新增")
|
|
||||||
@PostMapping("/save")
|
|
||||||
public ResultJson<Boolean> save(@RequestBody @Validated DeviceSLInfo bean) {
|
|
||||||
return ResultJson.ok(iDeviceSLInfoService.save(bean));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "删除")
|
|
||||||
@PostMapping("/del")
|
|
||||||
public ResultJson<Boolean> del(@RequestBody @Validated IntegerIdDto bean) {
|
|
||||||
return ResultJson.ok(iDeviceSLInfoService.removeById(bean.getId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "修改")
|
|
||||||
@PostMapping("/edit")
|
|
||||||
public ResultJson<Boolean> edit(@RequestBody @Validated DeviceSLInfo bean) {
|
|
||||||
return ResultJson.ok(iDeviceSLInfoService.updateById(bean));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "恢复")
|
|
||||||
@PostMapping("/restore")
|
|
||||||
public ResultJson<Boolean> edit(@RequestBody @Validated IntegerIdDto bean) {
|
|
||||||
return ResultJson.ok(iDeviceSLInfoService.restore(bean.getId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "列表查询")
|
|
||||||
@PostMapping(value = "/list")
|
|
||||||
public ResultJson<List<DeviceInfo>> list(@RequestBody StationCodeDto dto) {
|
|
||||||
return ResultJson.ok(iDeviceSLInfoService.list(dto.getStationCode()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "分页查询")
|
|
||||||
@PostMapping(value = "/page")
|
|
||||||
public ResultJson<IPage<DeviceInfo>> page(@RequestBody FindDeviceDto findDto) {
|
|
||||||
return ResultJson.ok(iDeviceSLInfoService.page(findDto));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "Excel数据导入")
|
|
||||||
@PostMapping("/imp")
|
|
||||||
public ResultJson<DeviceInfoImpVo> imp(@RequestParam(value = "file") @RequestPart MultipartFile file) throws Exception {
|
|
||||||
if (file == null) {
|
|
||||||
return ResultJson.error("无效文件");
|
|
||||||
}
|
|
||||||
|
|
||||||
return ResultJson.ok(iDeviceSLInfoService.imp(file.getInputStream()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.controller;
|
|
||||||
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|
||||||
import com.whdc.zhdbaqapi.utils.ResultJson;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-06-26 0:24
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@ApiSupport(author = "李赛")
|
|
||||||
@Slf4j
|
|
||||||
public class HomeController {
|
|
||||||
|
|
||||||
@ApiOperationSupport(author = "接口连通测试")
|
|
||||||
@GetMapping("/")
|
|
||||||
public ResultJson index() {
|
|
||||||
return ResultJson.ok("接口连通测试通过");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,131 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.controller;
|
|
||||||
|
|
||||||
import cn.dev33.satoken.stp.SaTokenInfo;
|
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.whdc.zhdbaqapi.model.dto.*;
|
|
||||||
import com.whdc.zhdbaqapi.model.entity.ForeignUserInfo;
|
|
||||||
import com.whdc.zhdbaqapi.model.entity.SysUser;
|
|
||||||
import com.whdc.zhdbaqapi.model.vo.AuthToken;
|
|
||||||
import com.whdc.zhdbaqapi.model.vo.LoginVo;
|
|
||||||
import com.whdc.zhdbaqapi.service.ISysUserService;
|
|
||||||
import com.whdc.zhdbaqapi.utils.HttpUtil;
|
|
||||||
import com.whdc.zhdbaqapi.utils.ResultJson;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-06-26 10:58
|
|
||||||
*/
|
|
||||||
@Api(tags = "用户信息 - Controller")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/v1/sysuser")
|
|
||||||
public class SysUserController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ISysUserService iSysUserService;
|
|
||||||
|
|
||||||
@ApiOperation(value = "新增")
|
|
||||||
@PostMapping("/save")
|
|
||||||
public ResultJson<Boolean> save(@RequestBody @Validated SysUser bean) {
|
|
||||||
return ResultJson.ok(iSysUserService.save(bean));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "删除")
|
|
||||||
@PostMapping("/del")
|
|
||||||
public ResultJson<Boolean> del(@RequestBody @Validated IdDto bean) {
|
|
||||||
return ResultJson.ok(iSysUserService.removeById(bean.getId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "修改")
|
|
||||||
@PostMapping("/edit")
|
|
||||||
public ResultJson<Boolean> edit(@RequestBody @Validated SysUser bean) {
|
|
||||||
return ResultJson.ok(iSysUserService.updateById(bean));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "分页查询")
|
|
||||||
@PostMapping(value = "/page")
|
|
||||||
public ResultJson<IPage<SysUser>> page(@RequestBody FindSysUserDto findDto) {
|
|
||||||
return ResultJson.ok(iSysUserService.page(findDto));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "登录", notes = "登录后,从 tokenInfo 中获取 token 相关信息。headers[tokenName] = tokenValue ")
|
|
||||||
@PostMapping("doLogin")
|
|
||||||
public ResultJson<LoginVo> doLogin(@RequestBody @Validated LoginDto obj) throws InvocationTargetException, IllegalAccessException {
|
|
||||||
LoginVo loginVo = iSysUserService.login(obj);
|
|
||||||
|
|
||||||
if (loginVo == null || loginVo.getId() == null) {
|
|
||||||
return ResultJson.error("登录失败");
|
|
||||||
} else {
|
|
||||||
StpUtil.login(loginVo.getId()); // 使用 user id 登录
|
|
||||||
|
|
||||||
// 获取 Token 相关参数
|
|
||||||
loginVo.setTokenInfo(new AuthToken(StpUtil.getTokenInfo()));
|
|
||||||
loginVo.setRoleList(StpUtil.getRoleList());
|
|
||||||
|
|
||||||
return ResultJson.ok(loginVo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "查询登录状态")
|
|
||||||
@PostMapping("isLogin")
|
|
||||||
public ResultJson<AuthToken> isLogin() {
|
|
||||||
return ResultJson.ok(StpUtil.getTokenInfo());
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "按id踢人下线")
|
|
||||||
@PostMapping("kickout")
|
|
||||||
public ResultJson kickout(@RequestBody IdDto idDto) {
|
|
||||||
StpUtil.kickout(idDto.getId());
|
|
||||||
return ResultJson.ok("将用户[" + idDto.getId() + "]踢下线");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation(value = "token注册")
|
|
||||||
@PostMapping("registerByToken")
|
|
||||||
public ResultJson<SaTokenInfo> registerByToken(@RequestBody @Validated ForeignTokenDto dto) throws InvocationTargetException, IllegalAccessException {
|
|
||||||
String jstr = HttpUtil.get("http://172.20.1.210:30042/sys/loginByToken?token=" + dto.getToken());
|
|
||||||
System.out.println("=======================");
|
|
||||||
System.out.println(dto.getToken());
|
|
||||||
System.out.println(jstr);
|
|
||||||
ForeignResp resp = JSON.parseObject(jstr, ForeignResp.class);
|
|
||||||
if (resp.getCode() != 200) {
|
|
||||||
return ResultJson.error("登录失败");
|
|
||||||
}
|
|
||||||
ForeignUserInfo userInfo = resp.getResult().getUserInfo();
|
|
||||||
SysUser bean = new SysUser();
|
|
||||||
bean.setName(userInfo.getRealname());
|
|
||||||
bean.setType(9527);
|
|
||||||
bean.setLoginName(userInfo.getUsername());
|
|
||||||
bean.setPassword(null);
|
|
||||||
bean.setForeignId(userInfo.getId());
|
|
||||||
SysUser byForeignId = iSysUserService.getByForeignId(userInfo.getId());
|
|
||||||
if (byForeignId == null) {
|
|
||||||
iSysUserService.save(bean);
|
|
||||||
}
|
|
||||||
|
|
||||||
LoginDto obj = new LoginDto();
|
|
||||||
obj.setLoginName(bean.getLoginName());
|
|
||||||
obj.setPassword(null);
|
|
||||||
LoginVo loginVo = iSysUserService.login(obj);
|
|
||||||
|
|
||||||
if (loginVo == null || loginVo.getId() == null) {
|
|
||||||
return ResultJson.error("登录失败");
|
|
||||||
} else {
|
|
||||||
StpUtil.login(loginVo.getId()); // 使用 user id 登录
|
|
||||||
// 获取 Token 相关参数
|
|
||||||
loginVo.setTokenInfo(new AuthToken(StpUtil.getTokenInfo()));
|
|
||||||
loginVo.setRoleList(StpUtil.getRoleList());
|
|
||||||
return ResultJson.ok(loginVo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.whdc.zhdbaqapi.model.dto.FindDeviceDto;
|
|
||||||
import com.whdc.zhdbaqapi.model.entity.DeviceData;
|
|
||||||
import com.whdc.zhdbaqapi.model.entity.SysUser;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-21 23:40
|
|
||||||
*/
|
|
||||||
public interface DeviceDataMapper extends BaseMapper<DeviceData> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询
|
|
||||||
*
|
|
||||||
* @param page
|
|
||||||
* @param findDto
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
IPage<DeviceData> page(@Param("page") IPage<SysUser> page, @Param("obj") FindDeviceDto findDto);
|
|
||||||
|
|
||||||
void clearByDeviceId(@Param("deviceId") String deviceId, @Param("channelNum") Integer channelNum);
|
|
||||||
}
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.whdc.zhdbaqapi.model.dto.FindDeviceDto;
|
|
||||||
import com.whdc.zhdbaqapi.model.entity.DeviceInfo;
|
|
||||||
import com.whdc.zhdbaqapi.model.entity.SysUser;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-21 23:40
|
|
||||||
*/
|
|
||||||
public interface DeviceInfoMapper extends BaseMapper<DeviceInfo> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: SKETCH_MAP 的数据类型是 text,不知道为啥非要 IFNULL(SKETCH_MAP, '') SKETCH_MAP 这样处理一下才能正常查询到结果
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
DeviceInfo get(Integer id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回查询
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DeviceInfo> list(String stationCode);
|
|
||||||
|
|
||||||
List<DeviceInfo> listAll();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询
|
|
||||||
*
|
|
||||||
* @param page
|
|
||||||
* @param findDto
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
IPage<DeviceInfo> page(@Param("page") IPage<SysUser> page, @Param("obj") FindDeviceDto findDto);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按 stationCode 查询
|
|
||||||
*
|
|
||||||
* @param scs
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DeviceInfo> listBySC(Set<String> scs);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检查 station_code 是否有效
|
|
||||||
* @param stationCode
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
DeviceInfo checkValidStationCode(String stationCode);
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.whdc.zhdbaqapi.model.dto.FindDeviceDto;
|
|
||||||
import com.whdc.zhdbaqapi.model.entity.DeviceData;
|
|
||||||
import com.whdc.zhdbaqapi.model.entity.DeviceSLData;
|
|
||||||
import com.whdc.zhdbaqapi.model.entity.SysUser;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-21 23:40
|
|
||||||
*/
|
|
||||||
public interface DeviceSLDataMapper extends BaseMapper<DeviceSLData> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询
|
|
||||||
*
|
|
||||||
* @param page
|
|
||||||
* @param findDto
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
IPage<DeviceSLData> page(@Param("page") IPage<SysUser> page, @Param("obj") FindDeviceDto findDto);
|
|
||||||
|
|
||||||
void clearByDeviceId(@Param("deviceId") String deviceId, @Param("channelNum") Integer channelNum);
|
|
||||||
}
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.whdc.zhdbaqapi.model.dto.FindDeviceDto;
|
|
||||||
import com.whdc.zhdbaqapi.model.entity.DeviceInfo;
|
|
||||||
import com.whdc.zhdbaqapi.model.entity.DeviceSLInfo;
|
|
||||||
import com.whdc.zhdbaqapi.model.entity.SysUser;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-21 23:40
|
|
||||||
*/
|
|
||||||
public interface DeviceSLInfoMapper extends BaseMapper<DeviceSLInfo> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: SKETCH_MAP 的数据类型是 text,不知道为啥非要 IFNULL(SKETCH_MAP, '') SKETCH_MAP 这样处理一下才能正常查询到结果
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
DeviceSLInfo get(Integer id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回查询
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DeviceSLInfo> list(String stationCode);
|
|
||||||
|
|
||||||
List<DeviceSLInfo> listAll();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询
|
|
||||||
*
|
|
||||||
* @param page
|
|
||||||
* @param findDto
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
IPage<DeviceSLInfo> page(@Param("page") IPage<SysUser> page, @Param("obj") FindDeviceDto findDto);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 按 stationCode 查询
|
|
||||||
*
|
|
||||||
* @param scs
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DeviceSLInfo> listBySC(Set<String> scs);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检查 station_code 是否有效
|
|
||||||
*
|
|
||||||
* @param stationCode
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
DeviceSLInfo checkValidStationCode(String stationCode);
|
|
||||||
}
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.whdc.zhdbaqapi.model.dto.FindSysUserDto;
|
|
||||||
import com.whdc.zhdbaqapi.model.entity.SysUser;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-01 1:17
|
|
||||||
*/
|
|
||||||
public interface SysUserMapper extends BaseMapper<SysUser> {
|
|
||||||
/**
|
|
||||||
* 返回所有
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<SysUser> list();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询
|
|
||||||
*
|
|
||||||
* @param page
|
|
||||||
* @param findDto
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
IPage<SysUser> page(@Param("page") IPage<SysUser> page, @Param("obj") FindSysUserDto findDto);
|
|
||||||
|
|
||||||
SysUser findByForeignId(String foreignId);
|
|
||||||
}
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.model.cklat;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-22 8:14
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true) // chain = true 实现链式调用
|
|
||||||
public class CklatQueryDto {
|
|
||||||
|
|
||||||
@JsonProperty("device_id")
|
|
||||||
@JSONField(name = "device_id")
|
|
||||||
private String deviceId;
|
|
||||||
|
|
||||||
@JsonProperty("channel_num")
|
|
||||||
@JSONField(name = "channel_num")
|
|
||||||
private Integer channelNum;
|
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ssZ", timezone = "GMT+8")
|
|
||||||
@JSONField(name = "start_timestamp", format = "yyyy-MM-dd'T'HH:mm:ssZ")
|
|
||||||
@JsonProperty("start_timestamp")
|
|
||||||
private Date startTimestamp;
|
|
||||||
}
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.model.cklat;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAlias;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-22 7:48
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class CklatRecord {
|
|
||||||
|
|
||||||
/*
|
|
||||||
"device_id": "00004216",
|
|
||||||
"timestamp": "2021-09-05T22:00:07+08:00",
|
|
||||||
"channel_num": 0,
|
|
||||||
"data_a": 2906.9,
|
|
||||||
"data_b": 26.77,
|
|
||||||
"data_c": 83857808
|
|
||||||
*/
|
|
||||||
|
|
||||||
@JsonProperty("device_id")
|
|
||||||
private String deviceId;
|
|
||||||
|
|
||||||
@JsonProperty("timestamp")
|
|
||||||
private Date timestamp;
|
|
||||||
|
|
||||||
@JsonProperty("channel_num")
|
|
||||||
private Integer channelNum;
|
|
||||||
|
|
||||||
@JsonProperty("data_a")
|
|
||||||
private BigDecimal dataA;
|
|
||||||
|
|
||||||
@JsonProperty("data_b")
|
|
||||||
private BigDecimal dataB;
|
|
||||||
|
|
||||||
@JsonProperty("data_c")
|
|
||||||
private BigDecimal dataC;
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.model.cklat;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-22 7:48
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class CklatResult {
|
|
||||||
private Integer total;
|
|
||||||
private List<CklatRecord> rows;
|
|
||||||
private String status;
|
|
||||||
private String message;
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.model.dto;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-01 1:21
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class ChangePwdDto {
|
|
||||||
@ApiParam(value = "旧密码")
|
|
||||||
private String oldpwd;
|
|
||||||
|
|
||||||
@ApiParam(value = "新密码")
|
|
||||||
private String newpwd;
|
|
||||||
}
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.model.dto;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.Pattern;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-01 1:17
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class FindDeviceDto extends FindPageDto {
|
|
||||||
@ApiModelProperty(value = "起始时间,格式应为:yyyy-MM-dd HH:mm:ss", dataType = "java.lang.String")
|
|
||||||
@Pattern(regexp = "^[1-9]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\\s+(20|21|22|23|[0-1]\\d):[0-5]\\d:[0-5]\\d$",
|
|
||||||
message = "时间格式应为:yyyy-MM-dd HH:mm:ss")
|
|
||||||
private String stm;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "截止时间,格式应为:yyyy-MM-dd HH:mm:ss", dataType = "java.lang.String")
|
|
||||||
@Pattern(regexp = "^[1-9]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\\s+(20|21|22|23|[0-1]\\d):[0-5]\\d:[0-5]\\d$",
|
|
||||||
message = "时间格式应为:yyyy-MM-dd HH:mm:ss")
|
|
||||||
private String etm;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "站点编码", dataType = "java.lang.String")
|
|
||||||
private String deviceId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "测点编号", dataType = "java.lang.String")
|
|
||||||
private String stationCode;
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.model.dto;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-07-01 1:17
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class FindSysUserDto extends FindPageDto {
|
|
||||||
@ApiModelProperty(value = "姓名", dataType = "java.lang.String")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "登录名", dataType = "java.lang.String")
|
|
||||||
private String loginName;
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.model.dto;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true) // chain = true 实现链式调用
|
|
||||||
public class ForeignResp {
|
|
||||||
boolean success;
|
|
||||||
String message;
|
|
||||||
String extMessage;
|
|
||||||
int code;
|
|
||||||
@JsonProperty(value = "result")
|
|
||||||
ForeignResult result;
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.model.dto;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.whdc.zhdbaqapi.model.entity.ForeignUserInfo;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Accessors(chain = true) // chain = true 实现链式调用
|
|
||||||
public class ForeignResult {
|
|
||||||
int multi_depart;
|
|
||||||
@JsonProperty(value = "userInfo")
|
|
||||||
ForeignUserInfo userInfo;
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.model.dto;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class ForeignTokenDto {
|
|
||||||
@ApiParam(value = "token", example = "")
|
|
||||||
@ApiModelProperty(value = "token", dataType = "java.lang.String")
|
|
||||||
@NotBlank(message = "token")
|
|
||||||
private String token;
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
package com.whdc.zhdbaqapi.model.dto;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 李赛
|
|
||||||
* @date 2022-06-26 10:43
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class IdDto implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@ApiParam(value = "主键ID", example = "")
|
|
||||||
@ApiModelProperty(value = "主键ID", dataType = "java.lang.String")
|
|
||||||
@NotBlank(message = "主键ID")
|
|
||||||
private String id;
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue