Commit 6377b813 authored by wuxiaokai's avatar wuxiaokai

Merge branch 'master' of http://10.100.1.74:56002/signal/traffic-signal-platform

 Conflicts:
	signal-utc-service/src/main/java/net/wanji/utc/common/commonentity/HttpRequest.java
	signal-utc-service/src/main/java/net/wanji/utc/controller/ControlCommandController.java
	signal-utc-service/src/main/java/net/wanji/utc/service/impl/HKControlCommandServiceImpl.java
	signal-utc-service/src/main/java/net/wanji/utc/service/impl/HkGetSignalMethodServiceImpl.java
parents 44654fad 18cd7f66
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('编译构建') {
steps {
sh 'mvn -pl signal-utc-service clean package -Dmaven.test.skip=true jib:build -DsendCredentialsOverHttp=true'
}
}
stage('删除镜像和容器') {
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('拉取镜像') {
steps {
sh 'docker pull 10.100.1.87:5000/xinkong/signal-utc-service:0.2.1'
}
}
stage('运行容器') {
steps {
sh 'docker run -p 32000:32000 -itd --name signal-utc-service 10.100.1.87:5000/xinkong/signal-utc-service:0.2.1'
}
}
}
}
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<groupId>net.wanji</groupId> <groupId>net.wanji</groupId>
<artifactId>identity-client-starter</artifactId> <artifactId>identity-client-starter</artifactId>
<version>1.0-SNAPSHOT</version> <version>0.2.1</version>
<name>identity-client-starter</name> <name>identity-client-starter</name>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<groupId>net.wanji</groupId> <groupId>net.wanji</groupId>
<artifactId>traffic-signal-platform</artifactId> <artifactId>traffic-signal-platform</artifactId>
<version>1.1.0</version> <version>0.2.1</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>traffic-signal-platform</name> <name>traffic-signal-platform</name>
...@@ -50,6 +50,10 @@ ...@@ -50,6 +50,10 @@
<beanutils.version>1.9.4</beanutils.version> <beanutils.version>1.9.4</beanutils.version>
<httpclient.version>4.5.13</httpclient.version> <httpclient.version>4.5.13</httpclient.version>
<jedis.version>3.3.0</jedis.version> <jedis.version>3.3.0</jedis.version>
<pagehelper.boot.version>1.3.1</pagehelper.boot.version>
<jersey.version>2.23.2</jersey.version>
<artemis.version>1.1.7</artemis.version>
</properties> </properties>
<!-- 依赖声明 --> <!-- 依赖声明 -->
...@@ -148,9 +152,110 @@ ...@@ -148,9 +152,110 @@
<artifactId>jedis</artifactId> <artifactId>jedis</artifactId>
<version>${jedis.version}</version> <version>${jedis.version}</version>
</dependency> </dependency>
<!-- pagehelper 分页插件 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper.boot.version}</version>
</dependency>
<!-- jersey -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>${jersey.version}</version>
</dependency>
<!-- 海康SDK,需要Maven私服 -->
<dependency>
<groupId>com.hikvision</groupId>
<artifactId>artemis-sdk</artifactId>
<version>${artemis.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<!--打包配置-->
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!--清除打包汇总生成的文件-->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>auto-clean</id>
<phase>pre-clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
<configuration>
<skip>false</skip>
<filesets>
<fileset>
<directory>${project.basedir}/assembly</directory>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<!--将启动脚本复制到指定目录-->
<execution>
<id>copy-start-bin</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/assembly</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}</directory>
<filtering>true</filtering>
<includes>
<include>*.sh</include>
<inclede>README.txt</inclede>
<include>license.properties</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
<!--将skywalking复制到指定目录-->
<execution>
<id>copy-thridparty-skywalking</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/assembly/gisc-common/third-party
</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/third-party/</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> </project>
\ No newline at end of file
...@@ -8,12 +8,12 @@ ...@@ -8,12 +8,12 @@
<parent> <parent>
<groupId>net.wanji</groupId> <groupId>net.wanji</groupId>
<artifactId>traffic-signal-platform</artifactId> <artifactId>traffic-signal-platform</artifactId>
<version>1.1.0</version> <version>0.2.1</version>
</parent> </parent>
<groupId>net.wanji</groupId> <groupId>net.wanji</groupId>
<artifactId>signal-utc-service</artifactId> <artifactId>signal-utc-service</artifactId>
<version>1.1.0</version> <version>0.2.1</version>
<name>signal-utc-service</name> <name>signal-utc-service</name>
...@@ -134,17 +134,167 @@ ...@@ -134,17 +134,167 @@
<groupId>redis.clients</groupId> <groupId>redis.clients</groupId>
<artifactId>jedis</artifactId> <artifactId>jedis</artifactId>
</dependency> </dependency>
<!-- pagehelper 分页插件 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<!-- jersey -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
</dependency>
<!-- 海康SDK,需要Maven私服 -->
<dependency>
<groupId>com.hikvision</groupId>
<artifactId>artemis-sdk</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> <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.utc.UtcApplication</mainClass> <mainClass>net.wanji.utc.UtcApplication</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-utc-service</finalName>
<descriptors>
<descriptor>src/main/assembly/package.xml</descriptor>
</descriptors>
</configuration> </configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</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>
</jvmFlags>
<!--配置使用的时区-->
<environment>
<TZ>Asia/Shanghai</TZ>
</environment>
<!--要暴露的端口-->
<ports>
<port>32000</port>
</ports>
<!-- <creationTime>2022-10-14T10:08:59.304+08:00</creationTime>-->
<creationTime>${maven.build.timestamp}</creationTime>
<mainClass>net.wanji.utc.UtcApplication</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>0.2.1</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>
...@@ -14,6 +14,6 @@ public class BaseCrossInfo { ...@@ -14,6 +14,6 @@ public class BaseCrossInfo {
@ApiModelProperty(value = "信号机ID") @ApiModelProperty(value = "信号机ID")
private String code; private String code;
@ApiModelProperty(value = "厂商缩写") @ApiModelProperty(value = "厂商代码")
private String manufacturerAbbr; private String manufacturerCode;
} }
...@@ -3,7 +3,7 @@ package net.wanji.utc.common.commonentity; ...@@ -3,7 +3,7 @@ package net.wanji.utc.common.commonentity;
import lombok.Data; import lombok.Data;
import net.wanji.utc.common.constant.Constants; import net.wanji.utc.common.constant.Constants;
import net.wanji.utc.common.exception.NoSuchApiException; import net.wanji.utc.common.exception.NoSuchApiException;
import net.wanji.utc.po.ApiInfoPO; import net.wanji.utc.po.ManufacturerApiInfoPO;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
...@@ -21,15 +21,15 @@ public class HttpRequest { ...@@ -21,15 +21,15 @@ public class HttpRequest {
} }
public HttpRequest(String manufacturerAbbr, String apiCode) { public HttpRequest(String manufacturerCode, String apiCode) {
// 获取请求地址 // 获取请求地址
ApiInfoPO apiInfoPo = Constants.getManufacturerUrlMap(manufacturerAbbr + ManufacturerApiInfoPO manufacturerApiInfoPO = Constants.getManufacturerUrlMap(manufacturerCode +
Constants.SEPARATOR_UNDER_LINE + apiCode); Constants.SEPARATOR_UNDER_LINE + apiCode);
if (apiInfoPo == null) { if (manufacturerApiInfoPO == null) {
throw new NoSuchApiException("没有此接口信息,请在t_manufacturer_api_info表中添加"); throw new NoSuchApiException("没有此接口信息,请在t_manufacturer_api_info表中添加");
} }
url = apiInfoPo.getAddress(); url = manufacturerApiInfoPO.getAddress();
httpMethod = HttpMethod.valueOf(apiInfoPo.getMethod()); httpMethod = HttpMethod.valueOf(manufacturerApiInfoPO.getMethod());
headers = buildHeader(); headers = buildHeader();
} }
......
package net.wanji.utc.common.exception;
/**
* @author Kent HAN
* @date 2022/11/15 13:57
*/
public class IpPortException extends RuntimeException{
public IpPortException(String message) {
super(message);
}
public IpPortException(String message, Exception e) {
super(message,e);
}
}
package net.wanji.utc.common.exception;
/**
* @author Kent HAN
* @date 2022/11/15 13:57
*/
public class PortFormatException extends RuntimeException{
public PortFormatException(String message) {
super(message);
}
public PortFormatException(String message, Exception e) {
super(message,e);
}
}
...@@ -19,9 +19,9 @@ public class OutVO<T> { ...@@ -19,9 +19,9 @@ public class OutVO<T> {
private String systemAbbr; private String systemAbbr;
/** /**
* 厂商缩写 * 厂商代码
*/ */
private String manufacturerAbbr; private String manufacturerCode;
/** /**
* 更新时间 * 更新时间
......
...@@ -2,9 +2,9 @@ package net.wanji.utc.common.task; ...@@ -2,9 +2,9 @@ package net.wanji.utc.common.task;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.utc.common.constant.Constants; import net.wanji.utc.common.constant.Constants;
import net.wanji.utc.mapper.ApiInfoMapper; import net.wanji.utc.mapper.ManufacturerApiInfoMapper;
import net.wanji.utc.mapper.ManufacturerInfoMapper; import net.wanji.utc.mapper.ManufacturerInfoMapper;
import net.wanji.utc.po.ApiInfoPO; import net.wanji.utc.po.ManufacturerApiInfoPO;
import net.wanji.utc.po.ManufacturerInfoPO; import net.wanji.utc.po.ManufacturerInfoPO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
...@@ -18,27 +18,27 @@ import java.util.List; ...@@ -18,27 +18,27 @@ import java.util.List;
@EnableAsync @EnableAsync
public class ApiInfoTask { public class ApiInfoTask {
@Autowired @Autowired
ApiInfoMapper apiInfoMapper; ManufacturerApiInfoMapper manufacturerApiInfoMapper;
@Autowired @Autowired
ManufacturerInfoMapper manufacturerInfoMapper; ManufacturerInfoMapper manufacturerInfoMapper;
@Scheduled(fixedRate = 2 * 60 * 1000) @Scheduled(fixedRate = 2 * 60 * 1000)
public void apiInfoRefresh() { public void apiInfoRefresh() {
try { try {
ApiInfoPO apiInfoPO = new ApiInfoPO(); ManufacturerApiInfoPO manufacturerApiInfoPO = new ManufacturerApiInfoPO();
List<ApiInfoPO> apiInfoPOList = apiInfoMapper.selectAll(); List<ManufacturerApiInfoPO> manufacturerApiInfoPOList = manufacturerApiInfoMapper.selectAll();
if (apiInfoPOList== null || apiInfoPOList.isEmpty()) { if (manufacturerApiInfoPOList == null || manufacturerApiInfoPOList.isEmpty()) {
return; return;
} }
// 刷新JVM // 刷新JVM
for (ApiInfoPO infoPO : apiInfoPOList) { for (ManufacturerApiInfoPO infoPO : manufacturerApiInfoPOList) {
Integer manufacturerId = infoPO.getManufacturerId(); Integer manufacturerId = infoPO.getManufacturerId();
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectById(manufacturerId); ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectById(manufacturerId);
String abbr = manufacturerInfoPO.getNickName(); String code = manufacturerInfoPO.getCode();
String s = abbr + Constants.SEPARATOR_UNDER_LINE + infoPO.getCode(); String s = code + Constants.SEPARATOR_UNDER_LINE + infoPO.getCode();
Constants.putManufacturerUrlMap(s, infoPO); Constants.putManufacturerUrlMap(s, infoPO);
} }
log.info("刷新" + apiInfoPOList.size() + "条厂商URL至JVM"); log.info("刷新" + manufacturerApiInfoPOList.size() + "条厂商URL至JVM");
} catch (Exception e) { } catch (Exception e) {
log.error("刷新厂商URL到JVM异常", e); log.error("刷新厂商URL到JVM异常", e);
} }
......
...@@ -9,8 +9,8 @@ public class BasicEnum { ...@@ -9,8 +9,8 @@ public class BasicEnum {
public enum ManufacturerEnum { public enum ManufacturerEnum {
HK(1, "海康", "HK"); HK(1, "海康", "HK");
private Integer code; private Integer id;
private String name; private String nick;
private String abbr; private String code;
} }
} }
package net.wanji.utc.common.typeenum;
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.utc.common.typeenum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author Kent HAN
* @date 2022/11/24 14:16
*/
@Getter
@AllArgsConstructor
public enum ManufacturerApiInfoTypeEnum {
ONE(1, "静态信息接口"),
TWO(2, "运行信息接口"),
THREE(3, "控制指令接口");
private Integer code;
private String msg;
public static Integer getCodeByMsg(String typeStr) {
for (ManufacturerApiInfoTypeEnum value : values()) {
if (value.getMsg().equals(typeStr)) {
return value.getCode();
}
}
return null;
}
}
...@@ -34,7 +34,7 @@ public class Swagger2 { ...@@ -34,7 +34,7 @@ public class Swagger2 {
//创建人 //创建人
.contact(new Contact("test", "#", "test@wanji.net.cn")) .contact(new Contact("test", "#", "test@wanji.net.cn"))
//版本号 //版本号
.version("1.1.0") .version("0.2.1")
//描述 //描述
.description("城市交通信号厂商调用服务API") .description("城市交通信号厂商调用服务API")
.build(); .build();
......
package net.wanji.utc.controller;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.utc.entity.JsonViewObject;
import net.wanji.utc.service.systemadmin.CrossInfoService;
import net.wanji.utc.vo.systemadmin.*;
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;
/**
* 系统管理-信号机管理
*
* @author Kent HAN
* @date 2022/11/24 8:32
*/
@Api(value = "系统管理-信号机管理", description = "系统管理-信号机管理")
@RequestMapping("/crossInfo")
@RestController
public class CrossInfoController {
@Autowired
CrossInfoService crossInfoService;
@ApiOperation(value = "信号机列表", notes = "信号机列表", response = CrossInfoListOutVO.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/list",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = CrossInfoListOutVO.class),
})
public JsonViewObject list(@RequestBody CrossInfoListInVO crossInfoListInVO) {
PageInfo<CrossInfoListOutVO> crossInfoListOutVOPageInfo = crossInfoService.list(crossInfoListInVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(crossInfoListOutVOPageInfo);
}
@ApiOperation(value = "信号机添加或修改", notes = "信号机添加或修改", consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/insertOrUpdate", consumes = MediaType.APPLICATION_JSON)
public JsonViewObject insertOrUpdate(@RequestBody CrossInfoInsertOrUpdateInVO inVO) {
crossInfoService.insertOrUpdate(inVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success();
}
@ApiOperation(value = "信号机删除", notes = "信号机删除", consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/delete", consumes = MediaType.APPLICATION_JSON)
public JsonViewObject delete(@RequestBody DeleteByStringIdListInVO inVO) {
crossInfoService.delete(inVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success();
}
}
package net.wanji.utc.controller;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.utc.entity.JsonViewObject;
import net.wanji.utc.po.ManufacturerApiInfoPO;
import net.wanji.utc.service.systemadmin.ManufacturerApiInfoService;
import net.wanji.utc.vo.systemadmin.DeleteByIntegerIdListInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoInsertOrUpdateInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoListInVO;
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;
/**
* 系统管理-接口管理
*
* @author Kent HAN
* @date 2022/11/24 8:32
*/
@Api(value = "系统管理-接口管理", description = "系统管理-接口管理")
@RequestMapping("/manufacturerApiInfo")
@RestController
public class ManufacturerApiController {
@Autowired
ManufacturerApiInfoService manufacturerApiInfoService;
@ApiOperation(value = "接口列表", notes = "接口列表", response = ManufacturerApiInfoPO.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/list",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = ManufacturerApiInfoPO.class),
})
public JsonViewObject list(@RequestBody ManufacturerApiInfoListInVO manufacturerApiInfoListInVO) {
PageInfo<ManufacturerApiInfoPO> manufacturerApiInfoPOPageInfo =
manufacturerApiInfoService.list(manufacturerApiInfoListInVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(manufacturerApiInfoPOPageInfo);
}
@ApiOperation(value = "接口添加或修改", notes = "接口添加或修改", consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/insertOrUpdate", consumes = MediaType.APPLICATION_JSON)
public JsonViewObject insertOrUpdate(@RequestBody ManufacturerApiInfoInsertOrUpdateInVO inVO) {
manufacturerApiInfoService.insertOrUpdate(inVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success();
}
@ApiOperation(value = "接口删除", notes = "接口删除", consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/delete", consumes = MediaType.APPLICATION_JSON)
public JsonViewObject delete(@RequestBody DeleteByIntegerIdListInVO inVO) {
manufacturerApiInfoService.delete(inVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success();
}
}
package net.wanji.utc.controller;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.utc.entity.JsonViewObject;
import net.wanji.utc.po.ManufacturerInfoPO;
import net.wanji.utc.service.systemadmin.ManufacturerService;
import net.wanji.utc.vo.systemadmin.DeleteByIntegerIdListInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerInsertOrUpdateInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerListInVO;
import org.springframework.beans.factory.annotation.Autowired;
import javax.ws.rs.core.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 系统管理-厂商管理
*
* @author Kent HAN
* @date 2022/11/24 8:32
*/
@Api(value = "系统管理-厂商管理", description = "系统管理-厂商管理")
@RequestMapping("/manufacturer")
@RestController
public class ManufacturerController {
@Autowired
ManufacturerService manufacturerService;
@ApiOperation(value = "厂商列表", notes = "厂商列表", response = ManufacturerInfoPO.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/list",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = ManufacturerInfoPO.class),
})
public JsonViewObject list(@RequestBody ManufacturerListInVO manufacturerListInVO) {
PageInfo<ManufacturerInfoPO> manufacturerInfoPOPageInfo = manufacturerService.list(manufacturerListInVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success(manufacturerInfoPOPageInfo);
}
@ApiOperation(value = "厂商添加或修改", notes = "厂商添加或修改", consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/insertOrUpdate", consumes = MediaType.APPLICATION_JSON)
public JsonViewObject insertOrUpdate(@RequestBody ManufacturerInsertOrUpdateInVO inVO) {
manufacturerService.insertOrUpdate(inVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success();
}
@ApiOperation(value = "厂商删除", notes = "厂商删除", consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/delete", consumes = MediaType.APPLICATION_JSON)
public JsonViewObject delete(@RequestBody DeleteByIntegerIdListInVO inVO) {
manufacturerService.delete(inVO);
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
return jsonViewObject.success();
}
}
...@@ -33,8 +33,8 @@ public class StaticInfoController { ...@@ -33,8 +33,8 @@ public class StaticInfoController {
@ApiOperation(value = "信号路口基础信息", notes = "信号路口基础信息") @ApiOperation(value = "信号路口基础信息", notes = "信号路口基础信息")
public ResponseEntity crossInfo(HttpServletRequest request, @RequestBody CrossInfoInVO crossInfoInVO) { public ResponseEntity crossInfo(HttpServletRequest request, @RequestBody CrossInfoInVO crossInfoInVO) {
OutVO<BaseCrossInfo> outVO = new OutVO<>(); OutVO<BaseCrossInfo> outVO = new OutVO<>();
String manufacturerAbbr = crossInfoInVO.getManufacturerAbbr(); String manufacturerCode = crossInfoInVO.getManufacturerCode();
outVO.setManufacturerAbbr(manufacturerAbbr); outVO.setManufacturerCode(manufacturerCode);
outVO.setUpdatetime(new Date()); outVO.setUpdatetime(new Date());
outVO.setSystemAbbr(Constants.SYSTEM_ABBR); outVO.setSystemAbbr(Constants.SYSTEM_ABBR);
......
package net.wanji.utc.entity;
import lombok.Data;
import net.wanji.utc.common.constant.Constants;
import net.wanji.utc.common.typeenum.HttpCode;
import java.io.Serializable;
@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.utc.mapper;
import net.wanji.utc.po.ApiInfoPO;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/15 15:31
*/
public interface ApiInfoMapper {
List<ApiInfoPO> selectAll();
}
...@@ -23,4 +23,13 @@ public interface CrossInfoMapper { ...@@ -23,4 +23,13 @@ public interface CrossInfoMapper {
List<CrossInfoPO> selectByManufacturerId(@Param("manufacturerId") Integer manufacturerId); List<CrossInfoPO> selectByManufacturerId(@Param("manufacturerId") Integer manufacturerId);
List<CrossInfoPO> selectAll(); List<CrossInfoPO> selectAll();
List<CrossInfoPO> selectByOptionals(@Param("crossName") String crossName,
@Param("manufacturerId") Integer manufacturerId);
void insertOne(CrossInfoPO crossInfoPO);
void updateOne(CrossInfoPO crossInfoPO);
void deleteBatch(@Param("ids") List<String> ids);
} }
package net.wanji.utc.mapper;
import net.wanji.utc.po.ManufacturerApiInfoPO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/15 15:31
*/
public interface ManufacturerApiInfoMapper {
List<ManufacturerApiInfoPO> selectAll();
List<ManufacturerApiInfoPO> selectByOptionals(@Param("name") String name,
@Param("typeCode")Integer typeCode,
@Param("manufacturerId")Integer manufacturerId);
void insertOne(ManufacturerApiInfoPO manufacturerApiInfoPO);
void updateOne(ManufacturerApiInfoPO manufacturerApiInfoPO);
void deleteBatch(@Param("ids") List<Integer> ids);
}
...@@ -3,7 +3,6 @@ package net.wanji.utc.mapper; ...@@ -3,7 +3,6 @@ package net.wanji.utc.mapper;
import net.wanji.utc.po.ManufacturerInfoPO; import net.wanji.utc.po.ManufacturerInfoPO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
...@@ -12,9 +11,19 @@ import java.util.List; ...@@ -12,9 +11,19 @@ import java.util.List;
*/ */
public interface ManufacturerInfoMapper { public interface ManufacturerInfoMapper {
ManufacturerInfoPO selectByAbbr(@Param("abbr") String abbr); ManufacturerInfoPO selectByCode(@Param("code") String code);
ManufacturerInfoPO selectById(@Param("manufacturerId") Integer manufacturerId); ManufacturerInfoPO selectById(@Param("manufacturerId") Integer manufacturerId);
List<ManufacturerInfoPO> selectAll(); List<ManufacturerInfoPO> selectAll();
List<ManufacturerInfoPO> selectByOptionalPartialName(@Param("name") String name);
void insertOne(ManufacturerInfoPO manufacturerInfoPO);
void updateOne(ManufacturerInfoPO manufacturerInfoPO);
void deleteBatch(@Param("ids") List<Integer> ids);
Integer selectIdByNick(@Param("manufacturerNick") String manufacturerNick);
} }
...@@ -11,39 +11,39 @@ import java.util.Date; ...@@ -11,39 +11,39 @@ import java.util.Date;
*/ */
@Data @Data
public class CrossInfoPO { public class CrossInfoPO {
@ApiModelProperty(name = "路口ID",notes = "") @ApiModelProperty(value = "路口ID",notes = "")
private String id ; private String id ;
/** 路口名称 */ /** 路口名称 */
@ApiModelProperty(name = "路口名称",notes = "") @ApiModelProperty(value = "路口名称",notes = "")
private String name ; private String name ;
/** 信号机编号 */ /** 信号机编号 */
@ApiModelProperty(name = "信号机编号",notes = "") @ApiModelProperty(value = "信号机编号",notes = "")
private String code ; private String code ;
/** 厂商ID */ /** 厂商ID */
@ApiModelProperty(name = "厂商ID",notes = "") @ApiModelProperty(value = "厂商ID",notes = "")
private Integer manufacturerId ; private Integer manufacturerId ;
/** 信号机IP */ /** 信号机IP */
@ApiModelProperty(name = "信号机IP",notes = "") @ApiModelProperty(value = "信号机IP",notes = "")
private String ip ; private String ip ;
/** 信号机端口 */ /** 信号机端口 */
@ApiModelProperty(name = "信号机端口",notes = "") @ApiModelProperty(value = "信号机端口",notes = "")
private Integer port ; private Integer port ;
/** 经纬度 */ /** 经纬度 */
@ApiModelProperty(name = "经纬度",notes = "") @ApiModelProperty(value = "经纬度",notes = "")
private String location ; private String location ;
/** 版本号 */ /** 版本号 */
@ApiModelProperty(name = "版本号",notes = "") @ApiModelProperty(value = "版本号",notes = "")
private String version ; private String version ;
/** 型号 */ /** 型号 */
@ApiModelProperty(name = "型号",notes = "") @ApiModelProperty(value = "型号",notes = "")
private String model ; private String model ;
/** 安装时间 */ /** 安装时间 */
@ApiModelProperty(name = "安装时间",notes = "") @ApiModelProperty(value = "安装时间",notes = "")
private Date installTime ; private Date installTime ;
/** 创建时间 */ /** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "") @ApiModelProperty(value = "创建时间",notes = "")
private Date gmtCreate ; private Date gmtCreate ;
/** 修改时间 */ /** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "") @ApiModelProperty(value = "修改时间",notes = "")
private Date gmtModified ; private Date gmtModified ;
} }
...@@ -10,32 +10,32 @@ import java.util.Date; ...@@ -10,32 +10,32 @@ import java.util.Date;
* @date 2022/11/15 13:41 * @date 2022/11/15 13:41
*/ */
@Data @Data
public class ApiInfoPO { public class ManufacturerApiInfoPO {
/** 接口ID */ /** 接口ID */
@ApiModelProperty(name = "接口ID",notes = "") @ApiModelProperty(value = "接口ID",notes = "")
private Integer id ; private Integer id ;
/** 接口代码 */ /** 接口代码 */
@ApiModelProperty(name = "接口代码",notes = "") @ApiModelProperty(value = "接口代码",notes = "")
private String code ; private String code ;
/** 接口名称 */ /** 接口名称 */
@ApiModelProperty(name = "接口名称",notes = "") @ApiModelProperty(value = "接口名称",notes = "")
private String name ; private String name ;
/** 接口类型:1、静态;2、动态;3、控制 */ /** 接口类型:1、静态;2、动态;3、控制 */
@ApiModelProperty(name = "接口类型:1、静态;2、动态;3、控制",notes = "") @ApiModelProperty(value = "接口类型:1、静态;2、动态;3、控制",notes = "")
private Integer type ; private Integer type ;
/** 请求方式:get、post */ /** 请求方式:get、post */
@ApiModelProperty(name = "请求方式:get、post",notes = "") @ApiModelProperty(value = "请求方式:get、post",notes = "")
private String method ; private String method ;
/** 接口地址 */ /** 接口地址 */
@ApiModelProperty(name = "接口地址",notes = "") @ApiModelProperty(value = "接口地址",notes = "")
private String address ; private String address ;
/** 厂商ID */ /** 厂商ID */
@ApiModelProperty(name = "厂商ID",notes = "") @ApiModelProperty(value = "厂商ID",notes = "")
private Integer manufacturerId ; private Integer manufacturerId ;
/** 创建时间 */ /** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "") @ApiModelProperty(value = "创建时间",notes = "")
private Date gmtCreate ; private Date gmtCreate ;
/** 修改时间 */ /** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "") @ApiModelProperty(value = "修改时间",notes = "")
private Date gmtModified ; private Date gmtModified ;
} }
package net.wanji.utc.po; package net.wanji.utc.po;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -10,29 +11,30 @@ import java.util.Date; ...@@ -10,29 +11,30 @@ import java.util.Date;
* @date 2022/11/15 16:47 * @date 2022/11/15 16:47
*/ */
@Data @Data
@ApiModel(value = "ManufacturerInfoPO", description = "查询厂商列表返回值")
public class ManufacturerInfoPO { public class ManufacturerInfoPO {
/** 厂商ID */ /** 厂商ID */
@ApiModelProperty(name = "厂商ID",notes = "") @ApiModelProperty(value = "厂商ID",notes = "")
private Integer id ; private Integer id ;
/** 厂商代码 */ /** 厂商代码 */
@ApiModelProperty(name = "厂商代码",notes = "") @ApiModelProperty(value = "厂商代码",notes = "")
private String code ; private String code ;
/** 厂商名称 */ /** 厂商名称 */
@ApiModelProperty(name = "厂商名称",notes = "") @ApiModelProperty(value = "厂商名称",notes = "")
private String name ; private String name ;
/** 厂商简称 */ /** 厂商简称 */
@ApiModelProperty(name = "厂商简称",notes = "") @ApiModelProperty(value = "厂商简称",notes = "")
private String nickName ; private String nickName ;
/** 平台地址 */ /** 平台地址 */
@ApiModelProperty(name = "平台地址",notes = "") @ApiModelProperty(value = "平台地址",notes = "")
private String address ; private String address ;
/** 维护单位 */ /** 维护单位 */
@ApiModelProperty(name = "维护单位",notes = "") @ApiModelProperty(value = "维护单位",notes = "")
private String maintenanceUnit ; private String maintenanceUnit ;
/** 创建时间 */ /** 创建时间 */
@ApiModelProperty(name = "创建时间",notes = "") @ApiModelProperty(value = "创建时间",notes = "")
private Date gmtCreate ; private Date gmtCreate ;
/** 修改时间 */ /** 修改时间 */
@ApiModelProperty(name = "修改时间",notes = "") @ApiModelProperty(value = "修改时间",notes = "")
private Date gmtModified ; private Date gmtModified ;
} }
...@@ -77,7 +77,7 @@ public class HkLightsStatusServiceImpl implements HkLightsStatusService { ...@@ -77,7 +77,7 @@ public class HkLightsStatusServiceImpl implements HkLightsStatusService {
int curRunTime = jsonObject.getIntValue("curRunTime"); // 当前运行时长 int curRunTime = jsonObject.getIntValue("curRunTime"); // 当前运行时长
int cycleCountDown = cycleLen - curRunTime; // 周期剩余时长 int cycleCountDown = cycleLen - curRunTime; // 周期剩余时长
infoVo.setCode(entity.getCode()); infoVo.setCode(entity.getCode());
infoVo.setManufacturerAbbr(entity.getManufacturerAbbr()); infoVo.setManufacturerCode(entity.getManufacturerCode());
infoVo.setCycleCountDown(cycleCountDown); infoVo.setCycleCountDown(cycleCountDown);
infoVo.setCycleLen(cycleLen); infoVo.setCycleLen(cycleLen);
// 循环相位列表 // 循环相位列表
...@@ -159,7 +159,7 @@ public class HkLightsStatusServiceImpl implements HkLightsStatusService { ...@@ -159,7 +159,7 @@ public class HkLightsStatusServiceImpl implements HkLightsStatusService {
private Map<String, String> getPathMapByApiCode(String apiCode) { private Map<String, String> getPathMapByApiCode(String apiCode) {
Map<String, String> res = new HashMap<>(); Map<String, String> res = new HashMap<>();
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getAbbr(), apiCode); HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getCode(), apiCode);
res.put("http://", artemisPath + httpRequest.getUrl()); res.put("http://", artemisPath + httpRequest.getUrl());
return res; return res;
} }
......
...@@ -65,7 +65,7 @@ public class HkRunningStatusServiceImpl implements HkRunningStatusService { ...@@ -65,7 +65,7 @@ public class HkRunningStatusServiceImpl implements HkRunningStatusService {
} }
// 从Redis中查询控制类型 // 从Redis中查询控制类型
String lightsStatusVOStr = redisUtil.getHash(RedisKeyConst.KEY_PREFIX + RedisKeyConst.LIGHTS_STATUS, String lightsStatusVOStr = redisUtil.getHash(RedisKeyConst.KEY_PREFIX + RedisKeyConst.LIGHTS_STATUS,
baseCrossInfo.getManufacturerAbbr() + Constants.SEPARATOR_UNDER_LINE + po.getSignalId()); baseCrossInfo.getManufacturerCode() + Constants.SEPARATOR_UNDER_LINE + po.getSignalId());
LightsStatusVO lightsStatusVO = JSON.parseObject(lightsStatusVOStr, LightsStatusVO.class); LightsStatusVO lightsStatusVO = JSON.parseObject(lightsStatusVOStr, LightsStatusVO.class);
String runMode = lightsStatusVO.getRunMode(); String runMode = lightsStatusVO.getRunMode();
int runModeInt = Integer.parseInt(runMode); int runModeInt = Integer.parseInt(runMode);
...@@ -83,7 +83,7 @@ public class HkRunningStatusServiceImpl implements HkRunningStatusService { ...@@ -83,7 +83,7 @@ public class HkRunningStatusServiceImpl implements HkRunningStatusService {
private Map<String, String> getPathMapByApiCode(String apiCode) { private Map<String, String> getPathMapByApiCode(String apiCode) {
Map<String, String> res = new HashMap<>(); Map<String, String> res = new HashMap<>();
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getAbbr(), apiCode); HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getCode(), apiCode);
res.put("http://", artemisPath + httpRequest.getUrl()); res.put("http://", artemisPath + httpRequest.getUrl());
return res; return res;
} }
......
...@@ -47,7 +47,7 @@ public class SignalStatusServiceImpl implements SignalStatusService { ...@@ -47,7 +47,7 @@ public class SignalStatusServiceImpl implements SignalStatusService {
List<BaseCrossInfo> baseCrossInfoList = getBaseCrossInfoList(manufacturerEnum); List<BaseCrossInfo> baseCrossInfoList = getBaseCrossInfoList(manufacturerEnum);
if (baseCrossInfoList == null) continue; if (baseCrossInfoList == null) continue;
List<SignalStatusLogPO> signalStatusLogPOList = null; List<SignalStatusLogPO> signalStatusLogPOList = null;
if(manufacturerEnum.getAbbr().equals(BasicEnum.ManufacturerEnum.HK.getAbbr())) { if(manufacturerEnum.getCode().equals(BasicEnum.ManufacturerEnum.HK.getCode())) {
// 海康 // 海康
// 3.2.5信号机运行状态和告警信息 // 3.2.5信号机运行状态和告警信息
signalStatusLogPOList = hkRunningStatusService.getHkRunningStatus(baseCrossInfoList); signalStatusLogPOList = hkRunningStatusService.getHkRunningStatus(baseCrossInfoList);
...@@ -63,7 +63,7 @@ public class SignalStatusServiceImpl implements SignalStatusService { ...@@ -63,7 +63,7 @@ public class SignalStatusServiceImpl implements SignalStatusService {
// 更新Redis // 更新Redis
if (null != signalStatusLogPOList) { if (null != signalStatusLogPOList) {
for (SignalStatusLogPO signalStatusLogPO : signalStatusLogPOList) { for (SignalStatusLogPO signalStatusLogPO : signalStatusLogPOList) {
String field = manufacturerEnum.getAbbr() + Constants.SEPARATOR_UNDER_LINE + String field = manufacturerEnum.getCode() + Constants.SEPARATOR_UNDER_LINE +
signalStatusLogPO.getSignalId(); signalStatusLogPO.getSignalId();
redisUtil.setHash(RedisKeyConst.KEY_PREFIX + RedisKeyConst.TELESEME_STATUS, field, redisUtil.setHash(RedisKeyConst.KEY_PREFIX + RedisKeyConst.TELESEME_STATUS, field,
signalStatusLogPO.getStatus()+""); signalStatusLogPO.getStatus()+"");
...@@ -83,7 +83,7 @@ public class SignalStatusServiceImpl implements SignalStatusService { ...@@ -83,7 +83,7 @@ public class SignalStatusServiceImpl implements SignalStatusService {
List<BaseCrossInfo> baseCrossInfoList = getBaseCrossInfoList(manufacturerEnum); List<BaseCrossInfo> baseCrossInfoList = getBaseCrossInfoList(manufacturerEnum);
if (baseCrossInfoList == null) continue; if (baseCrossInfoList == null) continue;
List<LightsStatusVO> lightsStatusVOList = null; List<LightsStatusVO> lightsStatusVOList = null;
if(manufacturerEnum.getAbbr().equals(BasicEnum.ManufacturerEnum.HK.getAbbr())) { if(manufacturerEnum.getCode().equals(BasicEnum.ManufacturerEnum.HK.getCode())) {
// 海康 // 海康
// 3.2.4灯态 // 3.2.4灯态
lightsStatusVOList = hkLightsStatusService.getHkLightsStatus(baseCrossInfoList); lightsStatusVOList = hkLightsStatusService.getHkLightsStatus(baseCrossInfoList);
...@@ -93,7 +93,7 @@ public class SignalStatusServiceImpl implements SignalStatusService { ...@@ -93,7 +93,7 @@ public class SignalStatusServiceImpl implements SignalStatusService {
// 更新Redis // 更新Redis
if (lightsStatusVOList != null) { if (lightsStatusVOList != null) {
for (LightsStatusVO lightsStatusVO : lightsStatusVOList) { for (LightsStatusVO lightsStatusVO : lightsStatusVOList) {
String field = manufacturerEnum.getAbbr() + Constants.SEPARATOR_UNDER_LINE + String field = manufacturerEnum.getCode() + Constants.SEPARATOR_UNDER_LINE +
lightsStatusVO.getCode(); lightsStatusVO.getCode();
redisUtil.setHash(RedisKeyConst.KEY_PREFIX + RedisKeyConst.LIGHTS_STATUS, field, redisUtil.setHash(RedisKeyConst.KEY_PREFIX + RedisKeyConst.LIGHTS_STATUS, field,
JSON.toJSONString(lightsStatusVO)); JSON.toJSONString(lightsStatusVO));
...@@ -104,7 +104,7 @@ public class SignalStatusServiceImpl implements SignalStatusService { ...@@ -104,7 +104,7 @@ public class SignalStatusServiceImpl implements SignalStatusService {
private List<BaseCrossInfo> getBaseCrossInfoList(BasicEnum.ManufacturerEnum manufacturerEnum) { private List<BaseCrossInfo> getBaseCrossInfoList(BasicEnum.ManufacturerEnum manufacturerEnum) {
// 查询路口信息 // 查询路口信息
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByAbbr(manufacturerEnum.getAbbr()); ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByCode(manufacturerEnum.getCode());
Integer manufacturerId = manufacturerInfoPO.getId(); Integer manufacturerId = manufacturerInfoPO.getId();
List<CrossInfoPO> crossInfoPOList = crossInfoMapper.selectByManufacturerId(manufacturerId); List<CrossInfoPO> crossInfoPOList = crossInfoMapper.selectByManufacturerId(manufacturerId);
if (ListUtil.isEmpty(crossInfoPOList)) { if (ListUtil.isEmpty(crossInfoPOList)) {
...@@ -115,7 +115,7 @@ public class SignalStatusServiceImpl implements SignalStatusService { ...@@ -115,7 +115,7 @@ public class SignalStatusServiceImpl implements SignalStatusService {
for (CrossInfoPO infoPO : crossInfoPOList) { for (CrossInfoPO infoPO : crossInfoPOList) {
BaseCrossInfo baseCrossInfo = new BaseCrossInfo(); BaseCrossInfo baseCrossInfo = new BaseCrossInfo();
baseCrossInfo.setCode(infoPO.getCode()); baseCrossInfo.setCode(infoPO.getCode());
baseCrossInfo.setManufacturerAbbr(manufacturerEnum.getAbbr()); baseCrossInfo.setManufacturerCode(manufacturerEnum.getCode());
baseCrossInfoList.add(baseCrossInfo); baseCrossInfoList.add(baseCrossInfo);
} }
return baseCrossInfoList; return baseCrossInfoList;
......
...@@ -8,5 +8,5 @@ import net.wanji.utc.vo.DetailCrossInfoVO; ...@@ -8,5 +8,5 @@ import net.wanji.utc.vo.DetailCrossInfoVO;
* @date 2022/11/16 11:03 * @date 2022/11/16 11:03
*/ */
public interface OthersStaticInfoService { public interface OthersStaticInfoService {
ManufacturerRes<DetailCrossInfoVO> crossBasicInfo(String manufacturerAbbr); ManufacturerRes<DetailCrossInfoVO> crossBasicInfo(String manufacturerCode);
} }
...@@ -110,7 +110,7 @@ public class HkCrossSchedulesServiceImpl implements HkCrossSchedulesService { ...@@ -110,7 +110,7 @@ public class HkCrossSchedulesServiceImpl implements HkCrossSchedulesService {
private Map<String, String> getPathMapByApiCode(String apiCode) { private Map<String, String> getPathMapByApiCode(String apiCode) {
Map<String, String> res = new HashMap<>(); Map<String, String> res = new HashMap<>();
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getAbbr(), apiCode); HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getCode(), apiCode);
res.put("http://", artemisPath + httpRequest.getUrl()); res.put("http://", artemisPath + httpRequest.getUrl());
return res; return res;
} }
......
...@@ -111,7 +111,7 @@ public class HkPlanSectionServiceImpl implements HkPlanSectionService { ...@@ -111,7 +111,7 @@ public class HkPlanSectionServiceImpl implements HkPlanSectionService {
private Map<String, String> getPathMapByApiCode(String apiCode) { private Map<String, String> getPathMapByApiCode(String apiCode) {
Map<String, String> res = new HashMap<>(); Map<String, String> res = new HashMap<>();
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getAbbr(), apiCode); HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getCode(), apiCode);
res.put("http://", artemisPath + httpRequest.getUrl()); res.put("http://", artemisPath + httpRequest.getUrl());
return res; return res;
} }
......
...@@ -253,7 +253,7 @@ public class HkSchemePhaseLightsServiceImpl implements HkSchemePhaseLightsServic ...@@ -253,7 +253,7 @@ public class HkSchemePhaseLightsServiceImpl implements HkSchemePhaseLightsServic
private Map<String, String> getPathMapByApiCode(String apiCode) { private Map<String, String> getPathMapByApiCode(String apiCode) {
Map<String, String> res = new HashMap<>(); Map<String, String> res = new HashMap<>();
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getAbbr(), apiCode); HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getCode(), apiCode);
res.put("http://", artemisPath + httpRequest.getUrl()); res.put("http://", artemisPath + httpRequest.getUrl());
return res; return res;
} }
......
...@@ -74,8 +74,8 @@ public class HkStaticInfoServiceImpl implements HkStaticInfoService { ...@@ -74,8 +74,8 @@ public class HkStaticInfoServiceImpl implements HkStaticInfoService {
crossInfoPO.setId(IdUtil.simpleUUID()); crossInfoPO.setId(IdUtil.simpleUUID());
crossInfoPO.setName(crossName); crossInfoPO.setName(crossName);
crossInfoPO.setCode(crossCode); crossInfoPO.setCode(crossCode);
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByAbbr( ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByCode(
BasicEnum.ManufacturerEnum.HK.getAbbr()); BasicEnum.ManufacturerEnum.HK.getCode());
if (manufacturerInfoPO != null) { if (manufacturerInfoPO != null) {
crossInfoPO.setManufacturerId(manufacturerInfoPO.getId()); crossInfoPO.setManufacturerId(manufacturerInfoPO.getId());
} }
...@@ -99,7 +99,7 @@ public class HkStaticInfoServiceImpl implements HkStaticInfoService { ...@@ -99,7 +99,7 @@ public class HkStaticInfoServiceImpl implements HkStaticInfoService {
private Map<String, String> getPathMapByApiCode(String apiCode) { private Map<String, String> getPathMapByApiCode(String apiCode) {
Map<String, String> res = new HashMap<>(); Map<String, String> res = new HashMap<>();
HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getAbbr(), apiCode); HttpRequest httpRequest = new HttpRequest(BasicEnum.ManufacturerEnum.HK.getCode(), apiCode);
res.put("http://", artemisPath + httpRequest.getUrl()); res.put("http://", artemisPath + httpRequest.getUrl());
return res; return res;
} }
......
...@@ -22,8 +22,8 @@ public class OthersStaticInfoServiceImpl implements OthersStaticInfoService { ...@@ -22,8 +22,8 @@ public class OthersStaticInfoServiceImpl implements OthersStaticInfoService {
private HttpRestUtil httpRestUtil; private HttpRestUtil httpRestUtil;
@Override @Override
public ManufacturerRes<DetailCrossInfoVO> crossBasicInfo(String manufacturerAbbr) { public ManufacturerRes<DetailCrossInfoVO> crossBasicInfo(String manufacturerCode) {
HttpRequest httpRequest = new HttpRequest(manufacturerAbbr, "queryCrossing"); HttpRequest httpRequest = new HttpRequest(manufacturerCode, "queryCrossing");
String result = httpRestUtil.doExecute(httpRequest.getUrl(), httpRequest.getHeaders(), HttpMethod.POST, null); String result = httpRestUtil.doExecute(httpRequest.getUrl(), httpRequest.getHeaders(), HttpMethod.POST, null);
if (StringUtils.isEmpty(result)) { if (StringUtils.isEmpty(result)) {
return null; return null;
......
...@@ -46,11 +46,11 @@ public class StaticInfoServiceImpl implements StaticInfoService { ...@@ -46,11 +46,11 @@ public class StaticInfoServiceImpl implements StaticInfoService {
public ManufacturerRes<DetailCrossInfoVO> crossBasicInfo(OutVO<BaseCrossInfo> outVO) { public ManufacturerRes<DetailCrossInfoVO> crossBasicInfo(OutVO<BaseCrossInfo> outVO) {
List<CrossInfoPO> crossInfoPOList = new ArrayList<>(); List<CrossInfoPO> crossInfoPOList = new ArrayList<>();
ManufacturerRes<DetailCrossInfoVO> res = new ManufacturerRes<>(); ManufacturerRes<DetailCrossInfoVO> res = new ManufacturerRes<>();
if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getAbbr(), outVO.getManufacturerAbbr())) { if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getCode(), outVO.getManufacturerCode())) {
crossInfoPOList = hkStaticInfoService.hkCrossBasicInfo(); crossInfoPOList = hkStaticInfoService.hkCrossBasicInfo();
} else { } else {
// todo 其他厂商 // todo 其他厂商
res = othersStaticInfoService.crossBasicInfo(outVO.getManufacturerAbbr()); res = othersStaticInfoService.crossBasicInfo(outVO.getManufacturerCode());
if (null == res) { if (null == res) {
return null; return null;
} }
...@@ -69,7 +69,7 @@ public class StaticInfoServiceImpl implements StaticInfoService { ...@@ -69,7 +69,7 @@ public class StaticInfoServiceImpl implements StaticInfoService {
crossInfoPO.setId(id); crossInfoPO.setId(id);
crossInfoPO.setName(vo.getCrossName()); crossInfoPO.setName(vo.getCrossName());
crossInfoPO.setCode(id); crossInfoPO.setCode(id);
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByAbbr(vo.getManufacturerAbbr()); ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectByCode(vo.getManufacturerCode());
if (manufacturerInfoPO != null) { if (manufacturerInfoPO != null) {
crossInfoPO.setManufacturerId(manufacturerInfoPO.getId()); crossInfoPO.setManufacturerId(manufacturerInfoPO.getId());
} }
...@@ -103,8 +103,8 @@ public class StaticInfoServiceImpl implements StaticInfoService { ...@@ -103,8 +103,8 @@ public class StaticInfoServiceImpl implements StaticInfoService {
Integer manufacturerId = crossInfoPO.getManufacturerId(); Integer manufacturerId = crossInfoPO.getManufacturerId();
// 获取厂商缩写 // 获取厂商缩写
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectById(manufacturerId); ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectById(manufacturerId);
String manufacturerAbbr = manufacturerInfoPO.getNickName(); String manufacturerCode = manufacturerInfoPO.getCode();
if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getAbbr(), manufacturerAbbr)) { if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerCode)) {
// 海康 // 海康
hkSchemePhaseLightsService.hkSchemePhaseLights(crossId, crossCode); hkSchemePhaseLightsService.hkSchemePhaseLights(crossId, crossCode);
} else { } else {
...@@ -121,9 +121,9 @@ public class StaticInfoServiceImpl implements StaticInfoService { ...@@ -121,9 +121,9 @@ public class StaticInfoServiceImpl implements StaticInfoService {
Integer manufacturerId = crossInfoPO.getManufacturerId(); Integer manufacturerId = crossInfoPO.getManufacturerId();
// 获取厂商缩写 // 获取厂商缩写
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectById(manufacturerId); ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectById(manufacturerId);
String manufacturerAbbr = manufacturerInfoPO.getNickName(); String manufacturerCode = manufacturerInfoPO.getCode();
Integer planNo = planSectionInVO.getPlanNo(); Integer planNo = planSectionInVO.getPlanNo();
if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getAbbr(), manufacturerAbbr)) { if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerCode)) {
// 海康 // 海康
hkPlanSectionService.planSection(crossCode, planNo, crossId); hkPlanSectionService.planSection(crossCode, planNo, crossId);
} else { } else {
...@@ -133,9 +133,9 @@ public class StaticInfoServiceImpl implements StaticInfoService { ...@@ -133,9 +133,9 @@ public class StaticInfoServiceImpl implements StaticInfoService {
@Override @Override
public void crossSchedules(CrossSchedulesInVO crossSchedulesInVO) throws Exception { public void crossSchedules(CrossSchedulesInVO crossSchedulesInVO) throws Exception {
String manufacturerAbbr = crossSchedulesInVO.getManufacturerAbbr(); String manufacturerCode = crossSchedulesInVO.getManufacturerCode();
List<String> crossIdList = crossSchedulesInVO.getCrossIdList(); List<String> crossIdList = crossSchedulesInVO.getCrossIdList();
if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getAbbr(), manufacturerAbbr)) { if (Objects.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerCode)) {
// 海康 // 海康
hkCrossSchedulesService.crossSchedules(crossIdList); hkCrossSchedulesService.crossSchedules(crossIdList);
} else { } else {
......
package net.wanji.utc.service.systemadmin;
import com.github.pagehelper.PageInfo;
import net.wanji.utc.vo.systemadmin.CrossInfoInsertOrUpdateInVO;
import net.wanji.utc.vo.systemadmin.CrossInfoListInVO;
import net.wanji.utc.vo.systemadmin.CrossInfoListOutVO;
import net.wanji.utc.vo.systemadmin.DeleteByStringIdListInVO;
/**
* @author Kent HAN
* @date 2022/11/25 8:54
*/
public interface CrossInfoService {
PageInfo<CrossInfoListOutVO> list(CrossInfoListInVO crossInfoListInVO);
void insertOrUpdate(CrossInfoInsertOrUpdateInVO inVO);
void delete(DeleteByStringIdListInVO inVO);
}
package net.wanji.utc.service.systemadmin;
import com.github.pagehelper.PageInfo;
import net.wanji.utc.po.ManufacturerApiInfoPO;
import net.wanji.utc.vo.systemadmin.DeleteByIntegerIdListInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoInsertOrUpdateInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoListInVO;
/**
* @author Kent HAN
* @date 2022/11/24 13:59
*/
public interface ManufacturerApiInfoService {
PageInfo<ManufacturerApiInfoPO> list(ManufacturerApiInfoListInVO manufacturerApiInfoListInVO);
void insertOrUpdate(ManufacturerApiInfoInsertOrUpdateInVO inVO);
void delete(DeleteByIntegerIdListInVO inVO);
}
package net.wanji.utc.service.systemadmin;
import com.github.pagehelper.PageInfo;
import net.wanji.utc.po.ManufacturerInfoPO;
import net.wanji.utc.vo.systemadmin.DeleteByIntegerIdListInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerInsertOrUpdateInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerListInVO;
/**
* @author Kent HAN
* @date 2022/11/24 8:49
*/
public interface ManufacturerService {
PageInfo<ManufacturerInfoPO> list(ManufacturerListInVO manufacturerListInVO);
void insertOrUpdate(ManufacturerInsertOrUpdateInVO inVO);
void delete(DeleteByIntegerIdListInVO inVO);
}
package net.wanji.utc.service.systemadmin.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import net.wanji.utc.common.exception.IpPortException;
import net.wanji.utc.common.exception.PortFormatException;
import net.wanji.utc.mapper.CrossInfoMapper;
import net.wanji.utc.mapper.ManufacturerInfoMapper;
import net.wanji.utc.po.CrossInfoPO;
import net.wanji.utc.po.ManufacturerInfoPO;
import net.wanji.utc.service.systemadmin.CrossInfoService;
import net.wanji.utc.util.PageUtils;
import net.wanji.utc.vo.systemadmin.CrossInfoInsertOrUpdateInVO;
import net.wanji.utc.vo.systemadmin.CrossInfoListInVO;
import net.wanji.utc.vo.systemadmin.CrossInfoListOutVO;
import net.wanji.utc.vo.systemadmin.DeleteByStringIdListInVO;
import org.springframework.beans.BeanUtils;
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/25 8:54
*/
@Service
public class CrossInfoServiceImpl implements CrossInfoService {
@Autowired
ManufacturerInfoMapper manufacturerInfoMapper;
@Autowired
CrossInfoMapper crossInfoMapper;
@Override
public PageInfo<CrossInfoListOutVO> list(CrossInfoListInVO crossInfoListInVO) {
Integer pageNum = crossInfoListInVO.getPageNum();
Integer pageSize = crossInfoListInVO.getPageSize();
String crossName = crossInfoListInVO.getCrossName();
String manufacturerNick = crossInfoListInVO.getManufacturerName();
Integer manufacturerId = null;
if (manufacturerNick != null) {
manufacturerId = manufacturerInfoMapper.selectIdByNick(manufacturerNick);
}
PageHelper.startPage(pageNum, pageSize);
List<CrossInfoPO> crossInfoPOList = crossInfoMapper.selectByOptionals(crossName, manufacturerId);
PageInfo<CrossInfoPO> crossInfoPOPageInfo = new PageInfo<>(crossInfoPOList);
// 转换为VO类型的PageInfo对象
PageInfo<CrossInfoListOutVO> crossInfoListOutVOPageInfo = PageUtils.PageInfo2PageInfoVo(crossInfoPOPageInfo);
for (CrossInfoPO crossInfoPO : crossInfoPOList) {
CrossInfoListOutVO crossInfoListOutVO = new CrossInfoListOutVO();
BeanUtils.copyProperties(crossInfoPO, crossInfoListOutVO);
Integer manufacturerIdInPage = crossInfoPO.getManufacturerId();
ManufacturerInfoPO manufacturerInfoPO = manufacturerInfoMapper.selectById(manufacturerIdInPage);
String nickName = manufacturerInfoPO.getNickName();
crossInfoListOutVO.setManufacturerNick(nickName);
crossInfoListOutVOPageInfo.getList().add(crossInfoListOutVO);
}
return crossInfoListOutVOPageInfo;
}
@Override
public void insertOrUpdate(CrossInfoInsertOrUpdateInVO inVO) {
CrossInfoPO crossInfoPO = new CrossInfoPO();
BeanUtils.copyProperties(inVO, crossInfoPO);
// IP和端口
String ipPort = inVO.getIpPort();
String[] split = ipPort.split(":");
if (split.length != 2) {
throw new IpPortException("IP/端口格式错误,正确格式为 192.168.1.23:8080");
}
String portStr = split[1];
Integer port = null;
try {
port = Integer.parseInt(portStr);
} catch (NumberFormatException e){
throw new PortFormatException("端口必须为数字");
}
crossInfoPO.setIp(split[0]);
crossInfoPO.setPort(port);
// 厂商ID
String manufacturerNick = inVO.getManufacturerNick();
Integer manufacturerId = manufacturerInfoMapper.selectIdByNick(manufacturerNick);
crossInfoPO.setManufacturerId(manufacturerId);
// 安装时间
String installTimeStr = inVO.getInstallTime();
Date installTime = DateUtil.parse(installTimeStr);
crossInfoPO.setInstallTime(installTime);
String id = inVO.getId();
if (id == null || "".equals(id)) {
// 添加
crossInfoPO.setId(IdUtil.simpleUUID());
crossInfoMapper.insertOne(crossInfoPO);
} else {
// 修改
crossInfoMapper.updateOne(crossInfoPO);
}
}
@Override
public void delete(DeleteByStringIdListInVO inVO) {
List<String> ids = inVO.getIds();
crossInfoMapper.deleteBatch(ids);
}
}
package net.wanji.utc.service.systemadmin.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import net.wanji.utc.common.typeenum.ManufacturerApiInfoTypeEnum;
import net.wanji.utc.mapper.ManufacturerApiInfoMapper;
import net.wanji.utc.mapper.ManufacturerInfoMapper;
import net.wanji.utc.po.ManufacturerApiInfoPO;
import net.wanji.utc.service.systemadmin.ManufacturerApiInfoService;
import net.wanji.utc.vo.systemadmin.DeleteByIntegerIdListInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoInsertOrUpdateInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerApiInfoListInVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/24 14:10
*/
@Service
public class ManufacturerApiInfoServiceImpl implements ManufacturerApiInfoService {
@Autowired
ManufacturerApiInfoMapper manufacturerApiInfoMapper;
@Autowired
ManufacturerInfoMapper manufacturerInfoMapper;
@Override
public PageInfo<ManufacturerApiInfoPO> list(ManufacturerApiInfoListInVO manufacturerApiInfoListInVO) {
Integer pageNum = manufacturerApiInfoListInVO.getPageNum();
Integer pageSize = manufacturerApiInfoListInVO.getPageSize();
String name = manufacturerApiInfoListInVO.getName();
String typeStr = manufacturerApiInfoListInVO.getTypeStr();
Integer typeCode = null;
if (typeStr != null) {
typeCode = ManufacturerApiInfoTypeEnum.getCodeByMsg(typeStr);
}
String manufacturerNick = manufacturerApiInfoListInVO.getManufacturerNick();
Integer manufacturerId = null;
if (manufacturerNick != null) {
manufacturerId = manufacturerInfoMapper.selectIdByNick(manufacturerNick);
}
PageHelper.startPage(pageNum, pageSize);
List<ManufacturerApiInfoPO> manufacturerApiInfoPOList = manufacturerApiInfoMapper.selectByOptionals(
name, typeCode, manufacturerId);
PageInfo<ManufacturerApiInfoPO> manufacturerApiInfoPOPageInfo = new PageInfo<>(manufacturerApiInfoPOList);
return manufacturerApiInfoPOPageInfo;
}
@Override
public void insertOrUpdate(ManufacturerApiInfoInsertOrUpdateInVO inVO) {
ManufacturerApiInfoPO manufacturerApiInfoPO = new ManufacturerApiInfoPO();
BeanUtils.copyProperties(inVO, manufacturerApiInfoPO);
String typeStr = inVO.getApiType();
Integer typeCode = ManufacturerApiInfoTypeEnum.getCodeByMsg(typeStr);
String manufacturerName = inVO.getManufacturerName();
Integer manufacturerId = manufacturerInfoMapper.selectIdByNick(manufacturerName);
manufacturerApiInfoPO.setType(typeCode);
manufacturerApiInfoPO.setManufacturerId(manufacturerId);
Integer id = inVO.getId();
if (id == null || id == 0) {
// 添加
manufacturerApiInfoMapper.insertOne(manufacturerApiInfoPO);
} else {
// 修改
manufacturerApiInfoMapper.updateOne(manufacturerApiInfoPO);
}
}
@Override
public void delete(DeleteByIntegerIdListInVO inVO) {
List<Integer> ids = inVO.getIds();
manufacturerApiInfoMapper.deleteBatch(ids);
}
}
package net.wanji.utc.service.systemadmin.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import net.wanji.utc.mapper.ManufacturerInfoMapper;
import net.wanji.utc.po.ManufacturerInfoPO;
import net.wanji.utc.service.systemadmin.ManufacturerService;
import net.wanji.utc.vo.systemadmin.DeleteByIntegerIdListInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerInsertOrUpdateInVO;
import net.wanji.utc.vo.systemadmin.ManufacturerListInVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/24 8:50
*/
@Service
public class ManufacturerServiceImpl implements ManufacturerService {
@Autowired
ManufacturerInfoMapper manufacturerInfoMapper;
@Override
public PageInfo<ManufacturerInfoPO> list(ManufacturerListInVO manufacturerListInVO) {
Integer pageNum = manufacturerListInVO.getPageNum();
Integer pageSize = manufacturerListInVO.getPageSize();
String name = manufacturerListInVO.getName();
PageHelper.startPage(pageNum, pageSize);
List<ManufacturerInfoPO> manufacturerInfoPOList = manufacturerInfoMapper.selectByOptionalPartialName(name);
PageInfo<ManufacturerInfoPO> borrowPOPageInfo = new PageInfo<>(manufacturerInfoPOList);
return borrowPOPageInfo;
}
@Override
public void insertOrUpdate(ManufacturerInsertOrUpdateInVO inVO) {
Integer id = inVO.getId();
ManufacturerInfoPO manufacturerInfoPO = new ManufacturerInfoPO();
BeanUtils.copyProperties(inVO, manufacturerInfoPO);
if (id == null || id == 0) {
// 添加
manufacturerInfoMapper.insertOne(manufacturerInfoPO);
} else {
// 修改
manufacturerInfoMapper.updateOne(manufacturerInfoPO);
}
}
@Override
public void delete(DeleteByIntegerIdListInVO inVO) {
List<Integer> ids = inVO.getIds();
manufacturerInfoMapper.deleteBatch(ids);
}
}
package net.wanji.utc.util;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
public class PageUtils{
/**
* 将PageInfo对象泛型中的Po对象转化为Vo对象
* @param pageInfoPo PageInfo<Po>对象</>
* @param <P> Po类型
* @param <V> Vo类型
* @return
*/
public static <P, V> PageInfo<V> PageInfo2PageInfoVo(PageInfo<P> pageInfoPo) {
// 创建Page对象,实际上是一个ArrayList类型的集合
Page<V> page = new Page<>(pageInfoPo.getPageNum(), pageInfoPo.getPageSize());
page.setTotal(pageInfoPo.getTotal());
return new PageInfo<>(page);
}
}
\ No newline at end of file
...@@ -11,6 +11,6 @@ import lombok.Data; ...@@ -11,6 +11,6 @@ import lombok.Data;
@Data @Data
@ApiModel(value = "CrossInfoInVO", description = "查询信号路口基础信息输入参数") @ApiModel(value = "CrossInfoInVO", description = "查询信号路口基础信息输入参数")
public class CrossInfoInVO { public class CrossInfoInVO {
@ApiModelProperty(value = "厂商缩写 HK-海康") @ApiModelProperty(value = "厂商代码 HK")
String manufacturerAbbr; String manufacturerCode;
} }
...@@ -13,8 +13,8 @@ import java.util.List; ...@@ -13,8 +13,8 @@ import java.util.List;
@Data @Data
@ApiModel(value = "CrossSchedulesInVO", description = "查询时间表数据输入参数") @ApiModel(value = "CrossSchedulesInVO", description = "查询时间表数据输入参数")
public class CrossSchedulesInVO { public class CrossSchedulesInVO {
@ApiModelProperty(value = "厂商缩写 HK-海康") @ApiModelProperty(value = "厂商缩写 HK")
String manufacturerAbbr; String manufacturerCode;
@ApiModelProperty(value = "路口列表") @ApiModelProperty(value = "路口列表")
List<String> crossIdList; List<String> crossIdList;
......
package net.wanji.utc.vo.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author Kent HAN
* @date 2022/11/25 10:21
*/
@Data
@ApiModel(value = "CrossInfoInsertOrUpdateInVO", description = "信号机新增或修改输入参数")
public class CrossInfoInsertOrUpdateInVO {
@ApiModelProperty(value = "路口ID。不传ID为新增,传ID为修改",notes = "")
private String id ;
/** 信号机编号 */
@ApiModelProperty(required = true, value = "信号机编号",notes = "")
private String code ;
/** 路口名称 */
@ApiModelProperty(required = true, value = "路口名称",notes = "")
private String name ;
/** 信号机IP/端口 */
@ApiModelProperty(required = true, value = "信号机IP/端口",notes = "")
private String ipPort ;
/** 厂商名称 */
@ApiModelProperty(required = true, value = "厂商名称",notes = "")
private String manufacturerNick ;
/** 信号机版本 */
@ApiModelProperty(required = true, value = "信号机版本",notes = "")
private String version ;
/** 信号机型号 */
@ApiModelProperty(required = true, value = "信号机型号",notes = "")
private String model ;
/** 安装时间 */
@ApiModelProperty(required = true, value = "安装时间,格式 2022-11-18 10:11:47",notes = "")
private String installTime ;
/** 安装位置 */
@ApiModelProperty(required = true, value = "安装位置",notes = "")
private String location ;
}
package net.wanji.utc.vo.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/25 8:55
*/
@Data
@ApiModel(value = "CrossInfoListInVO", description = "信号机列表输入参数")
public class CrossInfoListInVO {
@ApiModelProperty(required = true, value = "页号")
Integer pageNum;
@ApiModelProperty(required = true, value = "每页记录数")
Integer pageSize;
@ApiModelProperty( value = "路口名称")
String crossName;
@ApiModelProperty( value = "信号机厂商")
String manufacturerName;
}
package net.wanji.utc.vo.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author Kent HAN
* @date 2022/11/25 10:03
*/
@Data
@ApiModel(value = "CrossInfoListOutVO", description = "信号机列表返回参数")
public class CrossInfoListOutVO {
@ApiModelProperty(value = "路口ID",notes = "")
private String id ;
/** 路口名称 */
@ApiModelProperty(value = "路口名称",notes = "")
private String name ;
/** 信号机编号 */
@ApiModelProperty(value = "信号机编号",notes = "")
private String code ;
/** 信号机厂商 */
@ApiModelProperty(value = "信号机厂商",notes = "")
private String manufacturerNick ;
/** 信号机IP */
@ApiModelProperty(value = "信号机IP",notes = "")
private String ip ;
/** 信号机端口 */
@ApiModelProperty(value = "信号机端口",notes = "")
private Integer port ;
/** 经纬度 */
@ApiModelProperty(value = "经纬度",notes = "")
private String location ;
/** 版本号 */
@ApiModelProperty(value = "版本号",notes = "")
private String version ;
/** 型号 */
@ApiModelProperty(value = "型号",notes = "")
private String model ;
/** 安装时间 */
@ApiModelProperty(value = "安装时间",notes = "")
private Date installTime ;
/** 创建时间 */
@ApiModelProperty(value = "创建时间",notes = "")
private Date gmtCreate ;
/** 修改时间 */
@ApiModelProperty(value = "修改时间",notes = "")
private Date gmtModified ;
}
package net.wanji.utc.vo.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/24 10:10
*/
@Data
@ApiModel(value = "DeleteByIntegerIdListInVO", description = "厂商或接口删除输入参数")
public class DeleteByIntegerIdListInVO {
/** 厂商或接口ID列表 */
@ApiModelProperty(value = "厂商或接口ID列表",notes = "")
private List<Integer> ids ;
}
package net.wanji.utc.vo.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author Kent HAN
* @date 2022/11/24 10:10
*/
@Data
@ApiModel(value = "DeleteByStringIdListInVO", description = "信号机删除输入参数")
public class DeleteByStringIdListInVO {
/** 信号机ID列表 */
@ApiModelProperty(value = "信号机ID列表",notes = "")
private List<String> ids ;
}
package net.wanji.utc.vo.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/24 15:20
*/
@Data
@ApiModel(value = "ManufacturerApiInfoInsertOrUpdateInVO", description = "接口新增或修改输入参数")
public class ManufacturerApiInfoInsertOrUpdateInVO {
/** 接口ID */
@ApiModelProperty(value = "接口ID。不传ID为新增,传ID为修改",notes = "")
private Integer id ;
/** 接口代码 */
@ApiModelProperty(required = true, value = "接口代码",notes = "")
private String code ;
/** 接口名称 */
@ApiModelProperty(required = true, value = "接口名称",notes = "")
private String name ;
/** 接口类型 */
@ApiModelProperty(required = true, value = "接口类型",notes = "")
private String apiType ;
/** 请求方式:get、post */
@ApiModelProperty(required = true, value = "请求方式:get、post",notes = "")
private String method ;
/** 接口地址 */
@ApiModelProperty(required = true, value = "接口地址",notes = "")
private String address ;
/** 厂商ID */
@ApiModelProperty(required = true, value = "接口厂商",notes = "")
private String manufacturerName ;
}
package net.wanji.utc.vo.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/24 14:05
*/
@Data
@ApiModel(value = "ManufacturerApiInfoListInVO", description = "查询接口列表输入参数")
public class ManufacturerApiInfoListInVO {
@ApiModelProperty(required = true, value = "页号")
Integer pageNum;
@ApiModelProperty(required = true, value = "每页记录数")
Integer pageSize;
@ApiModelProperty( value = "接口名称")
String name;
@ApiModelProperty( value = "接口类型")
String typeStr;
@ApiModelProperty( value = "接口厂商")
String manufacturerNick;
}
package net.wanji.utc.vo.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/24 9:42
*/
@Data
@ApiModel(value = "ManufacturerInsertOrUpdateInVO",
description = "厂商添加或修改输入参数。如果携带ID,即为修改;如果不携带ID,即为新增")
public class ManufacturerInsertOrUpdateInVO {
/** 厂商ID */
@ApiModelProperty(value = "厂商ID。如果携带ID,即为修改;如果不携带ID,即为新增",notes = "")
private Integer id ;
/** 厂商代码 */
@ApiModelProperty(required = true, value = "厂商代码",notes = "")
private String code ;
/** 厂商名称 */
@ApiModelProperty(required = true, value = "厂商名称",notes = "")
private String name ;
/** 厂商简称 */
@ApiModelProperty(required = true, value = "厂商简称",notes = "")
private String nickName ;
/** 平台地址 */
@ApiModelProperty(required = true, value = "平台地址",notes = "")
private String address ;
/** 维护单位 */
@ApiModelProperty(required = true, value = "维护单位",notes = "")
private String maintenanceUnit ;
}
package net.wanji.utc.vo.systemadmin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Kent HAN
* @date 2022/11/24 8:41
*/
@Data
@ApiModel(value = "ManufacturerListInVO", description = "查询厂商列表输入参数")
public class ManufacturerListInVO {
@ApiModelProperty(required = true, value = "页号")
Integer pageNum;
@ApiModelProperty(required = true, value = "每页记录数")
Integer pageSize;
@ApiModelProperty( value = "厂商名称")
String name;
}
server: server:
port: 30001 port: 32000
servlet: servlet:
context-path: /utc context-path: /utc
spring: spring:
......
...@@ -4,6 +4,9 @@ spring: ...@@ -4,6 +4,9 @@ spring:
mvc: mvc:
pathmatch: pathmatch:
matching-strategy: ant_path_matcher matching-strategy: ant_path_matcher
main:
allow-circular-references: true
server: server:
undertow: undertow:
url-charset: UTF-8 url-charset: UTF-8
...@@ -28,6 +31,7 @@ server: ...@@ -28,6 +31,7 @@ server:
enabled: true enabled: true
# 设置访问日志所在目录 # 设置访问日志所在目录
dir: logs dir: logs
mybatis-plus: mybatis-plus:
mapper-locations: classpath:mapper/*.xml mapper-locations: classpath:mapper/*.xml
typeAliasesPackage: net.wanji.utc.entity typeAliasesPackage: net.wanji.utc.entity
...@@ -44,3 +48,9 @@ mybatis-plus: ...@@ -44,3 +48,9 @@ mybatis-plus:
auto-mapping-unknown-column-behavior: warning auto-mapping-unknown-column-behavior: warning
#开启SQL打印 #开启SQL打印
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# PageHelper分页插件
pagehelper:
helperDialect: mysql
supportMethodsArguments: true
params: count=countSql
...@@ -25,6 +25,53 @@ ...@@ -25,6 +25,53 @@
</foreach> </foreach>
</insert> </insert>
<insert id="insertOne">
insert into t_cross_info(id, name,code,manufacturer_id,ip,port,location,version,model,install_time)
values (#{id},#{name},#{code},#{manufacturerId},#{ip},#{port},#{location},#{version},#{model},#{installTime})
</insert>
<update id="updateOne">
update t_cross_info
<set>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="code != null and code != ''">
code = #{code},
</if>
<if test="manufacturerId != null and manufacturerId != ''">
manufacturer_id = #{manufacturerId},
</if>
<if test="ip != null and ip != ''">
ip = #{ip},
</if>
<if test="port != null and port != ''">
port = #{port},
</if>
<if test="location != null and location != ''">
location = #{location},
</if>
<if test="version != null and version != ''">
version = #{version},
</if>
<if test="model != null and model != ''">
model = #{model},
</if>
<if test="installTime != null">
install_time = #{installTime},
</if>
</set>
where id = #{id}
</update>
<delete id="deleteBatch">
delete from t_cross_info
where id in
<foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</delete>
<select id="selectByPrimaryKey" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" resultMap="BaseResultMap">
select select
id,name,code,manufacturer_id,ip,port,location,version,model,install_time,gmt_create,gmt_modified id,name,code,manufacturer_id,ip,port,location,version,model,install_time,gmt_create,gmt_modified
...@@ -64,4 +111,17 @@ ...@@ -64,4 +111,17 @@
select id,name,code,manufacturer_id,ip,port,location,version,model,install_time,gmt_create,gmt_modified select id,name,code,manufacturer_id,ip,port,location,version,model,install_time,gmt_create,gmt_modified
from t_cross_info from t_cross_info
</select> </select>
<select id="selectByOptionals" resultMap="BaseResultMap">
select id,name,code,manufacturer_id,ip,port,location,version,model,install_time,gmt_create,gmt_modified
from t_cross_info
<where>
<if test="crossName != null and crossName != ''">
AND name LIKE CONCAT('%',#{crossName},'%')
</if>
<if test="manufacturerId != null and manufacturerId != 0">
AND manufacturer_id = #{manufacturerId}
</if>
</where>
</select>
</mapper> </mapper>
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.utc.mapper.ApiInfoMapper"> <mapper namespace="net.wanji.utc.mapper.ManufacturerApiInfoMapper">
<resultMap type="net.wanji.utc.po.ApiInfoPO" id="BaseResultMap"> <resultMap type="net.wanji.utc.po.ManufacturerApiInfoPO" id="BaseResultMap">
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="code" column="code"/> <result property="code" column="code"/>
<result property="name" column="name"/> <result property="name" column="name"/>
...@@ -13,9 +13,63 @@ ...@@ -13,9 +13,63 @@
<result property="gmtModified" column="gmt_modified"/> <result property="gmtModified" column="gmt_modified"/>
</resultMap> </resultMap>
<insert id="insertOne">
insert into t_manufacturer_api_info(code,name,type,method,address,manufacturer_id)
values (#{code},#{name},#{type},#{method},#{address},#{manufacturerId})
</insert>
<update id="updateOne">
update t_manufacturer_api_info
<set>
<if test="code != null and code != ''">
code = #{code},
</if>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="type != null and type != 0">
type = #{type},
</if>
<if test="method != null and method != ''">
method = #{method},
</if>
<if test="address != null and address != ''">
address = #{address},
</if>
<if test="manufacturerId != null and manufacturerId != 0">
manufacturer_id = #{manufacturerId},
</if>
</set>
where id = #{id}
</update>
<delete id="deleteBatch">
delete from t_manufacturer_api_info
where id in
<foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</delete>
<select id="selectAll" resultMap="BaseResultMap"> <select id="selectAll" resultMap="BaseResultMap">
select select
id,code,name,type,method,address,manufacturer_id,gmt_create,gmt_modified id,code,name,type,method,address,manufacturer_id,gmt_create,gmt_modified
from t_manufacturer_api_info from t_manufacturer_api_info
</select> </select>
<select id="selectByOptionals" resultMap="BaseResultMap">
select id,code,name,type,method,address,manufacturer_id,gmt_create,gmt_modified
from t_manufacturer_api_info
<where>
<if test="name != null and name != ''">
AND name LIKE CONCAT('%',#{name},'%')
</if>
<if test="typeCode != null and typeCode != 0">
AND type = #{typeCode}
</if>
<if test="manufacturerId != null and manufacturerId != 0">
AND manufacturer_id = #{manufacturerId}
</if>
</where>
</select>
</mapper> </mapper>
...@@ -12,11 +12,46 @@ ...@@ -12,11 +12,46 @@
<result property="gmtModified" column="gmt_modified"/> <result property="gmtModified" column="gmt_modified"/>
</resultMap> </resultMap>
<select id="selectByAbbr" resultMap="BaseResultMap"> <insert id="insertOne">
insert into t_manufacturer_info(code,name,nick_name,address,maintenance_unit)
values (#{code},#{name},#{nickName},#{address},#{maintenanceUnit})
</insert>
<update id="updateOne">
update t_manufacturer_info
<set>
<if test="code != null and code != ''">
code = #{code},
</if>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="nickName != null and nickName != ''">
nick_name = #{nickName},
</if>
<if test="address != null and address != ''">
address = #{address},
</if>
<if test="maintenanceUnit != null and maintenanceUnit != ''">
maintenance_unit = #{maintenanceUnit},
</if>
</set>
where id = #{id}
</update>
<delete id="deleteBatch">
delete from t_manufacturer_info
where id in
<foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</delete>
<select id="selectByCode" resultMap="BaseResultMap">
select select
id,code,name,nick_name,address,maintenance_unit,gmt_create,gmt_modified id,code,name,nick_name,address,maintenance_unit,gmt_create,gmt_modified
from t_manufacturer_info from t_manufacturer_info
where nick_name = #{abbr} where code = #{code}
</select> </select>
<select id="selectById" resultMap="BaseResultMap"> <select id="selectById" resultMap="BaseResultMap">
...@@ -30,4 +65,20 @@ ...@@ -30,4 +65,20 @@
id,code,name,nick_name,address,maintenance_unit,gmt_create,gmt_modified id,code,name,nick_name,address,maintenance_unit,gmt_create,gmt_modified
from t_manufacturer_info from t_manufacturer_info
</select> </select>
<select id="selectByOptionalPartialName" resultMap="BaseResultMap">
select id,code,name,nick_name,address,maintenance_unit,gmt_create,gmt_modified
from t_manufacturer_info
<where>
<if test="name != null and name != ''">
AND name LIKE CONCAT('%',#{name},'%')
</if>
</where>
order by id
</select>
<select id="selectIdByNick" resultType="java.lang.Integer">
select id from t_manufacturer_info
where nick_name = #{manufacturerNick}
</select>
</mapper> </mapper>
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<groupId>net.wanji</groupId> <groupId>net.wanji</groupId>
<artifactId>signal-web-service</artifactId> <artifactId>signal-web-service</artifactId>
<version>1.0-SNAPSHOT</version> <version>0.2.1</version>
<name>signal-web-service</name> <name>signal-web-service</name>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<groupId>net.wanji</groupId> <groupId>net.wanji</groupId>
<artifactId>wj-common</artifactId> <artifactId>wj-common</artifactId>
<version>1.0-SNAPSHOT</version> <version>0.2.1</version>
<name>wj-common</name> <name>wj-common</name>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<groupId>net.wanji</groupId> <groupId>net.wanji</groupId>
<artifactId>wj-databus</artifactId> <artifactId>wj-databus</artifactId>
<version>1.0-SNAPSHOT</version> <version>0.2.1</version>
<name>wj-databus</name> <name>wj-databus</name>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<groupId>net.wanji</groupId> <groupId>net.wanji</groupId>
<artifactId>wj-identity</artifactId> <artifactId>wj-identity</artifactId>
<version>1.0-SNAPSHOT</version> <version>0.2.1</version>
<name>wj-identity</name> <name>wj-identity</name>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<groupId>net.wanji</groupId> <groupId>net.wanji</groupId>
<artifactId>wj-portal</artifactId> <artifactId>wj-portal</artifactId>
<version>1.0-SNAPSHOT</version> <version>0.2.1</version>
<name>wj-portal</name> <name>wj-portal</name>
......
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