Commit e28421f3 authored by wuxiaokai's avatar wuxiaokai
parents 512673fb d271e650
......@@ -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']]])
}
}
stage('编译构建') {
stage('编译构建utc模块') {
steps {
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 {
sh '''
echo \'检查容器是否存在\'
......@@ -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 {
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 {
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'
}
}
}
}
pipeline {
agent {
label 'jenkinsagent-87'
}
stages {
stage('检测环境') {
steps {
sh '''java -version
mvn -v
git version
docker -v'''
}
}
stage('拉取代码') {
steps {
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('编译构建utc模块') {
steps {
sh 'mvn -pl signal-utc-service clean package -Dmaven.test.skip=true jib:build -DsendCredentialsOverHttp=true'
}
}
stage('删除utc模块镜像和容器') {
steps {
sh '''
echo \'检查容器是否存在\'
containerid=`docker ps -a|grep signal-utc-service|awk \'{print $1}\'`
if [ "$containerid" != "" ];then
echo \'容器存在,删除容器\'
docker rm -f $containerid
fi
echo \'检查镜像是否存在\'
imageid=`docker images|grep signal-utc-service|awk \'{print $3}\'`
if [ "$imageid" != "" ];then
echo \'删除镜像\'
docker rmi -f $imageid
fi
'''
}
}
stage('拉取utc模块镜像') {
steps {
sh 'docker pull 10.100.1.87:5000/xinkong/signal-utc-service:0.2.1'
}
}
stage('运行utc模块容器') {
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'
}
}
}
}
......@@ -37,9 +37,6 @@
<properties>
<spring-cloud.version>2021.0.0</spring-cloud.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>
<swagger.version>2.9.2</swagger.version>
<lombok.version>1.16.18</lombok.version>
......@@ -73,23 +70,6 @@
<type>pom</type>
<scope>import</scope>
</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 -->
<dependency>
<groupId>com.alibaba</groupId>
......@@ -170,6 +150,18 @@
<artifactId>artemis-sdk</artifactId>
<version>${artemis.version}</version>
</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>
</dependencyManagement>
......
......@@ -158,7 +158,7 @@
</dependencies>
<build>
<plugins>
<plugins>
<!-- 编译插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
......
......@@ -885,8 +885,8 @@ public class Constants {
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 = "com.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_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*/
......
......@@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 系统管理-厂商管理
*
......@@ -41,9 +43,15 @@ public class ManufacturerController {
@ApiResponse(code = 200, message = "OK", response = ManufacturerInfoPO.class),
})
public JsonViewObject list(@RequestBody ManufacturerListDTO manufacturerListDTO) {
Integer pageSize = manufacturerListDTO.getPageSize();
Integer pageNum = manufacturerListDTO.getPageNum();
if (pageSize == 0 && pageNum == 0) {
// 不分页
manufacturerListDTO.setPageNum(1);
manufacturerListDTO.setPageSize(9999);
}
PageInfo<ManufacturerInfoPO> manufacturerInfoPOPageInfo = manufacturerService.list(manufacturerListDTO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(manufacturerInfoPOPageInfo);
}
......
......@@ -76,7 +76,7 @@ public class TCrossInfo implements Serializable {
/**
* 型号
*/
@TableField("model")
@TableField("po")
private String model;
/**
......
......@@ -25,7 +25,6 @@ public class ApiInfoTask {
@Scheduled(fixedRate = 2 * 60 * 1000)
public void apiInfoRefresh() {
try {
ManufacturerApiInfoPO manufacturerApiInfoPO = new ManufacturerApiInfoPO();
List<ManufacturerApiInfoPO> manufacturerApiInfoPOList = manufacturerApiInfoMapper.selectAll();
if (manufacturerApiInfoPOList == null || manufacturerApiInfoPOList.isEmpty()) {
return;
......
package net.wanji.utc.vo.systemadmin;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -41,6 +42,7 @@ public class CrossInfoListVO {
private String model ;
/** 安装时间 */
@ApiModelProperty(value = "安装时间",notes = "")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date installTime ;
/** 创建时间 */
@ApiModelProperty(value = "创建时间",notes = "")
......
......@@ -22,6 +22,8 @@
<properties>
<java.version>1.8</java.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>
<dependencies>
......@@ -78,26 +80,219 @@
<artifactId>hibernate-validator</artifactId>
<version>6.0.1.Final</version>
</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>
<build>
<plugins>
<!-- 编译插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<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>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>net.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>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>${mybatis.generator.version}</version>
<configuration>
<includeSystemScope>true</includeSystemScope>
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
<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>net.wanji.web.SignalApplication</mainClass>
</container>
<!--可以进行HTTP-->
<allowInsecureRegistries>true</allowInsecureRegistries>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>repackage</goal>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</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;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
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
* @date 2022/11/28 9:31:34
* @author
*/
@MapperScan("net.wanji.web.mapper")
@SpringBootApplication
public class WebApplication {
@SpringBootApplication(scanBasePackages = "net.wanji.web")
@MapperScan(basePackages = "net.wanji.web.mapper")
@EnableTransactionManagement
@EnableScheduling
@EnableAsync
//@EnableDiscoveryClient
public class SignalApplication {
public static void main(String[] args) {
SpringApplication.run(WebApplication.class, args);
SpringApplication.run(SignalApplication.class, args);
}
}
package net.wanji.web.common.annotation;
import net.wanji.web.common.enums.BaseEnum;
import java.lang.annotation.*;
/**
* @Description: [自定义注解-系统操作日志,拦截Controller请求]
* @author wanji
* @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 wanji
* @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 wanji
* @version 1.0
*/
@Target({ElementType.TYPE, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Like {
}
package net.wanji.web.common.constant;
/**
* @Description: [常量类]
* @author wanji
* @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 wanji
* @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;
/**
* @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 wanji
* @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 wanji
* @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 wanji
* @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.date;
/**
* @author wanji
* @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 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 wanji
* @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 wanji
* @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 wanji
* @version 1.0
* Created on 2019年05月06日
*/
@Repository
@DS("webService")
public interface CrossInfoMapper {
/**
* @description: 根据路口id删除基础信息
* @param crossId 路口id
* @return
* @author wanji
* @date 2020/3/19 16:10
*/
void deleteByCrossId(@Param("crossId") String crossId);
/**
* @description: 根据条件获取路口基础信息列表
* @param crossName 路口名称
* @return
* @author wanji
* @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.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;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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