Commit 95b8300b authored by hanbing's avatar hanbing

集成统一信控V0.1版web-service代码

parent 75c8d89f
...@@ -16,12 +16,17 @@ pipeline { ...@@ -16,12 +16,17 @@ pipeline {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 'aa123658-f2bd-4079-9735-65b3f31d4d0e', url: 'http://10.100.1.74:56002/signal/traffic-signal-platform.git']]]) checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 'aa123658-f2bd-4079-9735-65b3f31d4d0e', url: 'http://10.100.1.74:56002/signal/traffic-signal-platform.git']]])
} }
} }
stage('编译构建') { stage('编译构建utc模块') {
steps { steps {
sh 'mvn -pl signal-utc-service clean package -Dmaven.test.skip=true jib:build -DsendCredentialsOverHttp=true' sh 'mvn -pl signal-utc-service clean package -Dmaven.test.skip=true jib:build -DsendCredentialsOverHttp=true'
} }
} }
stage('删除镜像和容器') { stage('编译构建web模块') {
steps {
sh 'mvn -pl signal-web-service clean package -Dmaven.test.skip=true jib:build -DsendCredentialsOverHttp=true'
}
}
stage('删除utc模块镜像和容器') {
steps { steps {
sh ''' sh '''
echo \'检查容器是否存在\' echo \'检查容器是否存在\'
...@@ -39,15 +44,43 @@ pipeline { ...@@ -39,15 +44,43 @@ pipeline {
''' '''
} }
} }
stage('拉取镜像') { stage('删除web模块镜像和容器') {
steps {
sh '''
echo \'检查容器是否存在\'
containerid=`docker ps -a|grep signal-web-service|awk \'{print $1}\'`
if [ "$containerid" != "" ];then
echo \'容器存在,删除容器\'
docker rm -f $containerid
fi
echo \'检查镜像是否存在\'
imageid=`docker images|grep signal-web-service|awk \'{print $3}\'`
if [ "$imageid" != "" ];then
echo \'删除镜像\'
docker rmi -f $imageid
fi
'''
}
}
stage('拉取utc模块镜像') {
steps { steps {
sh 'docker pull 10.100.1.87:5000/xinkong/signal-utc-service:0.2.1' sh 'docker pull 10.100.1.87:5000/xinkong/signal-utc-service:0.2.1'
} }
} }
stage('运行容器') { stage('拉取web模块镜像') {
steps {
sh 'docker pull 10.100.1.87:5000/xinkong/signal-web-service:0.2.1'
}
}
stage('运行utc模块容器') {
steps { steps {
sh 'docker run -p 32000:32000 -p 15115:15115 -itd --name signal-utc-service 10.100.1.87:5000/xinkong/signal-utc-service:0.2.1' sh 'docker run -p 32000:32000 -p 15115:15115 -itd --name signal-utc-service 10.100.1.87:5000/xinkong/signal-utc-service:0.2.1'
} }
} }
stage('运行web模块容器') {
steps {
sh 'docker run -p 32001:32001 -p 15116:15116 -itd --name signal-web-service 10.100.1.87:5000/xinkong/signal-web-service:0.2.1'
}
}
} }
} }
...@@ -37,9 +37,6 @@ ...@@ -37,9 +37,6 @@
<properties> <properties>
<spring-cloud.version>2021.0.0</spring-cloud.version> <spring-cloud.version>2021.0.0</spring-cloud.version>
<spring-cloud-alibaba.version>0.2.1.RELEASE</spring-cloud-alibaba.version> <spring-cloud-alibaba.version>0.2.1.RELEASE</spring-cloud-alibaba.version>
<mybatis.version>2.2.2</mybatis.version>
<mapper.springboot.version>2.1.5</mapper.springboot.version>
<mybatis.typehandlers.version>1.0.2</mybatis.typehandlers.version>
<druid.version>1.1.5</druid.version> <druid.version>1.1.5</druid.version>
<swagger.version>2.9.2</swagger.version> <swagger.version>2.9.2</swagger.version>
<lombok.version>1.16.18</lombok.version> <lombok.version>1.16.18</lombok.version>
...@@ -73,23 +70,6 @@ ...@@ -73,23 +70,6 @@
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
<!-- Mybatis 依赖 -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-typehandlers-jsr310</artifactId>
<version>${mybatis.typehandlers.version}</version>
</dependency>
<!-- TK MyBatis -->
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-spring-boot-starter</artifactId>
<version>${mapper.springboot.version}</version>
</dependency>
<!-- MySQL --> <!-- MySQL -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
...@@ -170,6 +150,18 @@ ...@@ -170,6 +150,18 @@
<artifactId>artemis-sdk</artifactId> <artifactId>artemis-sdk</artifactId>
<version>${artemis.version}</version> <version>${artemis.version}</version>
</dependency> </dependency>
<!-- pagehelper -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper.boot.version}</version>
</dependency>
<!-- Gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
......
...@@ -885,8 +885,8 @@ public class Constants { ...@@ -885,8 +885,8 @@ public class Constants {
public static final String BPMN_CANDIDATES = "candidates"; public static final String BPMN_CANDIDATES = "candidates";
public static final String BPMN_COMPLETION_CONDITION = "completionCondition"; public static final String BPMN_COMPLETION_CONDITION = "completionCondition";
public static final String BPMN_COMPLETION_CONDITION_CONTENT = "${userTaskHandler.dealComplete(execution)}"; public static final String BPMN_COMPLETION_CONDITION_CONTENT = "${userTaskHandler.dealComplete(execution)}";
public static final String BPMN_PROCESS_EXECUTION_LISTENER_NAME = "com.wanji.design.engine.operate.impl.ProcessExecutionListener"; public static final String BPMN_PROCESS_EXECUTION_LISTENER_NAME = "net.wanji.design.engine.operate.impl.ProcessExecutionListener";
public static final String BPMN_ACTIVITI_CLASS_NAME = "com.wanji.design.engine.operate.impl.AutoNodeServiceTask"; public static final String BPMN_ACTIVITI_CLASS_NAME = "net.wanji.design.engine.operate.impl.AutoNodeServiceTask";
/*bpmn20.xml节点定义 end*/ /*bpmn20.xml节点定义 end*/
......
...@@ -76,7 +76,7 @@ public class TCrossInfo implements Serializable { ...@@ -76,7 +76,7 @@ public class TCrossInfo implements Serializable {
/** /**
* 型号 * 型号
*/ */
@TableField("model") @TableField("po")
private String model; private String model;
/** /**
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<mybatis-plus-version>3.5.1</mybatis-plus-version> <mybatis-plus-version>3.5.1</mybatis-plus-version>
<mybatis.generator.version>1.3.2</mybatis.generator.version>
<mysql.connector.version>5.1.41</mysql.connector.version>
</properties> </properties>
<dependencies> <dependencies>
...@@ -78,26 +80,219 @@ ...@@ -78,26 +80,219 @@
<artifactId>hibernate-validator</artifactId> <artifactId>hibernate-validator</artifactId>
<version>6.0.1.Final</version> <version>6.0.1.Final</version>
</dependency> </dependency>
<!-- apache commons-->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<!-- redis -->
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!-- ws rs -->
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
</dependency>
<!-- pagehelper -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<!-- Hutool -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<!-- Gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<!-- 编译插件 -->
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<compilerArguments>
<encoding>${project.build.sourceEncoding}</encoding>
</compilerArguments>
</configuration>
</plugin>
<!-- 项目打包插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration> <configuration>
<includeSystemScope>true</includeSystemScope> <archive>
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 --> <manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.wanji.web.SignalApplication</mainClass>
</manifest>
</archive>
<excludes>
<exclude>generate_code_vm/**</exclude>
<exclude>mybatis-generator/**</exclude>
<exclude>**/*.yml</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<!-- 主类 -->
<configuration>
<finalName>signal-web-service</finalName>
<descriptors>
<descriptor>src/main/assembly/package.xml</descriptor>
</descriptors>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
<id>make-assembly</id>
<phase>package</phase>
<goals> <goals>
<goal>repackage</goal> <goal>single</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>${mybatis.generator.version}</version>
<configuration>
<configurationFile>${basedir}/src/main/resources/mybatis-generator/generatorConfig.xml</configurationFile>
<verbose>true</verbose>
<overwrite>true</overwrite>
</configuration>
<dependencies>
<!-- 数据库驱动 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.connector.version}</version>
</dependency>
</dependencies>
</plugin>
<!-- swagger 导出配置 -->
<plugin>
<groupId>io.github.swagger2markup</groupId>
<artifactId>swagger2markup-maven-plugin</artifactId>
<version>1.3.3</version>
<configuration>
<swaggerInput>http://10.100.1.87:30003/utcsystem/v2/api-docs</swaggerInput>
<outputDir>src/docs/asciidoc/generated</outputDir>
<config>
<swagger2markup.markupLanguage>ASCIIDOC</swagger2markup.markupLanguage>
</config>
</configuration>
</plugin>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>1.5.6</version>
<configuration>
<sourceDirectory>src/docs/asciidoc/generated</sourceDirectory>
<outputDirectory>src/docs/asciidoc/html</outputDirectory>
<backend>html</backend>
<sourceHighlighter>coderay</sourceHighlighter>
<attributes>
<toc>left</toc>
</attributes>
</configuration>
</plugin>
<!-- mvn clean package -Dmaven.test.skip=true jib:build -DsendCredentialsOverHttp=true -->
<!-- 使用jib 无需深入学习docker, 无需编写Dockerfile -->
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<!--from节点用来设置镜像的基础镜像,相当于Docerkfile中的FROM关键字-->
<from>
<!--使用harbor上的openjdk镜像-->
<image>10.100.1.87:5000/xinkong/openjdk:8-alpine3.9</image>
<!--harbor服务器的登录信息-->
<auth>
<username>admin</username>
<password>Wanji300552</password>
</auth>
</from>
<to>
<image>10.100.1.87:5000/xinkong/${artifactId}:${version}</image>
<auth>
<username>admin</username>
<password>Wanji300552</password>
</auth>
</to>
<container>
<!--配置jvm虚拟机参数-->
<jvmFlags>
<jvmFlag>-Xms512m</jvmFlag>
<jvmFlag>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=15116</jvmFlag>
</jvmFlags>
<!--配置使用的时区-->
<environment>
<TZ>Asia/Shanghai</TZ>
</environment>
<!--要暴露的端口-->
<ports>
<port>32001</port>
<port>15116</port>
</ports>
<!-- <creationTime>2022-10-14T10:08:59.304+08:00</creationTime>-->
<creationTime>${maven.build.timestamp}</creationTime>
<mainClass>com.wanji.web.SignalApplication</mainClass>
</container>
<!--可以进行HTTP-->
<allowInsecureRegistries>true</allowInsecureRegistries>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
......
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>1.0</id>
<formats>
<format>tar.gz</format>
<format>dir</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<fileSets>
<!-- for bin -->
<fileSet>
<directory>src/main/bin</directory>
<includes>
<include>*.*</include>
</includes>
<directoryMode>775</directoryMode>
<outputDirectory>bin/</outputDirectory>
</fileSet>
<!-- for configs -->
<fileSet>
<directory>src/main/resources</directory>
<includes>
<include>*.yml</include>
<include>*.xml</include>
</includes>
<outputDirectory>/</outputDirectory>
</fileSet>
<!-- for jar -->
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
</fileSets>
<!-- for lib -->
<dependencySets>
<dependencySet>
<outputDirectory>lib/</outputDirectory>
<scope>runtime</scope>
<excludes>
<exclude>${groupId}:${artifactId}</exclude>
</excludes>
</dependencySet>
</dependencySets>
</assembly>
#!/bin/bash
jarName="signal-web-service-1.0.0.jar"
NR=$(ps -ef | grep "${jarName}" | grep -v grep | wc -l)
if [ ${NR} != 0 ]
then
ps -ef | grep -v grep | grep "${jarName}" |
while read u p o
do
echo "结束Java程序进程..."
kill -9 $p
done
fi
sleep 2
echo "重启Java程序进程..."
nohup java -Xms2048m -Xmx2048m -jar -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/javaApp/heapdump.hprof -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=15115 -Djava.rmi.server.hostname=10.100.1.87 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false signal-web-service-1.0.0.jar --spring.profiles.active=dev >/dev/null 2>&1 &
...@@ -3,16 +3,23 @@ package net.wanji.web; ...@@ -3,16 +3,23 @@ package net.wanji.web;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/** /**
* @author wj * @author
* @date 2022/11/28 9:31:34
*/ */
@MapperScan("net.wanji.web.mapper") @SpringBootApplication(scanBasePackages = "net.wanji.web")
@SpringBootApplication @MapperScan(basePackages = "net.wanji.web.mapper")
public class WebApplication { @EnableTransactionManagement
@EnableScheduling
@EnableAsync
//@EnableDiscoveryClient
public class SignalApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(WebApplication.class, args); SpringApplication.run(SignalApplication.class, args);
} }
} }
package net.wanji.web.common;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;
public final class Constants {
/*记录当前用户*/
public static ThreadLocal<String> current_user_id = ThreadLocal.withInitial(() -> "");
//gisc-develop 工作流事务全局标识,默认不开启
public static ThreadLocal<Boolean> OPEN_GLOBAL_TRANSACTION = ThreadLocal.withInitial(() -> Boolean.FALSE);
//gisc-develop D2A事务实现,db操作临时conn存放
public static ThreadLocal<List<Connection>> DB_CONNS = ThreadLocal.withInitial(ArrayList::new);
//日志消息名称关键字
public static final String BP_LOG = "log";
//数据扩展表关键字
public static final String TABLE_RELATION="_relation";
public final class MessageES{
public static final String MESSAGE_HISTORY = "message_history";
public static final String MESSAGE_CONSUME_HISTORY = "message_consume_history";
public static final String MESSAGE_FILTER_HISTORY = "message_filter_history";
}
public final class WebsocketMessage{
public static final String NEW_UNREAD_MESSAGE = "";
public static final String GET_UNREAD_COUNT="";
public static final String GET_READ_MESSAGE="";
public static final String GET_UNREAD_MESSAGE="";
}
public final class igniteCacheName {
//bp design 模块缓存名称
public static final String BP_DESIGN_CACHE = "gisc-portal-cache-name";
public static final String BP_GATEWAY_CACHE = "gisc-gateway-cache-name";
public static final String GATEWAY_CACHE = "gatewayCache";
public static final String API_RESTFUL_CACHE = "apiRestfulCache";
public static final String A2A_RESTFUL_CACHE = "a2aRestfulCache";
public static final String D2A_TABLE_RESTFUL_CACHE = "d2aTableRestfulCache";
public static final String BP_ROADNET_CACHE = "gisc-roadnet-cache-name";
}
public final class Env {
public static final String BASE_HOME = "";
public static final String WORKFLOW_HOME = "configs/workflow/";
}
// RepoModuleType 分类
public final class RepoModuleTypeType {
public static final String RULE = "rule";
public static final String COMMON = "common";
public static final String APPLICATION = "application";
}
public final class MqTopic {
public static final String JAVA_MODULE_OFFLINE_TOPIC = "javaModuleOffline";
public static final String JAVA_MODULE_ONLINE_TOPIC = "javaModuleOnline";
}
public final class MqKey {
}
public final class ImportExport {
public static final String IMPORT = "import";
public static final String EXPORT = "export";
}
public final class DevExport {
public static final String MAN_DEV_APP = "MAN_DEV_APP.csv";
public static final String MAN_DEV_APPTHEME = "MAN_DEV_APPTHEME.csv";
public static final String MAN_APP_TYPE = "MAN_APP_TYPE.csv";
public static final String MAN_GW_D2A_DATABASE = "MAN_GW_D2A_DATABASE.csv";
public static final String MAN_DEV_API_RESTFUL = "MAN_DEV_API_RESTFUL.csv";
public static final String MAN_GW_D2A_TABLE_RESTFUL = "MAN_GW_D2A_TABLE_RESTFUL.csv";
public static final String MAN_DEV_RESTFUL = "MAN_DEV_RESTFUL.csv";
public static final String MAN_GW_D2A_TABLE = "MAN_GW_D2A_TABLE.csv";
public static final String MAN_GW_D2A_TABLE_FIELDS = "MAN_GW_D2A_TABLE_FIELDS.csv";
public static final String MAN_DEV_DATA_DICT_CONTENT = "MAN_DEV_DATA_DICT_CONTENT.csv";
public static final String MAN_DEV_DATA_DICT_TYPE = "MAN_DEV_DATA_DICT_TYPE.csv";
public static final String MAN_GW_M2A_MAIL = "MAN_GW_M2A_MAIL.csv";
public static final String MAN_REPO_MODULE_TYPE = "MAN_REPO_MODULE_TYPE.csv";
public static final String MAN_REPO_MODULE = "MAN_REPO_MODULE.csv";
public static final String MAN_DEV_MODULE = "MAN_DEV_MODULE.csv";
public static final String MAN_MSG_TOPIC = "MAN_MSG_TOPIC.csv";
public static final String MAN_MSG_ROUTE = "MAN_MSG_ROUTE.csv";
public static final String MAN_MSG_SUBSCRIBE = "MAN_MSG_SUBSCRIBE.csv";
public static final String MAN_MSG_FILTER_ITEM = "MAN_MSG_FILTER_ITEM.csv";
public static final String CLI_IC_APP_BUSINESS_ACCOUNT = "CLI_IC_APP_BUSINESS_ACCOUNT.csv";
public static final String CLI_IC_ORGANIZATION = "CLI_IC_ORGANIZATION.csv";
public static final String CLI_IC_ROLE = "CLI_IC_ROLE.csv";
public static final String CLI_IC_ROLE_BUSINESSACCOUNT_RLAT = "CLI_IC_ROLE_BUSINESSACCOUNT_RLAT.csv";
public static final String CLI_DEV_MENU = "CLI_DEV_MENU.csv";
public static final String MAN_MSG_TOPIC_FILTER_ITEM_RLAT= "MAN_MSG_TOPIC_FILTER_ITEM_RLAT.csv";
public static final String MAN_DEV_PLUGIN_PARAM="MAN_DEV_PLUGIN_PARAM.csv";
}
public final class BpmExport {
//导出流程定义表
public static final String WORKFLOW = "MAN_BPM_WORKFLOW.csv";
//导出流程实例表
public static final String WORKFLOW_INST = "MAN_BPM_WORKFLOW_INST.csv";
//导出流程任务表
public static final String WORKFLOW_INST_TASK = "MAN_BPM_WORKFLOW_TASK.csv";
//导出流程任务处理人表
public static final String WORKFLOW_INST_TASK_PERSON = "MAN_BPM_WORKFLOW_TASK_PERSON.csv";
//导出流程任务会签表
public static final String WORKFLOW_INST_TASK_SIGN = "MAN_BPM_WORKFLOW_TASK_COUNTERSIGN.csv";
//导出流程通知表
public static final String WORKFLOW_NOTICE = "MAN_BPM_WORKFLOW_NOTICE.csv";
//导出流程分类表
public static final String WORKFLOW_TYPE = "MAN_BPM_WORKFLOW_TYPE.csv";
//导出流程参数表
public static final String WORKFLOW_BPM_VAR = "MAN_BPM_VAR.csv";
//导出流程规则表
public static final String WORKFLOW_BPM_RULE = "MAN_BPM_RULE.csv";
//导出流程节点表
public static final String WORKFLOW_BPM_PLUGIN_PARAM = "MAN_BPM_PLUGIN_PARAM.csv";
//导出流程邮件日志表
public static final String WORKFLOW_MAIL_LOG = "MAN_BPM_MAIL_LOG.csv";
//导出流程原因表
public static final String WORKFLOW_LEAVE_INFO = "MAN_BPM_LEAVE_INFO.csv";
//导出流程form表单表
public static final String WORKFLOW_BPM_FORM = "MAN_BPM_FORM.csv";
//导出页面表
public static final String PAGE_WEB = "CLI_DEV_WEB_PAGE.csv";
//导出组件表
public static final String COMPONENT = "CLI_DEV_COMPONENT.csv";
//导出组件组表
public static final String COMPONENT_GROUP = "CLI_DEV_COMPONENT_GROUP.csv";
//导出组件版本表
public static final String COMPONENT_VERSION = "CLI_DEV_COMPONENT_VERSION.csv";
}
/**
* 系统基础服务路径
*/
public final class RestPathPrefix {
public static final String PREFIX = "bp/";
public static final String DEVELOP_PREFIX = "develop/";
public static final String LOG_PREFIX = "log/";
public static final String DESIGN_PREFIX = "design/";
public static final String MODEL_CONSOLE = "design/console/";
public static final String MODEL_IDENTITYAUTH = "bp/auth/";
public static final String MODEL_RESTFUL = "develop/restful/";
public static final String MODEL_IDENTITY = "bp/identity/";
public static final String MODEL_MSP = "bp/msp/";
public static final String MODEL_DATAMANAGE = "design/datamanage/";
public static final String MODEL_SGW = "design/sgw/";
public static final String MODEL_DISPLAYCENTER = "design/displaycenter/";
public static final String MODEL_TASKSCHEDULE = "design/taskschedule/";
public static final String MODEL_WEB = "design/web/";
public static final String FRONT_DEVELOP = "design/frontdevelop/";
public static final String MODEL_BPM_MANAGER = "design/bpm/";
public static final String MODEL_COMMON = "design/common/";
public static final String MODEL_PROCESS_QUERY = "develop/processquery/";
public static final String MODEL_MESSAGECENTER = "design/messagecenter/";
public static final String MODEL_DEV = "design/develop/";
public static final String MODEL_RULE = "design/rule/";
public static final String MODEL_DATA_CHECK = "design/datacheck/";
public static final String MODEL_TOOLS = "design/tools/";
public static final String MODEL_CONFIG_CENTER = "design/configcenter/";
public static final String MODEL_APPMANAGE = "design/appmanage/";
public static final String MODEL_COMPONENT = "design/component/";
public static final String MODEL_PORTAL = "design/portal/";
public static final String MODEL_LOG = "log/logcenter/";
public static final String MODEL_OPERATION_MONITOR = "design/operationmonitor/";
public static final String MODEL_SYSTEM_SETTING = "design/systemsetting/";
public static final String MODEL_STATISTICS = "bp/statistics/";
public static final String MODEL_IM = "bp/im/";
public static final String MODEL_DEVICE = "bp/things/";
public static final String MODEL_IM_USER = "bp/user/";
public static final String MODEL_IM_MESSAGE = "bp/message/";
public static final String MODEL_IM_GROUP = "bp/group/";
public static final String MODEL_IM_CHANNEL = "bp/channel/";
public static final String MODEL_IM_ORGANIZATION = "bp/organization/";
public static final String MODEL_IM_ORGAN_USER = "bp/organuser/";
public static final String MODEL_IM_STATISTICS = "bp/statistics";
public static final String MODEL_IM_TASK = "bp/task/";
//数据源
public static final String MODEL_DATASOURCE = "develop/datasource/";
//数据资源
public static final String MODEL_RESOURCE = "develop/resource/";
//数据资源管理
public static final String MODEL_RESOURCE_DATA = "develop/resourcedata/";
//基础数据
public static final String MODEL_BASE_DATA = "design/basedata/";
//服务接口
public static final String MODEL_DEV_SERVICE="develop/service/";
//基础设置
public static final String MODEL_CONFIG_DATA = "design/config/";
//MSP
public static final String MODEL_MSP_STYLECONFIG = "bp/msp/config/";
//geoServer
public static final String GEOSERVER = "geoserver/";
/**
* msp相关path定义
*/
public static final String MODEL_MSP_SERVICE = "bp/msp/service/";
public static final String MODEL_MSP_RESOURCE = "bp/msp/resource/";
public static final String MODEL_MSP_CONFIG = "bp/msp/config/";
public static final String MODEL_MSP_TOOL = "bp/msp/tool/";
public static final String MODEL_MSP_SCENSE = "bp/msp/sense/";
/***
* 路网api定义
*/
public static final String ROADNET_API = "api/roadnet/";
/**
* 设备信息
*/
public static final String DEVICE_API = "api/device/";
}
public final class ServiceDevPathPrefix{
/**
* 数据库接口
*/
public static final String DEV_DB_INTERFACE = "sgw/dbInterface";
/**
* 服务接口接口
*
*/
public static final String DEV_API_INTERFACE="sgw/apiInterface";
/**
* dev 注册服务
*/
public static final String DEV_SGW_SERVICE = "develop/sgw/serviceInterface/";
/**
* vt 矢量栅格服务
*/
public static final String DEV_VT_SERVICE="develop/vt/";
}
/**
* 数据能力标签,元数据驱动的核心代码
*/
public final class DataTag{
/**
* geometry
* 空间表
* --
* export
* 导出
* --
* nest
* 套和
* --
* hook
* 挂接
* --
* cache
* 缓存
* --
* publish
* 发布
* --
* edit
*/
public static final String DATA_TAG_EXPORT="export";
public static final String DATA_TAG_GEOMETRY="geometry";
public static final String DATA_TAG_NEST="nest";
public static final String DATA_TAG_HOOK="hook";
public static final String DATA_TAG_CACHE="cache";
public static final String DATA_TAG_PUBLISH="publish";
public static final String DATA_TAG_EDIT="edit";
}
/**
* Restful 对外的静态变量
*/
public final class JsonView {
public static final String STATUS_SUCCESS = "success";
public static final String STATUS_FAIL = "fail";
public static final String MESSAGE_FAIL = "操作失败";
public static final String MESSAGE_SUCCESS = "操作成功";
public static final String MESSAGE_PARAM_ERROR = "参数错误";
public static final String MESSAGE_FROMAT_ERROR = "请求格式错误";
public static final String MESSAGE_GET_PARAM_ERROR = "GET请求参数错误,注:暂不支持对象嵌套及数组";
public static final String MESSAGE_LOGIN_SUCCESS = "登录成功";
public static final String DELETE_ERROR_MSG = "表单【%s】已被流程【%s】使用";
}
/**
* 接口服务参数
*/
public static class ServiceConstants {
public static final String API_URL = "url";
public static final String API_ACCESS_METHOD = "method";
public static final String API_ACCESS_GET = "get";
public static final String API_ACCESS_POST = "post";
public static final String API_ACCESS_PUT = "put";
public static final String API_ACCESS_DELETE = "delete";
public static final String API_BODY = "body";
public static final String API_HEADER = "header";
public static final String API_QUERY = "query";
public static final String API_PATH = "pathParam";
}
/**
* @Description: 网关表,类型相关参数
* @return
* @Author mapabc8
* @Date 2020/2/14 10:10
**/
public static class ServiceType {
public static final String SERVICE_D2A = "d2a";
public static final String SERVICE_A2A = "a2a";
public static final String SERVICE_WEB_SERVICE = "webservice";
public static final String SERVICE_M2A = "m2a";
public static final String SERVICE_ORCHESTRATION = "orchestration";
public static final String SERVICE_DEVELOP = "develop";
public static final String SERVICE_BASIC = "basic";
public static final String SERVICE_BUSINESS = "business";
}
public static class AppType {
public static final String APP_REPOSITORY = "repository";
public static final String APP_EXTERNAL = "external";
public static final String APP_ORCHESTRATION = "orchestration";
public static final String APP_DEVELOP = "develop";
public static final String APP_INTERNAL = "internal";
}
/*
* apiType
* api 类型
*/
public static class RestfulApiType {
//内部系统
public static final String SERVICE_INSIDE = "inside";
//外部系统
public static final String SERVICE_OUTSIDE = "outside";
}
/*
* apiParam
* api 参数
*/
public static class ApiParam {
// mock
public static final String MOCK = "mock";
public static final String UNMOCK = "unmock";
}
/*
* spring application name
*/
public static class applicationName {
public static final String BP_RESTFUL = "gisc-restful";
public static final String BP_GATEWAY = "gisc-gateway";
public static final String BP_DESIGN = "gisc-portal";
public static final String BP_DEVELOP = "gisc-develop";
public static final String BP_IDENTITY = "gisc-identity";
public static final String BP_MSP = "gisc-msp";
}
/**
* 缓存名称
*/
public final class Cache {
public static final String USER = "user";
public static final String ONLINE_USER = "online_user";
public static final String ONLINE_MOBILE_USER = "online_mobile_user";
public static final String SYSTEM_SESSION = "system_session";
public static final String LOGIN_CACHE = "login_cache";
public static final String ETL_CACHE = "etl_workflow_cache";
public static final String RE_CACHE = "re_workflow_cache";
public static final String RE_CACHE_TOPIC = "re_workflow_cache_topic";
}
public final static class SystemParam {
/**
* 逗号分隔符
*/
public static String COMMA_SPLIT = ",";
/**
* 冒号分隔符
*/
public static String COLON_SPLIT = ":";
/**
* 空Json串
*/
public static String BLANK_JSON_STRING = "{}";
}
/**
* mysql 的字段类型
*/
public final static class MysqlColumn {
public final static String YEAR = "YEAR";
public final static String DATE = "DATE";
public final static String DATETIME = "DATETIME";
public final static String TIMESTAMP = "TIMESTAMP";
public final static String BINARY = "BINARY";
public final static String VARBINARY = "VARBINARY";
public final static String TINYINT = "TINYINT";
public final static String SMALLINT = "SMALLINT";
public final static String MEDIUMINT = "MEDIUMINT";
public final static String INT = "INT";
public final static String BIGINT = "BIGINT";
public final static String BIT = "BIT";
public final static String CHAR = "CHAR";
public final static String VARCHAR = "VARCHAR";
public final static String TEXT = "TEXT";
public final static String LONGTEXT = "LONGTEXT";
public final static String DECIMAL = "DECIMAL";
public final static String DOUBLE = "DOUBLE";
public final static String FLOAT = "FLOAT";
}
/**
* postgresql 的字段类型
*/
public final static class PostGreSqlColumn {
public final static String TEXT = "text"; // string
public final static String BPCHAR = "char"; // string
public final static String VARCHAR = "varchar"; // string
public final static String INT4 = "int4"; // integer
public final static String INT2 = "int2"; // integer
public final static String FLOAT4 = "float4"; // float
public final static String FLOAT8 = "float8"; // double
public final static String MONEY = "money"; // double
public final static String BIT = "bit"; // boolean
public final static String NUMERIC = "numeric"; // BigDecimal
public final static String BOOL = "bool"; // boolean
public final static String INT8 = "int8"; // long
public final static String TIMESTAMP = "timestamp"; // timestamp
public final static String TIME = "time"; // time
public final static String DATE = "date"; // time
public final static String BYTEA = "bytea"; // ?
public final static String BOX = "box"; // object
public final static String CIDR = "cidr"; // object
public final static String INET = "inet"; // object
public final static String MACADDR = "macaddr"; // object
public final static String VARBIT = "varbit"; // object
public final static String CIRCLE = "circle"; // object
public final static String INTERVAL = "interval"; // object
public final static String LINE = "line"; // object
public final static String LSEG = "lseg"; // object
public final static String POLYGON = "polygon"; // object
public final static String POINT = "point"; // object
public final static String PATH = "path"; // object
}
/**
* oracle 的字段类型
*/
public final static class OracleColumn {
public final static String VARCHAR2 = "VARCHAR2";
public final static String VARCHAR = "VARCHAR";
public final static String ORACLE_CHAR = "CHAR";
public final static String TIMESTAMP = "TIMESTAMP";
public final static String DATE = "DATE";
public final static String RAW = "RAW";
public final static String NVARCHAR2 = "NVARCHAR2";
public final static String TIMESTAMP_WITH_LOCAL_TIME_ZONE = "TIMESTAMP_WITH_LOCAL_TIME_ZONE";
public final static String TIMESTAMP_WITH_TIME_ZONE = "TIMESTAMP_WITH_TIME_ZONE";
public final static String INTERVAL_DAY_TO_SECOND = "INTERVAL_DAY_TO_SECOND";
public final static String INTERVAL_YEAR_TO_MONTH = "INTERVAL_YEAR_TO_MONTH";
public final static String NUMBER = "NUMBER";
public final static String FLOAT = "FLOAT";
}
/**
* @Description: sqlserver 的字段类型
* @return
* @Author mapabc8
* @Date 2020/3/12 17:47
**/
public final static class SqlServerColumn {
// Character 字符串
public final static String CHAR = "char";
public final static String VARCHAR = "varchar";
public final static String TEXT = "text";
// Number 类型
public final static String TINYINT = "tinyint";
public final static String SMALLINT = "smallint";
public final static String INT = "int";
public final static String BIGINT = "bigint";
public final static String FLOAT = "float";
// Binary类型
public final static String BIT = "bit";
public final static String BINARY = "binary";
public final static String VARBINARY = "varbinary";
// Date 类型
public final static String DATETIME = "datetime";
public final static String DATETIME2 = "datetime2";
public final static String TIMESTAMP = "timestamp";
}
/**
* 数据表相关
*/
public final static class TableInfo {
public static final String COLUMN_NAME = "COLUMN_NAME";
public static final String TYPE_NAME = "TYPE_NAME";
public static final String COLUMN_SIZE = "COLUMN_SIZE";
public static final String IS_PK = "IS_PK";
public static final String ISNULL = "ISNULL";
public static final String IS_BUSINESS_PK = "IS_BUSINESS_PK";
public static final String NULLABLE = "NULLABLE";
public static final String COLUMN_DEF = "COLUMN_DEF";
public static final String DECIMAL_DIGITS = "DECIMAL_DIGITS";
}
/**
* 数据库
*/
public final static class DataBase {
public static final String MYSQL = "mysql";
public static final String ORACLE = "oracle";
public static final String BEYONDB = "beyondb";
public static final String POSTGRESQL = "postgresql";
public static final String SQLSERVER="sqlserver";
}
/**
* 数据源的驱动
*/
public static final class DbDriver {
public static final String MYSQL = "com.mysql.jdbc.Driver";
public static final String ORACLE = "oracle.jdbc.driver.OracleDriver";
public static final String BEYONDB = "org.postgresql.Driver";
public static final String IMPALA = "com.cloudera.impala.jdbc41.Driver";
public static final String SQLSERVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
public static final String POSTGRESQL = "org.postgresql.Driver";
}
private static final String DATE_FORMAT_DAY = "yyyy-MM-dd";
private static final String DATE_FORMAT_HOUR = "yyyy-MM-dd HH";
private static final String DATE_FORMAT_MINUTE = "yyyy-MM-dd HH:mm";
private static final String DATE_FORMAT_SECOND = "yyyy-MM-dd HH:mm:ss";
private static final String DATE_FORMAT_MILLIS = "yyyy-MM-dd HH:mm:ss.SSS";
private static final String DATE_FORMAT_TIME = "HH:mm:ss";
private static final String DATE_FORMAT_WEEKDAY = "EEEE";
public enum DATE_FORMAT {
// 平台指定的时间格式字符串
E_DATE_FORMAT_DAY(DATE_FORMAT_DAY),
E_DATE_FORMAT_HOUR(DATE_FORMAT_HOUR),
E_DATE_FORMAT_MINUTE(DATE_FORMAT_MINUTE),
E_DATE_FORMAT_SECOND(DATE_FORMAT_SECOND),
E_DATE_FORMAT_MILLIS(DATE_FORMAT_MILLIS),
E_DATE_FORMAT_TIME(DATE_FORMAT_TIME),
E_DATE_FORMAT_WEEKDAY(DATE_FORMAT_WEEKDAY);
private final String strFormat;
DATE_FORMAT(String strFormat) {
this.strFormat = strFormat;
}
public String getStrFormat() {
return strFormat;
}
}
public static final class ServicePluginParamArea {
public static final String GLOBAL = "global";
public static final String PARAM = "param";
public static final String OUTPUT = "output";
}
/*流程服务封装公用变量定义*/
public final class ProcessService {
public static final String ERROR_PARAM = "参数错误";
public static final String NO_PROCESS_OPERATE = "参数错误,无对应流程操作";
public static final String OPERATE_FAILD = "操作失败";
public static final String DEPLOY_SUCCESS = "部署成功";
public static final String DEPLOY_FAILD = "部署失败";
public static final String UNDEPLOY_SUCCESS = "取消部署成功";
public static final String UNDEPLOY_FAILD = "取消部署失败";
public static final String SUCCEED_COUNT = "成功条数";
public static final String FAILED_COUNT = "失败条数";
public static final String FAILED_USER_ID = "失败用户id";
public static final String START_ROWNUM = "startRowNum";
public static final String PAGE_SIZE = "pageSize";
public static final String PARAM_ERROR = "参数错误: processId=%s, userId=%s";
public static final String NODE_CONFIG_ERROR = "节点配置错误";
public static final String CANNOT_DEAL = "无法处理此任务,用户无对应操作权限或流程被暂停";
public static final String COMMENT_TYPE_PASS = "PASS";
public static final String COMMENT_TYPE_NO_PASS = "NO_PASS";
public static final String NR_OF_INSTANCES_VAR_NAME = "nrOfInstances";
public static final String NR_OF_ACTIVE_INSTANCES_VAR_NAME = "nrOfActiveInstances";
public static final String APPROVED_COUNTER_VAR_NAME = "approvedCounter";
public static final String COMMENT_BACK = "驳回";
public static final String COMMENT_TYPE_BACK = "BACK";
public static final String PAUSE_PROCESS = "流程已暂停,无法操作";
public static final String ADMIN_ID = "admin";
public static final String ALREADY_ACTIVE = "流程已激活,请勿重复操作";
public static final String ALREADY_ASSIGNED = "任务已分配到指定用户,无需重复操作";
public static final String COMMENT_ASSIGNE = "委派处理";
public static final String REJECT_ASSIGNE = "驳回处理";
public static final String COMMENT_TYPE_DEFAULT = "comment";
public static final String PROCESS_START_EVENT = "start";
public static final String PROCESS_END_EVENT = "end";
public static final String START_USER_ID = "startUserId";
public static final String PROCESS_INSTANCE_NAME = "processInstanceName";
public static final String NEED_EMAIL_VAR_NAME = "needEmail";
public static final String EMAIL_SERVICE_BEAN_NAME = "emailService";
public static final String CANDIDATE_USERS_VAR_NAME = "candidateUsers";
public static final String NOTICE_TYPE_START = "start";
public static final String NOTICE_TYPE_NEXT = "next";
/*流程表单保存在流程变量中的名称*/
public static final String FORM_DATA_USER_DEFINED_VAR_NAME = "formDataUserDefined";
public static final String START_FORM_DATA_USER_DEFINED_VAR_NAME = "startFormDataUserDefined";
/*流程是否通过流程变量*/
public static final String IS_APPROVED_VAR_NAME = "isApproved";
}
/*流程操作,枚举常量*/
public enum ProcessOperateType {
/*启动流程*/
start,
//审批,通过-不通过,通过变量控制
approve,
//驳回,到指定节点
back,
//委派
transfer,
//暂停
suspend,
//激活
active,
//作废
delete,
//抄送标记为已读
readCopyTo,
//抄送标记为未读
unReadCopyTo;
}
/*流程节点权限计算,枚举常量*/
public enum AUTH_CALCULATE_TYPE {
//根据指定企业
withCompany,
//根据指定部门
withDepartment,
//根据岗位
withStation,
//根据角色
withRole,
//根据企业用户
withCompanyUser,
//求并集
withUnion,
//求交集
withIntersection;
}
/**
* 流程定义bpmn20.xml生成字符属性
*/
public final static class Process {
public static final String DEFAULT_CHARSET = "UTF-8"; //编码格式utf-8定义
public static final String BPMN_XML_SUFFIX = ".bpmn20.xml"; //编码格式utf-8定义
/*bpmn20.xml节点定义 start*/
public static final String BPMN_DEFINITIONS = "definitions";
public static final String BPMN_XMLNS = "xmlns";
public static final String BPMN_XMLNS_CONTENT = "http://www.omg.org/spec/BPMN/20100524/MODEL";
public static final String BPMN_XMLNS_ACTIVITI = "xmlns:activiti";
public static final String BPMN_XMLNS_ACTIVITI_CONTENT = "http://activiti.org/bpmn";
public static final String BPMN_TARGET_NAMESPACE = "targetNamespace";
public static final String BPMN_TARGET_NAMESPACE_CONTENT = "http://activiti.org/bpmn20";
public static final String BPMN_XMLNS_XSI = "xmlns:xsi";
public static final String BPMN_XMLNS_XSI_CONTENT = "http://www.w3.org/2001/XMLSchema-instance";
public static final String BPMN_PROCESS = "process";
public static final String BPMN_ID = "id";
public static final String BPMN_PROCESS_ID = "processId";
public static final String BPMN_NAME = "name";
public static final String BPMN_SOURCE_REF = "sourceRef";
public static final String BPMN_TARGET_REF = "targetRef";
public static final String BPMN_CALLED_ELEMENT = "calledElement";
public static final String BPMN_EXTENSION_ELEMENTS = "extensionElements";
public static final String BPMN_SOURCE = "source";
public static final String BPMN_TARGET = "target";
public static final String BPMN_ACTIVITI_IN = "activiti:in";
public static final String BPMN_ACTIVITI_OUT = "activiti:out";
public static final String BPMN_CONDITION_EXPRESSION = "conditionExpression";
public static final String BPMN_XSI_TYPE = "xsi:type";
public static final String BPMN_FORMAL_EXPRESSION = "tFormalExpression";
public static final String BPMN_ACTIVITI_TASKLISTENER = "activiti:taskListener";
public static final String BPMN_EVENT = "event";
public static final String BPMN_CREATE = "create";
public static final String BPMN_CLASS = "class";
public static final String BPMN_ACTIVITI_CLASS = "activiti:class";
public static final String BPMN_ACTIVITI_EXECUTION_LISTENER = "activiti:executionListener";
public static final String BPMN_START = "start";
public static final String BPMN_END = "end";
public static final String BPMN_COMPLETE = "complete";
public static final String BPMN_EXPRESSION = "expression";
public static final String BPMN_COMPLETE_EXPRESSION_METHOD = "${userTaskHandler.postComplete(execution)}";
public static final String BPMN_START_EXPRESSION_METHOD = "${userTaskHandler.preStart(execution)}";
public static final String BPMN_ACTIVITI_CANDIDATE_USERS = "activiti:candidateUsers";
public static final String BPMN_ACTIVITI_CANDIDATE_USERS_VALUE = "${candidates}";
public static final String BPMN_MULTI_INSTANCE_LOOP_CHARACTERISTICS = "multiInstanceLoopCharacteristics";
public static final String BPMN_IS_SEQUENTIAL = "isSequential";
public static final String BPMN_IS_SEQUENTIAL_VALUE = "false";
public static final String BPMN_ACTIVITI_COLLECTION = "activiti:collection";
public static final String BPMN_ACTIVITI_COLLECTION_METHOD_NAME = "${userTaskHandler.getActorUser(execution)}";
public static final String BPMN_ACTIVITI_ELEMENT_VARIABLE = "activiti:elementVariable";
public static final String BPMN_CANDIDATES = "candidates";
public static final String BPMN_COMPLETION_CONDITION = "completionCondition";
public static final String BPMN_COMPLETION_CONDITION_CONTENT = "${userTaskHandler.dealComplete(execution)}";
public static final String BPMN_PROCESS_EXECUTION_LISTENER_NAME = "net.wanji.design.engine.operate.impl.ProcessExecutionListener";
public static final String BPMN_ACTIVITI_CLASS_NAME = "net.wanji.design.engine.operate.impl.AutoNodeServiceTask";
/*bpmn20.xml节点定义 end*/
/*流程设计器元素类型常量定义 start*/
public static final String START_NODE = "startNode";
public static final String END_NODE = "endNode";
public static final String APPROVAL_NODE = "approvalNode";
public static final String CONDITION_LINE = "conditionLine";
public static final String FORK_NODE = "forkNode";
public static final String CALL_ACTIVITY_NODE = "callActivityNode";
public static final String AUTO_NODE = "autoNode";
/*流程设计器元素类型常量定义 end*/
/*xml创建节点类型,枚举常量*/
public enum NodeType {
START("startEvent"),
END("endEvent"),
USERTASK("userTask"),
CONDITION("inclusiveGateway"),
FLOW("sequenceFlow"),
AUTO_NODE("serviceTask"),
CALL_ACTIVITY("callActivity");
private String value;
NodeType(String value) {
this.value = value;
}
@Override
public String toString() {
return this.value;
}
}
/*审批节点类型*/
public enum ApprovalNodeType {
SINGLE_INSTANCE, //非会签节点
MULTI_INSTANCE, //会签节点
COPY_TO; //抄送节点, 通过任务接收人实现, 用权限控制
}
}
/* 消息类型 */
public enum MessageType {
// 工作流消息
BPM_MESSAGE_LOG("bpm_log");
private String value;
MessageType(String value) {
this.value = value;
}
public static MessageType getEnumByValue(String value) {
for (MessageType msgType : MessageType.values()) {
if (msgType.toString().equals(value)) {
return msgType;
}
}
return null;
}
@Override
public String toString() {
return this.value;
}
}
/*日志保存操作类型*/
public enum LogType {
//接口日志 D2A
D2A_INTERFACE_API_LOG("d2a_interface_api_log"),
//接口日志 A2A
A2A_INTERFACE_API_LOG("a2a_interface_api_log"),
//接口日志 webservice
WEBSERVICE_INTERFACE_API_LOG("webservice_interface_api_log"),
//接口日志 基础接口
BASE_INTERFACE_API_LOG("base_interface_api_log"),
//接口日志 业务接口
BUSINESS_INTERFACE_API_LOG("business_interface_api_log"),
//接口日志 集成接口
INTEGRATION_INTERFACE_API_LOG("integration_interface_api_log"),
//接口日志 服务编排接口
SGW_INTERFACE_API_LOG("sgw_interface_api_log"),
//接口日志 邮件接口
MAIL_INTERFACE_API_LOG("mail_interface_api_log"),
//调度日志 d2a接口
SCHEDULE_D2A_INTERFACE_API_LOG("schedule_d2a_interface_api_log"),
//调度日志 A2A接口
SCHEDULE_A2A_INTERFACE_API_LOG("schedule_a2a_interface_api_log"),
//调度日志 基础接口
MICROSERVICE_BASE_INTERFACE_API_LOG("microservice_base_interface_api_log"),
//调度日志 业务接口
MICROSERVICE_BUSINESS_INTERFACE_API_LOG("microservice_business_interface_api_log"),
//调度日志 集成接口
MICROSERVICE_INTEGRATION_INTERFACE_API_LOG("microservice_integration_interface_api_log"),
//调度日志 服务编排
MICROSERVICE_ORCHESTRATION_INTERFACE_API_LOG("microservice_orchestration_interface_api_log"),
//调度日志 系统日志
SYSTEM_TASK_LOG("system_task_log"),
// 授权日志
AUTH_LOG("auth_log"),
//网关日志 基础接口日志
GATEWAY_BASE_INTERFACE_API_LOG("gateway_base_interface_api_log"),
//网关日志 业务接口日志
GATEWAY_BUSINESS_INTERFACE_API_LOG("gateway_business_interface_api_log"),
//网关日志 集成接口日志
GATEWAY_INTEGRATION_INTERFACE_API_LOG("gateway_integration_interface_api_log"),
//网关日志 a2a
GATEWAY_A2A_INTERFACE_API_LOG("gateway_a2a_interface_api_log"),
//网关日志 d2a
GATEWAY_D2A_INTERFACE_API_LOG("gateway_d2a_interface_api_log"),
//网关日志 服务编排
GATEWAY_ORCHESTRATION_INTERFACE_API_LOG("gateway_orchestration_interface_api_log"),
//服务开发插件日志
DEV_SERVICE_PLUGIN_LOG("dev_service_plugin_log"),
//服务开发流程日志
DEV_SERVICE_FLOW_LOG("dev_service_flow_log"),
//服务编排任务调度日志
DEV_SCHEDULE_LOG("dev_schedule_log"),
//服务编排发布日志
SGW_SERVICE_PUBLISH_LOG("sgw_service_publish_log"),
//服务编排插件日志
SGW_SERVICE_PLUGIN_LOG("sgw_service_plugin_log"),
//服务编排流程日志
SGW_SERVICE_FLOW_LOG("sgw_service_flow_log"),
//服务网关D2A日志
SGW_D2A_SERVICE_LOG("sgw_d2a_service_log"),
// 操作日志
OPERATION_LOG("operation_log"),
// 登录日志
LOGIN_LOG("login_log");
private String value;
LogType(String value) {
this.value = value;
}
public static LogType getEnumByValue(String value) {
for (LogType logType : LogType.values()) {
if (logType.toString().equals(value)) {
return logType;
}
}
return null;
}
@Override
public String toString() {
return this.value;
}
}
/**
* 重构移植 重新划分模块后,把之前bp-domain下的constants移植过来 start 20200514
*/
public static class ConsoleConstants {
public static final class User {
public static final String USER = "user";
public static final String SYS_USER = "sysUser";
public static final String TOKEN = "token";
}
}
public static class FunctionManageConstants {
public static final class FunctionJar {
public static final String DOWNLOAD_PATH_KEY = "folder";
}
}
public static class ServiceDevelopConstants {
public static final class TableOperationLogConst {
public static final String RES_TYPE = "table";
// 业务表的操作类型。
public static final String CREATE_TABLE_OPERATION = "new";
public static final String DELETE_TABLE_OPERATION = "delete";
public static final String UPDATE_TABLE_OPERATION = "update";
public static final String IMPORT_TABLE_OPERATION = "import";
}
}
public static class ServiceGateWayConstants {
public static final class D2ADataBase {
public static final String DB_MYSQL = "mysql";
public static final String DB_ORACLE = "oracle";
public static final String DB_SQLSERVER = "sqlserver";
public static final String DB_BEYONDB = "beyondb";
public static final String DB_POSTGRESQL = "postgresql";
}
public static final class DataSource {
public static final String DB_ELASTICSEARCH = "elasticsearch";
public static final String DB_KAFKA = "kafka";
public static final String DB_RABBITMQ = "rabbitmq";
public static final String DB_REDIS = "redis";
public static final String DB_WEBSOCKET = "websocket";
public static final String DB_WEBSERVICE = "webservice";
public static final String DB_MONGODB="mongo";
}
public static final class TableRestfulConstants {
public final static String INTERFACE_CODE_BY_PAGE = "findByPage";
public final static String INTERFACE_CODE_BY_CONDITION = "findByWhere";
public final static String INTERFACE_CODE_BY_ID = "findById";
public final static String INTERFACE_CODE_INSERT = "insert";
public final static String INTERFACE_CODE_UPDATE = "update";
public final static String INTERFACE_CODE_DELETE = "delete";
public final static String INTERFACE_CODE_BY_SQL = "multiTable";//bySql
}
}
public static class ServicePublishConstants {
public final class SqlConstants {
public static final String BLANK = " ";
public static final String FIELD_NAME_EN = "fieldNameEn";
public static final String FIELD_TYPE = "type";
public static final String FIELD_VALUE = "value";
public static final String FIELD_FLAG = "flag";
public static final String OPERATIONS = "operations";
public static final String CONDITION_COLUMNS = "condition_columns";
public static final String TYPES_AND_VALUES = "typesAndValues";
public static final String CONDITION = "condition";
public static final String SET = "set";
public static final String OPERATION = "operation";
public static final String BETWEEN_OPERATION = "between";
public static final String PAGE_SIZE = "pageSize";
public static final String PAGE_NUM = "pageNum";
public static final String ORDER="order";
public static final String IN_OPERATION="in";
public static final String DESC_OPERATION="DESC";
public static final String ASC_OPERATION="ASC";
public static final String LIKE_OPERATION="like";
}
/**
* 数据库类型常量定义
*/
public final class DBType {
public final static String MYSQL = "mysql";
public final static String ORACLE = "oracle";
public final static String SQLSERVER = "sqlserver";
public final static String BEYONDB = "beyondb";
}
}
public static class TaskScheduleConstants {
public static class ScheduleStatus {
public static final String STOP = "0";
public static final String START = "1";
}
}
public static class StatisticalConstants {
public static class UserTrends {
public static final String LOGIN_TIME = "loginTime";
public static final String START_DATE = "startDate";
public static final String END_DATE = "endDate";
public static final String CHART_DATA = "chartData";
public static final String DAILY_ACTIVE_USER = "dailyActiveUser";
public static final String DAILY_NEW_USER = "dailyNewUser";
public static final String DAILY_OLD_USER = "dailyOldUser";
public static final String DAILY_USER_VISITS = "dailyUserVisits";
public static final String DEDICATED_HOSTING_IP = "dedicatedHostingIp";
public static final String DAILY_UPDATE_USER = "dailyUpdateUser";
public static final String DAILY_NEWANDUPDATE_USER = "dailyNewAndUpdateUser";
public static final String DAILY_STARTUP = "dailyStartup";
}
}
/**
* IM类型
*/
public final class IM {
public static final String IM_CLIENT_ID = "IMClientId";
public static final String IM_PLATFORM = "IMPlatform";
public static final String IM_USER = "IMUser";
public static final String IM_TOKEN = "IMToken";
}
public final class Idnetity {
public static final String UNI_USER_AGENT = "X-Uni-User-Agent";
}
/**重构移植 end 20200514*/
/**
* 空间数据表
*/
public final class tableNameConstants {
public static final String RID_RID = "rid_rid";
public static final String RID_CROSS = "rid_cross";
public static final String RID_LANE_OBJ = "rid_lane_obj";
public static final String RID_AXF_THREE = "rid_axf_three";
public static final String ROAD_SEGMENT = "data_roadsegment";
}
/**
* 路网数据更新状态
*/
public final class DataConstants {
// 数据状态 0继承,1删除,2增加,3修改
public final static String DATA_MODE_EXTENTD = "0";
public final static String DATA_MODE_DELETE = "1";
public final static String DATA_MODE_ADD = "2";
public final static String DATA_MODE_EDIT = "3";
}
}
\ No newline at end of file
package net.wanji.web.common.annotation;
import net.wanji.web.common.enums.BaseEnum;
import java.lang.annotation.*;
/**
* @Description: [自定义注解-系统操作日志,拦截Controller请求]
* @author hfx
* @version 1.0
* Created on 2019/4/17 14:06
*/
@Target({ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface AspectLog {
/**
* 操作描述 业务名称description
* @return
*/
String description() default "";
/**
* 操作类型 query create modify delete
* @return
*/
BaseEnum.OperationTypeEnum operationType();
}
package net.wanji.web.common.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @Description: [构造Example时忽略此条件]
* Created on: 2019/5/5
* @author hfx
* @version 1.0
*/
@Target({ElementType.TYPE, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Ignore {
}
package net.wanji.web.common.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @Description: [构造Example时,此字段为like]
* Created on: 2019/5/5
* @author hfx
* @version 1.0
*/
@Target({ElementType.TYPE, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Like {
}
package net.wanji.web.common.constant;
/**
* @Description: [常量类]
* @author hfx
* @version 1.0
* Created on 2019/4/16 15:07
*/
public class Const {
/**
* UTC 城市交通信号控制系统简称
*/
public static final String SYSTEM_TYPE = "UTC";
/**
* 未删除
*/
public static final Boolean IS_DELETE_NO = false;
/**
* 已删除
*/
public static final Boolean IS_DELETE_YES = true;
/**
* 失败-false
*/
public static final int FALSE = 0;
/**
* 成功-true
*/
public static final int TRUE = 1;
/**
* 不下发
*/
public static final String NOT_SEND = "2";
/**
* 全部:-1
*/
public static final Integer ALL = -1;
/**
* 分隔符:逗号
**/
public static final String SEPARATOR_COMMA = ",";
/**
* 分隔符:冒号
**/
public static final String SEPARATOR_COLON = ":";
/**
* 分隔符:减号
**/
public static final String SEPARATOR_MINUS = "-";
/**
* 分隔符:下划线
**/
public static final String SEPARATOR_UNDER_LINE = "_";
/**
* 下划线,作为查询条件时,将"_"转化为"\_"
*/
public static final String TRANS_UNDERLINE = "\\\\_";
/**
* 分隔符:空格
**/
public static final String SEPARATOR_SPACE = " ";
/**
* 分隔符:分号
**/
public static final String SEPARATOR_SEMICOLON = ";";
/**
* 分隔符:@
*/
public static final String SEPARATOR_AT = "@";
/**
* 分隔符:左括号
*/
public static final String SEPARATOR_LEFTBRACES = "(";
/**
* 分隔符:右括号
*/
public static final String SEPARATOR_RIGHTBRACES = ")";
/**
* 分隔符:大于号 >
*/
public static final String SEPARATOR_GREATER_THAN = ">";
/**
* webSocket topic 信号机状态分组
*/
public static final String WEBSOCKET_TOPIC_SIGNAL_STATE = "topic_signal_state";
/**
* webSocket topic 下发结果状态分组
*/
public static final String WEBSOCKET_TOPIC_PLAN_ISSUED = "topic_plan_issued";
/**
* 海康返回成功码
*/
public static final Integer HK_TRUE_CODE = 0;
/**
* 海康返回成功码的 key
*/
public static final String HK_KEY_CODE = "code";
}
package net.wanji.web.common.constant;
/**
* @author hfx
* @version 1.0
* Created on 2019/5/8 16:35
* @description: [redis key常量类]
*/
public interface RedisKeyConst {
/**
* Redis存储Key前缀
*/
String KEY_PREFIX = "utcsystem_";
//redis时段方案版本号
String SECTIM_VERSION = "sectim_version_";
//redis相位方案版本号
String PHASE_VERSION = "phase_version_";
//token存储Redis有效时长
int TOKEN_EXPIRE_TIME = 7200;
//信号机状态
String TELESEME_STATUS = "teleseme_status";
//信号机灯组方向信息
String CROSS_LIGHTS = "cross_lights";
//信号灯线圈车道
String CROSS_COIL_LANE = "cross_coil_lane";
//信号机列表
String SIGNAL_LIST = "signal_list";
//优化配置管理
String SET_OPT_CONFIG = "set_opt_config";
//最小绿时长
String MIN_GREEN_TIME = "min_green_time";
//最大绿时长
String MAX_GREEN_TIME = "max_green_time";
//绿信比是否下发
String IS_SEND = "is_send";
//绿信比优化时段
String OPT_TIME = "opt_time";
}
package net.wanji.web.common.entity;
import net.wanji.web.common.Constants;
import net.wanji.web.common.enums.HttpCode;
import lombok.Data;
import java.io.Serializable;
//没有get set方法会导致feign 接口调用时,无法使用JsonViewObject作为返回值
@Data
public class JsonViewObject implements Serializable {
private Object content;
private String message;
private String status;
private Integer code;
private Long timestamp;
public Object getContent() {
return content;
}
public String getMessage() {
return message;
}
public String getStatus() {
return status;
}
private JsonViewObject() {
}
public static JsonViewObject newInstance() {
return new JsonViewObject();
}
public JsonViewObject success() {
return success((Object) "");
}
public JsonViewObject success(Object content) {
return success(content, "");
}
public JsonViewObject success(String message) {
return success("", message);
}
public JsonViewObject success(Object content, String message) {
return pack(content, message, Constants.JsonView.STATUS_SUCCESS);
}
public JsonViewObject fail() {
return fail("", "");
}
public JsonViewObject fail(Exception e) {
String message = e.getMessage();
int index = message.indexOf(":");
return fail(index == -1 ? message : message.substring(index + 1));
}
public JsonViewObject fail(String errMsg) {
return fail("", errMsg);
}
public JsonViewObject fail(Object content, String message) {
return pack(content, message, Constants.JsonView.STATUS_FAIL);
}
private JsonViewObject pack(Object content, String message, String status) {
this.content = content;
this.message = message;
this.status = status;
//增加服务返回状态码,后期待完善
this.code=(status.equals(Constants.JsonView.STATUS_SUCCESS) ? HttpCode.SUCCESS.value():HttpCode.INTERNAL_SERVER_ERROR.value());
return this;
}
}
\ No newline at end of file
package net.wanji.web.common.entity;
import net.wanji.web.common.enums.StatusCode;
/**
* HTTP响应类
*
* @author Kent HAN
* @date 2022/10/26 15:48
*/
public class Result<T> {
private String status;
private String msg;
private T data;
private Result(T data) {
this.status = StatusCode.SUCCESS.getStatus();
this.msg = StatusCode.SUCCESS.getMsg();
this.data = data;
}
private Result(StatusCode statusCode) {
if (statusCode == null) {
return;
}
this.status = statusCode.getStatus();
this.msg = statusCode.getMsg();
}
private Result(StatusCode statusCode, String msg) {
if (statusCode == null) {
return;
}
this.status = statusCode.getStatus();
this.msg = statusCode.getMsg() + "--" + msg;
}
/**
* 成功时候的调用
*/
public static <T> Result<T> success(T data) {
return new Result<T>(data);
}
/**
* 成功,不需要传入参数
*/
@SuppressWarnings("unchecked")
public static <T> Result<T> success() {
return (Result<T>) success("");
}
/**
* 失败时候的调用
*/
public static <T> Result<T> error(StatusCode statusCode) {
return new Result<T>(statusCode);
}
/**
* 失败时候的调用,扩展消息参数
*/
public static <T> Result<T> error(StatusCode statusCode, String msg) {
return new Result<T>(statusCode, msg);
}
public T getData() {
return data;
}
public String getStatus() {
return status;
}
public String getMsg() {
return msg;
}
}
\ No newline at end of file
package net.wanji.web.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author hfx
* @version 1.0
* Created on 2019/4/16 15:07
* @Description: [枚举类]
*/
public class BaseEnum {
/**
* @author hfx
* @description: [操作日志类型枚举]
* @date 2019/4/17 14:09
*/
public enum OperationTypeEnum {
INSERT, UPDATE, QUERY, DELETE
}
/**
* @author hfx
* @description: [状态]
* @date 2019/4/19 18:01
*/
@Getter
@AllArgsConstructor
public enum StatusEnum {
ON(1, "在线/有效"),
OFF(2, "下线/无效");
private Integer code;
private String name;
}
/**
* @author hfx
* @description: [厂商类型枚举类]
* @date 2019/4/19 18:01
*/
@Getter
@AllArgsConstructor
public enum VendorTypeEnum {
QS(1, "青松", "QS"),
SCATS(2, "SCATS", "SCATS"),
HS(3, "海信", "Hisense"),
HK(4, "海康", "HK"),
JA(5, "京安", "JA"),
TA(6, "同安", "TA"),
TSC(7, "励安","TSC"),
DT(8, "东土","DT"),
LES(9, "莱斯","LES");
private Integer code;
private String name;
private String nick;
public static VendorTypeEnum getNameByCode(int code) {
for (VendorTypeEnum vendorTypeEnum : VendorTypeEnum.values()) {
if (vendorTypeEnum.getCode() == code) {
return vendorTypeEnum;
}
}
return null;
}
public static VendorTypeEnum getNameByNick(String nick) {
for (VendorTypeEnum vendorTypeEnum : VendorTypeEnum.values()) {
if (vendorTypeEnum.getNick().equals(nick)) {
return vendorTypeEnum;
}
}
return null;
}
}
@Getter
@AllArgsConstructor
public enum VendorMethodCodeEnum {
QS("1", "路口列表数据获取"),
SCATS("1", "SCATS"),
HS("1", "海信"),
HK("1", "海康");
private String code;
private String name;
public static VendorMethodCodeEnum getNameByCode(String code) {
for (VendorMethodCodeEnum methodTypeEnum : VendorMethodCodeEnum.values()) {
if (methodTypeEnum.getCode().equals(code)) {
return methodTypeEnum;
}
}
return null;
}
}
/**
* @author hfx
* @description: [信号方向枚举类]
* @date 2019/4/19 18:01
*/
@Getter
@AllArgsConstructor
public enum SignalDirectionEnum {
N(1, "北", "N"),
EN(2, "东北", "EN"),
E(3, "东", "E"),
ES(4, "东南", "ES"),
S(5, "南", "S"),
WS(6, "西南", "WS"),
W(7, "西", "W"),
WN(8, "西北", "WN");
private Integer code;
private String name;
private String nick;
public static SignalDirectionEnum getNameByCode(int code) {
for (SignalDirectionEnum signalDirectionEnum : SignalDirectionEnum.values()) {
if (signalDirectionEnum.getCode() == code) {
return signalDirectionEnum;
}
}
return null;
}
public static SignalDirectionEnum getNameByNick(String nick) {
for (SignalDirectionEnum signalDirectionEnum : SignalDirectionEnum.values()) {
if (signalDirectionEnum.getNick().equals(nick)) {
return signalDirectionEnum;
}
}
return null;
}
}
@Getter
@AllArgsConstructor
public enum StepTypeEnum {
//步类型:1-机动车/行人同时绿灯 2-机动车绿灯/行人绿闪 3-机动车/行人同时绿闪 4-黄灯 5-红灯 6-关灯 7-黄闪 8-红闪
GREEN(1, "机动车/行人同时绿灯"),
PEDESTRIAN_GREEN_FLASH(2, "机动车绿灯/行人绿闪"),
GREEN_FLASH(3, "机动车/行人同时绿闪"),
YELLOW(4, "黄灯"),
RED(5, "红灯"),
OFF(6, "关灯"),
YELLOW_FLASH(7, "黄闪"),
RED_FLASH(8, "红闪");
private Integer type;
private String name;
/**
* 根据code返回枚举值
*
* @param type
* @return
*/
public static StepTypeEnum getEnumByType(int type) {
for (StepTypeEnum testEnums : StepTypeEnum.values()) {
if (testEnums.getType() == type) {
return testEnums;
}
}
return null;
}
}
@Getter
@AllArgsConstructor
public enum TurnTypeEnum {
//步类型:1-左转 2-直行 3-右转 4-调头
LEFT(1, "左转"),
STRAIGHT(2, "直行"),
RIGHT(3, "右转"),
TURN(4, "调头"),
ALL(5, "圆饼灯"),
PEDESTRIAN(6, "行人"),
ONCE_PEDESTRIAN(7, "一次行人"),
TWO_PEDESTRIAN(8, "二次行人");
private Integer type;
private String name;
/**
* 根据code返回枚举值
*
* @param type
* @return
*/
public static TurnTypeEnum getEnumByType(int type) {
for (TurnTypeEnum testEnums : TurnTypeEnum.values()) {
if (testEnums.getType() == type) {
return testEnums;
}
}
return null;
}
}
/**
* @author hfx
* @description: [车辆类型枚举类]
* @date 2019/4/19 18:01
*/
@Getter
@AllArgsConstructor
public enum VehicleTypeEnum {
LARGE_VEHICLE("01", "大型车辆"),
MEDIUM_VEHICLE("02", "中型车辆"),
SMALL_VEHICLE("03", "小型车辆"),
MICRO_VEHICLE("04", "微型车辆"),
TRICYCLE("05", "三轮车"),
MOTORCYCLE("06", "摩托车"),
POLICE_VEHICLE("07", "警用车辆"),
FOREIGN_VEHICLE("08", "外籍车辆"),
OTHER("99", "其他");
private String code;
private String name;
public static String getNameByCode(int code) {
for (SignalDirectionEnum signalDirectionEnum : SignalDirectionEnum.values()) {
if (signalDirectionEnum.getCode() == code) {
return signalDirectionEnum.getName();
}
}
return "";
}
}
@Getter
@AllArgsConstructor
public enum ColorTypeEnum {
GREEN(1, "++g", "绿色"),
YELLOW(2, "+y+", "黄色"),
// RED(3, "++g", "红色"),
OFF(10, "+++", "关闭");
private Integer code;
private String type;
private String name;
public static String getTypeByCode(int code) {
for (ColorTypeEnum colorTypeEnum : ColorTypeEnum.values()) {
if (colorTypeEnum.getCode() == code) {
return colorTypeEnum.getType();
}
}
return "";
}
}
@Getter
@AllArgsConstructor
public enum LampStatusEnum {
GREEN("绿灯", "green"),
GREEN_FLASH("绿闪", "greenFlash"),
YELLOW("黄灯", "yellow"),
YELLOW_FLASH("黄闪", "yellowFlash"),
RED("红灯", "red"),
RED_FLASH("红闪", "redFlash"),
LIGHTS_OUT("熄灯", "lightsOut");
private String name;
private String code;
public static String getTypeByCode(String code) {
for (LampStatusEnum lampStatusEnum : LampStatusEnum.values()) {
if(lampStatusEnum.getCode().equals(code)){
return lampStatusEnum.getName();
}
}
return "";
}
}
/**
* @author hfx
* @description: [信号中心控制枚举类]
* @date 2019/4/19 18:01
*/
@Getter
@AllArgsConstructor
public enum SignalControlModeEnum {
//控制类型
NO_CABLE(1,"无电缆控制"),
ONLINE(2,"区域协调控制"),
MANUAL(3,"手控模式"),
NO_CABLE_TRUNK_(4,"无电缆干线协调控制"),
NO_CABLE_INDUCTION(5,"无电缆式感应控制"),
FULL_INDUCTION(6,"全感应控制"),
HALF_INDUCTION(7,"单点感应控制"),
DYNAMIC_PLAN(8,"单点自适应控制"),
SCHEDULE(9,"时间表控制"),
URGENT(10,"紧急呼叫模式"),
SECRET_SERVICE(11,"特勤模式"),
START_MODE(12,"启动模式"),
SPECIAL(13,"特殊控制"),
PEDESTRIAN_CROSSING(14,"行人过街信号控制模式"),
BUS_PRIORITY(15,"公交优先控制模式"),
FLOW_CONTROL(16,"调仓控流环保信号控制模式"),
VARIABLE_LANE(17,"可变车道的信号控制模式"),
DEMAND_SENSING(18,"请求式感应信号控制模式"),
OVERFLOW(19,"路口防溢出信号控制模式"),
TRUNK(20,"干线协调信号控制模式"),
MOBILE_SIGNAL(21,"集装箱移动式信号控制模式"),
FLASH(22,"闪光控制"),
UNCOORDINATED_PHASE(23,"非协调相位顺序监控模式"),
COORDINATED_PHASE(24,"协调相位优先顺序监控模式"),
COORDINATED_PHASE_NORETURN(25,"协调相位不再返回模式"),
UNCOORDINATED_PHASE_CONTINUOUS(26,"非协调相位连续顺序监控模式"),
CENTER_SCHEDULE(27,"中心主控降级多时段"),
CENTER_HALF_INDUCTION(28,"中心主控降级自适应"),
TEMPORARY_PLAN(29,"临时方案控制"),
OTHER_USER(30,"定周期控制");
private Integer type;
private String name;
/**
* 根据code返回枚举值
*
* @param type
* @return
*/
public static SignalControlModeEnum getEnumByType(int type) {
for (SignalControlModeEnum testEnums : SignalControlModeEnum.values()) {
if (testEnums.getType() == type) {
return testEnums;
}
}
return null;
}
}
/**
* @author hfx
* @description: [信号中心控制-运行模式枚举类]
* @date 2019/4/19 18:01
*/
@Getter
@AllArgsConstructor
public enum SignalRunModeEnum {
//控制类型
//2 手动锁定当前相位
//3 手动全红
//4 手动黄闪
//5 手动关灯
//6 全红闪控制
//8 正常按计划运行
//9 手动步进控制
//10 自动步进控制
//11 恢复时间表
//255 临时控制方案
LOCK_PHASE(2, "相位锁定"),
ALL_RED(3, "全红控制"),
YELLOW_FLASH(4, "全黄闪控制"),
OFF(5, "关灯控制"),
RED_FLASH(6, "全红闪控制"),
ALL_YELLOW(7, "全黄控制"),
NORMAL_PLAN(8, "按正常计划运行"),
STEP_CONTROL(9, "步进控制"),
AUTO_STEP_CONTROL(10, "自动步进控制"),
RECOVER_SCHEDULE(11, "恢复时间表"),
OTHER_USER_CONTROL(56, "其它账号控制运行"),
TEMPORARY_PLAN(255, "临时控制方案");
private Integer type;
private String name;
/**
* 根据code返回枚举值
*
* @param type
* @return
*/
public static SignalRunModeEnum getEnumByType(int type) {
for (SignalRunModeEnum testEnums : SignalRunModeEnum.values()) {
if (testEnums.getType() == type) {
return testEnums;
}
}
return null;
}
}
}
package net.wanji.web.common.enums;
/**
* @author Kent HAN
* @date 2022/10/27 10:10
*/
public enum ControlHistEnum {
ONE(1, "时间表"),
TWO(2, "全红"),
THREE(3, "黄闪"),
FOUR(4, "锁定"),
FIVE(5, "中心优化"),
SIX(6, "MEC优化"),
SEVEN(7, "现场手动");
private Integer code;
private String msg;
ControlHistEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public static String getMsgByCode(Integer code) {
for (ControlHistEnum value : ControlHistEnum.values()) {
if (value.code.equals(code)) {
return value.msg;
}
}
return null;
}
public String getMsg() {
return msg;
}
}
package net.wanji.web.common.enums;
/**
* @author Kent HAN
* @date 2022/10/27 10:10
*/
public enum CrossAlarmEnum {
ZERO("0", "正常"),
ONE("1", "失衡"),
TWO("2", "拥堵"),
THREE("3", "溢出"),
FOUR("4", "死锁");
private String code;
private String msg;
CrossAlarmEnum(String code, String msg) {
this.code = code;
this.msg = msg;
}
public static String getMsgByCode(String codeStr) {
for (CrossAlarmEnum value : CrossAlarmEnum.values()) {
if (value.code.equals(codeStr)) {
return value.msg;
}
}
return null;
}
public static Integer getCodeIntByMsg(String msg) {
for (CrossAlarmEnum value : CrossAlarmEnum.values()) {
if (value.msg.equals(msg)) {
String code = value.code;
int codeInt = Integer.parseInt(code);
return codeInt;
}
}
return null;
}
public String getMsg() {
return msg;
}
}
package net.wanji.web.common.enums;
import java.util.Objects;
/**
* @author Kent HAN
* @date 2022/11/8 17:20
*/
public enum CrossPhasePlanTurnTypeEnum {
ONE("1", "l"),
TWO("2", "r"),
THREE("3", "s"),
FOUR("4", "u");
private final String code;
private final String msg;
CrossPhasePlanTurnTypeEnum(String code, String msg) {
this.code = code;
this.msg = msg;
}
public static String getMsgByCode(String code) {
for (CrossPhasePlanTurnTypeEnum value : CrossPhasePlanTurnTypeEnum.values()) {
if (Objects.equals(value.code, code)) {
return value.msg;
}
}
return null;
}
public static String getCodeByMsg(String msg) {
for (CrossPhasePlanTurnTypeEnum value : CrossPhasePlanTurnTypeEnum.values()) {
if (Objects.equals(value.msg, msg)) {
return value.code;
}
}
return null;
}
public String getMsg() {
return msg;
}
}
package net.wanji.web.common.enums;
/**
* @author Kent HAN
* @date 2022/10/27 10:10
*/
public enum DeviceStatusEnum {
NORMAL(1, "在线"),
WRONG(2, "故障"),
OFFLINE(0, "离线");
private final Integer code;
private final String msg;
DeviceStatusEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public static String getMsgByCode(Integer code) {
for (DeviceStatusEnum value : DeviceStatusEnum.values()) {
if (value.code.equals(code)) {
return value.msg;
}
}
return null;
}
public String getMsg() {
return msg;
}
}
package net.wanji.web.common.enums;
/**
* @author Kent HAN
* @date 2022/10/27 10:10
*/
public enum DeviceTypeEnum {
ONE(1, "信号"),
TWO(2, "卡口"),
THREE(3, "地磁"),
FOUR(4, "视频"),
FIVE(5, "微波"),
SIX(6, "激光"),
SEVEN(7, "电警"),
EIGHT(8, "MEC");
private final Integer code;
private final String msg;
DeviceTypeEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public static String getMsgByCode(Integer code) {
for (DeviceTypeEnum value : DeviceTypeEnum.values()) {
if (value.code.equals(code)) {
return value.msg;
}
}
return null;
}
public String getMsg() {
return msg;
}
}
package net.wanji.web.common.enums;
/**
* @author Kent HAN
* @date 2022/10/27 10:10
*/
public enum EventAlarmEnum {
ONE(1, "事故"),
TWO(2, "拥堵"),
THREE(3, "管制"),
FOUR(4, "施工");
private final int code;
private final String msg;
EventAlarmEnum(int code, String msg) {
this.code = code;
this.msg = msg;
}
public static String getMsgByCode(int code) {
for (EventAlarmEnum value : EventAlarmEnum.values()) {
if (value.code == code) {
return value.msg;
}
}
return null;
}
public String getMsg() {
return msg;
}
}
package net.wanji.web.common.enums;
/**
* @author Kent HAN
* @date 2022/10/27 10:10
*/
public enum EventAlarmSourceEnum {
ONE(1, "接处警"),
TWO(2, "交管部门"),
THREE(3, "互联网");
private final int code;
private final String msg;
EventAlarmSourceEnum(int code, String msg) {
this.code = code;
this.msg = msg;
}
public static String getMsgByCode(int code) {
for (EventAlarmSourceEnum value : EventAlarmSourceEnum.values()) {
if (value.code == code) {
return value.msg;
}
}
return null;
}
public String getMsg() {
return msg;
}
}
package net.wanji.web.common.enums;
public enum HttpCode {
/** 200请求成功 */
SUCCESS(200),
/** 207频繁操作 */
MULTI_STATUS(207),
/** 400请求参数出错 */
BAD_REQUEST(400),
/** 401没有登录 */
UNAUTHORIZED(401),
/** 402登录失败 */
LOGIN_FAIL(402),
/** 403没有权限 */
FORBIDDEN(403),
/** 404找不到页面 */
NOT_FOUND(404),
/** 405请求方法不能被用于请求相应的资源 */
METHOD_NOT_ALLOWED(405),
/** 406内容特性不满足 */
NOT_ACCEPTABLE(406),
/** token过期 */
TOKEN_EXPIRED(407),
/** 408请求超时 */
REQUEST_TIMEOUT(408),
/** 409发生冲突 */
CONFLICT(409),
/** 410已被删除 */
GONE(410),
/** 411没有定义长度 */
LENGTH_REQUIRED(411),
/** 412条件不满足 */
PRECONDITION_FAILED(412),
/** 413数据太大 */
ENTITY_TOO_LARGE(413),
/** 415不是服务器中所支持的格式 */
UNSUPPORTED_MEDIA_TYPE(415),
/** 421连接数过多 */
TOO_MANY_CONNECTIONS(421),
/** 423已被锁定 */
LOCKED(423),
/** 451法律不允许 */
UNAVAILABLE_LEGAL(451),
/** 500服务器出错 */
INTERNAL_SERVER_ERROR(500),
/** 501不支持当前请求所需要的某个功能 */
NOT_IMPLEMENTED(501),
/** 503服务器升级中,暂时不可用 */
SERVICE_UNAVAILABLE(503),
/** 501获取资源所需要的策略并没有被满足 */
NOT_EXTENDED(510);
private final Integer value;
private HttpCode(Integer value) {
this.value = value;
}
/**
* Return the integer value of this status code.
*/
public Integer value() {
return this.value;
}
@Override
public String toString() {
return this.value.toString();
}
}
\ No newline at end of file
package net.wanji.web.common.enums;
import java.util.Objects;
/**
* @author Kent HAN
* @date 2022/11/8 17:20
*/
public enum SpecialServiceCrossDirEnum {
ONE(1, "北"),
TWO(2, "东北"),
THREE(3, "东"),
FOUR(4, "东南"),
FIVE(5, "南"),
SIX(6, "西南"),
SEVEN(7, "西"),
EIGHT(3, "西北");
private final int code;
private final String msg;
SpecialServiceCrossDirEnum(int code, String msg) {
this.code = code;
this.msg = msg;
}
public static String getMsgByCode(int code) {
for (SpecialServiceCrossDirEnum value : SpecialServiceCrossDirEnum.values()) {
if (value.code == code) {
return value.msg;
}
}
return null;
}
public static Integer getCodeByMsg(String msg) {
for (SpecialServiceCrossDirEnum value : SpecialServiceCrossDirEnum.values()) {
if (Objects.equals(value.msg, msg)) {
return value.code;
}
}
return null;
}
public String getMsg() {
return msg;
}
}
package net.wanji.web.common.enums;
/**
* @author Kent HAN
* @date 2022/11/8 17:20
*/
public enum SpecialServiceCrossInOutEnum {
ONE(1, "出口"),
TWO(2, "进口");
private final int code;
private final String msg;
SpecialServiceCrossInOutEnum(int code, String msg) {
this.code = code;
this.msg = msg;
}
public static String getMsgByCode(int code) {
for (SpecialServiceCrossInOutEnum value : SpecialServiceCrossInOutEnum.values()) {
if (value.code == code) {
return value.msg;
}
}
return null;
}
public String getMsg() {
return msg;
}
}
package net.wanji.web.common.enums;
import java.util.Objects;
/**
* @author Kent HAN
* @date 2022/11/8 17:20
*/
public enum SpecialServiceCrossTurnEnum {
LEFT("l", "左转"),
STRAIGHT("s", "直行"),
RIGHT("r", "右转"),
UTURN("u", "掉头");
private final String code;
private final String msg;
SpecialServiceCrossTurnEnum(String code, String msg) {
this.code = code;
this.msg = msg;
}
public static String getMsgByCode(String code) {
for (SpecialServiceCrossTurnEnum value : SpecialServiceCrossTurnEnum.values()) {
if (Objects.equals(value.code, code)) {
return value.msg;
}
}
return null;
}
public String getMsg() {
return msg;
}
}
package net.wanji.web.common.enums;
public enum StatusCode {
SUCCESS("success", "成功"),
ERROR("fail", "失败");
private String status;
private String msg;
StatusCode(String status, String msg) {
this.status = status;
this.msg = msg;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
\ No newline at end of file
package net.wanji.web.common.exception;
/**
* 路段关系异常
*
* @author Kent HAN
* @date 2022/11/10 9:09
*/
public class CrossRelationException extends RuntimeException {
public CrossRelationException(String message) {
super(message);
}
public CrossRelationException(String message, Exception e) {
super(message,e);
}
}
package net.wanji.web.common.exception;
/**
* @Description: [自定义异常,用于提示警告的Exception]
* @author hfx
* @version 1.0
* Created on 2019/4/17 11:07
*/
public class WarnException extends RuntimeException {
public WarnException(String message) {
super(message);
}
public WarnException(String message, Exception e) {
super(message,e);
}
}
package net.wanji.web.common.util;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/9 16:48
*/
public class CrossUtil {
// 从路口信息中分离经纬度
public static double[] getLonLat(String location) {
List<String> result = RegexUtils.getMatchGroups(location,
"^POINT\\(([0-9]*\\.?[0-9]+) ([0-9]*\\.?[0-9]+)\\)$", 2);
String longitudeStr = result.get(1);
double longitude = Double.parseDouble(longitudeStr);
String latitudeStr = result.get(2);
double latitude = Double.parseDouble(latitudeStr);
double[] lonLat = {longitude, latitude};
return lonLat;
}
}
package net.wanji.web.common.util;
import net.wanji.web.common.constant.Const;
import net.wanji.web.common.constant.RedisKeyConst;
import net.wanji.web.common.util.date.DateStyle;
import net.wanji.web.common.util.date.DateUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.support.atomic.RedisAtomicLong;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.text.DecimalFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
* @description: redis工具类
* @author hfx
* @version 1.0
* Created on 2019/4/29 20:34
*/
@Component
public class RedisUtils {
/**
* 注入redisTemplate
*/
@Resource
private RedisTemplate<String, Object> redisTemplate;
/**
* @description: 判断是否存在Key
* @param key redis的Key
* @return boolean true:有 false:无
*/
public boolean hasKey(String key) {
return redisTemplate.hasKey(key);
}
/**
* @description: 添加字符串
* @param key redis的Key
* @param value 添加redis的value
*/
public void set(String key, String value) {
redisTemplate.opsForValue().set(key, value);
}
/**
* @description: 添加对象
* @param key redis的Key
* @param object 添加redis的value
*/
public void set(String key, Object object) {
redisTemplate.opsForValue().set(key, object);
}
/**
* @description: 添加带生命周期的对象
* @param key redis的Key
* @param object 添加redis的value
* @param seconds 失效时间
*/
public void setAndExpire(String key, Object object, int seconds) {
redisTemplate.opsForValue().set(key, object);
redisTemplate.expire(key, seconds, TimeUnit.SECONDS);
}
/**
* @description: 添加带生命周期的对象
* @param key redis的Key
* @param value 添加redis的value
* @param seconds 失效时间
*/
public void setAndExpire(String key, String value, int seconds) {
redisTemplate.opsForValue().set(key, value);
redisTemplate.expire(key, seconds, TimeUnit.SECONDS);
}
/**
* @description: 获取对象
* @param key redis的Key
* @return Object 返回对象
*/
public Object get(String key) {
return redisTemplate.opsForValue().get(key);
}
/**
* @description: 存入redis的hash
* @param key redis的Key
* @param field 字段值
* @param value 存入的值
*/
public void setHash(String key, String field, String value) {
redisTemplate.opsForHash().put(key, field, value);
}
/**
* @description: 存入redis的hash
* @param key redis的Key
* @param field 字段值
* @param value 存入的值
*/
public void setHash(String key, String field, Object value) {
redisTemplate.opsForHash().put(key, field, value);
}
/**
* @description: 根据key和字段值获取内容值
* @param key redis的Key
* @param field 字段值
* @return String 返回字符串
*/
public String getHash(String key, String field) {
return (String)redisTemplate.opsForHash().get(key, field);
}
/**
* @description: 根据field删除值
* @param key redis的Key
* @param field 字段值
*/
public void delHashMap(String key, String field) {
redisTemplate.boundHashOps(key).delete(field);
}
/**
* @description: 存入hash集合
* @param key redis的Key
* @param hashmap 存入的Map集合
*/
public void setHashMap(String key, Map<String, Object> hashmap){
redisTemplate.opsForHash().putAll(key, hashmap);;
}
/**
* @description: 取出hash集合
* @param key redis的Key
* @return Map<Object, Object> 返回Map集合
*/
public Map<Object, Object> getHashMap(String key) {
return redisTemplate.opsForHash().entries(key);
}
/**
* @description: 存入redis的Set
* @param key redis的Key
* @param object 对象
*/
public void setSet(String key,Object object){
redisTemplate.opsForSet().add(key, object);
}
/**
* @description: 获取redis的Set
* @param key redis的Key
* @return Set<Object> Set集合
*/
public Set<Object> getSet(String key){
return redisTemplate.opsForSet().members(key);
}
/**
* @discription: 查看值是否是set成员
* @param key set的key
* @param value set的成员
* @return 是否是set成员
*/
public Boolean isSetMember(String key, Object value) {
return redisTemplate.opsForSet().isMember(key, value);
}
/**
* @description:设置key的过期时间,endTime格式:yyyy-MM-dd hh:mm:ss
* @param key redis的Key
* @param endTime 结束时间
*/
public void setExpire(String key, Date endTime) {
long seconds = endTime.getTime() - System.currentTimeMillis();
redisTemplate.expire(key, (int) (seconds / 1000), TimeUnit.SECONDS);
}
/**
* @description: 设置key的过期时间
* @param key redis的Key
* @param time 过期时间(秒)
*/
public void setExpire(String key, int time) {
redisTemplate.expire(key, time, TimeUnit.SECONDS);
}
/**
* <p>Discription:获取key的过期时间
* @param key redis的Key
* @return 过期时间(秒)
*/
public Long getExpire(String key) {
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
}
/**
* @description: 在redis消息队列队尾插入数据
* @param key redis的Key
* @param object 添加的对象
*/
public void tailPush(String key, Object object){
redisTemplate.opsForList().rightPush(key, object);
}
/**
* @description: 在redis消息队列对头插入数据
* @param key redis的Key
* @param object 添加的对象
*/
public void headPush(String key,Object object){
redisTemplate.opsForList().leftPush(key, object);
}
/**
* @description: 在redis消息队列队尾删除数据
* @param key redis的Key
* @return Object 删除的对象
*/
public Object tailPop(String key){
return redisTemplate.opsForList().rightPop(key);
}
/**
* @description: 在redis消息队列队头删除数据
* @param key redis的Key
* @return Object 删除的对象
*/
public Object headPop(String key){
return redisTemplate.opsForList().leftPop(key);
}
/**
* @description: 删除redis的值
* @param key redis的Key
*/
public void del(String key) {
if (hasKey(key)) {
redisTemplate.delete(key);
}
}
/**
* @description: 清理redis缓存
*/
public void flushDB(){
redisTemplate.getConnectionFactory().getConnection().flushDb();
}
/**
* @description: 根据类型生成版本号
* @param type 类型key区分
* @return 版本号
* @author hfx
* @date 2019/5/5 19:26
*/
public String getVersion(String type) {
String formatDate = DateUtils.dateToString(new Date(), DateStyle.YYYYMMDD);
String key = RedisKeyConst.KEY_PREFIX + type + formatDate;
//当前时间到第二天还剩多少时间
Date newDate = DateUtils.dateForMat(DateUtils.addDay(new Date(), 1), DateStyle.YYYY_MM_DD);
int liveTime = DateUtils.dayDiff(newDate, new Date(), Calendar.MILLISECOND);
//获取自增号
Long incr = getIncr(key, liveTime);
if(incr == 0) {
incr = getIncr(key, liveTime);//从001开始
}
DecimalFormat df = new DecimalFormat("000");//三位序列号
return formatDate + Const.SEPARATOR_MINUS + df.format(incr);
}
/**
* 自增ID
* @param key 建
* @param liveTime 过期时间
* @return 自增结果
*/
public Long getIncr(String key, long liveTime) {
RedisAtomicLong entityIdCounter = new RedisAtomicLong(key, redisTemplate.getConnectionFactory());
Long increment = entityIdCounter.getAndIncrement();
if ((null == increment || increment.longValue() == 0) && liveTime > 0) {//初始设置过期时间
entityIdCounter.expire(liveTime, TimeUnit.MILLISECONDS);//单位毫秒
}
return increment;
}
/**
* 获取全部Redis的key
* @return
*/
public Set<String> keys() {
return redisTemplate.keys("*");
}
}
package net.wanji.web.common.util;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegexUtils {
/**
* 匹配第一个字符串
*
* @param text
* @param regex
* @return
*/
public static String getMatchGroupString(String text, String regex) {
String result = "";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(text);
if (matcher.find()) {
result = matcher.group();
}
return result;
}
/**
* 捕获组
*
* @param text
* @param regex
* @param group
* @return
*/
public static String getMatchGroupString(String text, String regex, int group) {
String result = "";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(text);
if (matcher.find()) {
result = matcher.group(group);
}
return result;
}
/**
* 匹配所有结果
*
* @param text
* @param regex
* @return
*/
public static List<String> getMatchStrings(String text, String regex) {
List<String> results = new ArrayList<>();
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(text);
while (matcher.find()) {
results.add(matcher.group());
}
return results;
}
/**
* 捕获所有分组结果,包含第0组
* 应用场景:需要的信息分别包含在各个分组内
* @param text
* @param regex
* @param totalGroup 分组数量,即正则中小括号的对数,从0开始计数
* @return
*/
public static List<String> getMatchGroups(String text, String regex,int totalGroup) {
List<String> results = new ArrayList<>();
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(text);
matcher.find();
for (int i=0;i<=totalGroup;i++) {
results.add(matcher.group(i));
}
return results;
}
}
\ No newline at end of file
package net.wanji.web.common.util;
import lombok.extern.slf4j.Slf4j;
import java.math.BigDecimal;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @Description: [字符串工具类]
* @author hfx
* @version 1.0
* Created on 2019/4/16 15:07
*/
@Slf4j
public class StringUtils extends org.apache.commons.lang3.StringUtils {
/**
* @description: 判断字符串是否为空
* @param value 字符串
* @return java.lang.Boolean 空:false 不是空:true
* @author hfx
* @date 2019/4/17 9:54
*/
public static Boolean isNotEmpty(String value) {
if (value == null || value.length() == 0) {
return false;
}
return true;
}
/**
* @description: 判断字符串是否为空
* @param value 字符串
* @return java.lang.Boolean 空:true 不是空:false
* @author hfx
* @date 2019/4/17 9:54
*/
public static Boolean isEmpty(String value) {
if (value == null || value.length() == 0) {
return true;
}
return false;
}
/**
* @description: 判断对象是否为空
* @param obj 对象
* @return java.lang.Boolean 空:true 不是空:false
* @author hfx
* @date 2019/4/17 9:54
*/
public static Boolean isEmpty(Object obj) {
if (null == obj) {
return true;
}
return false;
}
/**
* @description: 判断字符串是否为空、空字符、null
* @param string 字符串
* @return java.lang.Boolean 空:true 不是空:false
* @author hfx
* @date 2019/4/17 9:54
*/
public static Boolean isRedisEmpty(String string) {
if (StringUtils.isEmpty(string) || "null".equals(string) || "".equals(string)) {
return true;
}
return false;
}
/**
* @description: null转化为空字符
* @param str 字符串对象
* @return java.lang.String 空字符
* @author hfx
* @date 2019/4/17 9:58
*/
public static String replaceNullToEmpty(String str) {
if (str == null) {
str = "";
}
return str;
}
/**
* @description: 根据字符串获取Integer值,空字符串返回null
* @param str 字符串
* @return java.lang.Integer
* @author hfx
* @date 2019/4/16 15:34
*/
public static Integer getIntValue(String str) {
if (org.apache.commons.lang3.StringUtils.isBlank(str)) {
return null;
}
if (!isNumeric(str)) {
return null;
}
return Integer.parseInt(str);
}
/**
* @description: 根据字符串获取Double值,空字符串返回null
* @param str 字符串
* @return java.lang.Double
* @author hfx
* @date 2019/4/16 15:34
*/
public static Double getDoubleValue(String str) {
if (org.apache.commons.lang3.StringUtils.isBlank(str)) {
return null;
}
if (!isNumber(str)) {
return null;
}
return Double.parseDouble(str);
}
/**
* @description: 根据字符串获取BigDecimal值,空字符串返回null
* @param str 字符串
* @return BigDecimal
* @author hfx
* @date 2019/4/16 15:34
*/
public static BigDecimal getBigDecimalValue(String str) {
if (org.apache.commons.lang3.StringUtils.isBlank(str)) {
return null;
}
if (!isNumber(str)) {
return null;
}
return new BigDecimal(str);
}
/**
* <p>Description:[判断字符串是否为整数]</p>
* @param str 字符串
* @return boolean 是否是整数
* @author hfx
* @date 2019/4/16 15:34
*/
public static boolean isNumeric(String str) {
for (int i = 0; i < str.length(); i++) {
if (!Character.isDigit(str.charAt(i))) {
return false;
}
}
return true;
}
/**
* <p>Description:[判断字符串是否为数字类型]</p>
* @param str 字符串
* @return boolean 是否是数字类型
* @author hfx
* @date 2019/4/16 15:34
*/
public static boolean isNumber(String str) {
String reg = "^[0-9]+(.[0-9]+)?$";
return str.matches(reg);
}
/**
* <p>Description:[字符串数组转int数组]</p>
* @param strings 字符串数组
* @return int[] int类型数组
* @author hfx
* @date 2019/4/16 15:34
*/
public static int[] stringArrayToIntArray(String[] strings) {
try {
if (null == strings || strings.length == 0) {
return null;
}
int[] ints = new int[strings.length];
if (ints.length > 0) {
for (int i = 0; i < strings.length; i++) {
if (isBlank(strings[i])) {
ints[i] = 0;
} else {
ints[i] = Integer.parseInt(strings[i]);
}
}
}
return ints;
} catch (Exception e) {
log.error(e.getMessage());
return null;
}
}
/**
* <p>Description:[字符串数组转Long数组]</p>
* @param strings 字符串数组
* @return int[] int类型数组
* @author hfx
* @date 2019/4/16 15:34
*/
public static Long[] stringArrayToLongArray(String[] strings) {
if (null == strings || strings.length == 0) {
return null;
}
Long[] longs = new Long[strings.length];
if (null != longs && longs.length > 0) {
for (int i = 0; i < strings.length; i++) {
longs[i] = Long.parseLong(strings[i]);
}
}
return longs;
}
/**
* <p>Description:[字符类型list转Integer类型List]</p>
* @param stringList 字符串数组
* @return List<Integer> Integer类型List
* @author hfx
* @date 2019/4/16 15:34
*/
public static List<Integer> stringListToIntegerList(List<String> stringList) {
if (null == stringList || stringList.size() == 0) {
return null;
}
List<Integer> integerList = new ArrayList<>();
for (String string : stringList) {
integerList.add(getIntValue(string));
}
return integerList;
}
/**
* <p>Description:[字符类型list转Long类型List]</p>
* @param stringList 字符串数组
* @return List<Long> Long类型List
* @author hfx
* @date 2019/4/16 15:34
*/
public static List<Long> stringListToLongList(List<String> stringList) {
if (null == stringList || stringList.size() == 0) {
return null;
}
List<Long> longList = new ArrayList<>();
for (String string : stringList) {
if(isEmpty(string)||string.equals("null")){
continue;
}
longList.add(Long.parseLong(string));
}
return longList;
}
/**
* <p>Description:[字符串转小写字符串]</p>
* @param origString 原始字符串
* @return 转换后的字符串
* @author hfx
* @date 2019/4/16 15:34
*/
public static String getLowerString(String origString) {
if (StringUtils.isBlank(origString)) {
return origString;
}
return origString.toLowerCase();
}
/**
* <p>Description:[字符串转小写字符串]</p>
* @param origString 原始字符串
* @return 转换后的字符串
* @author hfx
* @date 2019/4/16 15:34
*/
public static String getUpperString(String origString) {
if (StringUtils.isBlank(origString)) {
return origString;
}
return origString.toUpperCase();
}
/**
* <p>Description:[判断字符串是否只包含数字和字母]</p>
* @author hfx
* @date 2019/4/16 15:34
*/
public static boolean containLetterAndNumber(String string) {
return string.matches("[0-9A-Za-z]*");
}
/**
* <p>Description:[判断字符串是否只包含数字和横杠(电话号校验)]</p>
* @author hfx
* @date 2019/4/16 15:34
*/
public static boolean isPhone(String string) {
return string.matches("[0-9-]*");
}
/**
* <p>Description:[过滤表情符号]</p>
* @author hfx
* @date 2019/4/16 15:34
*/
public static String filterEmoji(String string) {
if(StringUtils.isEmpty(string)){
return null;
}
//Pattern emoji = Pattern.compile ("[\ud83c\udc00-\ud83c\udfff]|[\ud83d\udc00-\ud83d\udfff]|[\u2600-\u27ff]",Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE);
Pattern emoji = Pattern.compile ("(?:[\uD83C\uDF00-\uD83D\uDDFF]|[\uD83E\uDD00-\uD83E\uDDFF]|[\uD83D\uDE00-\uD83D\uDE4F]|[\uD83D\uDE80-\uD83D\uDEFF]|[\u2600-\u26FF]\uFE0F?|[\u2700-\u27BF]\uFE0F?|\u24C2\uFE0F?|[\uD83C\uDDE6-\uD83C\uDDFF]{1,2}|[\uD83C\uDD70\uD83C\uDD71\uD83C\uDD7E\uD83C\uDD7F\uD83C\uDD8E\uD83C\uDD91-\uD83C\uDD9A]\uFE0F?|[\u0023\u002A\u0030-\u0039]\uFE0F?\u20E3|[\u2194-\u2199\u21A9-\u21AA]\uFE0F?|[\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55]\uFE0F?|[\u2934\u2935]\uFE0F?|[\u3030\u303D]\uFE0F?|[\u3297\u3299]\uFE0F?|[\uD83C\uDE01\uD83C\uDE02\uD83C\uDE1A\uD83C\uDE2F\uD83C\uDE32-\uD83C\uDE3A\uD83C\uDE50\uD83C\uDE51]\uFE0F?|[\u203C\u2049]\uFE0F?|[\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE]\uFE0F?|[\u00A9\u00AE]\uFE0F?|[\u2122\u2139]\uFE0F?|\uD83C\uDC04\uFE0F?|\uD83C\uDCCF\uFE0F?|[\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA]\uFE0F?)",Pattern.UNICODE_CASE | Pattern . CASE_INSENSITIVE ) ;
Matcher emojiMatcher = emoji.matcher(string);
if (emojiMatcher.find()) {
string = emojiMatcher.replaceAll("");
}
return string;
}
/**
* <p>Description:[获取URL文件名称KEY]</p>
* @param imgUrl
* @return String
* @author hfx
* @date 2019/4/16 15:34
*/
public static String getFileUrlName(String imgUrl) {
if (imgUrl == null) {
return null;
}
String[] strs = imgUrl.split("/");
if(strs == null || strs.length == 0){
return null;
}
String temp = strs[strs.length - 1];
if(StringUtils.isBlank(temp)){
return null;
}
if (temp.lastIndexOf(".") < 0) {
return null;
}
temp = temp.substring(0, temp.lastIndexOf("."));
return temp;
}
/**
* <p>Description:[获取uuid]</p>
* @author hfx
* @date 2019/4/16 15:34
*/
public static String getUUID() {
return UUID.randomUUID().toString().replaceAll("-", "");
}
/**
* <p>Description:[获取两个字符串数组交集]</p>
* @param str1 字符串1(逗号分隔)
* @param str2 字符串2(逗号分隔)
* @author hfx
* @date 2019/4/16 15:34
*/
public static String getIntersection(String str1, String str2){
String[] ary1 = str1.split(",");
String[] ary2 = str2.split(",");
Set<String> result = new HashSet<>();
for (String s1: ary1) {
for (String s2: ary2) {
if(s1.equalsIgnoreCase(s2)){
result.add(s1.trim());
}
}
}
return result.toString().replace("[","").replace("]","");
}
}
package net.wanji.web.common.util.date;
/**
* @author hfx
* @version 1.0
* @Description: [日期风格工具类]
* Created on 2019/4/16 15:07
*/
public enum DateStyle {
YYYY_MM("yyyy-MM", false),
YYYY_MM_DD("yyyy-MM-dd", false),
YYYY_MM_DD_HH_MM("yyyy-MM-dd HH:mm", false),
YYYY_MM_DD_HH_MM_SS("yyyy-MM-dd HH:mm:ss", false),
YYYYMMDDHHMMSS("yyyyMMddHHmmss", false),
YYYYMMDDHHMMSSSSS("yyyyMMddHHmmssSSS", false),
YYYYMMDD("yyyyMMdd", false),
YYYY_MM_EN("yyyy/MM", false),
YYYY_MM_DD_EN("yyyy/MM/dd", false),
YYYY_MM_DD_HH_MM_EN("yyyy/MM/dd HH:mm", false),
YYYY_MM_DD_HH_MM_SS_EN("yyyy/MM/dd HH:mm:ss", false),
DD_MM_YYYY_EN("dd/MM/yyyy", false),
YYYY_MM_CN("yyyy年MM月", false),
YYYY_MM_DD_CN("yyyy年MM月dd日", false),
YYYY_MM_DD_HH_MM_CN("yyyy年MM月dd日 HH:mm", false),
YYYY_MM_DD_HH_MM_SS_CN("yyyy年MM月dd日 HH:mm:ss", false),
HH_MM("HH:mm", true),
HH_MM_SS("HH:mm:ss", true),
MM_DD("MM-dd", true),
MM_DD_HH_MM("MM-dd HH:mm", true),
MM_DD_HH_MM_SS("MM-dd HH:mm:ss", true),
MM_DD_EN("MM/dd", true),
MM_DD_HH_MM_EN("MM/dd HH:mm", true),
MM_DD_HH_MM_SS_EN("MM/dd HH:mm:ss", true),
MM_DD_CN("MM月dd日", true),
MM_DD_HH_MM_CN("MM月dd日 HH:mm", true),
MM_DD_HH_MM_SS_CN("MM月dd日 HH:mm:ss", true);
private String value;
private boolean isShowOnly;
DateStyle(String value, boolean isShowOnly) {
this.value = value;
this.isShowOnly = isShowOnly;
}
public String getValue() {
return value;
}
public boolean isShowOnly() {
return isShowOnly;
}
}
\ No newline at end of file
package net.wanji.web.common.util.date;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @author hfx
* @version 1.0
* Created on 2019/4/16 15:28
* @Description: [日期工具类]
*/
@Slf4j
public class DateUtils {
private static final ThreadLocal<SimpleDateFormat> threadLocal = new ThreadLocal<>();
private static final Object object = new Object();
private DateUtils() {}
/**
* 获取SimpleDateFormat
*
* @param pattern 日期格式
* @return SimpleDateFormat对象
* @throws RuntimeException 异常:非法日期格式
*/
public static SimpleDateFormat getDateFormat(String pattern) {
SimpleDateFormat dateFormat = threadLocal.get();
if (dateFormat == null) {
synchronized (object) {
dateFormat = new SimpleDateFormat(pattern);
dateFormat.setLenient(false);
threadLocal.set(dateFormat);
}
}
dateFormat.applyPattern(pattern);
return dateFormat;
}
/**
* 获取日期中的某数值。如获取月份
*
* @param date 日期
* @param dateType 日期格式
* @return 数值
*/
private static int getInteger(Date date, int dateType) {
int num = 0;
Calendar calendar = Calendar.getInstance();
if (date != null) {
calendar.setTime(date);
num = calendar.get(dateType);
}
return num;
}
/**
* 增加日期中某类型的某数值。如增加日期
*
* @param date 日期字符串
* @param dateType 类型
* @param amount 数值
* @return 计算后日期字符串
*/
private static String addInteger(String date, int dateType, int amount) {
String dateString = null;
DateStyle dateStyle = getDateStyle(date);
if (dateStyle != null) {
Date myDate = stringToDate(date, dateStyle);
myDate = addInteger(myDate, dateType, amount);
dateString = dateToString(myDate, dateStyle);
}
return dateString;
}
/**
* 增加日期中某类型的某数值。如增加日期
*
* @param date 日期
* @param dateType 类型
* @param amount 数值
* @return 计算后日期
*/
private static Date addInteger(Date date, int dateType, int amount) {
Date myDate = null;
if (date != null) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(dateType, amount);
myDate = calendar.getTime();
}
return myDate;
}
/**
* 获取精确的日期
*
* @param timestamps 时间long集合
* @return 日期
*/
private static Date getAccurateDate(List<Long> timestamps) {
Date date = null;
long timestamp = 0;
Map<Long, long[]> map = new HashMap<>();
List<Long> absoluteValues = new ArrayList<>();
if (timestamps != null && !timestamps.isEmpty()) {
if (timestamps.size() > 1) {
for (int i = 0; i < timestamps.size(); i++) {
for (int j = i + 1; j < timestamps.size(); j++) {
long absoluteValue = Math.abs(timestamps.get(i)
- timestamps.get(j));
absoluteValues.add(absoluteValue);
long[] timestampTmp = {timestamps.get(i),
timestamps.get(j)};
map.put(absoluteValue, timestampTmp);
}
}
// 有可能有相等的情况。如2012-11和2012-11-01。时间戳是相等的。此时minAbsoluteValue为0
// 因此不能将minAbsoluteValue取默认值0
long minAbsoluteValue = -1;
if (!absoluteValues.isEmpty()) {
minAbsoluteValue = absoluteValues.get(0);
for (int i = 1; i < absoluteValues.size(); i++) {
if (minAbsoluteValue > absoluteValues.get(i)) {
minAbsoluteValue = absoluteValues.get(i);
}
}
}
if (minAbsoluteValue != -1) {
long[] timestampsLastTmp = map.get(minAbsoluteValue);
long dateOne = timestampsLastTmp[0];
long dateTwo = timestampsLastTmp[1];
if (absoluteValues.size() > 1) {
timestamp = Math.abs(dateOne) > Math.abs(dateTwo) ? dateOne
: dateTwo;
}
}
} else {
timestamp = timestamps.get(0);
}
}
if (timestamp != 0) {
date = new Date(timestamp);
}
return date;
}
/**
* 根据开始时间和结束时间获取间隔的时间(单位/小时)
*
* @param startTime
* @param endTime
* @return
*/
public static Double getIntervalHours(String startTime, String endTime) {
Date staDate = DateUtils.stringToDate(startTime, DateStyle.HH_MM_SS);
Date endDate = DateUtils.stringToDate(endTime, DateStyle.HH_MM_SS);
if(staDate == null || endDate == null) return null;
BigDecimal startTimeStamp = BigDecimal.valueOf(staDate.getTime());
BigDecimal endTimeStamp = BigDecimal.valueOf(endDate.getTime());
BigDecimal hours = endTimeStamp.subtract(startTimeStamp).divide(new BigDecimal(1000 * 60 * 60), 2, BigDecimal.ROUND_DOWN);
return hours.doubleValue();
}
/**
* 判断字符串是否为日期字符串
*
* @param date 日期字符串
* @return true or false
*/
public static boolean isDate(String date) {
boolean isDate = false;
if (date != null && getDateStyle(date) != null) {
isDate = true;
}
return isDate;
}
/**
* 获取日期字符串的日期风格。失敗返回null。
*
* @param date 日期字符串
* @return 日期风格
*/
public static DateStyle getDateStyle(String date) {
DateStyle dateStyle = null;
Map<Long, DateStyle> map = new HashMap<>();
List<Long> timestamps = new ArrayList<>();
for (DateStyle style : DateStyle.values()) {
if (style.isShowOnly()) {
continue;
}
Date dateTmp = null;
if (date != null) {
try {
ParsePosition pos = new ParsePosition(0);
dateTmp = getDateFormat(style.getValue()).parse(date, pos);
if (pos.getIndex() != date.length()) {
dateTmp = null;
}
} catch (Exception e) {
log.error(e.getMessage());
}
}
if (dateTmp != null) {
timestamps.add(dateTmp.getTime());
map.put(dateTmp.getTime(), style);
}
}
Date accurateDate = getAccurateDate(timestamps);
if (accurateDate != null) {
dateStyle = map.get(accurateDate.getTime());
}
return dateStyle;
}
/**
* 将日期字符串转化为日期。失败返回null。
*
* @param date 日期字符串
* @return 日期
*/
public static Date stringToDate(String date) {
DateStyle dateStyle = getDateStyle(date);
return stringToDate(date, dateStyle);
}
/**
* 将日期字符串转化为日期。失败返回null。
*
* @param date 日期字符串
* @param pattern 日期格式
* @return 日期
*/
public static Date stringToDate(String date, String pattern) {
Date myDate = null;
if (date != null) {
try {
myDate = getDateFormat(pattern).parse(date);
} catch (Exception e) {
log.error(e.getMessage());
}
}
return myDate;
}
/**
* 将日期字符串转化为日期。失败返回null。
*
* @param date 日期字符串
* @param dateStyle 日期风格
* @return 日期
*/
public static Date stringToDate(String date, DateStyle dateStyle) {
Date myDate = null;
if (dateStyle != null) {
myDate = stringToDate(date, dateStyle.getValue());
}
return myDate;
}
/**
* 将日期转化为日期字符串。失败返回null。
*
* @param date 日期
* @param pattern 日期格式
* @return 日期字符串
*/
public static String dateToString(Date date, String pattern) {
return getDateFormat(pattern).format(date);
}
/**
* 将日期转化为日期字符串。失败返回null。
*
* @param date 日期
* @param dateStyle 日期风格
* @return 日期字符串
*/
public static String dateToString(Date date, DateStyle dateStyle) {
String dateString = "";
if (dateStyle != null) {
dateString = dateToString(date, dateStyle.getValue());
}
return dateString;
}
/**
* 将日期字符串转化为另一日期字符串。失败返回null。
*
* @param date 旧日期字符串
* @param newPattern 新日期格式
* @return 新日期字符串
*/
public static String stringToString(String date, String newPattern) {
DateStyle oldDateStyle = getDateStyle(date);
return stringToString(date, oldDateStyle, newPattern);
}
/**
* 将日期字符串转化为另一日期字符串。失败返回null。
*
* @param date 旧日期字符串
* @param newDateStyle 新日期风格
* @return 新日期字符串
*/
public static String stringToString(String date, DateStyle newDateStyle) {
DateStyle oldDateStyle = getDateStyle(date);
return stringToString(date, oldDateStyle, newDateStyle);
}
/**
* 将日期字符串转化为另一日期字符串。失败返回null。
*
* @param date 旧日期字符串
* @param olddPattern 旧日期格式
* @param newPattern 新日期格式
* @return 新日期字符串
*/
public static String stringToString(String date, String olddPattern,
String newPattern) {
return dateToString(stringToDate(date, olddPattern), newPattern);
}
/**
* 将日期字符串转化为另一日期字符串。失败返回null。
*
* @param date 旧日期字符串
* @param olddDteStyle 旧日期风格
* @param newParttern 新日期格式
* @return 新日期字符串
*/
public static String stringToString(String date, DateStyle olddDteStyle,
String newParttern) {
String dateString = null;
if (olddDteStyle != null) {
dateString = stringToString(date, olddDteStyle.getValue(),
newParttern);
}
return dateString;
}
/**
* 将日期字符串转化为另一日期字符串。失败返回null。
*
* @param date 旧日期字符串
* @param olddPattern 旧日期格式
* @param newDateStyle 新日期风格
* @return 新日期字符串
*/
public static String stringToString(String date, String olddPattern,
DateStyle newDateStyle) {
String dateString = null;
if (newDateStyle != null) {
dateString = stringToString(date, olddPattern,
newDateStyle.getValue());
}
return dateString;
}
/**
* 将日期字符串转化为另一日期字符串。失败返回null。
*
* @param date 旧日期字符串
* @param olddDteStyle 旧日期风格
* @param newDateStyle 新日期风格
* @return 新日期字符串
*/
public static String stringToString(String date, DateStyle olddDteStyle,
DateStyle newDateStyle) {
String dateString = null;
if (olddDteStyle != null && newDateStyle != null) {
dateString = stringToString(date, olddDteStyle.getValue(),
newDateStyle.getValue());
}
return dateString;
}
/**
* 格式化时间
*
* @param date
* @param dateStyle
* @return 时间
*/
public static Date dateForMat(Date date, DateStyle dateStyle) {
return stringToDate(dateToString(date, dateStyle), dateStyle);
}
/**
* 增加日期的年份。失败返回null。
*
* @param date 日期
* @param yearAmount 增加数量。可为负数
* @return 增加年份后的日期字符串
*/
public static String addYear(String date, int yearAmount) {
return addInteger(date, Calendar.YEAR, yearAmount);
}
/**
* 增加日期的值。失败返回null。
*
* @param date 日期
* @param type 添加的类型 年、月、日、时、分、秒
* @param amount 增加数量
* @return
*/
public static Date add(Date date, int type, int amount) {
return addInteger(date, type, amount);
}
/**
* 增加日期的年份。失败返回null。
*
* @param date 日期
* @param yearAmount 增加数量。可为负数
* @return 增加年份后的日期
*/
public static Date addYear(Date date, int yearAmount) {
return addInteger(date, Calendar.YEAR, yearAmount);
}
/**
* 增加日期的月份。失败返回null。
*
* @param date 日期
* @param monthAmount 增加数量。可为负数
* @return 增加月份后的日期字符串
*/
public static String addMonth(String date, int monthAmount) {
return addInteger(date, Calendar.MONTH, monthAmount);
}
/**
* 增加日期的月份。失败返回null。
*
* @param date 日期
* @param monthAmount 增加数量。可为负数
* @return 增加月份后的日期
*/
public static Date addMonth(Date date, int monthAmount) {
return addInteger(date, Calendar.MONTH, monthAmount);
}
/**
* 增加日期的天数。失败返回null。
*
* @param date 日期字符串
* @param dayAmount 增加数量。可为负数
* @return 增加天数后的日期字符串
*/
public static String addDay(String date, int dayAmount) {
return addInteger(date, Calendar.DATE, dayAmount);
}
/**
* 增加日期的天数。失败返回null。
*
* @param date 日期
* @param dayAmount 增加数量。可为负数
* @return 增加天数后的日期
*/
public static Date addDay(Date date, int dayAmount) {
return addInteger(date, Calendar.DATE, dayAmount);
}
/**
* 增加日期的小时。失败返回null。
*
* @param date 日期字符串
* @param hourAmount 增加数量。可为负数
* @return 增加小时后的日期字符串
*/
public static String addHour(String date, int hourAmount) {
return addInteger(date, Calendar.HOUR_OF_DAY, hourAmount);
}
/**
* 增加日期的小时。失败返回null。
*
* @param date 日期
* @param hourAmount 增加数量。可为负数
* @return 增加小时后的日期
*/
public static Date addHour(Date date, int hourAmount) {
return addInteger(date, Calendar.HOUR_OF_DAY, hourAmount);
}
/**
* 增加日期的分钟。失败返回null。
*
* @param date 日期字符串
* @param minuteAmount 增加数量。可为负数
* @return 增加分钟后的日期字符串
*/
public static String addMinute(String date, int minuteAmount) {
return addInteger(date, Calendar.MINUTE, minuteAmount);
}
/**
* 增加日期的分钟。失败返回null。
*
* @param date 日期
* @param minuteAmount 增加数量。可为负数
* @return 增加分钟后的日期
*/
public static Date addMinute(Date date, int minuteAmount) {
return addInteger(date, Calendar.MINUTE, minuteAmount);
}
/**
* 增加日期的秒钟。失败返回null。
*
* @param date 日期字符串
* @param secondAmount 增加数量。可为负数
* @return 增加秒钟后的日期字符串
*/
public static String addSecond(String date, int secondAmount) {
return addInteger(date, Calendar.SECOND, secondAmount);
}
/**
* 增加日期的秒钟。失败返回null。
*
* @param date 日期
* @param secondAmount 增加数量。可为负数
* @return 增加秒钟后的日期
*/
public static Date addSecond(Date date, int secondAmount) {
return addInteger(date, Calendar.SECOND, secondAmount);
}
/**
* 获取日期的年份。失败返回0。
*
* @param date 日期字符串
* @return 年份
*/
public static int getYear(String date) {
return getYear(stringToDate(date));
}
/**
* 获取日期的年份。失败返回0。
*
* @param date 日期
* @return 年份
*/
public static int getYear(Date date) {
return getInteger(date, Calendar.YEAR);
}
/**
* 获取日期的月份。失败返回0。
*
* @param date 日期字符串
* @return 月份
*/
public static int getMonth(String date) {
return getMonth(stringToDate(date));
}
/**
* 获取日期的月份。失败返回0。
*
* @param date 日期
* @return 月份
*/
public static int getMonth(Date date) {
return getInteger(date, Calendar.MONTH) + 1;
}
/**
* 获取日期的星期。失败返回0
*
* @param date 日期
* @return 星期
*/
public static int getWeek(String date) {
return getWeek(stringToDate(date));
}
/**
* 获取日期的星期。失败返回0
*
* @param date 日期
* @return 星期
*/
public static int getWeek(Date date) {
return getInteger(date, Calendar.DAY_OF_WEEK) - 1;
}
/**
* 获取日期的天数。失败返回0。
*
* @param date 日期字符串
* @return 天
*/
public static int getDay(String date) {
return getDay(stringToDate(date));
}
/**
* 获取日期的天数。失败返回0。
*
* @param date 日期
* @return 天
*/
public static int getDay(Date date) {
return getInteger(date, Calendar.DATE);
}
/**
* 获取日期的小时。失败返回0。
*
* @param date 日期字符串
* @return 小时
*/
public static int getHour(String date) {
return getHour(stringToDate(date));
}
/**
* 获取日期的小时。失败返回0。
*
* @param date 日期
* @return 小时
*/
public static int getHour(Date date) {
return getInteger(date, Calendar.HOUR_OF_DAY);
}
/**
* 获取日期的分钟。失败返回0。
*
* @param date 日期字符串
* @return 分钟
*/
public static int getMinute(String date) {
return getMinute(stringToDate(date));
}
/**
* 获取日期的分钟。失败返回0。
*
* @param date 日期
* @return 分钟
*/
public static int getMinute(Date date) {
return getInteger(date, Calendar.MINUTE);
}
/**
* 获取日期的秒钟。失败返回0。
*
* @param date 日期字符串
* @return 秒钟
*/
public static int getSecond(String date) {
return getSecond(stringToDate(date));
}
/**
* 获取日期的秒钟。失败返回0。
*
* @param date 日期
* @return 秒钟
*/
public static int getSecond(Date date) {
return getInteger(date, Calendar.SECOND);
}
/**
* 获取日期 。默认yyyy-MM-dd格式。失败返回null。
*
* @param date 日期字符串
* @return 日期
*/
public static String getDate(String date) {
return stringToString(date, DateStyle.YYYY_MM_DD);
}
/**
* 获取日期。默认yyyy-MM-dd格式。失败返回null。
*
* @param date 日期
* @return 日期
*/
public static String getDate(Date date) {
return dateToString(date, DateStyle.YYYY_MM_DD);
}
/**
* 获取日期的时间。默认HH:mm:ss格式。失败返回null。
*
* @param date 日期字符串
* @return 时间
*/
public static String getTime(String date) {
return stringToString(date, DateStyle.HH_MM_SS);
}
/**
* 获取日期的时间。默认HH:mm:ss格式。失败返回null。
*
* @param date 日期
* @return 时间
*/
public static String getTime(Date date) {
return dateToString(date, DateStyle.HH_MM_SS);
}
/**
* 获取两个日期相差的天数
*
* @param date 日期字符串
* @param otherDate 另一个日期字符串
* @return 相差天数。如果失败则返回-1
*/
public static int getIntervalDays(String date, String otherDate) {
return getIntervalDays(stringToDate(date), stringToDate(otherDate));
}
/**
* @param date 日期
* @param otherDate 另一个日期
* @return 相差天数。如果失败则返回-1
*/
public static int getIntervalDays(Date date, Date otherDate) {
int num = -1;
Date dateTmp = DateUtils.stringToDate(DateUtils.getDate(date),
DateStyle.YYYY_MM_DD);
Date otherDateTmp = DateUtils.stringToDate(DateUtils.getDate(otherDate),
DateStyle.YYYY_MM_DD);
if (dateTmp != null && otherDateTmp != null) {
long time = Math.abs(dateTmp.getTime() - otherDateTmp.getTime());
num = (int) (time / (24 * 60 * 60 * 1000));
}
return num;
}
/**
* @param date 日期
* @param otherDate 另一个日期
* @return 相差分钟数。如果失败则返回-1
*/
public static int getIntervalMinute(Date date, Date otherDate) {
int num = -1;
if (date != null && otherDate != null) {
long time = Math.abs(date.getTime() - otherDate.getTime());
num = (int) (time / (1000 * 60));
}
return num;
}
/**
* Description :获取当前时间yyyyMMddHHmmss字符串
*
* @return String 当前时间yyyyMMddHHmmss字符串
*/
public static String getSecondString() {
return dateToString(new Date(), DateStyle.YYYYMMDDHHMMSS);
}
/**
* Description : 获取当前时间yyyyMMddHHmmssSSS字符串
*
* @return String 当前时间yyyyMMddHHmmssSSS字符串
*/
public static String getMillisecondString() {
return dateToString(new Date(), DateStyle.YYYYMMDDHHMMSSSSS);
}
/**
* 比较两个日期的大小
*
* @param date1 日期1
* @param date2 日期2
* @return 1 date1 > date2; -1 date1 < date2 ; 0 date1 = date2
*/
public static int compareDate(String date1, String date2) {
Date dt1 = stringToDate(date1);
Date dt2 = stringToDate(date2);
return compareDate(dt1, dt2);
}
/**
* 比较两个日期的大小
*
* @param date1 日期1
* @param date2 日期2
* @return 1 date1 > date2; -1 date1 < date2 ; 0 date1 = date2
*/
public static int compareDate(Date date1, Date date2) {
if(date1 == null || date2 == null) return 0;
if (date1.getTime() > date2.getTime()) {
return 1;
} else if (date1.getTime() < date2.getTime()) {
return -1;
} else {
return 0;
}
}
/**
* Description:[判断两个日期是否相等]
*
* @param d1 日期1
* @param d2 日期2
* @return boolean 相等true
* <p>
* Created on 2019/4/17
* @author: yinguijin
*/
public static boolean isSameDate(Date d1, Date d2) {
if (null == d1 || null == d2)
return false;
Calendar cal1 = Calendar.getInstance();
cal1.setTime(d1);
Calendar cal2 = Calendar.getInstance();
cal2.setTime(d2);
return cal1.get(0) == cal2.get(0) && cal1.get(1) == cal2.get(1) && cal1.get(6) == cal2.get(6);
}
/**
* Description:[获取两个时间的时间差]
*
* @param date1 时间一
* @param date2 时间二
* @param type 获取的类型 天 时 分 秒
* @return 时间一 减 时间二 的值
* <p>
* Created on 2019/4/17
* @author: yinguijin
*/
public static int dayDiff(Date date1, Date date2, int type) {
long diff = date1.getTime() - date2.getTime();
int nd = 1000 * 24 * 60 * 60;
int nh = 1000 * 60 * 60;
int nm = 1000 * 60;
int ns = 1000;
// 计算差多少天
long day = diff / nd;
// 计算差多少小时
long hour = diff / nh;
// 计算差多少分钟
long min = diff / nm;
// 计算差多少秒
long sec = diff / ns;
if (Calendar.DATE == type) {
return (int) day;
} else if (Calendar.HOUR_OF_DAY == type) {
return (int) hour;
} else if (Calendar.MINUTE == type) {
return (int) min;
} else if (Calendar.SECOND == type) {
return (int) sec;
} else {
return (int) diff;
}
}
/**
* Description:[根据参数时间获取前推的整点时间:列2017-11-22 17:13返回17:00;列2017-11-22 17:59返回17:30]
*
* @param date 时间
* @return 列2017-11-22 17:13返回17:00;列2017-11-22 17:59返回17:30
* <p>
* Created on 2019/4/17
* @author: yinguijin
*/
public static Date wholeHour(Date date) {
int hour = DateUtils.getHour(date);
int minute = DateUtils.getMinute(date);
if (minute >= 30) {
minute = 30;
} else {
minute = 00;
}
String endTime = hour + ":" + minute;
return DateUtils.stringToDate(endTime, DateStyle.HH_MM);
}
/**
* <p>Description:[计算两个日期相差的月数,不足15天按照半个月计算,超过15天按照一个月计算]</p>
*
* @param startDate 开始时间
* @param endDate 结束时间
* @return 相差的月数0.5的倍数
* Created on 2019/4/17
* @author: yinguijin
*/
public static double getMonths(Date startDate, Date endDate) {
int startYear = DateUtils.getYear(startDate);
int endYear = DateUtils.getYear(endDate);
int startMonth = DateUtils.getMonth(startDate);
int endMonth = DateUtils.getMonth(endDate);
int startDay = DateUtils.getDay(startDate);
int endDay = DateUtils.getDay(endDate);
int endLastDay = DateUtils.getLastDay(endDate);
int startLastDay = DateUtils.getLastDay(startDate);
int intervalYears = endYear - startYear;
double intervalMonths;
int intervalDays;
if (intervalYears >= 1) {
intervalDays = (startLastDay - startDay) + endDay + 1;
intervalMonths = (12.0 - startMonth) + endMonth + 1;
if (startDay == 1 && endDay == endLastDay) {
intervalDays = 0;
} else {
if (startDay != 1) {
intervalMonths -= 1.0;
} else {
intervalDays = endDay;
}
if (endDay != endLastDay) {
intervalMonths -= 1.0;
} else {
intervalDays = startLastDay - startDay + 1;
}
}
} else {
intervalMonths = endMonth - startMonth + 1.0;
if (intervalMonths > 1.0) {
intervalDays = (startLastDay - startDay) + endDay + 1;
if (startDay == 1 && endDay == endLastDay) {
intervalDays = 0;
} else {
if (startDay != 1) {
intervalMonths -= 1.0;
} else {
intervalDays = endDay;
}
if (endDay != endLastDay) {
intervalMonths -= 1.0;
} else {
intervalDays = startLastDay - startDay + 1;
}
}
intervalMonths = intervalMonths < 0.0 ? 0.0 : intervalMonths;
} else {
intervalMonths = 0.0;
intervalDays = endDay - startDay + 1;
}
}
if (intervalDays == 0) {
intervalMonths += 0.0;
} else if (intervalDays <= 15) {
intervalMonths += 0.5;
} else if (intervalDays >= 31) {
intervalMonths += 1.0;
if (intervalDays - 31 > 15) {
intervalMonths += 1.0;
} else if (intervalDays - 31 >= 1) {
intervalMonths += 0.5;
}
} else {
intervalMonths += 1.0;
}
for (int i = 1; i < intervalYears; i++) {
intervalMonths += 12.0;
}
return intervalMonths;
}
/**
* <p>Description:[计算当前时间所处的拆分时间段]</p>
*
* @return 拆分时间段Integer值
* Created on 2019/4/17
* @author: yinguijin
*/
public static Integer getSplitTimeByNow() {
return getSplitTime(new Date());
}
/**
* <p>Description:[计算时间所处的拆分时间段]</p>
*
* @return 拆分时间段Integer值
* Created on 2019/4/17
* @author: yinguijin
*/
public static Integer getSplitTime(Date date) {
int hour = DateUtils.getHour(date);
int minute = DateUtils.getMinute(date);
if (minute > 0 && minute < 30) {
minute = 30;
}
int splitTime = hour * 2 + 1;
if (minute >= 30) {
splitTime += 1;
}
return splitTime;
}
/**
* Description:[获取当前月的第一天的日期]
*
* @return 当前月第一天
* <p>
* Created on 2019/4/17
* @author: yinguijin
*/
public static Date getfirstDate() {
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, 0);
c.set(Calendar.DAY_OF_MONTH, 1);//设置为1号,当前日期既为本月第一天
return stringToDate(getDateFormat(DateStyle.YYYY_MM_DD.getValue()).format(c.getTime()));
}
/**
* Description:[获取当前月的最后一天的日期]
*
* @return 当前月的最后一天
* <p>
* Created on 2019/4/17
* @author: yinguijin
*/
public static Date getlastDate() {
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, 0);
c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH));
return stringToDate(getDateFormat(DateStyle.YYYY_MM_DD.getValue()).format(c.getTime()));
}
/**
* Description:[获取指定月的最后一天的日期]
*
* @return 指定的最后一天
* <p>
* Created on 2019/4/17
* @author: yinguijin
*/
public static int getLastDay(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.getActualMaximum(Calendar.DAY_OF_MONTH);
}
/**
* Description:[获取指定月的第一天的日期]
*
* @return 指定的第一天
* <p>
* Created on 2019/4/17
* @author: yinguijin
*/
public static int getFirstDay(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.getActualMinimum(Calendar.DAY_OF_MONTH);
}
/**
* <p>Description:[获取当前日期字符串]</p>
* Created on 2019/4/17
*
* @author: yinguijin
*/
public static String getCurrentDateString() {
return dateToString(new Date(), DateStyle.YYYY_MM_DD);
}
/**
* <p>Description:[获取当前日期]</p>
* Created on 2019/4/17
*
* @author: yinguijin
*/
public static Date getCurrentDate() {
return stringToDate(getCurrentDateString(), DateStyle.YYYY_MM_DD);
}
/**
* <p>Description:[获取某月最大日期]</p>
* Created on 2019/4/17
*
* @author: yinguijin
*/
public static int getMonthMaxDay(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.set(getYear(date), getMonth(date) - 1, 1);
return calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
}
/**
* <p>Discription:[根据传入的两个时间计算相差几个小时,结果保留一位小数]</p>
*
* @param dateLast date类型的时间1
* @param dateNext date类型的时间2
* @return Double 返回保留一位小数的绝对值
* Created on 2019/4/17
* @author: yinguijin
*/
public static Double calculateHour(Date dateLast, Date dateNext) {
long millisLast = dateLast.getTime();
long millisNext = dateNext.getTime();
double differenceMillis = (double) (millisNext - millisLast);
double hourDouble = differenceMillis / 1000 / 60 / 60;
hourDouble = BigDecimal.valueOf(hourDouble).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
return Math.abs(hourDouble);
}
/**
* 判断一个时间是否在一个时间段之间
*
* @param date 为目标时间
* @param startDate 为起始时间
* @param endDate 为结束时间
* @return true or false
* Created on 2019/4/17
* @author: yinguijin
*/
public static boolean getInDate(String date, String startDate, String endDate) {
boolean flag = false;
Date targetTime = DateUtils.stringToDate(date, DateStyle.HH_MM);
Date startTime = DateUtils.stringToDate(startDate, DateStyle.HH_MM);
Date endTime;
if (endDate.equals("24:00")) {
endTime = addDay(DateUtils.stringToDate("00:00", DateStyle.HH_MM), 1);
} else {
endTime = DateUtils.stringToDate(endDate, DateStyle.HH_MM);
}
//目标时间大于等于开始时间 且 目标时间小于结束时间 时返回true
if (targetTime != null && targetTime.compareTo(startTime) >= 0 && targetTime.compareTo(endTime) < 0) {
flag = true;
}
return flag;
}
/**
* @param startTime 开始时间
* @param endTime 结束时间
* @return java.lang.String 时段名称
* @description: 获取时段名称
* @author yinguijin
* @date 2019/5/5 20:12
*/
public static String getSectimeName(String startTime, String endTime) {
String secname = "平峰";
String st = startTime.split(":")[0];
String et = endTime.split(":")[0];
if (StringUtils.isEmpty(st) || StringUtils.isEmpty(et)) {
return secname;
}
int s = Integer.parseInt(st);
int e = Integer.parseInt(et);
if (s >= 0 && e <= 6) {
secname = "低峰";
} else if (s >= 6 && e <= 7) {
secname = "早平峰";
} else if (s >= 7 && e <= 9) {
secname = "早高峰";
} else if (s >= 9 && e <= 12) {
secname = "平峰";
} else if (s >= 12 && e <= 14) {
secname = "次平峰";
} else if (s >= 14 && e <= 17) {
secname = "平峰";
} else if (s >= 17 && e <= 19) {
secname = "晚高峰";
} else if (s >= 19 && e <= 22) {
secname = "次平峰";
} else if (s >= 22 && e <= 24) {
secname = "低峰";
}
return secname;
}
/**
* @param cntDateBeg 开始时间
* @param cntDateEnd 结束时间
* @return
*/
public static List<String> addDates(String cntDateBeg, String cntDateEnd) {
List<String> list = new ArrayList<>();
//拆分成数组
String[] dateBegs = cntDateBeg.split("-");
String[] dateEnds = cntDateEnd.split("-");
//开始时间转换成时间戳
Calendar start = Calendar.getInstance();
start.set(Integer.valueOf(dateBegs[0]), Integer.valueOf(dateBegs[1]) - 1, Integer.valueOf(dateBegs[2]));
Long startTIme = start.getTimeInMillis();
//结束时间转换成时间戳
Calendar end = Calendar.getInstance();
end.set(Integer.valueOf(dateEnds[0]), Integer.valueOf(dateEnds[1]) - 1, Integer.valueOf(dateEnds[2]));
Long endTime = end.getTimeInMillis();
//定义一个一天的时间戳时长
Long oneDay = 1000 * 60 * 60 * 24l;
Long time = startTIme;
//循环得出
while (time <= endTime) {
list.add(new SimpleDateFormat("yyyy-MM-dd").format(new Date(time)));
time += oneDay;
}
return list;
}
}
\ No newline at end of file
package net.wanji.web.common.util.date;
import java.util.ArrayList;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/3 16:29
*/
public class TimeArrayUtil {
/**
* 返回一天的时间数组,按小时。如 ["00:00", "01:00" ... "23:00"]
*
* @author Kent HAN
* @date 2022/11/3 16:30
*/
public static List<String> getTimeArray() {
List<String> res = new ArrayList<>();
for (int i = 0; i < 24; i++) {
if (i < 10) {
res.add("0" + i + ":00");
} else {
res.add(i + ":00");
}
}
return res;
}
public static void main(String[] args) {
List<String> timeArray = TimeArrayUtil.getTimeArray();
}
}
package net.wanji.web.common.util.date;
/**
* @author hfx
* @version 1.0
* @Description: [星期工具类]
* Created on 2019/4/16 15:07
*/
public enum Week {
MONDAY("星期一", "周一", "Monday", "Mon.", 1),
TUESDAY("星期二", "周二","Tuesday", "Tues.", 2),
WEDNESDAY("星期三", "周三","Wednesday", "Wed.", 3),
THURSDAY("星期四", "周四","Thursday","Thur.", 4),
FRIDAY("星期五", "周五","Friday", "Fri.", 5),
SATURDAY("星期六", "周六","Saturday", "Sat.", 6),
SUNDAY("星期日", "周日","Sunday", "Sun.", 7);
String name_cn;
String name_cnWeek;
String name_en;
String name_enShort;
int number;
Week(String name_cn, String name_cnWeek,String name_en, String name_enShort, int number) {
this.name_cn = name_cn;
this.name_cnWeek = name_cnWeek;
this.name_en = name_en;
this.name_enShort = name_enShort;
this.number = number;
}
public String getChineseName() {
return name_cn;
}
public String getWeekName() {
return name_cnWeek;
}
public String getName() {
return name_en;
}
public String getShortName() {
return name_enShort;
}
public int getNumber() {
return number;
}
public static Week getNameByNumber(int number) {
for (Week week : Week.values()) {
if(week.getNumber() == number){
return week;
}
}
return null;
}
}
\ No newline at end of file
package net.wanji.web.controller;
import net.wanji.web.service.ExceptionService;
import javax.annotation.Resource;
/**
* @Description: [基础控制类]
* @author hfx
* @version 1.0
* Created on 2019/4/17 12:01
*/
public class BaseController {
@Resource
ExceptionService exceptionService;
}
package net.wanji.web.controller;
import net.wanji.web.common.entity.JsonViewObject;
import net.wanji.web.service.SignalEvaluateService;
import net.wanji.web.vo.signalEvaluate.FlowQueueInVO;
import net.wanji.web.vo.signalEvaluate.FlowQueueOutVO;
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;
import javax.ws.rs.core.MediaType;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 信号评价
*
* @author Kent HAN
* @date 2022/11/3 15:52
*/
@Api(value = "SignalEvaluateController", description = "信号评价")
@RequestMapping("/signalEvaluate")
@RestController
public class SignalEvaluateController extends BaseController{
@Autowired
SignalEvaluateService signalEvaluateService;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ApiOperation(value = "流量、排队折线图", notes = "流量、排队折线图", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/flowQueue",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject flowQueue(@RequestBody FlowQueueInVO flowQueueInVO) throws ParseException {
String adCode = flowQueueInVO.getAdCode();
String crossId = flowQueueInVO.getCrossId();
String currentTimeStr = flowQueueInVO.getCurrentTime();
Date currentTime = sdf.parse(currentTimeStr);
Integer timeType = flowQueueInVO.getTimeType();
Integer dataType = flowQueueInVO.getDataType();
FlowQueueOutVO flowQueueOutVO = signalEvaluateService.flowQueue(adCode, crossId, currentTime, timeType, dataType);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(flowQueueOutVO);
}
}
package net.wanji.web.controller;
import net.wanji.web.common.entity.JsonViewObject;
import net.wanji.web.service.SituationDetectionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.wanji.web.vo.situationDetection.*;
import org.springframework.beans.factory.annotation.Autowired;
import javax.ws.rs.core.MediaType;
import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 态势监测
*
* @author Kent HAN
* @date 2022/10/26 13:31
*/
@Api(value = "SituationDetectionController", description = "态势监测")
@RequestMapping("/situationDetection")
@RestController
public class SituationDetectionController extends BaseController{
@Autowired
SituationDetectionService situationDetectionService;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ApiOperation(value = "优化记录", notes = "优化记录", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/optRecords",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject optRecords(@RequestBody OptRecordsInVO optRecordsInVO) throws ParseException {
String adCode = optRecordsInVO.getAdCode();
String currentTimeStr = optRecordsInVO.getCurrentTime();
Date adaptTime = sdf.parse(currentTimeStr);
OptRecordsOutVO optRecordsOutVO = situationDetectionService.optRecords(adCode, adaptTime);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(optRecordsOutVO);
}
@ApiOperation(value = "路口报警", notes = "路口报警",
response = JsonViewObject.class, produces = MediaType.APPLICATION_JSON)
@GetMapping(value = "/crossAlarm", produces = MediaType.APPLICATION_JSON)
public JsonViewObject crossAlarm() {
List<CrossAlarmOutVO> crossAlarmOutVOList = situationDetectionService.crossAlarm();
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(crossAlarmOutVOList);
}
@ApiOperation(value = "事件报警", notes = "事件报警", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/eventAlarm",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject eventAlarm(@RequestBody EventAlarmInVO eventAlarmInVO) throws ParseException {
String currentTimeStr = eventAlarmInVO.getCurrentTime();
Date todayTime = sdf.parse(currentTimeStr);
List<EventAlarmOutVO> eventAlarmOutVOList = situationDetectionService.eventAlarm(todayTime);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(eventAlarmOutVOList);
}
@ApiOperation(value = "信号控制状态", notes = "信号控制状态", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/controlHist",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject controlHist(@RequestBody ControlHistInVO controlHistInVO) throws ParseException {
String crossId = controlHistInVO.getCrossId();
String currentTime = controlHistInVO.getCurrentTime();
List<ControlHistOutVO> controlHistOutVOList = situationDetectionService.controlHist(crossId, currentTime);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(controlHistOutVOList);
}
@ApiOperation(value = "在途车辆", notes = "在途车辆", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/vehicleTraceHist",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject vehicleTrace(@RequestBody VehicleTraceInVO vehicleTraceInVO) throws ParseException {
String adCode = vehicleTraceInVO.getAdCode();
String currentTime = vehicleTraceInVO.getCurrentTime();
List<VehicleTraceOutVO> vehicleTraceOutVOList = situationDetectionService.vehicleTrace(adCode, currentTime);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(vehicleTraceOutVOList);
}
@ApiOperation(value = "图层-视频设备信息及状态", notes = "图层-视频设备信息及状态", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/videoDeviceInfo",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject videoDeviceInfo(@RequestBody VideoDeviceInfoInVO videoDeviceInfoInVO) {
String adCode = videoDeviceInfoInVO.getAdCode();
List<VideoDeviceInfoOutVO> videoDeviceInfoOutVOList = situationDetectionService.videoDeviceInfo(adCode);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(videoDeviceInfoOutVOList);
}
@ApiOperation(value = "绿波监测", notes = "绿波监测", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/greenwaveRealtime",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject greenwaveRealtime(@RequestBody GreenwaveRealtimeInVO greenwaveRealtimeInVO) throws ParseException {
String adCode = greenwaveRealtimeInVO.getAdCode();
String currentTime = greenwaveRealtimeInVO.getCurrentTime();
List<GreenwaveRealtimeOutVO> greenwaveRealtimeOutVOList = situationDetectionService.greenwaveRealtime(adCode, currentTime);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(greenwaveRealtimeOutVOList);
}
@ApiOperation(value = "交通设备状态", notes = "交通设备状态", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/allDeviceStatus",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject allDeviceStatus(@RequestBody AllDeviceStatusInVO allDeviceStatusInVO) {
String adCode = allDeviceStatusInVO.getAdCode();
Map<String, Map<String, Integer>> allDeviceStatusMap = situationDetectionService.allDeviceStatus(adCode);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(allDeviceStatusMap);
}
@ApiOperation(value = "绿波监测-关联路口", notes = "绿波监测-关联路口", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/greenwaveCross",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject greenwaveCross(@RequestBody GreenwaveCrossInVO greenwaveCrossInVO) {
String adCode = greenwaveCrossInVO.getAdCode();
String currentTime = greenwaveCrossInVO.getCurrentTime();
Integer id = greenwaveCrossInVO.getId();
List<GreenwaveCrossOutVO> greenwaveCrossOutVOList = situationDetectionService.greenwaveCross(adCode, currentTime, id);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(greenwaveCrossOutVOList);
}
}
package net.wanji.web.controller;
import net.wanji.web.common.entity.JsonViewObject;
import net.wanji.web.common.exception.CrossRelationException;
import net.wanji.web.service.SpecialServiceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.web.vo.specialService.*;
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;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Set;
/**
* 快速特勤
*
* @author Kent HAN
* @date 2022/11/8 10:57
*/
@Api(value = "SpecialServiceController", description = "快速特勤")
@RequestMapping("/specialService")
@RestController
public class SpecialServiceController {
@Autowired
SpecialServiceService specialServiceService;
@ApiOperation(value = "添加特勤", notes = "添加特勤", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/addSpecialService",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject addSpecialService(@RequestBody AddSpecialServiceInVO addSpecialServiceInVO) {
specialServiceService.addSpecialService(addSpecialServiceInVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success();
}
@ApiOperation(value = "特勤列表", notes = "特勤列表", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/listSpecialServices",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = ListSpecialServicesOutVO.class),
})
public JsonViewObject listSpecialServices(@RequestBody ListSpecialServicesInVO listSpecialServicesInVO) {
String adCode = listSpecialServicesInVO.getAdCode();
List<ListSpecialServicesOutVO> listSpecialServicesOutVOList = specialServiceService.listSpecialServices(adCode);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(listSpecialServicesOutVOList);
}
@ApiOperation(value = "编辑特勤", notes = "编辑特勤", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/updateSpecialService",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject updateSpecialService(@RequestBody UpdateSpecialServiceInVO updateSpecialServiceInVO) {
specialServiceService.updateSpecialService(updateSpecialServiceInVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success();
}
@ApiOperation(value = "删除特勤", notes = "删除特勤", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/deleteSpecialService",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject deleteSpecialService(@RequestBody DeleteSpecialServiceInVO deleteSpecialServiceInVO) {
Integer id = deleteSpecialServiceInVO.getId();
specialServiceService.deleteSpecialService(id);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success();
}
@ApiOperation(value = "添加路口", notes = "添加路口", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/addCross",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject addCross(@RequestBody AddCrossInVO addCrossInVO) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
specialServiceService.addCross(addCrossInVO);
return jsonViewObject.success();
} catch (CrossRelationException e) {
return jsonViewObject.fail("路段关系不正确");
}
}
@ApiOperation(value = "路口列表", notes = "路口列表", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/crossList",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossListOutVO.class),
})
public JsonViewObject crossList(@RequestBody CrossListInVO crossListInVO) {
Integer specialServiceId = crossListInVO.getSpecialServiceId();
List<CrossListOutVO> crossListOutVOList = specialServiceService.crossList(specialServiceId);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(crossListOutVOList);
}
@ApiOperation(value = "更新路口", notes = "更新路口", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/updateCross",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject updateCross(@RequestBody UpdateCrossInVO updateCrossInVO) {
specialServiceService.updateCross(updateCrossInVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success();
}
@ApiOperation(value = "删除路口", notes = "删除路口", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/deleteCross",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject deleteCross(@RequestBody DeleteCrossInVO deleteCrossInVO) {
specialServiceService.deleteCross(deleteCrossInVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success();
}
@ApiOperation(value = "一键特勤", notes = "一键特勤", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/enableSpecialService",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject enableSpecialService(@RequestBody EnableDisableSpecialServiceInVO enableDisableSpecialServiceInVO) {
specialServiceService.enableSpecialService(enableDisableSpecialServiceInVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success();
}
@ApiOperation(value = "一键取消特勤", notes = "一键取消特勤", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/disableSpecialService",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject disableSpecialService(@RequestBody EnableDisableSpecialServiceInVO enableDisableSpecialServiceInVO) {
specialServiceService.disableSpecialService(enableDisableSpecialServiceInVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success();
}
@ApiOperation(value = "路口进口列表", notes = "路口进口列表", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/crossInList",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public JsonViewObject crossInList(@RequestBody CrossIdVO crossIdVO) {
String crossId = crossIdVO.getCrossId();
Set<String> crossInList = specialServiceService.crossInList(crossId);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(crossInList);
}
}
package net.wanji.web.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import net.wanji.web.po.AllDeviceStatusPO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/10/27 14:25
*/
@Repository
@DS("webService")
public interface AllDeviceStatusMapper {
List<AllDeviceStatusPO> selectAllDeviceStatus(String adCode);
}
package net.wanji.web.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import net.wanji.web.po.ControlHistPO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/10/27 14:25
*/
@Repository
@DS("webService")
public interface ControlHistMapper {
List<ControlHistPO> selectByCrossId(@Param("crossId") String crossId, @Param("todayDate") Date todayDate);
}
package net.wanji.web.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import net.wanji.web.po.CrossAlarmPO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/10/27 9:58
*/
@Repository
@DS("webService")
public interface CrossAlarmMapper {
List<CrossAlarmPO> selectStatusNotZero();
}
package net.wanji.web.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import net.wanji.web.po.CrossDirTurnPO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/9 8:55
*/
@Repository
@DS("webService")
public interface CrossDirTurnMapper {
CrossDirTurnPO selectOneByInAndOutIds(@Param("startCrossInDirId") String startCrossInDirId,
@Param("startCrossOutDirId") String startCrossOutDirId);
List<String> crossInList(@Param("crossId") String crossId);
}
package net.wanji.web.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import net.wanji.web.po.CrossInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* @Description: [路口信息持久层实现]</p>
* @author hfx
* @version 1.0
* Created on 2019年05月06日
*/
@Repository
@DS("webService")
public interface CrossInfoMapper {
/**
* @description: 根据路口id删除基础信息
* @param crossId 路口id
* @return
* @author hfx
* @date 2020/3/19 16:10
*/
void deleteByCrossId(@Param("crossId") String crossId);
/**
* @description: 根据条件获取路口基础信息列表
* @param crossName 路口名称
* @return
* @author hfx
* @date 2020/3/19 16:10
*/
void listCrossInfo(@Param("crossName") String crossName);
CrossInfo selectById(String crossId);
}
\ No newline at end of file
package net.wanji.web.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* @author Kent HAN
* @date 2022/11/9 13:26
*/
@Repository
@DS("webService")
public interface CrossPhasePlanMapper {
String selectPhaseId(@Param("dirStr") String dirStr,
@Param("turnCode") String turnCode);
}
package net.wanji.web.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import net.wanji.web.po.EventAlarmPO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/10/27 14:25
*/
@Repository
@DS("webService")
public interface EventAlarmMapper {
List<EventAlarmPO> selectByTodayTime(@Param("todayTime") Date todayTime);
}
package net.wanji.web.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import net.wanji.web.po.FlowQueuePO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/3 16:53
*/
@Repository
@DS("webService")
public interface FlowQueueMapper {
List<FlowQueuePO> getDayFlowToday(@Param("adCode") String adCode,
@Param("crossId") String crossId,
@Param("currentTime") Date currentTime);
List<FlowQueuePO> getDayFlowYesterday(@Param("adCode") String adCode,
@Param("crossId") String crossId,
@Param("currentTime") Date currentTime);
List<FlowQueuePO> getDayFlowLastWeekDay(@Param("adCode") String adCode,
@Param("crossId") String crossId,
@Param("currentTime") Date currentTime);
List<FlowQueuePO> getDayQueueToday(@Param("adCode") String adCode,
@Param("crossId") String crossId,
@Param("currentTime") Date currentTime);
List<FlowQueuePO> getDayQueueYesterday(@Param("adCode") String adCode,
@Param("crossId") String crossId,
@Param("currentTime") Date currentTime);
List<FlowQueuePO> getDayQueueLastWeekDay(@Param("adCode") String adCode,
@Param("crossId") String crossId,
@Param("currentTime") Date currentTime);
}
package net.wanji.web.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import net.wanji.web.po.GreenwaveCrossPO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/10/31 11:03
*/
@Repository
@DS("webService")
public interface GreenwaveCrossMapper {
List<GreenwaveCrossPO> selectByGreenwaveId(@Param("adCode") String adCode,
@Param("currentTime") String currentTime,
@Param("id") Integer id);
}
package net.wanji.web.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import net.wanji.web.po.GreenwaveRealtimePO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/10/27 14:25
*/
@Repository
@DS("webService")
public interface GreenwaveRealtimeMapper {
List<GreenwaveRealtimePO> selectByAdCodeAndCurrentTime(@Param("adCode") String adCode,
@Param("todayDate") Date todayDate);
}
package net.wanji.web.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import net.wanji.web.po.BaseAreaDataPO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/10/26 16:28
*/
@Repository
@DS("webService")
public interface OptRecordsMapper {
List<BaseAreaDataPO> selectByAdCodeAndTime(@Param("adCode") String adCode, @Param("adaptTime") Date adaptTime);
}
package net.wanji.web.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import net.wanji.web.po.RidInfoPO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* @author Kent HAN
* @date 2022/11/8 16:22
*/
@Repository
@DS("webService")
public interface RidInfoMapper {
Double selectRoadLength(@Param("startCrossid") String startCrossid,
@Param("endCrossid") String endCrossid);
String selectStartCrossOutDir(@Param("startCrossid") String startCrossid,
@Param("endCrossid") String endCrossid);
String selectWkt(@Param("startCrossid") String startCrossid,
@Param("endCrossid") String endCrossid);
RidInfoPO selectOne(@Param("startCrossid") String startCrossid,
@Param("endCrossid") String endCrossid);
}
package net.wanji.web.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import net.wanji.web.po.SpecialServiceCrossPO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/8 14:48
*/
@Repository
@DS("webService")
public interface SpecialServiceCrossMapper {
void insertOne(SpecialServiceCrossPO specialServiceCrossPO);
Integer getMaxSort(@Param("specialServiceId") Integer specialServiceId);
String selectCrossIdBySort(@Param("specialServiceId") Integer specialServiceId,
@Param("preSort") Integer preSort);
List<SpecialServiceCrossPO> selectBySpecialServiceId(@Param("specialServiceId") Integer specialServiceId);
Integer selectStartCrossInDir(@Param("specialServiceId") Integer specialServiceId,
@Param("startCrossid") String startCrossid);
void updateTurn(@Param("specialServiceId") Integer specialServiceId,
@Param("startCrossid") String startCrossid,
@Param("turntype") String turntype);
void updatDir(@Param("specialServiceId") Integer specialServiceId,
@Param("crossId") String crossId,
@Param("dir") Integer dir);
void deleteCross(@Param("specialServiceId") Integer specialServiceId,
@Param("crossId") String crossId);
void updateStatusSuccess(@Param("specialServiceId") Integer specialServiceId,
@Param("crossId") String crossId);
void updateStatusFail(@Param("specialServiceId") Integer specialServiceId,
@Param("crossId") String crossId);
void updateDir(@Param("specialServiceId") Integer specialServiceId,
@Param("endCrossid")String endCrossid,
@Param("endDirInt")Integer endDirInt);
void deleteCrossBySpecialServiceId(@Param("id") Integer id);
}
package net.wanji.web.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import net.wanji.web.po.SpecialServicePO;
import net.wanji.web.vo.specialService.UpdateSpecialServiceInVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/8 11:14
*/
@Repository
@DS("webService")
public interface SpecialServiceMapper {
void insertOne(SpecialServicePO specialServicePO);
List<SpecialServicePO> selectByAdCode(@Param("adCode") String adCode);
void updateSpecialService(UpdateSpecialServiceInVO updateSpecialServiceInVO);
void deleteSpecialService(@Param("id") Integer id);
void updateLength(@Param("specialServiceId") Integer specialServiceId,
@Param("roadLength") Double roadLength);
Double selectRoadLength(@Param("specialServiceId") Integer specialServiceId);
void updateStatusEnable(@Param("specialServiceId") Integer specialServiceId);
void updateStatusDisable(@Param("specialServiceId") Integer specialServiceId);
}
package net.wanji.web.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import net.wanji.web.po.VehicleTracePO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/10/28 15:16
*/
@Repository
@DS("webService")
public interface VehicleTraceMapper {
List<VehicleTracePO> selectByAdCode(@Param("adCode") String adCode, @Param("todayDate") Date todayDate);
}
package net.wanji.web.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import net.wanji.web.po.VideoDeviceInfoPO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/10/28 15:16
*/
@Repository
@DS("webService")
public interface VideoDeviceInfoMapper {
List<VideoDeviceInfoPO> selectVideoDevices(@Param("adCode") String adCode);
}
package net.wanji.web.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/10/27 14:16
*/
@Data
public class AllDeviceStatusPO {
/**
* 设备类型:1信号;2卡口;3地磁;4视频;5微波;6激光;7电警;8 MEC
*/
@ApiModelProperty(name = "设备类型:1信号;2卡口;3地磁;4视频;5微波;6激光;7电警;8 MEC", notes = "")
private Integer type;
/**
* 状态:0离线;1在线;2故障
*/
@ApiModelProperty(name = "状态:0离线;1在线;2故障", notes = "")
private Integer status;
/**
* 状态计数
*/
@ApiModelProperty(name = "状态计数", notes = "")
private Integer statusCount;
}
package net.wanji.web.po;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Id;
import java.util.Date;
/**
* @author Kent HAN
* @date 2022/10/26 15:35
*/
@Data
@ApiModel(value = "BaseAreaDataPO", description = "区域信息分钟表实体类")
public class BaseAreaDataPO {
/** 主键 */
@Id
@ApiModelProperty(value = "主键")
Integer id;
/** 区域编号 */
@ApiModelProperty(value = "区域编号")
String adCode ;
/** 统计时间:yyyy-MM-dd;HH:mm:ss */
@ApiModelProperty(value = "统计时间")
Date adaptTime ;
/** 交通指数 */
@ApiModelProperty(value = "交通指数")
private Double trafficIndex ;
/** 平均速度 */
@ApiModelProperty(value = "平均速度")
private Double speed ;
/** 优化次数 */
@ApiModelProperty(value = "优化次数")
private Double optNum ;
/** 创建时间 */
@ApiModelProperty(value = "创建时间")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(value = "修改时间")
private Date gmtModified ;
}
package net.wanji.web.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/10/27 14:16
*/
@Data
public class ControlHistPO {
/**
* 时间
*/
@ApiModelProperty(name = "时间", notes = "")
private String controlTime;
/**
* 控制类型:1时间表;2全红;3黄闪;4锁定;5中心优化;6MEC优化;7现场手动
*/
@ApiModelProperty(name = "控制类型:1时间表;2全红;3黄闪;4锁定;5中心优化;6MEC优化;7现场手动", notes = "")
private Integer controlType;
/**
* 控制状态计数
*/
@ApiModelProperty(name = "控制状态计数", notes = "")
private Integer typeCount;
}
package net.wanji.web.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Id;
import java.util.Date;
/**
* @author Kent HAN
* @date 2022/10/27 9:49
*/
@Data
public class CrossAlarmPO {
/** 路口编号 */
@Id
@ApiModelProperty(value = "路口编号")
private String crossId ;
/** 路口状态0;正常 1 失衡 2 拥堵 3 溢出 4 死锁 */
@ApiModelProperty(name = "路口状态",notes = "0正常 1 失衡 2 拥堵 3 溢出 4 死锁")
private String status ;
/** 交通指数(1~10) */
@ApiModelProperty(name = "交通指数(1~10)",notes = "")
private Double trafficIndex;
/** 开始时间:yyyy-MM-dd;HH;mm:ss */
@ApiModelProperty(name = "开始时间:yyyy-MM-dd HH:mm:ss")
private Date startTime ;
/** 结束时间:yyyy-MM-dd;HH;mm:ss */
@ApiModelProperty(name = "结束时间:yyyy-MM-dd HH:mm:ss")
private Date endTime ;
/** 持续时间(单位:分钟) */
@ApiModelProperty(name = "持续时间(单位:分钟)",notes = "")
private Integer duration ;
/** 是否失衡:0;否 1 是 */
@ApiModelProperty(name = "是否失衡",notes = "0否 1 是")
private Integer isUnbalance ;
/** 是否溢出:0;否 1 是 */
@ApiModelProperty(name = "是否溢出",notes = "0否 1 是")
private Integer isSpillover ;
/** 是否拥堵:0;否 1 是 */
@ApiModelProperty(name = "是否拥堵",notes = "0否 1 是")
private Integer isCongestion ;
/** 失衡指数 */
@ApiModelProperty(name = "失衡指数",notes = "")
private Double unbalanceIndex ;
/** 溢出指数 */
@ApiModelProperty(name = "溢出指数",notes = "")
private Double spilloverIndex ;
/** 拥堵指数 */
@ApiModelProperty(name = "拥堵指数",notes = "")
private Double congestionIndex ;
/** 失衡时间(单位:分钟) */
@ApiModelProperty(name = "失衡时间(单位:分钟)",notes = "")
private Integer unbalanceTime ;
/** 溢出时间(单位:分钟) */
@ApiModelProperty(name = "溢出时间(单位:分钟)",notes = "")
private Integer spilloverTime ;
/** 拥堵时间(单位:分钟) */
@ApiModelProperty(name = "拥堵时间(单位:分钟)",notes = "")
private Integer congestionTime ;
/** 路口失衡方向:1;2,3... */
@ApiModelProperty(name = "路口失衡方向:1,2,3...")
private String unbalanceDirs ;
/** 路口溢出方向:1;2,3... */
@ApiModelProperty(name = "路口溢出方向:1,2,3...")
private String spilloverDirs ;
/** 路口拥堵方向:1;2,3... */
@ApiModelProperty(name = "路口拥堵方向:1,2,3...")
private String congestionDirs ;
/** 创建时间:yyyy-MM-dd;HH;mm:ss */
@ApiModelProperty(name = "创建时间:yyyy-MM-dd HH:mm:ss")
private Date gmtCreate ;
/** 修改时间:yyyy-MM-dd;HH;mm:ss */
@ApiModelProperty(name = "修改时间:yyyy-MM-dd",notes = "HH;mm:ss")
private Date gmtModified ;
}
package net.wanji.web.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author Kent HAN
* @date 2022/11/9 8:52
*/
@Data
public class CrossDirTurnPO {
/** 开始路口方向编号 */
@ApiModelProperty(name = "开始路口方向编号",notes = "")
private String scrossdirid ;
/** 结束路口方向编号 */
@ApiModelProperty(name = "结束路口方向编号",notes = "")
private String ecrossdirid ;
/** 转向类型:l;左转 s直行 r右转 u掉头 */
@ApiModelProperty(name = "转向类型:l",notes = "左转 s直行 r右转 u掉头")
private String turntype ;
/** 转向名称 */
@ApiModelProperty(name = "转向名称",notes = "")
private String name ;
/** 路口编号 */
@ApiModelProperty(name = "路口编号",notes = "")
private String crossid ;
/** 开始路段编号 */
@ApiModelProperty(name = "开始路段编号",notes = "")
private String sroadsegid ;
/** 结束路段编号 */
@ApiModelProperty(name = "结束路段编号",notes = "")
private String eroadsegid ;
/** 信号机方向编号 */
@ApiModelProperty(name = "信号机方向编号",notes = "")
private String sianaldirid ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
private Date gmtCreate ;
}
package net.wanji.web.po;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @version 1.0
* @Description: [路口信息实体类]</ p>
*/
@Data
@ApiModel(value = "路口信息", description = "")
public class CrossInfo {
/**
* 路口编号11位
*/
@ApiModelProperty(name = "路口编号11位", notes = "")
private String id;
/**
* 路口编码;默认是路口编号
*/
@ApiModelProperty(name = "路口编码", notes = "默认是路口编号")
private String code;
/**
* 路口名称
*/
@ApiModelProperty(name = "路口名称", notes = "")
private String name;
/**
* 路口类型:1丁字口;;2十字口;3环岛;4畸形口;5立体交叉口;6铁路道口;7其他
*/
@ApiModelProperty(name = "路口类型:1丁字口;", notes = "2十字口;3环岛;4畸形口;5立体交叉口;6铁路道口;7其他")
private String type;
/**
* 路口级别:
* 1;高-高交叉口
* 10 高-支交叉口
* 11 高-小路交叉口
* 12 国-国交叉口
* 13 国-快交叉口
* 14 国-主交叉口
* 15 国-次交叉口
* 16 国-省交叉口
* 17 国-县交叉口
* 18 国-乡交叉口
* 19 国-其它交叉口
* 2 高-国交叉口
* 20 国-支交叉口
* 21 国-小路交叉口
* 22 快-快交叉口
* 23 快-主交叉口
* 24 快-次交叉口
* 25 快-省交叉口
* 26 快-县交叉口
* 27 快-乡交叉口
* 28 快-其它交叉口
* 29 快-支交叉口
* 3 高-快交叉口
* 30 快-小路交叉口
* 31 主-主交叉口
* 32 主-次交叉口
* 33 主-省交叉口
* 34 主-县交叉口
* 35 主-乡交叉口
* 36 主-其它交叉口
* 37 主-支交叉口
* 38 主-小路交叉口
* 39 次-次交叉口
* 4 高-主交叉口
* 40 次-省交叉口
* 41 次-县交叉口
* 42 次-乡交叉口
* 43 次-其它交叉口
* 44 次-支交叉口
* 45 次-小路交叉口
* 46 省-省交叉口
* 47 省-县交叉口
* 48 省-乡交叉口
* 49 省-其它交叉口
* 5 高-次交叉口
* 50 省-支交叉口
* 51 省-小路交叉口
* 52 县-县交叉口
* 53 县-乡交叉口
* 54 县-其它交叉口
* 55 县-支交叉口
* 56 县-小路交叉口
* 57 乡-乡交叉口
* 58 乡-其它交叉口
* 59 乡-支交叉口
* 6 高-省交叉口
* 60 乡-小路交叉口
* 61 其它-其它交叉口
* 62 其它-支交叉口
* 63 其它-小路交叉口
* 64 支-支交叉口
* 65 支-小路交叉口
* 7 高-县交叉口
* 8 高-乡交叉口
* 9 高-其它交叉口
*/
@ApiModelProperty(name = "路口级别", notes = "")
private Integer level;
/**
* 行政区划代码
*/
@ApiModelProperty(name = "行政区划代码", notes = "")
private String adcode;
/**
* 行政区划名称
*/
@ApiModelProperty(name = "行政区划名称", notes = "")
private String adname;
/**
* 位置信息POINT(经度;维度)
*/
@ApiModelProperty(name = "位置信息POINT(经度", notes = "维度)")
private String location;
/**
* 控制类型:0中心控制;1:单点自适应;2:;感应控制;
*/
@ApiModelProperty(name = "控制类型:0中心控制;1:单点自适应;2:", notes = "感应控制;")
private Integer controlType;
/**
* 是否启动优化:0;否;1 是
*/
@ApiModelProperty(name = "是否启动优化:0", notes = "否;1 是")
private Integer isControl;
/**
* 是否下发:0否;1是
*/
@ApiModelProperty(name = "是否下发:0否;1是", notes = "")
private Integer isStart;
/**
* 是否是信号路口;0否;1是
*/
@ApiModelProperty(name = "是否是信号路口", notes = "0否;1是")
private Integer isSignlight;
/**
* 信号机编号
*/
@ApiModelProperty(name = "信号机编号", notes = "")
private String signalId;
/**
* 信号机类型:1青松;2SCATS;3海信;4海康;5京安;6同安;7励安;8东土;9莱斯
*/
@ApiModelProperty(name = "信号机类型:1青松;2SCATS;3海信;4海康;5京安;6同安;7励安;8东土;9莱斯", notes = "")
private String signalType;
/**
* 信号机路口类型:十字路口、丄字路口、丅字路口等
*/
@ApiModelProperty(name = "信号机路口类型:十字路口、丄字路口、丅字路口等", notes = "")
private Integer signalCrossType;
/**
* 行人二次过街多个逗号隔开
*/
@ApiModelProperty(name = "行人二次过街多个逗号隔开", notes = "")
private String signalSidewalk;
/**
* 路网路口ID
*/
@ApiModelProperty(name = "路网路口ID", notes = "")
private String ridcrossId;
/**
* 实体类型:1、标准路口;3、行人过街路口;4、掉头路口;5、虚拟路口;6、末端路口(真);8、末端路口(假);99、其他
*/
@ApiModelProperty(name = "实体类型:1、标准路口;3、行人过街路口;4、掉头路口;5、虚拟路口;6、末端路口(真);8、末端路口(假);99、其他", notes = "")
private Integer ridcrossType;
/**
* 创建时间
*/
@ApiModelProperty(name = "创建时间", notes = "")
private Date gmtCreate;
/**
* 更新时间
*/
@ApiModelProperty(name = "更新时间", notes = "")
private Date gmtModified;
/**
* 信号机品牌
*/
@ApiModelProperty(name = "信号机品牌", notes = "")
private String signalBrand;
/**
* 路口别名
*/
@ApiModelProperty(name = "路口别名", notes = "")
private String crossName;
}
package net.wanji.web.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Id;
import java.util.Date;
/**
* @author Kent HAN
* @date 2022/10/27 14:16
*/
@Data
public class EventAlarmPO {
/** 主键 */
@Id
@ApiModelProperty(name = "主键",notes = "")
private Integer id;
/** 事件ID */
@ApiModelProperty(name = "事件ID",notes = "")
private String eventId;
/** 事件描述 */
@ApiModelProperty(name = "事件描述",notes = "")
private String eventDesc;
/** 事件类型:1事故;2拥堵;3管制;4施工 */
@ApiModelProperty(name = "事件类型:1事故;2拥堵;3管制;4施工",notes = "")
private Integer type;
/** 开始时间 */
@ApiModelProperty(name = "开始时间",notes = "")
private Date startTime;
/** 结束时间 */
@ApiModelProperty(name = "结束时间",notes = "")
private Date endTime;
/** 事件来源:1接处警;2交管部门;3互联网 */
@ApiModelProperty(name = "事件来源:1接处警;2交管部门;3互联网",notes = "")
private Integer source;
/** 事件坐标:精度;维度;精度,维度... */
@ApiModelProperty(name = "事件坐标:精度",notes = "维度;精度,维度...")
private String wkt;
/** 图片链接 */
@ApiModelProperty(name = "图片链接",notes = "")
private String imageUrl;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
private Date gmtCreate;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
private Date gmtModified;
}
package net.wanji.web.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/3 16:52
*/
@Data
public class FlowQueuePO {
@ApiModelProperty(name = "时间",notes = "")
private String time;
@ApiModelProperty(name = "数量",notes = "")
private Double count;
}
package net.wanji.web.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/10/31 11:04
*/
@Data
public class GreenwaveCrossPO {
@ApiModelProperty(name = "路口名称",notes = "")
private String name;
@ApiModelProperty(name = "位置信息POINT(经度,维度)",notes = "")
private String location;
}
package net.wanji.web.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Id;
import java.util.Date;
/**
* @author Kent HAN
* @date 2022/10/27 14:16
*/
@Data
public class GreenwaveRealtimePO {
/** 绿波编号 */
@Id
@ApiModelProperty(name = "绿波编号",notes = "")
private Integer greenwaveId ;
/** 绿波名称 */
@ApiModelProperty(name = "绿波名称",notes = "")
private String greenwaveName ;
/** 绿波带宽 */
@ApiModelProperty(name = "绿波带宽",notes = "")
private Integer greenwaveWidth ;
/** 交通状态1;畅通 2 拥挤 3 拥堵 4 严重拥堵 5 未知 */
@ApiModelProperty(name = "交通状态1",notes = "畅通 2 拥挤 3 拥堵 4 严重拥堵 5 未知")
private Integer status ;
/** 交通指数 */
@ApiModelProperty(name = "交通指数",notes = "")
private Double trafficIndex ;
/** 行程速度(km/h) */
@ApiModelProperty(name = "行程速度(km/h)",notes = "")
private Double speed ;
/** 行程时间(秒) */
@ApiModelProperty(name = "行程时间(秒)",notes = "")
private Integer trvalTime ;
/** 停车次数 */
@ApiModelProperty(name = "停车次数",notes = "")
private Double stopNumber ;
/** 拥堵距离(米) */
@ApiModelProperty(name = "拥堵距离(米)",notes = "")
private Double congestionLength ;
/** 拥堵比例 */
@ApiModelProperty(name = "拥堵比例",notes = "")
private Double congRate ;
/** 延误时间(秒) */
@ApiModelProperty(name = "延误时间(秒)",notes = "")
private Integer delayTime ;
/** 坐标 */
@ApiModelProperty(name = "坐标",notes = "")
private String wkt ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
private Date gmtModified ;
}
package net.wanji.web.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Id;
import java.util.Date;
/**
* @author Kent HAN
* @date 2022/11/10 8:40
*/
@Data
public class RidInfoPO {
/** 路段编号(开始路口编号+结束路口编号+顺序号0) */
@Id
@ApiModelProperty(name = "路段编号(开始路口编号+结束路口编号+顺序号0)",notes = "")
private String rid ;
/** 路段名称 */
@ApiModelProperty(name = "路段名称",notes = "")
private String name ;
/** 道路编号 */
@ApiModelProperty(name = "道路编号",notes = "")
private String roadId ;
/** 道路名称 */
@ApiModelProperty(name = "道路名称",notes = "")
private String roadName ;
/** 道路方向编号 */
@ApiModelProperty(name = "道路方向编号",notes = "")
private String roaddirid ;
/** 开始路口编号 */
@ApiModelProperty(name = "开始路口编号",notes = "")
private String startCrossid ;
/** 结束路口编号 */
@ApiModelProperty(name = "结束路口编号",notes = "")
private String endCrossid ;
/** 开始路口方向编号 */
@ApiModelProperty(name = "开始路口方向编号",notes = "")
private String startCrossdirid ;
/** 结束路口方向编号 */
@ApiModelProperty(name = "结束路口方向编号",notes = "")
private String endCrossdirid ;
/** 出口绝对角度;正北方向顺时针计算角度0~359 */
@ApiModelProperty(name = "出口绝对角度",notes = "正北方向顺时针计算角度0~359")
private Double startAngle ;
/** 入口绝对角度;正北方向顺时针计算角度0~359 */
@ApiModelProperty(name = "入口绝对角度",notes = "正北方向顺时针计算角度0~359")
private Double endAngle ;
/** 出口方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北 */
@ApiModelProperty(name = "出口方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北",notes = "")
private String startDir ;
/** 入口方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北 */
@ApiModelProperty(name = "入口方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北",notes = "")
private String endDir ;
/** 顺序号 */
@ApiModelProperty(name = "顺序号",notes = "")
private Integer orderid ;
/** 行驶方向:0上行;1下行 */
@ApiModelProperty(name = "行驶方向:0上行;1下行",notes = "")
private String direction ;
/** 路段走向:1;南向北;2 西向东;3 北向南;4 东向西;5 内环;6 外环;99 其他(参见路段走向字典) */
@ApiModelProperty(name = "路段走向:1",notes = "南向北;2 西向东;3 北向南;4 东向西;5 内环;6 外环;99 其他(参见路段走向字典)")
private Integer trend ;
/** 道路等级:
41000;高速公路
42000 国道
43000 城市快速路
44000 城市主干道
45000 城市次干道
47000 城市普通道路
51000 省道
52000 县道
53000 乡道
54000 县乡村内部道路
49 小路(参见道路等级字典) */
@ApiModelProperty(name = "道路等级: 41000 高速公路 42000 国道 43000 城市快速路 44000 城市主干道 45000 城市次干道 " +
"47000 城市普通道路 51000 省道 52000 县道 53000 乡道 54000 县乡村内部道路 49 小路(参见道路等级字典)",notes = "")
private Integer roadClass ;
/** 行政区划代码;跨区数据会以逗号分开 */
@ApiModelProperty(name = "行政区划代码",notes = "跨区数据会以逗号分开")
private String adcode ;
/** 路段长度(米) */
@ApiModelProperty(name = "路段长度(米)",notes = "")
private Double length ;
/** 路段宽度(米) */
@ApiModelProperty(name = "路段宽度(米)",notes = "")
private Double width ;
/** 开始位置描述 */
@ApiModelProperty(name = "开始位置描述",notes = "")
private String startLocationDesc ;
/** 结束位置描述 */
@ApiModelProperty(name = "结束位置描述",notes = "")
private String endLocationDesc ;
/** 是否单行线:0;否 1 是 99 其他 */
@ApiModelProperty(name = "是否单行线:0",notes = "否 1 是 99 其他")
private Integer isOneway ;
/** 路段类型:1路段;3匝道;4隧道;5桥梁;6高架;99其他 */
@ApiModelProperty(name = "路段类型:1路段;3匝道;4隧道;5桥梁;6高架;99其他",notes = "")
private Integer roadsegType ;
/** 路段主辅标志:1;主路;2 辅路;99 其他 (参见主辅标志字典) */
@ApiModelProperty(name = "路段主辅标志:1",notes = "主路;2 辅路;99 其他 (参见主辅标志字典)")
private Integer mainFlag ;
/** 数据版本:18q4_201911151904 */
@ApiModelProperty(name = "数据版本:18q4_201911151904",notes = "")
private String dataVersion ;
/** 继承版本:18q4_201911151904 */
@ApiModelProperty(name = "继承版本:18q4_201911151904",notes = "")
private String preDataVersion ;
/** 数据状态:0继承;1删除,2增加,3修改 */
@ApiModelProperty(name = "数据状态:0继承",notes = "1删除,2增加,3修改")
private String dataMode ;
/** 继承关系;记录上一版本数据ID */
@ApiModelProperty(name = "继承关系",notes = "记录上一版本数据ID")
private String relation ;
/** RID;空间对象 */
@ApiModelProperty(name = "RID",notes = "空间对象")
private String geom ;
/** RID;空间对象 */
@ApiModelProperty(name = "RID",notes = "空间对象")
private String wkt ;
/** 信控路段编号 */
@ApiModelProperty(name = "信控路段编号",notes = "")
private String ctRid ;
/** 信控路段名称 */
@ApiModelProperty(name = "信控路段名称",notes = "")
private String ctName ;
/** 信控路段RID顺序号 */
@ApiModelProperty(name = "信控路段RID顺序号",notes = "")
private Integer ctSeq ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
private Date gmtModified ;
}
package net.wanji.web.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Id;
import java.util.Date;
/**
* @author Kent HAN
* @date 2022/11/8 14:35
*/
@Data
public class SpecialServiceCrossPO {
/** 主键 */
@Id
@ApiModelProperty(name = "主键",notes = "")
private Integer id ;
/** 特勤ID */
@ApiModelProperty(name = "特勤ID",notes = "")
private Integer specialServiceId ;
/** 路口编号 */
@ApiModelProperty(name = "路口编号",notes = "")
private String crossId ;
/** 进口方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北 */
@ApiModelProperty(name = "进口方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北",notes = "")
private Integer dir = 1 ;
/** 转向:l左转;s直行;r右转;u掉头 */
@ApiModelProperty(name = "转向:l左转;s直行;r右转;u掉头",notes = "")
private String turn ;
/** 顺序号 */
@ApiModelProperty(name = "顺序号",notes = "")
private Integer sort ;
/** 执行状态:1成功;0失败 */
@ApiModelProperty(name = "执行状态:1成功;0失败",notes = "")
private Integer status = 0 ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
private Date gmtModified ;
}
package net.wanji.web.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.Id;
import java.util.Date;
/**
* @author Kent HAN
* @date 2022/11/8 11:09
*/
@Data
public class SpecialServicePO {
/** 特勤ID */
@Id
@ApiModelProperty(name = "特勤ID",notes = "")
private Integer id ;
/** 特勤名称 */
@ApiModelProperty(name = "特勤名称",notes = "")
private String name ;
/** 控制类型:1手动;2自动 */
@ApiModelProperty(name = "控制类型:1手动;2自动",notes = "")
private Integer controlModel = 1;
/** 特勤线路长度 */
@ApiModelProperty(name = "特勤线路长度",notes = "")
private Double length = 0.0 ;
/** 是否被删除:1是;0否 */
@ApiModelProperty(name = "是否被删除:1是;0否",notes = "")
private Integer isDel = 0 ;
/** 特勤状态:1执行;0未执行 */
@ApiModelProperty(name = "特勤状态:1执行;0未执行",notes = "")
private Integer status = 0 ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
private Date gmtModified ;
}
package net.wanji.web.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/10/27 14:16
*/
@Data
public class VehicleTracePO {
/**
* 时间
*/
@ApiModelProperty(name = "时间", notes = "")
private String traceTime;
/**
* 车辆数统计
*/
@ApiModelProperty(name = "车辆数统计", notes = "")
private Integer vehicleCount;
}
package net.wanji.web.po;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author Kent HAN
* @date 2022/10/27 14:16
*/
@Data
public class VideoDeviceInfoPO {
/** 设备ID */
@ApiModelProperty(name = "设备ID",notes = "")
private Integer id;
/** 设备编号 */
@ApiModelProperty(name = "设备编号",notes = "")
private String code;
/** 设备名称 */
@ApiModelProperty(name = "设备名称",notes = "")
private String name;
/** 设备类型:1信号;2卡口;3地磁;4视频;5微波;6雷达;7电警 */
@ApiModelProperty(name = "设备类型:1信号;2卡口;3地磁;4视频;5微波;6雷达;7电警",notes = "")
private Integer type;
/** 状态:0离线;1在线 */
@ApiModelProperty(name = "状态:0离线;1在线",notes = "")
private Integer status;
/** 安装位置(经纬度) */
@ApiModelProperty(name = "安装位置(经纬度)",notes = "")
private String location ;
/** 安装时间 */
@ApiModelProperty(name = "安装时间",notes = "")
private Date installTime ;
/** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "")
private Date gmtModified ;
}
package net.wanji.web.service;
import javax.servlet.http.HttpServletRequest;
/**
* @Description: [异常处理service类]
* @author hfx
* @version 1.0
* Created on 2019/4/17 12:02
*/
public interface ExceptionService {
/**
* @description: 异常处理
* @param exceptionMsg 异常描述
* @param e 异常对象
* @param request 请求对象
* @author hfx
* @date 2019/4/17 12:06
*/
void handle(String exceptionMsg, Exception e, HttpServletRequest request);
/**
* @description: 异常处理
* @param exceptionMsg 异常描述
* @param e 异常对象
* @author hfx
* @date 2019/4/17 12:06
*/
void handle(String exceptionMsg, Exception e);
}
package net.wanji.web.service;
import net.wanji.web.po.CrossInfo;
import net.wanji.web.vo.signalEvaluate.FlowQueueOutVO;
import java.util.Date;
/**
* @author Kent HAN
* @date 2022/11/3 16:14
*/
public interface SignalEvaluateService {
FlowQueueOutVO flowQueue(String adCode, String crossId, Date currentTime, Integer timeType, Integer dataType);
}
package net.wanji.web.service;
import net.wanji.web.po.CrossInfo;
import net.wanji.web.vo.situationDetection.*;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @author Kent HAN
* @date 2022/10/26 13:41
*/
public interface SituationDetectionService {
OptRecordsOutVO optRecords(String adCode, Date adaptTime);
List<CrossAlarmOutVO> crossAlarm();
List<EventAlarmOutVO> eventAlarm(Date todayTime) throws ParseException;
List<ControlHistOutVO> controlHist(String crossId, String currentTime) throws ParseException;
List<VehicleTraceOutVO> vehicleTrace(String adCode, String currentTime) throws ParseException;
List<VideoDeviceInfoOutVO> videoDeviceInfo(String adCode);
List<GreenwaveRealtimeOutVO> greenwaveRealtime(String adCode, String currentTime) throws ParseException;
Map<String, Map<String, Integer>> allDeviceStatus(String adCode);
List<GreenwaveCrossOutVO> greenwaveCross(String adCode, String currentTime, Integer id);
}
package net.wanji.web.service;
import net.wanji.web.vo.specialService.*;
import java.util.List;
import java.util.Set;
/**
* @author Kent HAN
* @date 2022/11/8 11:06
*/
public interface SpecialServiceService {
void addSpecialService(AddSpecialServiceInVO addSpecialServiceInVO);
List<ListSpecialServicesOutVO> listSpecialServices(String adCode);
void updateSpecialService(UpdateSpecialServiceInVO updateSpecialServiceInVO);
void deleteSpecialService(Integer id);
void addCross(AddCrossInVO addCrossInVO);
List<CrossListOutVO> crossList(Integer specialServiceId);
void updateCross(UpdateCrossInVO updateCrossInVO);
void deleteCross(DeleteCrossInVO deleteCrossInVO);
void enableSpecialService(EnableDisableSpecialServiceInVO enableDisableSpecialServiceInVO);
void disableSpecialService(EnableDisableSpecialServiceInVO enableDisableSpecialServiceInVO);
Set<String> crossInList(String crossId);
}
package net.wanji.web.service.impl;
import net.wanji.web.service.ExceptionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
/**
* @Description: [异常处理service实现]
* @author hfx
* @version 1.0
* Created on 2019/4/17 12:03
*/
@Slf4j
@Service
public class ExceptionServiceImpl implements ExceptionService {
// @Value("${service.name: }")
// private String serverName;
//
// @Value("${spring.profiles.active: }")
// private String profile;
private String HTTP_CONTENT_DEFAULT_CHARSET = "UTF-8";
private String errorTemplate = "系统:%s\r\n" +
"环境:%s\r\n" +
"URL:%s\r\n" +
"IP:%s\r\n" +
"操作时间:%s\r\n" +
"错误描述:%s\r\n" +
"浏览器信息:%s\r\n" +
"错误详情:%s";
/**
* @description: 异常处理
* @param exceptionMsg 异常描述
* @param e 异常对象
* @param request 请求对象
* @author hfx
* @date 2019/4/17 12:06
*/
@Override
public void handle(String exceptionMsg, Exception e, HttpServletRequest request) {
try {
} catch (Exception e1) {
log.error("记录输出异常日志失败", e1);
}
}
/**
* @description: 异常处理detail
* @param exceptionMsg 异常描述
* @param e 异常对象
* @author hfx
* @date 2019/4/17 12:06
*/
@Override
public void handle(String exceptionMsg, Exception e) {
handle(exceptionMsg, e, null);
}
/**
* @description: 控制台打印异常信息
* @param exceptionLog 异常信息对象
* @return void
* @author hfx
* @date 2019/4/17 12:35
*/
// private void consoleLog(ExceptionLog exceptionLog) {
// String errorText = String.format(errorTemplate,
// exceptionLog.getSystem(),
// profile,
// exceptionLog.getUri(),
// exceptionLog.getOperatorIp(),
// DateUtils.dateToString(exceptionLog.getCreateTime(), DateStyle.YYYY_MM_DD_HH_MM_SS),
// exceptionLog.getDescription()==null?"":exceptionLog.getDescription(),
// exceptionLog.getBrowerMessage(),
// exceptionLog.getDetail());
// LOGGER.error(errorText);
// LoggerLogcenterUtil.error(getClass(), new LogBeanBuilders().setAccessLog(errorText));
// }
}
package net.wanji.web.service.impl;
import net.wanji.web.common.util.date.TimeArrayUtil;
import net.wanji.web.mapper.FlowQueueMapper;
import net.wanji.web.po.FlowQueuePO;
import net.wanji.web.service.SignalEvaluateService;
import net.wanji.web.vo.signalEvaluate.FlowQueueOutVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/3 16:15
*/
@Service
public class SignalEvaluateServiceImpl implements SignalEvaluateService {
@Autowired
FlowQueueMapper flowQueueMapper;
@Override
public FlowQueueOutVO flowQueue(String adCode, String crossId, Date currentTime, Integer timeType, Integer dataType) {
FlowQueueOutVO flowQueueOutVO = new FlowQueueOutVO();
if (timeType == 1) { // 按日
if (dataType == 1) { // 流量
flowQueueOutVO = getDayFlow(adCode, crossId, currentTime);
} else if (dataType == 2) { // 排队
flowQueueOutVO = getDayQueue(adCode, crossId, currentTime);
}
} else if (timeType == 2) { // todo 按周
} else if (timeType == 3) { // todo 按月
}
return flowQueueOutVO;
}
private FlowQueueOutVO getDayQueue(String adCode, String crossId, Date currentTime) {
List<String> time = TimeArrayUtil.getTimeArray();
double[] toDay = new double[24];
double[] yesterday = new double[24];
double[] lastWeekDay = new double[24];
List<FlowQueuePO> dayQueueTodayPOList = flowQueueMapper.getDayQueueToday(adCode, crossId, currentTime);
fillArray(time, toDay, dayQueueTodayPOList);
List<FlowQueuePO> dayQueueYesterdayPOList = flowQueueMapper.getDayQueueYesterday(adCode, crossId, currentTime);
fillArray(time, yesterday, dayQueueYesterdayPOList);
List<FlowQueuePO> dayQueueLastWeekDayPOList = flowQueueMapper.getDayQueueLastWeekDay(adCode, crossId, currentTime);
fillArray(time, lastWeekDay, dayQueueLastWeekDayPOList);
FlowQueueOutVO flowQueueOutVO = new FlowQueueOutVO();
flowQueueOutVO.setTime(time);
flowQueueOutVO.setToDay(toDay);
flowQueueOutVO.setYesterday(yesterday);
flowQueueOutVO.setLastWeekDay(lastWeekDay);
return flowQueueOutVO;
}
private FlowQueueOutVO getDayFlow(String adCode, String crossId, Date currentTime) {
List<String> time = TimeArrayUtil.getTimeArray();
double[] toDay = new double[24];
double[] yesterday = new double[24];
double[] lastWeekDay = new double[24];
List<FlowQueuePO> dayFlowTodayPOList = flowQueueMapper.getDayFlowToday(adCode, crossId, currentTime);
fillArray(time, toDay, dayFlowTodayPOList);
List<FlowQueuePO> dayFlowYesterdayPOList = flowQueueMapper.getDayFlowYesterday(adCode, crossId, currentTime);
fillArray(time, yesterday, dayFlowYesterdayPOList);
List<FlowQueuePO> dayFlowLastWeekDayPOList = flowQueueMapper.getDayFlowLastWeekDay(adCode, crossId, currentTime);
fillArray(time, lastWeekDay, dayFlowLastWeekDayPOList);
FlowQueueOutVO flowQueueOutVO = new FlowQueueOutVO();
flowQueueOutVO.setTime(time);
flowQueueOutVO.setToDay(toDay);
flowQueueOutVO.setYesterday(yesterday);
flowQueueOutVO.setLastWeekDay(lastWeekDay);
return flowQueueOutVO;
}
private void fillArray(List<String> time, double[] arr, List<FlowQueuePO> list) {
changeTimeStr(list);
// 填入结果数组
for (FlowQueuePO flowQueuePO : list) {
int i = time.indexOf(flowQueuePO.getTime());
arr[i] = flowQueuePO.getCount();
}
}
private void changeTimeStr(List<FlowQueuePO> dayFlowTodayPOList) {
for (FlowQueuePO flowQueuePO : dayFlowTodayPOList) {
// 替换时间字符串
String controlTime = flowQueuePO.getTime();
if (':' == controlTime.charAt(1)) {
controlTime = "0" + controlTime;
}
flowQueuePO.setTime(controlTime);
}
}
}
package net.wanji.web.service.impl;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import net.wanji.web.common.enums.*;
import net.wanji.web.common.util.CrossUtil;
import net.wanji.web.po.*;
import net.wanji.web.mapper.*;
import net.wanji.web.service.SituationDetectionService;
import net.wanji.web.vo.situationDetection.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* 态势监测服务类
*
* @author Kent HAN
* @date 2022/10/26 13:48
*/
@Service
public class SituationDetectionServiceImpl implements SituationDetectionService {
@Autowired
OptRecordsMapper optRecordsMapper;
@Autowired
CrossAlarmMapper crossAlarmMapper;
@Autowired
EventAlarmMapper eventAlarmMapper;
@Autowired
ControlHistMapper controlHistMapper;
@Autowired
VehicleTraceMapper vehicleTraceMapper;
@Autowired
VideoDeviceInfoMapper videoDeviceInfoMapper;
@Autowired
GreenwaveRealtimeMapper greenwaveRealtimeMapper;
@Autowired
AllDeviceStatusMapper allDeviceStatusMapper;
@Autowired
GreenwaveCrossMapper greenwaveCrossMapper;
@Autowired
CrossInfoMapper crossInfoMapper;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@Override
public OptRecordsOutVO optRecords(String adCode, Date adaptTime) {
OptRecordsOutVO optRecordsOutVO = new OptRecordsOutVO();
List<OptRecordsOutVO.TrafficIndexVO> trafficIndexVOList = new ArrayList<>();
List<BaseAreaDataPO> baseAreaDataPOList = optRecordsMapper.selectByAdCodeAndTime(adCode, adaptTime);
double optNumSum = 0.0;
double speedSum = 0.0;
int speedCount = 0;
for (BaseAreaDataPO baseAreaDataPO : baseAreaDataPOList) {
// 加总优化次数
Double optNum = baseAreaDataPO.getOptNum();
optNumSum += optNum;
Double speed = baseAreaDataPO.getSpeed();
speedSum += speed;
speedCount += 1;
// 构造交通指数列表
OptRecordsOutVO.TrafficIndexVO trafficIndexVO = new OptRecordsOutVO.TrafficIndexVO();
Date adaptFullTime = baseAreaDataPO.getAdaptTime();
String adaptFullTimeStr = sdf.format(adaptFullTime);
// 返回小时分钟
String timeStr = adaptFullTimeStr.substring(11, 16);
trafficIndexVO.setTime(timeStr);
Double trafficIndex = baseAreaDataPO.getTrafficIndex();
trafficIndexVO.setIndex(trafficIndex);
trafficIndexVOList.add(trafficIndexVO);
}
// 计算平均速度
double averageSpeed = speedSum / speedCount;
optRecordsOutVO.setOptTimes((int) optNumSum);
optRecordsOutVO.setSpeed((int) averageSpeed);
optRecordsOutVO.setTrafficIndexVOList(trafficIndexVOList);
return optRecordsOutVO;
}
@Override
public List<CrossAlarmOutVO> crossAlarm() {
List<CrossAlarmPO> crossAlarmPOList = crossAlarmMapper.selectStatusNotZero();
List<CrossAlarmOutVO> crossAlarmOutVOList = new ArrayList<>();
for (CrossAlarmPO crossAlarmPO : crossAlarmPOList) {
// 获取状态
Integer isUnbalance = crossAlarmPO.getIsUnbalance();
Integer isSpillover = crossAlarmPO.getIsSpillover();
Integer isCongestion = crossAlarmPO.getIsCongestion();
if (isUnbalance == 1) {
String msg = CrossAlarmEnum.ONE.getMsg();
Integer minuteDuration = crossAlarmPO.getUnbalanceTime();
addCrossAlarmVO(crossAlarmOutVOList, crossAlarmPO, msg, minuteDuration);
}
if (isCongestion == 1) {
String msg = CrossAlarmEnum.TWO.getMsg();
Integer minuteDuration = crossAlarmPO.getCongestionTime();
addCrossAlarmVO(crossAlarmOutVOList, crossAlarmPO, msg, minuteDuration);
}
if (isSpillover == 1) {
String msg = CrossAlarmEnum.THREE.getMsg();
Integer minuteDuration = crossAlarmPO.getSpilloverTime();
addCrossAlarmVO(crossAlarmOutVOList, crossAlarmPO, msg, minuteDuration);
}
if ("4".equals(crossAlarmPO.getStatus())) {
String msg = CrossAlarmEnum.FOUR.getMsg();
Integer minuteDuration = crossAlarmPO.getDuration();
addCrossAlarmVO(crossAlarmOutVOList, crossAlarmPO, msg, minuteDuration);
}
}
CrossAlarmComparator crossAlarmComparator = new CrossAlarmComparator();
crossAlarmOutVOList.sort(crossAlarmComparator);
return crossAlarmOutVOList;
}
private void addCrossAlarmVO(List<CrossAlarmOutVO> crossAlarmOutVOList, CrossAlarmPO crossAlarmPO, String msg,
Integer minuteDuration) {
CrossAlarmOutVO crossAlarmOutVO = new CrossAlarmOutVO();
// 根据路口ID获取路口名称
String crossId = crossAlarmPO.getCrossId();
CrossInfo crossInfo = crossInfoMapper.selectById(crossId);
crossAlarmOutVO.setCrossName(crossInfo.getName());
// 从例如POINT(116.29959807 39.95929275)中获取经纬度
String location = crossInfo.getLocation();
double[] lonLat = CrossUtil.getLonLat(location);
crossAlarmOutVO.setLongitude(lonLat[0]);
crossAlarmOutVO.setLatitude(lonLat[1]);
crossAlarmOutVO.setCrossStatus(msg);
// 发生时间
Date date = DateUtil.date();
Date startTime = DateUtil.offset(date, DateField.MINUTE, -minuteDuration);
String timeStr = sdf.format(startTime);
String substring = timeStr.substring(11, 16); // 截取小时分钟
crossAlarmOutVO.setStartTime(substring);
crossAlarmOutVO.setDuration(minuteDuration);
crossAlarmOutVOList.add(crossAlarmOutVO);
}
@Override
public List<EventAlarmOutVO> eventAlarm(Date todayTime) throws ParseException {
List<EventAlarmPO> eventAlarmPOList = eventAlarmMapper.selectByTodayTime(todayTime);
List<EventAlarmOutVO> eventAlarmOutVOList = new ArrayList<>();
for (EventAlarmPO eventAlarmPO : eventAlarmPOList) {
EventAlarmOutVO eventAlarmOutVO = new EventAlarmOutVO();
eventAlarmOutVO.setEventDesc(eventAlarmPO.getEventDesc());
// 事件类型
Integer typeCode = eventAlarmPO.getType();
String msgByCode = EventAlarmEnum.getMsgByCode(typeCode);
eventAlarmOutVO.setType(msgByCode);
Date endTime = eventAlarmPO.getEndTime();
if (typeCode == 1 || typeCode == 2) {
// 发生时间
Date startTime = eventAlarmPO.getStartTime();
String startTimeStr = sdf.format(startTime);
String substring = startTimeStr.substring(11, 16);
eventAlarmOutVO.setStartTime(substring);
// 时长
if (endTime == null) {
Date nowTime = DateUtil.date();
// todo 时间为演示用,待删除
Date parse = sdf.parse("2022-10-27 09:56:23");
nowTime = parse;
long between = DateUtil.between(startTime, nowTime, DateUnit.MINUTE);
int betweenInt = (int) between;
eventAlarmOutVO.setDuration(betweenInt);
} else {
long between = DateUtil.between(startTime, endTime, DateUnit.MINUTE);
int betweenInt = (int) between;
eventAlarmOutVO.setDuration(betweenInt);
}
}
if (typeCode == 3 || typeCode == 4) {
// 时间范围
Date startTime = eventAlarmPO.getStartTime();
String startTimeStr = sdf.format(startTime);
String startTimeSubStr = startTimeStr.substring(0, 16); // 截取到分钟
String endTimeStr = sdf.format(endTime);
String endTimeSubStr = endTimeStr.substring(0, 16); // 截取到分钟
eventAlarmOutVO.setTimeSpan(startTimeSubStr + "~" + endTimeSubStr);
}
Integer sourceCode = eventAlarmPO.getSource();
String sourceStr = EventAlarmSourceEnum.getMsgByCode(sourceCode);
eventAlarmOutVO.setSource(sourceStr);
eventAlarmOutVO.setCoordinate(eventAlarmPO.getWkt());
eventAlarmOutVOList.add(eventAlarmOutVO);
}
return eventAlarmOutVOList;
}
@Override
public List<ControlHistOutVO> controlHist(String crossId, String currentTime) throws ParseException {
List<ControlHistOutVO> controlHistOutVOList = new ArrayList<>();
Date todayDate = sdf.parse(currentTime);
List<ControlHistPO> controlHistPOList = controlHistMapper.selectByCrossId(crossId, todayDate);
// 替换时间字符串
for (ControlHistPO controlHistPO : controlHistPOList) {
String controlTime = controlHistPO.getControlTime();
if (controlTime.endsWith(":0")) {
controlTime += "0";
}
if (':' == controlTime.charAt(1)) {
controlTime = "0" + controlTime;
}
controlHistPO.setControlTime(controlTime);
}
// 按时间聚合
String tmpTime = "";
Map<String, Integer> typeStat = new LinkedHashMap<>();
// 初始化Map
initTypeStat(typeStat);
for (int i = 0; i < controlHistPOList.size(); i++) {
ControlHistPO controlHistPO = controlHistPOList.get(i);
String controlTime = controlHistPO.getControlTime();
if (tmpTime.equals(controlTime)) {
// 构造Map
Integer controlType = controlHistPO.getControlType();
String typeStr = ControlHistEnum.getMsgByCode(controlType);
Integer typeCount = controlHistPO.getTypeCount();
typeStat.put(typeStr, typeCount);
} else if ("".equals(tmpTime)) {
initTypeStat(typeStat);
tmpTime = controlTime;
i--;
} else {
// 构造一条记录
Map<String, Integer> resTypeStat = new LinkedHashMap<>(typeStat);
addControlHist(controlHistOutVOList, tmpTime, resTypeStat);
initTypeStat(typeStat);
tmpTime = controlTime;
i--;
}
}
// 构造最后一条记录
addControlHist(controlHistOutVOList, tmpTime, typeStat);
controlHistOutVOList.sort(Comparator.comparing(
ControlHistOutVO::getTime, Comparator.nullsLast(Comparator.naturalOrder())));
return controlHistOutVOList;
}
private void initTypeStat(Map<String, Integer> typeStat) {
typeStat.clear();
for (ControlHistEnum value : ControlHistEnum.values()) {
typeStat.put(value.getMsg(), 0);
}
}
private void addControlHist(List<ControlHistOutVO> controlHistOutVOList,
String tmpTime, Map<String, Integer> typeStat) {
ControlHistOutVO controlHistOutVO = new ControlHistOutVO();
controlHistOutVO.setTime(tmpTime);
controlHistOutVO.setTypeStat(typeStat);
controlHistOutVOList.add(controlHistOutVO);
}
@Override
public List<VehicleTraceOutVO> vehicleTrace(String adCode, String currentTime) throws ParseException {
List<VehicleTraceOutVO> vehicleTraceOutVOList = new ArrayList<>();
Date todayDate = sdf.parse(currentTime);
List<VehicleTracePO> vehicleTracePOList = vehicleTraceMapper.selectByAdCode(adCode, todayDate);
// 替换时间字符串
for (VehicleTracePO vehicleTracePO : vehicleTracePOList) {
String traceTime = vehicleTracePO.getTraceTime();
if (traceTime.endsWith(":0")) {
traceTime += "0";
}
if (':' == traceTime.charAt(1)) {
traceTime = "0" + traceTime;
}
vehicleTracePO.setTraceTime(traceTime);
}
for (VehicleTracePO vehicleTracePO : vehicleTracePOList) {
VehicleTraceOutVO vehicleTraceOutVO = new VehicleTraceOutVO();
vehicleTraceOutVO.setTraceTime(vehicleTracePO.getTraceTime());
vehicleTraceOutVO.setVehicleCount(vehicleTracePO.getVehicleCount());
vehicleTraceOutVOList.add(vehicleTraceOutVO);
}
vehicleTraceOutVOList.sort(Comparator.comparing(
VehicleTraceOutVO::getTraceTime, Comparator.nullsLast(Comparator.naturalOrder())));
return vehicleTraceOutVOList;
}
@Override
public List<VideoDeviceInfoOutVO> videoDeviceInfo(String adCode) {
List<VideoDeviceInfoPO> videoDeviceInfoPOList = videoDeviceInfoMapper.selectVideoDevices(adCode);
List<VideoDeviceInfoOutVO> videoDeviceInfoOutVOList = new ArrayList<>();
for (VideoDeviceInfoPO videoDeviceInfoPO : videoDeviceInfoPOList) {
VideoDeviceInfoOutVO videoDeviceInfoOutVO = new VideoDeviceInfoOutVO();
videoDeviceInfoOutVO.setCode(videoDeviceInfoPO.getCode());
videoDeviceInfoOutVO.setName(videoDeviceInfoPO.getName());
Integer status = videoDeviceInfoPO.getStatus();
videoDeviceInfoOutVO.setStatus(DeviceStatusEnum.getMsgByCode(status));
videoDeviceInfoOutVO.setLocation(videoDeviceInfoPO.getLocation());
videoDeviceInfoOutVOList.add(videoDeviceInfoOutVO);
}
return videoDeviceInfoOutVOList;
}
@Override
public List<GreenwaveRealtimeOutVO> greenwaveRealtime(String adCode, String currentTime) throws ParseException {
Date todayDate = sdf.parse(currentTime);
List<GreenwaveRealtimePO> greenwaveRealtimePOList = greenwaveRealtimeMapper.selectByAdCodeAndCurrentTime(adCode, todayDate);
List<GreenwaveRealtimeOutVO> greenwaveRealtimeOutVOList = new ArrayList<>();
for (GreenwaveRealtimePO greenwaveRealtimePO : greenwaveRealtimePOList) {
GreenwaveRealtimeOutVO greenwaveRealtimeOutVO = new GreenwaveRealtimeOutVO();
greenwaveRealtimeOutVO.setId(greenwaveRealtimePO.getGreenwaveId());
BeanUtils.copyProperties(greenwaveRealtimePO, greenwaveRealtimeOutVO);
greenwaveRealtimeOutVOList.add(greenwaveRealtimeOutVO);
}
return greenwaveRealtimeOutVOList;
}
@Override
public Map<String, Map<String, Integer>> allDeviceStatus(String adCode) {
List<AllDeviceStatusPO> allDeviceStatusPOList = allDeviceStatusMapper.selectAllDeviceStatus(adCode);
Map<String, Map<String, Integer>> res = new LinkedHashMap<>();
// 初始化Map
for (DeviceTypeEnum value : DeviceTypeEnum.values()) {
res.put(value.getMsg(), null);
}
Map<Integer, List<AllDeviceStatusPO>> collect = allDeviceStatusPOList.stream()
.collect(Collectors.groupingBy(AllDeviceStatusPO::getType));
for (Map.Entry<Integer, List<AllDeviceStatusPO>> entry : collect.entrySet()) {
Map<String, Integer> valueMap = new LinkedHashMap<>();
// 初始化Map
for (DeviceStatusEnum value : DeviceStatusEnum.values()) {
valueMap.put(value.getMsg(), 0);
}
for (AllDeviceStatusPO allDeviceStatusPO : entry.getValue()) {
Integer status = allDeviceStatusPO.getStatus();
Integer statusCount = allDeviceStatusPO.getStatusCount();
valueMap.put(DeviceStatusEnum.getMsgByCode(status), statusCount);
}
Integer key = entry.getKey();
res.put(DeviceTypeEnum.getMsgByCode(key), valueMap);
}
return res;
}
@Override
public List<GreenwaveCrossOutVO> greenwaveCross(String adCode, String currentTime, Integer id) {
List<GreenwaveCrossOutVO> greenwaveCrossOutVOList = new ArrayList<>();
List<GreenwaveCrossPO> greenwaveCrossPOList = greenwaveCrossMapper.selectByGreenwaveId(adCode, currentTime, id);
for (GreenwaveCrossPO greenwaveCrossPO : greenwaveCrossPOList) {
GreenwaveCrossOutVO greenwaveCrossOutVO = new GreenwaveCrossOutVO();
greenwaveCrossOutVO.setName(greenwaveCrossPO.getName());
// 构造坐标
String location = greenwaveCrossPO.getLocation();
double[] lonLat = CrossUtil.getLonLat(location);
greenwaveCrossOutVO.setLongitude(lonLat[0]);
greenwaveCrossOutVO.setLatitude(lonLat[1]);
greenwaveCrossOutVOList.add(greenwaveCrossOutVO);
}
return greenwaveCrossOutVOList;
}
}
class CrossAlarmComparator implements Comparator<CrossAlarmOutVO> {
@Override
public int compare(CrossAlarmOutVO o1, CrossAlarmOutVO o2) {
// 先按路口名称排序,再按溢出-拥堵-失衡排序
int flag = o1.getCrossName().compareTo(o2.getCrossName());
if (flag == 0) {
String crossStatus1 = o1.getCrossStatus();
Integer codeInt1 = CrossAlarmEnum.getCodeIntByMsg(crossStatus1);
String crossStatus2 = o2.getCrossStatus();
Integer codeInt2 = CrossAlarmEnum.getCodeIntByMsg(crossStatus2);
return codeInt2 - codeInt1;
}
return flag;
}
}
package net.wanji.web.service.impl;
import cn.hutool.http.HttpUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.wanji.web.common.enums.CrossPhasePlanTurnTypeEnum;
import net.wanji.web.common.enums.SpecialServiceCrossDirEnum;
import net.wanji.web.common.enums.SpecialServiceCrossTurnEnum;
import net.wanji.web.common.exception.CrossRelationException;
import net.wanji.web.common.util.CrossUtil;
import net.wanji.web.mapper.*;
import net.wanji.web.po.*;
import net.wanji.web.service.SpecialServiceService;
import net.wanji.web.vo.specialService.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* @author Kent HAN
* @date 2022/11/8 11:07
*/
@Service
public class SpecialServiceServiceImpl implements SpecialServiceService {
@Autowired
SpecialServiceMapper specialServiceMapper;
@Autowired
SpecialServiceCrossMapper specialServiceCrossMapper;
@Autowired
RidInfoMapper ridInfoMapper;
@Autowired
CrossInfoMapper crossInfoMapper;
@Autowired
CrossDirTurnMapper crossDirTurnMapper;
@Autowired
CrossPhasePlanMapper crossPhasePlanMapper;
private Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create();
@Override
public void addSpecialService(AddSpecialServiceInVO addSpecialServiceInVO) {
SpecialServicePO specialServicePO = new SpecialServicePO();
String name = addSpecialServiceInVO.getName();
specialServicePO.setName(name);
specialServiceMapper.insertOne(specialServicePO);
}
@Override
public List<ListSpecialServicesOutVO> listSpecialServices(String adCode) {
List<SpecialServicePO> specialServicePOList = specialServiceMapper.selectByAdCode(adCode);
List<ListSpecialServicesOutVO> listSpecialServicesOutVOList = new ArrayList<>();
for (SpecialServicePO specialServicePO : specialServicePOList) {
ListSpecialServicesOutVO listSpecialServicesOutVO = new ListSpecialServicesOutVO();
BeanUtils.copyProperties(specialServicePO, listSpecialServicesOutVO);
// 构造wkt列表
List<String> wkts = new ArrayList<>();
Integer specialServiceId = specialServicePO.getId();
List<SpecialServiceCrossPO> specialServiceCrossPOList =
specialServiceCrossMapper.selectBySpecialServiceId(specialServiceId);
int size = specialServiceCrossPOList.size();
for (int i = 0; i < size - 1; i++) {
SpecialServiceCrossPO currentCross = specialServiceCrossPOList.get(i);
SpecialServiceCrossPO nextCross = specialServiceCrossPOList.get(i + 1);
RidInfoPO ridInfoPO = ridInfoMapper.selectOne(currentCross.getCrossId(), nextCross.getCrossId());
String wkt = ridInfoPO.getWkt();
wkts.add(wkt);
}
listSpecialServicesOutVO.setWkts(wkts);
listSpecialServicesOutVOList.add(listSpecialServicesOutVO);
}
return listSpecialServicesOutVOList;
}
@Override
public void updateSpecialService(UpdateSpecialServiceInVO updateSpecialServiceInVO) {
specialServiceMapper.updateSpecialService(updateSpecialServiceInVO);
}
@Override
public void deleteSpecialService(Integer id) {
specialServiceMapper.deleteSpecialService(id);
specialServiceCrossMapper.deleteCrossBySpecialServiceId(id);
}
@Override
public void addCross(AddCrossInVO addCrossInVO) throws RuntimeException{
Integer specialServiceId = addCrossInVO.getSpecialServiceId();
String endCrossid = addCrossInVO.getCrossId();
SpecialServiceCrossPO specialServiceCrossPO = new SpecialServiceCrossPO();
BeanUtils.copyProperties(addCrossInVO, specialServiceCrossPO);
// 构造顺序号
Integer maxSort = specialServiceCrossMapper.getMaxSort(specialServiceId);
if (maxSort == null) {
maxSort = 1;
} else {
maxSort++;
}
if (maxSort > 1) {
// 插入路段长度,插入转向
// 查询上一个路口ID
Integer preSort = maxSort - 1;
String startCrossid = specialServiceCrossMapper.selectCrossIdBySort(specialServiceId, preSort);
// 查询路段
RidInfoPO ridInfoPO = ridInfoMapper.selectOne(startCrossid, endCrossid);
// 路段关系不正确
if (ridInfoPO == null) {
throw new CrossRelationException("路段关系不正确");
}
// 插入路段长度
Double roadLength = ridInfoPO.getLength();
Double oldLength = specialServiceMapper.selectRoadLength(specialServiceId);
oldLength += roadLength;
specialServiceMapper.updateLength(specialServiceId, oldLength);
// 插入上一个路口转向
String startCrossOutDirId = ridInfoPO.getStartCrossdirid();
Integer startCrossInDir = specialServiceCrossMapper.selectStartCrossInDir(specialServiceId, startCrossid);
String startCrossInDirId = startCrossid + "_" + startCrossInDir + "_2_1";
CrossDirTurnPO crossDirTurnPO = crossDirTurnMapper.selectOneByInAndOutIds(startCrossInDirId, startCrossOutDirId);
String turntype = crossDirTurnPO.getTurntype();
specialServiceCrossMapper.updateTurn(specialServiceId, startCrossid, turntype);
// 更新当前路口进口
String endDirCode = ridInfoPO.getEndDir();
Integer endDirInt = Integer.parseInt(endDirCode);
specialServiceCrossPO.setDir(endDirInt);
}
specialServiceCrossPO.setSort(maxSort);
specialServiceCrossMapper.insertOne(specialServiceCrossPO);
}
@Override
public List<CrossListOutVO> crossList(Integer specialServiceId) {
List<SpecialServiceCrossPO> specialServiceCrossPOList =
specialServiceCrossMapper.selectBySpecialServiceId(specialServiceId);
List<CrossListOutVO> crossListOutVOList = new ArrayList<>();
for (int i = 0; i < specialServiceCrossPOList.size(); i++) {
SpecialServiceCrossPO specialServiceCrossPO = specialServiceCrossPOList.get(i);
CrossListOutVO crossListOutVO = new CrossListOutVO();
String crossId = specialServiceCrossPO.getCrossId();
crossListOutVO.setCrossId(crossId);
Integer sort = specialServiceCrossPO.getSort();
crossListOutVO.setSort(sort);
crossListOutVO.setStatus(specialServiceCrossPO.getStatus());
CrossInfo crossInfo = crossInfoMapper.selectById(specialServiceCrossPO.getCrossId());
// 经纬度
String location = crossInfo.getLocation();
double[] lonLat = CrossUtil.getLonLat(location);
crossListOutVO.setLongitude(lonLat[0]);
crossListOutVO.setLatitude(lonLat[1]);
// 路口名称
crossListOutVO.setName(crossInfo.getName());
// 获取控制方向
Integer dirCode = specialServiceCrossPO.getDir();
String dir = SpecialServiceCrossDirEnum.getMsgByCode(dirCode);
String turnCode = specialServiceCrossPO.getTurn();
if (turnCode != null) {
String turn = SpecialServiceCrossTurnEnum.getMsgByCode(turnCode);
String dirAndTurn = dir + turn;
crossListOutVO.setDirAndTurn(dirAndTurn);
}
// 获取wkt
if (i < specialServiceCrossPOList.size() - 1) {
SpecialServiceCrossPO nextPO = specialServiceCrossPOList.get(i + 1);
String startCrossid = specialServiceCrossPO.getCrossId();
String endCrossid = nextPO.getCrossId();
String wkt = ridInfoMapper.selectWkt(startCrossid, endCrossid);
crossListOutVO.setWkt(wkt);
}
crossListOutVOList.add(crossListOutVO);
}
return crossListOutVOList;
}
@Override
public void updateCross(UpdateCrossInVO updateCrossInVO) {
Integer specialServiceId = updateCrossInVO.getSpecialServiceId();
String crossId = updateCrossInVO.getCrossId();
String dirInAndOut = updateCrossInVO.getDirInAndOut();
// 获取方向(东西南北...)
int length = dirInAndOut.length();
String dirStr = dirInAndOut.substring(0, length - 2);
Integer dir = SpecialServiceCrossDirEnum.getCodeByMsg(dirStr);
specialServiceCrossMapper.updatDir(specialServiceId, crossId, dir);
// 更新当前路口转向
Integer sort = updateCrossInVO.getSort();
Integer nextSort = sort + 1;
String endCrossid = specialServiceCrossMapper.selectCrossIdBySort(specialServiceId, nextSort);
String startCrossOutDirId = ridInfoMapper.selectStartCrossOutDir(crossId, endCrossid);
String startCrossInDirId = crossId + "_" + dir + "_2_1";
CrossDirTurnPO crossDirTurnPO = crossDirTurnMapper.selectOneByInAndOutIds(startCrossInDirId, startCrossOutDirId);
String turntype = crossDirTurnPO.getTurntype();
specialServiceCrossMapper.updateTurn(specialServiceId, crossId, turntype);
}
@Override
public void deleteCross(DeleteCrossInVO deleteCrossInVO) {
String crossId = deleteCrossInVO.getCrossId();
Integer specialServiceId = deleteCrossInVO.getSpecialServiceId();
Integer sort = deleteCrossInVO.getSort();
if (sort > 1) {
Integer preSort = sort - 1;
String preCrossid = specialServiceCrossMapper.selectCrossIdBySort(specialServiceId, preSort);
// 减少路线长度
Double roadLength = ridInfoMapper.selectRoadLength(preCrossid, crossId);
Double oldLength = specialServiceMapper.selectRoadLength(specialServiceId);
oldLength -= roadLength;
specialServiceMapper.updateLength(specialServiceId, oldLength);
// 删除上一个路口转向
specialServiceCrossMapper.updateTurn(specialServiceId, preCrossid, null);
}
specialServiceCrossMapper.deleteCross(specialServiceId, crossId);
}
@Override
public void enableSpecialService(EnableDisableSpecialServiceInVO enableDisableSpecialServiceInVO) {
Integer specialServiceId = enableDisableSpecialServiceInVO.getSpecialServiceId();
specialServiceMapper.updateStatusEnable(specialServiceId);
List<SpecialServiceCrossPO> specialServiceCrossPOList =
specialServiceCrossMapper.selectBySpecialServiceId(specialServiceId);
for (SpecialServiceCrossPO specialServiceCrossPO : specialServiceCrossPOList) {
// 构造请求体
EnableDisableSpecialServiceOutVO enableDisableSpecialServiceOutVO = new EnableDisableSpecialServiceOutVO();
PhaseLockVO phaseLockVO = new PhaseLockVO();
Integer dirInt = specialServiceCrossPO.getDir();
String dirStr = dirInt.toString();
String turnStr = specialServiceCrossPO.getTurn();
String turnCode = CrossPhasePlanTurnTypeEnum.getCodeByMsg(turnStr);
String phaseId = crossPhasePlanMapper.selectPhaseId(dirStr, turnCode);
phaseLockVO.setPhaseid(phaseId);
phaseLockVO.setLocktime(999);
phaseLockVO.setCommand(1);
List<PhaseLockVO> phaseLockVOList = Arrays.asList(phaseLockVO);
enableDisableSpecialServiceOutVO.setPhases(phaseLockVOList);
String crossId = specialServiceCrossPO.getCrossId();
CrossInfo crossInfo = crossInfoMapper.selectById(crossId);
String signalId = crossInfo.getSignalId();
String signalType = crossInfo.getSignalType();
enableDisableSpecialServiceOutVO.setSignalid(signalId);
enableDisableSpecialServiceOutVO.setSignaltype(signalType);
// 发送请求
String url = "http://10.100.1.87/utc/" + signalId + "/lockphase";
String s = gson.toJson(enableDisableSpecialServiceOutVO);
String response = HttpUtil.post(url, s);
EnableDisableSpecialServiceResponseVO enableDisableSpecialServiceResponseVO =
gson.fromJson(response, EnableDisableSpecialServiceResponseVO.class);
Boolean success = enableDisableSpecialServiceResponseVO.getSuccess();
// 更新路口状态
if (success) {
specialServiceCrossMapper.updateStatusSuccess(specialServiceId, crossId);
} else {
specialServiceCrossMapper.updateStatusFail(specialServiceId, crossId);
}
}
}
@Override
public void disableSpecialService(EnableDisableSpecialServiceInVO enableDisableSpecialServiceInVO) {
Integer specialServiceId = enableDisableSpecialServiceInVO.getSpecialServiceId();
specialServiceMapper.updateStatusDisable(specialServiceId);
List<SpecialServiceCrossPO> specialServiceCrossPOList =
specialServiceCrossMapper.selectBySpecialServiceId(specialServiceId);
for (SpecialServiceCrossPO specialServiceCrossPO : specialServiceCrossPOList) {
// 构造请求体
EnableDisableSpecialServiceOutVO enableDisableSpecialServiceOutVO = new EnableDisableSpecialServiceOutVO();
PhaseLockVO phaseLockVO = new PhaseLockVO();
Integer dirInt = specialServiceCrossPO.getDir();
String dirStr = dirInt.toString();
String turnStr = specialServiceCrossPO.getTurn();
String turnCode = CrossPhasePlanTurnTypeEnum.getCodeByMsg(turnStr);
String phaseId = crossPhasePlanMapper.selectPhaseId(dirStr, turnCode);
phaseLockVO.setPhaseid(phaseId);
phaseLockVO.setLocktime(0);
phaseLockVO.setCommand(0);
List<PhaseLockVO> phaseLockVOList = Arrays.asList(phaseLockVO);
enableDisableSpecialServiceOutVO.setPhases(phaseLockVOList);
String crossId = specialServiceCrossPO.getCrossId();
CrossInfo crossInfo = crossInfoMapper.selectById(crossId);
String signalId = crossInfo.getSignalId();
String signalType = crossInfo.getSignalType();
enableDisableSpecialServiceOutVO.setSignalid(signalId);
enableDisableSpecialServiceOutVO.setSignaltype(signalType);
// 发送请求
String url = "http://10.100.1.87/utc/" + signalId + "/lockphase";
String s = gson.toJson(enableDisableSpecialServiceOutVO);
String response = HttpUtil.post(url, s);
EnableDisableSpecialServiceResponseVO enableDisableSpecialServiceResponseVO =
gson.fromJson(response, EnableDisableSpecialServiceResponseVO.class);
Boolean success = enableDisableSpecialServiceResponseVO.getSuccess();
// 更新路口状态
if (success) {
specialServiceCrossMapper.updateStatusSuccess(specialServiceId, crossId);
} else {
specialServiceCrossMapper.updateStatusFail(specialServiceId, crossId);
}
}
}
@Override
public Set<String> crossInList(String crossId) {
List<String> crossInIdList = crossDirTurnMapper.crossInList(crossId);
Set<String> res = new HashSet<>();
for (String crossInId : crossInIdList) {
String crossIn = getCrossIn(crossInId);
res.add(crossIn);
}
return res;
}
private String getCrossIn(String crossInId) {
// 从 13FNK0C6790_1_2_1 中获取 “北进口”
int length = crossInId.length();
String dir = crossInId.substring(length - 5, length - 4);
String dirStr = SpecialServiceCrossDirEnum.getMsgByCode(Integer.parseInt(dir));
String s = dirStr + "进口";
return s;
}
}
\ No newline at end of file
package net.wanji.web.vo.signalEvaluate;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/3 15:58
*/
@Data
@ApiModel(value = "FlowQueueInVO", description = "查询流量、排队折线图输入参数")
public class FlowQueueInVO {
@ApiModelProperty(value = "城市代码,示例值:110000")
String adCode;
@ApiModelProperty(value = "路口ID,如:13FNK0C6790")
String crossId;
@ApiModelProperty(value = "当天时间,格式:yyyy-MM-dd HH:mm:ss,如:2022-11-03 20:10:00")
String currentTime;
@ApiModelProperty(value = "按日周月,1按日 2按周 3按月")
Integer timeType;
@ApiModelProperty(value = "流量或排队,1流量 2排队")
Integer dataType;
}
package net.wanji.web.vo.signalEvaluate;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/3 16:06
*/
@Data
@ApiModel(value = "FlowQueueOutVO", description = "查询流量、排队折线图返回值")
public class FlowQueueOutVO {
@ApiModelProperty(value = "时间")
List<String> time;
@ApiModelProperty(value = "今日")
double[] toDay;
@ApiModelProperty(value = "昨日")
double[] yesterday;
@ApiModelProperty(value = "上周今日")
double[] lastWeekDay;
}
package net.wanji.web.vo.situationDetection;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/10/27 14:11
*/
@Data
@ApiModel(value = "AllDeviceStatusInVO", description = "查询交通设备状态输入参数")
public class AllDeviceStatusInVO {
@ApiModelProperty(value = "城市代码,示例值:110000")
String adCode;
}
package net.wanji.web.vo.situationDetection;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/10/27 14:11
*/
@Data
@ApiModel(value = "ControlHistInVO", description = "查询信号控制状态输入参数")
public class ControlHistInVO {
@ApiModelProperty(value = "路口ID,如:13FNK0C6790")
String crossId;
@ApiModelProperty(value = "当天时间,格式:yyyy-MM-dd HH:mm:ss,如:2022-10-27 17:21:23")
String currentTime;
}
package net.wanji.web.vo.situationDetection;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Map;
/**
* @author Kent HAN
* @date 2022/10/27 9:41
*/
@Data
@ApiModel(value = "ControlHistOutVO", description = "查询信号控制状态返回值")
public class ControlHistOutVO {
@ApiModelProperty(value = "时间")
String time;
@ApiModelProperty(value = "控制类型统计")
Map<String, Integer> typeStat;
}
package net.wanji.web.vo.situationDetection;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/10/27 9:41
*/
@Data
@ApiModel(value = "CrossAlarmOutVO", description = "查询路口报警返回值")
public class CrossAlarmOutVO {
@ApiModelProperty(value = "路口名称")
String crossName;
@ApiModelProperty(value = "状态 0 正常 1 失衡 2 拥堵 3 溢出 4 死锁")
String crossStatus;
@ApiModelProperty(value = "发生时间")
String startTime;
@ApiModelProperty(value = "时长(单位:分钟)")
Integer duration;
@ApiModelProperty(value = "经度")
Double longitude;
@ApiModelProperty(value = "纬度")
Double latitude;
}
package net.wanji.web.vo.situationDetection;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/10/27 14:11
*/
@Data
@ApiModel(value = "EventAlarmInVO", description = "查询事件报警输入参数")
public class EventAlarmInVO {
@ApiModelProperty(value = "当天时间,格式:yyyy-MM-dd HH:mm:ss,如:2022-10-27 17:21:23")
String currentTime;
}
package net.wanji.web.vo.situationDetection;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/10/27 14:01
*/
@Data
@ApiModel(value = "EventAlarmOutVO", description = "查询事件报警返回值")
public class EventAlarmOutVO {
@ApiModelProperty(value = "事件描述")
String eventDesc;
@ApiModelProperty(value = "事件类型:1事故;2拥堵;3管制;4施工")
String type;
@ApiModelProperty(value = "发生时间")
String startTime;
@ApiModelProperty(value = "时长(单位:分钟)")
Integer duration;
@ApiModelProperty(value = "时间范围")
String timeSpan;
@ApiModelProperty(value = "事件来源:事件来源:1接处警;2交管部门;3互联网")
String source;
@ApiModelProperty(value = "事件坐标:经度,纬度;经度,纬度...")
String coordinate;
}
package net.wanji.web.vo.situationDetection;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/10/31 10:52
*/
@Data
@ApiModel(value = "GreenwaveCrossInVO", description = "查询绿波监测-关联路口输入参数")
public class GreenwaveCrossInVO {
@ApiModelProperty(value = "城市代码,示例值:110000")
String adCode;
@ApiModelProperty(value = "当天时间,格式:yyyy-MM-dd HH:mm:ss,如:2022-10-31 17:21:23")
String currentTime;
@ApiModelProperty(value = "绿波ID")
Integer id;
}
package net.wanji.web.vo.situationDetection;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/10/31 10:58
*/
@Data
@ApiModel(value = "GreenwaveCrossOutVO", description = "查询绿波监测-关联路口返回值")
public class GreenwaveCrossOutVO {
@ApiModelProperty(value = "路口名称")
String name;
@ApiModelProperty(value = "经度")
Double longitude;
@ApiModelProperty(value = "纬度")
Double latitude;
}
package net.wanji.web.vo.situationDetection;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/10/27 14:11
*/
@Data
@ApiModel(value = "GreenwaveRealtimeInVO", description = "查询绿波监测输入参数")
public class GreenwaveRealtimeInVO {
@ApiModelProperty(value = "城市代码,示例值:110000")
String adCode;
@ApiModelProperty(value = "当天时间,格式:yyyy-MM-dd HH:mm:ss,如:2022-10-28 17:21:23")
String currentTime;
}
package net.wanji.web.vo.situationDetection;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/10/27 14:01
*/
@Data
@ApiModel(value = "GreenwaveRealtimeOutVO", description = "查询绿波监测返回值")
public class GreenwaveRealtimeOutVO {
@ApiModelProperty(value = "ID")
Integer id;
@ApiModelProperty(value = "绿波名称")
String greenwaveName;
@ApiModelProperty(value = "行程时间(秒)")
Integer trvalTime;
@ApiModelProperty(value = "停车次数")
Double stopNumber;
@ApiModelProperty(value = "绿波带宽")
Integer greenwaveWidth;
@ApiModelProperty(value = "行程速度(km/h)")
Double speed;
@ApiModelProperty(value = "坐标")
String wkt;
}
package net.wanji.web.vo.situationDetection;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/10/26 15:53
*/
@Data
@ApiModel(value = "OptRecordsInVO", description = "查询优化记录输入参数")
public class OptRecordsInVO {
@ApiModelProperty(value = "城市代码,示例值:110000")
String adCode;
@ApiModelProperty(value = "当天时间,格式:yyyy-MM-dd HH:mm:ss,如:2022-10-25 17:21:23")
String currentTime;
}
package net.wanji.web.vo.situationDetection;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/10/26 16:19
*/
@Data
@ApiModel(value = "OptRecordsOutVO", description = "查询优化记录返回值")
public class OptRecordsOutVO {
@ApiModelProperty(value = "优化次数")
Integer optTimes;
@ApiModelProperty(value = "速度")
Integer speed;
@ApiModelProperty(value = "交通指数列表")
List<TrafficIndexVO> trafficIndexVOList;
@Data
public static class TrafficIndexVO {
@ApiModelProperty(value = "时间")
String time;
@ApiModelProperty(value = "交通指数")
Double index;
}
}
package net.wanji.web.vo.situationDetection;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/10/26 15:53
*/
@Data
@ApiModel(value = "VehicleTraceInVO", description = "查询在途车辆输入参数")
public class VehicleTraceInVO {
@ApiModelProperty(value = "城市代码,示例值:110000")
String adCode;
@ApiModelProperty(value = "当天时间,格式:yyyy-MM-dd HH:mm:ss,如:2022-10-27 17:21:23")
String currentTime;
}
package net.wanji.web.vo.situationDetection;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/10/27 9:41
*/
@Data
@ApiModel(value = "VehicleTraceOutVO", description = "查询在途车辆返回值")
public class VehicleTraceOutVO {
@ApiModelProperty(value = "时间")
String traceTime;
@ApiModelProperty(value = "车辆数统计")
Integer vehicleCount;
}
package net.wanji.web.vo.situationDetection;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/10/26 15:53
*/
@Data
@ApiModel(value = "VideoDeviceInfoInVO", description = "查询图层-视频设备信息及状态输入参数")
public class VideoDeviceInfoInVO {
@ApiModelProperty(value = "城市编号,如110000")
String adCode;
}
package net.wanji.web.vo.situationDetection;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/10/27 9:41
*/
@Data
@ApiModel(value = "VehicleTraceOutVO", description = "查询图层-视频设备信息及状态返回值")
public class VideoDeviceInfoOutVO {
@ApiModelProperty(value = "设备编号")
String code;
@ApiModelProperty(value = "设备名称")
String name;
@ApiModelProperty(value = "状态:0离线;1在线")
String status;
@ApiModelProperty(value = "安装位置(经纬度)")
String location;
}
package net.wanji.web.vo.specialService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/8 14:31
*/
@Data
@ApiModel(value = "AddCrossInVO", description = "快速特勤-添加路口输入参数")
public class AddCrossInVO {
@ApiModelProperty(value = "特勤ID")
Integer specialServiceId;
@ApiModelProperty(value = "路口编号")
String crossId;
}
package net.wanji.web.vo.specialService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/8 11:01
*/
@Data
@ApiModel(value = "AddSpecialServiceInVO", description = "快速特勤-添加特勤输入参数")
public class AddSpecialServiceInVO {
@ApiModelProperty(value = "城市代码,示例值:110000")
String adCode;
@ApiModelProperty(value = "特勤名称")
String name;
}
package net.wanji.web.vo.specialService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/9 17:21
*/
@Data
@ApiModel(value = "CrossIdVO")
public class CrossIdVO {
@ApiModelProperty( value = "路口ID",notes = "")
private String crossId ;
}
package net.wanji.web.vo.specialService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/8 15:18
*/
@Data
@ApiModel(value = "CrossListInVO", description = "快速特勤-路口列表输入参数")
public class CrossListInVO {
@ApiModelProperty(value = "特勤ID")
Integer specialServiceId;
}
package net.wanji.web.vo.specialService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/8 15:20
*/
@Data
@ApiModel(value = "CrossListOutVO", description = "查询快速特勤-路口列表返回值")
public class CrossListOutVO {
@ApiModelProperty(value = "路口ID",notes = "")
private String crossId ;
@ApiModelProperty(value = "序号",notes = "")
private Integer sort ;
@ApiModelProperty(value = "路口名称",notes = "")
private String name ;
@ApiModelProperty(value = "路口经度",notes = "")
private Double longitude ;
@ApiModelProperty(value = "路口纬度",notes = "")
private Double latitude ;
@ApiModelProperty(value = "执行状态:1成功;0失败",notes = "")
private Integer status ;
@ApiModelProperty(value = "控制方向",notes = "")
private String dirAndTurn ;
@ApiModelProperty(value = "RID 空间对象",notes = "")
private String wkt ;
}
package net.wanji.web.vo.specialService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/9 11:04
*/
@Data
@ApiModel(value = "DeleteCrossInVO", description = "快速特勤-删除路口输入参数")
public class DeleteCrossInVO {
@ApiModelProperty(value = "特勤ID")
Integer specialServiceId;
@ApiModelProperty(value = "路口ID")
String crossId;
@ApiModelProperty(value = "顺序号")
Integer sort;
}
package net.wanji.web.vo.specialService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/8 13:18
*/
@Data
@ApiModel(value = "DeleteSpecialServiceInVO", description = "快速特勤-删除特勤输入参数")
public class DeleteSpecialServiceInVO {
@ApiModelProperty(value = "特勤ID")
Integer id;
}
package net.wanji.web.vo.specialService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/9 13:01
*/
@Data
@ApiModel(value = "EnableDisableSpecialServiceInVO", description = "快速特勤-一键特勤/一键取消特勤输入参数")
public class EnableDisableSpecialServiceInVO {
@ApiModelProperty(value = "特勤ID")
Integer specialServiceId;
}
package net.wanji.web.vo.specialService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/9 13:10
*/
@Data
@ApiModel(value = "ListSpecialServicesOutVO", description = "快速特勤-一键特勤、一键取消特勤请求体")
public class EnableDisableSpecialServiceOutVO {
@ApiModelProperty(name = "相位锁定参数",notes = "")
List<PhaseLockVO> phases;
@ApiModelProperty(name = "信号机编号",notes = "")
String signalid;
@ApiModelProperty(name = "信号机类型 QS/SCATS/HS/HK/DT",notes = "")
String signaltype;
}
package net.wanji.web.vo.specialService;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/9 14:39
*/
@Data
@ApiModel(value = "ListSpecialServicesOutVO", description = "快速特勤-一键特勤、一键取消特勤响应体")
public class EnableDisableSpecialServiceResponseVO {
String msg;
Integer status;
Boolean success;
}
package net.wanji.web.vo.specialService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/8 13:04
*/
@Data
@ApiModel(value = "ListSpecialServicesInVO", description = "查询快速特勤-特勤列表输入参数")
public class ListSpecialServicesInVO {
@ApiModelProperty(value = "城市代码,示例值:110000")
String adCode;
}
\ No newline at end of file
package net.wanji.web.vo.specialService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/8 13:07
*/
@Data
@ApiModel(value = "ListSpecialServicesOutVO", description = "查询快速特勤-特勤列表返回值")
public class ListSpecialServicesOutVO {
@ApiModelProperty( value = "特勤ID",notes = "")
private Integer id ;
/** 特勤名称 */
@ApiModelProperty(value = "特勤名称",notes = "")
private String name ;
/** 控制类型:1手动;2自动 */
@ApiModelProperty(value = "控制类型:1手动;2自动",notes = "")
private Integer controlModel = 1;
/** 特勤线路长度 */
@ApiModelProperty(value = "特勤线路长度",notes = "")
private Double length = 0.0 ;
/** 特勤状态:1执行;0未执行 */
@ApiModelProperty(value = "特勤状态:1执行;0未执行",notes = "")
private Integer status = 0 ;
@ApiModelProperty(value = "wkt列表",notes = "")
private List<String> wkts;
}
package net.wanji.web.vo.specialService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/9 13:13
*/
@Data
@ApiModel(value = "PhaseLockVO", description = "相位锁定参数")
public class PhaseLockVO {
@ApiModelProperty(name = "1 锁定;0 取消",notes = "")
private Integer command ;
@ApiModelProperty(name = "相位锁定时间,999 永久锁定,必须手动取消;0~999,自动取消",notes = "")
private Integer locktime ;
@ApiModelProperty(name = "相位编号",notes = "")
private String phaseid ;
}
package net.wanji.web.vo.specialService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/9 10:13
*/
@Data
@ApiModel(value = "UpdateCrossInVO", description = "快速特勤-更新路口输入参数")
public class UpdateCrossInVO {
@ApiModelProperty(value = "特勤ID")
Integer specialServiceId;
@ApiModelProperty(value = "路口ID")
String crossId;
@ApiModelProperty(value = "进口方向,如:北进口")
String dirInAndOut;
@ApiModelProperty(value = "顺序号")
Integer sort;
}
package net.wanji.web.vo.specialService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/8 13:18
*/
@Data
@ApiModel(value = "UpdateSpecialServiceInVO", description = "快速特勤-编辑特勤输入参数")
public class UpdateSpecialServiceInVO {
@ApiModelProperty(value = "特勤ID")
Integer id;
@ApiModelProperty(value = "特勤名称")
String name;
}
server:
port: 32001
servlet:
display-name: Wanji
context-path: /web
multipart:
max-file-size: 50MB
max-request-size: 50MB
tomcat:
threads:
max: 10000
#线程池配置
threadPool:
corePoolSize: 5
maxPoolSize: 200
queueCapacity: 5
keepAliveTime: 60000
spring:
datasource:
dynamic:
primary: master
datasource:
master:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://10.100.1.74:3306/t_signal_control?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
# url: jdbc:mysql://10.102.1.112:53306/t_signal_control?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
username: root
password: Wanji300552
driverClassName: com.mysql.cj.jdbc.Driver
slave:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://10.100.1.74:3306/t_signal_control?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
username: root
password: Wanji300552
driverClassName: com.mysql.cj.jdbc.Driver
webService:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://10.100.1.74:3306/t_signal?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
username: root
password: Wanji300552
type: com.alibaba.druid.pool.DruidDataSource
redis:
host: 10.100.1.74
port: 6379
password: Wanji300552
jedis:
pool:
max-active: 200
max-wait: 5000
max-idle: 20
min-idle: 10
timeout: 5000
database: 3
# 信号平台
signal:
server:
port: 32001
servlet:
display-name: Wanji
context-path: /web
multipart:
max-file-size: 50MB
max-request-size: 50MB
tomcat:
threads:
max: 10000
#线程池配置
threadPool:
corePoolSize: 5
maxPoolSize: 200
queueCapacity: 5
keepAliveTime: 60000
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://10.100.1.74:3306/t_signal?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
username: root
password: Wanji300552
type: com.alibaba.druid.pool.DruidDataSource
filters: stat
minIdle: 50
maxActive: 200
initialSize: 10
maxWait: 5000
minEvictableIdleTimeMillis: 60000
timeBetweenEvictionRunsMillis: 30000
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
keepAlive: false
validationQuery: SELECT 1
poolPreparedStatements: false
maxPoolPreparedStatementPerConnectionSize: -1
maxOpenPreparedStatements: -1
logAbandoned: true
encoding:
force: true
charset: UTF-8
enabled: true
redis:
host: 10.100.1.74
port: 6379
password: Wanji300552
jedis:
pool:
max-active: 200
max-wait: 5000
max-idle: 20
min-idle: 10
timeout: 5000
database: 3
# 信号平台
signal:
server:
port: 32001
servlet:
context-path: /web
spring: spring:
profiles:
active: dev
jackson:
mapper:
accept_case_insensitive_properties: true
main:
allow-circular-references: true
mvc: mvc:
pathmatch: pathmatch:
matching-strategy: ant_path_matcher matching-strategy: ant_path_matcher
main: service:
allow-circular-references: true name: signal-web-service
datasource:
dynamic: mybatis:
primary: master type-aliases-package: net.wanji.*.model
datasource: mapper-locations: classpath:mapper/*.xml
master: configuration:
type: com.alibaba.druid.pool.DruidDataSource log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
url: jdbc:mysql://10.100.1.74:3306/t_signal_control?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true
# url: jdbc:mysql://10.102.1.112:53306/t_signal_control?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true mapper:
username: root mappers:
password: Wanji300552 - net.wanji.web.mapper.MyBaseMapper
driverClassName: com.mysql.cj.jdbc.Driver not-empty: false
slave: identity: MYSQL
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://10.100.1.74:3306/t_signal_control?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'&useSSL=false&useCursorFetch=true pagehelper:
username: root helper-dialect: mysql
password: Wanji300552 reasonable: false
driverClassName: com.mysql.cj.jdbc.Driver support-methods-arguments: true
redis: params: count=countSql
host: 10.100.1.74
port: 6379 jasypt:
password: Wanji300552 encryptor:
jedis: algorithm: PBEWithMD5AndDES
pool: password: 7F84150B6A114C48F0EA1158484BF63C
max-active: 200 iv-generator-classname: org.jasypt.iv.NoIvGenerator
max-wait: 5000
max-idle: 20
min-idle: 10
timeout: 5000
database: 5
mybatis-plus: mybatis-plus:
mapper-locations: classpath:mapper/*.xml mapper-locations: classpath:mapper/*.xml
......
package ${package.Controller};
import ${package.Service}.${table.serviceName};
import ${package.Entity}.${entity};
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
<#if superControllerClassPackage?? >
import ${superControllerClassPackage};
</#if>
/**
* @Description: [${table.comment} 接口API]</p>
* @author ${author}
* @version 1.0
* Created on ${date}
*/
@Slf4j
@RestController
@RequestMapping("<#if package.ModuleName??>/${package.ModuleName}</#if><#if package.SubModuleName??>/${package.SubModuleName}</#if>/${table.viewName}")
@Api(value = ${table.comment}接口, description = ${table.comment}接口, tags = {${table.comment}})
<#if superControllerClass??>
public class ${table.controllerName} extends ${superControllerClass} {
<#else>
public class ${table.controllerName} {
</#if>
/**
* <p>Description:[${table.comment}服务]</p>
*/
@Autowired
private ${table.serviceName} ${table.serviceName?uncap_first};
}
package ${package.Entity};
<#list table.importPackages as pkg>
import ${pkg};
</#list>
import lombok.Data;
import javax.persistence.*;
/**
* @Description: [${table.comment}实体类]</p>
* @author ${author}
* @version 1.0
* Created on ${date}
*/
@Data
<#if tableAnnotation??&&tableAnnotation >
@Table(name = "${table.name}")
</#if>
<#if superEntityClass?? >
public class ${entity} extends ${superEntityClass}<#if activeRecord ><${entity}></#if> {
<#elseif activeRecord>
public class ${entity} extends Model<${entity}> {
<#else>
public class ${entity} {
</#if>
<#list table.fields as field>
/**
* <#if field.comment??&& field.comment!= "">${field.comment}</#if>
**/
<#if field.keyFlag >
<#assign keyPropertyName=field.propertyName/>
@Id
</#if>
<#if field.convert >
@Column(name = "${field.name}")
</#if>
private ${field.propertyType} ${field.propertyName};
<#if cfg.rangeDateFileds?seq_contains(field.propertyName)>
/**
* <p>${field.comment}范围查询-开始</p>
*/
private String ${field.propertyName}Start;
/**
* <p>${field.comment}范围查询-结束</p>
*/
private String ${field.propertyName}End;
</#if>
</#list>
}
package ${package.Mapper};
import ${package.Entity}.${entity};
import ${superMapperClassPackage};
import org.springframework.stereotype.Repository;
/**
* @Description: [${table.comment}持久层实现]</p>
* @author ${author}
* @version 1.0
* Created on ${date}
*/
@Repository
public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${package.Mapper}.${table.mapperName}">
<#if enableCache>
<!-- 开启二级缓存 -->
<cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>
</#if>
<#if baseResultMap>
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="${package.Entity}.${entity}">
<#list table.fields as field>
<#if field.keyFlag >
<id column="${field.name}" property="${field.propertyName}"/>
<#else>
<result column="${field.name}" property="${field.propertyName}"/>
</#if>
</#list>
</resultMap>
</#if>
<!--基本字段列表-->
<sql id="Base_Column_List">
<#list table.fields as field>
${field.name}<#sep>,
</#list>
</sql>
</mapper>
package ${package.Service};
import ${package.Entity}.${entity};
import org.springframework.stereotype.Repository;
/**
* @Description: [${table.comment}service]</p>
* @author ${author}
* @version 1.0
* Created on ${date}
*/
@Repository
public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
}
package ${package.ServiceImpl};
import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import org.springframework.stereotype.Service;
/**
* @Description: [${table.comment}service实现]</p>
* @author ${author}
* @version 1.0
* Created on ${date}
*/
@Service
public class ${table.serviceImplName} extends ${superServiceImplClass}<${entity}, ${table.mapperName}> implements ${table.serviceName} {
}
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<property name="encoding" value="UTF-8"/>
<property name="normal-pattern"
value="%date{yyyy-MM-dd HH:mm:ss.SSS} %-5level[%thread]%logger{56}.%method:%L -%msg%n"/>
<property name="LOG_PATH" value="./logs"/>
<!-- 配置打印DEBUG级别日志的环境. 多个使用逗号隔开. -->
<springProfile name="dev,test">
<!-- 如果需要,请自行开启spring或其他组件的debug级别 -->
<logger name="net.wanji.web" level="info"/>
</springProfile>
<!-- 配置打印INFO级别日志的环境 -->
<springProfile name="prod">
<logger name="net.wanji.web" level="info" />
</springProfile>
<appender name="consoleLog" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>
${normal-pattern}
</pattern>
</layout>
</appender>
<appender name="fileInfoLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/info.log</file>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>DENY</onMatch>
<onMismatch>ACCEPT</onMismatch>
</filter>
<encoder>
<pattern>${normal-pattern}</pattern>
<charset>${encoding}</charset>
</encoder>
<!--滚动策略-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--路径-->
<fileNamePattern>${LOG_PATH}/info.%d.log</fileNamePattern>
<MaxHistory>30</MaxHistory>
</rollingPolicy>
</appender>
<appender name="fileErrorLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH}/error.log</file>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>>
<encoder>
<pattern>${normal-pattern}</pattern>
<charset>${encoding}</charset>
</encoder>
<!--滚动策略-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--路径-->
<fileNamePattern>${LOG_PATH}/error.%d.log</fileNamePattern>
<MaxHistory>30</MaxHistory>
</rollingPolicy>
</appender>
<root level="INFO">
<appender-ref ref="consoleLog"/>
<appender-ref ref="fileInfoLog"/>
<appender-ref ref="fileErrorLog"/>
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.web.mapper.AllDeviceStatusMapper">
<!-- 通用查询映射结果 -->
<resultMap type="net.wanji.web.po.AllDeviceStatusPO" id="BaseResultMap">
<result property="type" column="type"/>
<result property="status" column="status"/>
<result property="statusCount" column="statusCount"/>
</resultMap>
<select id="selectAllDeviceStatus" resultMap="BaseResultMap">
select type, status, count(*) as statusCount
from t_base_device_info
group by type, status
order by type
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.web.mapper.ControlHistMapper">
<!-- 通用查询映射结果 -->
<resultMap type="net.wanji.web.po.ControlHistPO" id="BaseResultMap">
<result property="controlTime" column="controlTime"/>
<result property="controlType" column="controlType"/>
<result property="typeCount" column="typeCount"/>
</resultMap>
<select id="selectByCrossId" resultMap="BaseResultMap">
select concat(hour(start_time), ':', floor(minute(start_time)/30)*30) as controlTime,
type as controlType,
count(*) as typeCount
from t_cross_control_hist
where cross_id = #{crossId} and to_days(#{todayDate}) = to_days(start_time)
group by controlTime, controlType
order by controlTime
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.web.mapper.CrossAlarmMapper">
<!-- 通用查询映射结果 -->
<resultMap type="net.wanji.web.po.CrossAlarmPO" id="BaseResultMap">
<result property="crossId" column="cross_id"/>
<result property="status" column="status"/>
<result property="trafficIndex" column="traffic_index"/>
<result property="startTime" column="start_time"/>
<result property="endTime" column="end_time"/>
<result property="duration" column="duration"/>
<result property="isUnbalance" column="is_unbalance"/>
<result property="isSpillover" column="is_spillover"/>
<result property="isCongestion" column="is_congestion"/>
<result property="unbalanceIndex" column="unbalance_index"/>
<result property="spilloverIndex" column="spillover_index"/>
<result property="congestionIndex" column="congestion_index"/>
<result property="unbalanceTime" column="unbalance_time"/>
<result property="spilloverTime" column="spillover_time"/>
<result property="congestionTime" column="congestion_time"/>
<result property="unbalanceDirs" column="unbalance_dirs"/>
<result property="spilloverDirs" column="spillover_dirs"/>
<result property="congestionDirs" column="congestion_dirs"/>
<result property="gmtCreate" column="gmt_create"/>
<result property="gmtModified" column="gmt_modified"/>
</resultMap>
<select id="selectStatusNotZero" resultMap="BaseResultMap">
select
cross_id,status,traffic_index,start_time,end_time,duration,is_unbalance,is_spillover,is_congestion,unbalance_index,spillover_index,congestion_index,unbalance_time,spillover_time,congestion_time,unbalance_dirs,spillover_dirs,congestion_dirs,gmt_create,gmt_modified
from t_cross_data_realtime
where status != "0"
order by start_time desc;
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.web.mapper.CrossDirTurnMapper">
<!-- 通用查询映射结果 -->
<resultMap type="net.wanji.web.po.CrossDirTurnPO" id="BaseResultMap">
<result property="scrossdirid" column="SCROSSDIRID"/>
<result property="ecrossdirid" column="ECROSSDIRID"/>
<result property="turntype" column="TURNTYPE"/>
<result property="name" column="NAME"/>
<result property="crossid" column="CROSSID"/>
<result property="sroadsegid" column="SROADSEGID"/>
<result property="eroadsegid" column="EROADSEGID"/>
<result property="sianaldirid" column="SIANALDIRID"/>
<result property="gmtCreate" column="gmt_create"/>
</resultMap>
<select id="selectOneByInAndOutIds" resultMap="BaseResultMap">
select SCROSSDIRID,ECROSSDIRID,TURNTYPE,NAME,CROSSID,SROADSEGID,EROADSEGID,SIANALDIRID,gmt_create
from t_base_crossdir_turn_info
where SCROSSDIRID = #{startCrossInDirId} and ECROSSDIRID = #{startCrossOutDirId}
</select>
<select id="crossInList" resultType="java.lang.String">
select distinct SCROSSDIRID
from t_base_crossdir_turn_info
where CROSSID = #{crossId}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.web.mapper.CrossInfoMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="net.wanji.web.po.CrossInfo">
<result property="id" column="ID"/>
<result property="code" column="CODE"/>
<result property="name" column="NAME"/>
<result property="type" column="TYPE"/>
<result property="level" column="level"/>
<result property="adcode" column="ADCODE"/>
<result property="adname" column="ADNAME"/>
<result property="location" column="LOCATION"/>
<result property="controlType" column="control_type"/>
<result property="isControl" column="is_control"/>
<result property="isStart" column="is_start"/>
<result property="isSignlight" column="is_signlight"/>
<result property="signalId" column="signal_id"/>
<result property="signalType" column="signal_type"/>
<result property="signalCrossType" column="signal_cross_type"/>
<result property="signalSidewalk" column="signal_sidewalk"/>
<result property="ridcrossId" column="ridcross_id"/>
<result property="ridcrossType" column="ridcross_type"/>
<result property="gmtCreate" column="gmt_create"/>
<result property="gmtModified" column="gmt_modified"/>
<result property="signalBrand" column="signal_brand"/>
<result property="crossName" column="cross_name"/>
</resultMap>
<delete id="deleteByCrossId">
delete from t_base_cross_info where 1=1
<if test="id != null and id !='' ">
and id = #{id}
</if>
</delete>
<select id="listCrossInfo" resultMap="BaseResultMap">
SELECT
id,
name,
type,
level,
ad_code,
location,
is_signal,
is_start,
is_send
FROM
t_base_cross_info
WHERE 1=1
<if test="crossName != null and crossName != ''">
AND name = #{crossName}
</if>
GROUP BY name
</select>
<select id="selectById" resultMap="BaseResultMap">
select
ID,CODE,NAME,TYPE,level,ADCODE,ADNAME,LOCATION,control_type,is_control,is_start,is_signlight,signal_id,signal_type,signal_cross_type,signal_sidewalk,ridcross_id,ridcross_type,gmt_create,gmt_modified,signal_brand,cross_name
from t_base_cross_info
where ID = #{id}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.web.mapper.CrossPhasePlanMapper">
<select id="selectPhaseId" resultType="java.lang.String">
select phaseid
from t_base_cross_phase_plan
where direction = #{dirStr} and turntype = #{turnCode}
limit 1
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.web.mapper.EventAlarmMapper">
<!-- 通用查询映射结果 -->
<resultMap type="net.wanji.web.po.EventAlarmPO" id="BaseResultMap">
<result property="id" column="id"/>
<result property="eventId" column="event_id"/>
<result property="eventDesc" column="event_desc"/>
<result property="type" column="type"/>
<result property="startTime" column="start_time"/>
<result property="endTime" column="end_time"/>
<result property="source" column="source"/>
<result property="wkt" column="wkt"/>
<result property="imageUrl" column="image_url"/>
<result property="gmtCreate" column="gmt_create"/>
<result property="gmtModified" column="gmt_modified"/>
</resultMap>
<select id="selectByTodayTime" resultMap="BaseResultMap">
select
id,event_id,event_desc,type,start_time,end_time,source,wkt,image_url,gmt_create,gmt_modified
from t_event_data
where to_days(#{todayTime}) = to_days(start_time)
order by start_time desc;
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.web.mapper.FlowQueueMapper">
<!-- 通用查询映射结果 -->
<resultMap type="net.wanji.web.po.FlowQueuePO" id="BaseResultMap">
<result property="time" column="time"/>
<result property="count" column="count"/>
</resultMap>
<select id="getDayFlowToday" resultMap="BaseResultMap">
select concat(hour(start_time), ':00') as time, sum(flow) as count
from t_cross_data_hist
where cross_id = #{crossId} and to_days(start_time) = to_days(#{currentTime})
group by time
</select>
<select id="getDayFlowYesterday" resultMap="BaseResultMap">
select concat(hour(start_time), ':00') as time, sum(flow) as count
from t_cross_data_hist
where cross_id = #{crossId} and to_days(start_time)+1 = to_days(#{currentTime})
group by time
</select>
<select id="getDayFlowLastWeekDay" resultMap="BaseResultMap">
select concat(hour(start_time), ':00') as time, sum(flow) as count
from t_cross_data_hist
where cross_id = #{crossId} and to_days(start_time)+7 = to_days(#{currentTime})
group by time
</select>
<select id="getDayQueueToday" resultMap="BaseResultMap">
select concat(hour(start_time), ':00') as time, avg(queue_length) as count
from t_cross_data_hist
where cross_id = #{crossId} and to_days(start_time) = to_days(#{currentTime})
group by time
</select>
<select id="getDayQueueYesterday" resultMap="BaseResultMap">
select concat(hour(start_time), ':00') as time, avg(queue_length) as count
from t_cross_data_hist
where cross_id = #{crossId} and to_days(start_time)+1 = to_days(#{currentTime})
group by time
</select>
<select id="getDayQueueLastWeekDay" resultMap="BaseResultMap">
select concat(hour(start_time), ':00') as time, avg(queue_length) as count
from t_cross_data_hist
where cross_id = #{crossId} and to_days(start_time)+7 = to_days(#{currentTime})
group by time
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.web.mapper.GreenwaveCrossMapper">
<!-- 通用查询映射结果 -->
<resultMap type="net.wanji.web.po.GreenwaveCrossPO" id="BaseResultMap">
<result property="name" column="NAME"/>
<result property="location" column="LOCATION"/>
</resultMap>
<select id="selectByGreenwaveId" resultMap="BaseResultMap">
select t3.NAME as name, t3.LOCATION as location
from t_greenwave_cross as t1
join t_greenwave_realtime as t2
join t_base_cross_info as t3
on t1.green_id = t2.greenwave_id and t1.cross_id = t3.ID
where t1.green_id = #{id} and to_days(#{currentTime}) = to_days(t1.gmt_create)
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.web.mapper.GreenwaveRealtimeMapper">
<!-- 通用查询映射结果 -->
<resultMap type="net.wanji.web.po.GreenwaveRealtimePO" id="BaseResultMap">
<result property="greenwaveId" column="greenwave_id"/>
<result property="greenwaveName" column="greenwave_name"/>
<result property="greenwaveWidth" column="greenwave_width"/>
<result property="status" column="status"/>
<result property="trafficIndex" column="traffic_index"/>
<result property="speed" column="speed"/>
<result property="trvalTime" column="trval_time"/>
<result property="stopNumber" column="stop_number"/>
<result property="congestionLength" column="congestion_length"/>
<result property="congRate" column="cong_rate"/>
<result property="delayTime" column="delay_time"/>
<result property="wkt" column="wkt"/>
<result property="gmtCreate" column="gmt_create"/>
<result property="gmtModified" column="gmt_modified"/>
</resultMap>
<select id="selectByAdCodeAndCurrentTime" resultMap="BaseResultMap">
select
greenwave_id,greenwave_name,greenwave_width,status,traffic_index,speed,trval_time,stop_number,congestion_length,cong_rate,delay_time,wkt,gmt_create,gmt_modified
from t_greenwave_realtime
where to_days(#{todayDate}) = to_days(gmt_create)
order by gmt_create desc;
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.web.mapper.OptRecordsMapper">
<!-- 通用查询映射结果 -->
<resultMap type="net.wanji.web.po.BaseAreaDataPO" id="BaseResultMap">
<result property="id" column="id"/>
<result property="adCode" column="ad_code"/>
<result property="adaptTime" column="adapt_time"/>
<result property="trafficIndex" column="traffic_index"/>
<result property="speed" column="speed"/>
<result property="optNum" column="opt_num"/>
<result property="gmtCreate" column="gmt_create"/>
<result property="gmtModified" column="gmt_modified"/>
</resultMap>
<select id="selectByAdCodeAndTime" resultMap="BaseResultMap">
SELECT
id,ad_code,adapt_time,traffic_index,speed,opt_num,gmt_create,gmt_modified
FROM
t_base_area_data
WHERE to_days(#{adaptTime}) = to_days(adapt_time)
ORDER BY adapt_time;
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.web.mapper.RidInfoMapper">
<!-- 通用查询映射结果 -->
<resultMap type="net.wanji.web.po.RidInfoPO" id="BaseResultMap">
<result property="rid" column="rid"/>
<result property="name" column="name"/>
<result property="roadId" column="road_id"/>
<result property="roadName" column="road_name"/>
<result property="roaddirid" column="roadDirId"/>
<result property="startCrossid" column="start_crossid"/>
<result property="endCrossid" column="end_crossid"/>
<result property="startCrossdirid" column="start_crossdirid"/>
<result property="endCrossdirid" column="end_crossdirid"/>
<result property="startAngle" column="start_angle"/>
<result property="endAngle" column="end_angle"/>
<result property="startDir" column="start_dir"/>
<result property="endDir" column="end_dir"/>
<result property="orderid" column="orderId"/>
<result property="direction" column="direction"/>
<result property="trend" column="trend"/>
<result property="roadClass" column="road_class"/>
<result property="adcode" column="adcode"/>
<result property="length" column="length"/>
<result property="width" column="width"/>
<result property="startLocationDesc" column="start_location_desc"/>
<result property="endLocationDesc" column="end_location_desc"/>
<result property="isOneway" column="is_oneway"/>
<result property="roadsegType" column="roadseg_type"/>
<result property="mainFlag" column="main_flag"/>
<result property="dataVersion" column="data_version"/>
<result property="preDataVersion" column="pre_data_version"/>
<result property="dataMode" column="data_mode"/>
<result property="relation" column="relation"/>
<result property="geom" column="geom"/>
<result property="wkt" column="wkt"/>
<result property="ctRid" column="ct_rid"/>
<result property="ctName" column="ct_name"/>
<result property="ctSeq" column="ct_seq"/>
<result property="gmtCreate" column="gmt_create"/>
<result property="gmtModified" column="gmt_modified"/>
</resultMap>
<select id="selectRoadLength" resultType="java.lang.Double">
select length
from t_base_rid_info
where start_crossid = #{startCrossid} and end_crossid = #{endCrossid}
</select>
<select id="selectStartCrossOutDir" resultType="java.lang.String">
select start_crossdirid
from t_base_rid_info
where start_crossid = #{startCrossid} and end_crossid = #{endCrossid}
</select>
<select id="selectWkt" resultType="java.lang.String">
select wkt
from t_base_rid_info
where start_crossid = #{startCrossid} and end_crossid = #{endCrossid}
</select>
<select id="selectOne" resultMap="BaseResultMap">
select
rid,name,road_id,road_name,roadDirId,start_crossid,end_crossid,start_crossdirid,end_crossdirid,start_angle,end_angle,start_dir,end_dir,orderId,direction,trend,road_class,adcode,length,width,start_location_desc,end_location_desc,is_oneway,roadseg_type,main_flag,data_version,pre_data_version,data_mode,relation,geom,wkt,ct_rid,ct_name,ct_seq,gmt_create,gmt_modified
from t_base_rid_info
where start_crossid = #{startCrossid} and end_crossid = #{endCrossid}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.web.mapper.SpecialServiceCrossMapper">
<!-- 通用查询映射结果 -->
<resultMap type="net.wanji.web.po.SpecialServiceCrossPO" id="BaseResultMap">
<result property="id" column="id"/>
<result property="specialServiceId" column="special_service_id"/>
<result property="crossId" column="cross_id"/>
<result property="dir" column="dir"/>
<result property="turn" column="turn"/>
<result property="sort" column="sort"/>
<result property="status" column="status"/>
<result property="gmtCreate" column="gmt_create"/>
<result property="gmtModified" column="gmt_modified"/>
</resultMap>
<insert id="insertOne">
insert into t_special_service_cross(special_service_id,cross_id,dir,sort,status)
values (#{specialServiceId},#{crossId},#{dir},#{sort},#{status})
</insert>
<update id="updateTurn">
update t_special_service_cross
set turn = #{turntype}
where special_service_id = #{specialServiceId} and cross_id = #{startCrossid}
</update>
<update id="updatDir">
update t_special_service_cross
set dir = #{dir}
where special_service_id = #{specialServiceId} and cross_id = #{crossId}
</update>
<update id="updateStatusSuccess">
update t_special_service_cross
set status = 1
where special_service_id = #{specialServiceId} and cross_id = #{crossId}
</update>
<update id="updateStatusFail">
update t_special_service_cross
set status = 0
where special_service_id = #{specialServiceId} and cross_id = #{crossId}
</update>
<update id="updateDir">
update t_special_service_cross
set dir = #{endDirInt}
where special_service_id = #{specialServiceId} and cross_id = #{endCrossid}
</update>
<delete id="deleteCross">
delete from t_special_service_cross
where special_service_id = #{specialServiceId} and cross_id = #{crossId}
</delete>
<delete id="deleteCrossBySpecialServiceId">
delete from t_special_service_cross
where special_service_id = #{id}
</delete>
<select id="getMaxSort" resultType="java.lang.Integer">
select max(sort)
from t_special_service_cross
where special_service_id = #{specialServiceId}
</select>
<select id="selectCrossIdBySort" resultType="java.lang.String">
select cross_id
from t_special_service_cross
where special_service_id = #{specialServiceId} and sort = #{preSort}
</select>
<select id="selectBySpecialServiceId" resultMap="BaseResultMap">
select id,special_service_id,cross_id,dir,turn,sort,status,gmt_create,gmt_modified
from t_special_service_cross
where special_service_id = #{specialServiceId}
order by sort
</select>
<select id="selectStartCrossInDir" resultType="java.lang.Integer">
select dir
from t_special_service_cross
where special_service_id = #{specialServiceId} and cross_id = #{startCrossid}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.web.mapper.SpecialServiceMapper">
<!-- 通用查询映射结果 -->
<resultMap type="net.wanji.web.po.SpecialServicePO" id="BaseResultMap">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="controlModel" column="control_model"/>
<result property="length" column="length"/>
<result property="isDel" column="is_del"/>
<result property="status" column="status"/>
<result property="gmtCreate" column="gmt_create"/>
<result property="gmtModified" column="gmt_modified"/>
</resultMap>
<insert id="insertOne">
insert into t_special_service_info(name,control_model,length,is_del,status)
values (#{name},#{controlModel},#{length},#{isDel},#{status})
</insert>
<insert id="insertLength">
insert into t_special_service_info (length)
values (#{roadLength})
</insert>
<update id="updateSpecialService">
update t_special_service_info
<set>
<if test="name != null and name != ''">
name = #{name},
</if>
</set>
where id = #{id}
</update>
<update id="deleteSpecialService">
update t_special_service_info
set is_del = 1, length = 0, status = 0
where id = #{id}
</update>
<update id="updateLength">
update t_special_service_info
set length = #{roadLength}
where id = #{specialServiceId}
</update>
<update id="updateStatusEnable">
update t_special_service_info
set status = 1
where id = #{specialServiceId}
</update>
<update id="updateStatusDisable">
update t_special_service_info
set status = 0
where id = #{specialServiceId}
</update>
<select id="selectByAdCode" resultMap="BaseResultMap">
select
id,name,control_model,length,is_del,status,gmt_create,gmt_modified
from t_special_service_info
where is_del = 0
order by gmt_modified desc
</select>
<select id="selectRoadLength" resultType="java.lang.Double">
select length
from t_special_service_info
where id = #{specialServiceId}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.web.mapper.VehicleTraceMapper">
<!-- 通用查询映射结果 -->
<resultMap type="net.wanji.web.po.VehicleTracePO" id="BaseResultMap">
<result property="traceTime" column="traceTime"/>
<result property="vehicleCount" column="vehicleCount"/>
</resultMap>
<select id="selectByAdCode" resultMap="BaseResultMap">
select concat(hour(adapt_time), ':', floor(minute(adapt_time)/30)*30) as traceTime,
count(*) as vehicleCount
from t_vehicle_trace_hist
where to_days(#{todayDate}) = to_days(adapt_time)
group by traceTime
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.web.mapper.VideoDeviceInfoMapper">
<!-- 通用查询映射结果 -->
<resultMap type="net.wanji.web.po.VideoDeviceInfoPO" id="BaseResultMap">
<result property="id" column="id"/>
<result property="code" column="code"/>
<result property="name" column="name"/>
<result property="type" column="type"/>
<result property="status" column="status"/>
<result property="location" column="location"/>
<result property="installTime" column="install_time"/>
<result property="gmtCreate" column="gmt_create"/>
<result property="gmtModified" column="gmt_modified"/>
</resultMap>
<select id="selectVideoDevices" resultMap="BaseResultMap">
select id,code,name,type,status,location,install_time,gmt_create,gmt_modified
from t_base_device_info
where type = 4
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<context id="Mysql" defaultModelType="flat">
<property name="javaFileEncoding" value="UTF-8"/>
<!-- xml配置文件中分隔符 -->
<property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/>
<!-- 配置通用的Mapper基类 -->
<plugin type="tk.mybatis.mapper.generator.MapperPlugin">
<property name="mappers" value="com.xiaojukeji.ep.ip.dao.util.MyBaseMapper"/>
</plugin>
<jdbcConnection connectionURL="jdbc:mysql://172.20.24.58/didi-assets"
driverClass="com.mysql.jdbc.Driver"
userId="root"
password="Eifqr!Kge">
</jdbcConnection>
<javaModelGenerator targetPackage="${targetModelPackage}" targetProject="${targetJavaProject}"/>
<sqlMapGenerator targetPackage="${targetXMLPackage}" targetProject="${targetResourcesProject}"/>
<javaClientGenerator targetPackage="${targetMapperPackage}" targetProject="${targetJavaProject}" type="MIXEDMAPPER" />
<!-- 控制生成文件和XML的内容 -->
<table tableName="outsource_user" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false" />
</context>
</generatorConfiguration>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment