REM:
1. Spring Boot 升级到 2.3.12
2. 修复单测MySQL服务器配置
3. 修复URLPath拼接缺少一个“/”
This commit is contained in:
HuangXin 2021-10-09 10:44:35 +08:00
parent 65a938d5bb
commit cbb1d29a63
3 changed files with 23 additions and 15 deletions

View File

@ -4,16 +4,16 @@ server.tomcat.basedir=./basedir
# 多个项目放在nginx下同个端口通过该配置区分 # 多个项目放在nginx下同个端口通过该配置区分
server.servlet.context-path=/dispose server.servlet.context-path=/dispose
# 配置数据源 # 配置数据源
spring.datasource.url=jdbc:mysql://10.88.77.65:33061/ci_dispose_v2?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior\ #spring.datasource.url=jdbc:mysql://10.88.77.65:33061/ci_dispose_v2?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior\
=convertToNull&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true # =convertToNull&useUnicode=true&characterEncoding=utf8&allowMultiQueries=true
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=h0K0_8u
#spring.datasource.url=jdbc:mysql://172.21.48.75:3306/ci_dispose_v1?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior\
# =convertToNull&useUnicode=true
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver #spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.username=root #spring.datasource.username=root
#spring.datasource.password=BCcf6Dd7&8 #spring.datasource.password=h0K0_8u
spring.datasource.url=jdbc:mysql://172.21.48.75:3306/ci_dispose_v1?serverTimezone=Asia/Shanghai&zeroDateTimeBehavior\
=convertToNull&useUnicode=true
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=BCcf6Dd7&8
# 配置连接池 # 配置连接池
spring.datasource.schema=classpath:test_db/unit_test.sql spring.datasource.schema=classpath:test_db/unit_test.sql
spring.datasource.initialization-mode=always spring.datasource.initialization-mode=always

View File

@ -12,7 +12,7 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.9.RELEASE</version> <version>2.3.12.RELEASE</version>
<relativePath/> <relativePath/>
</parent> </parent>
<groupId>com.dispose</groupId> <groupId>com.dispose</groupId>

View File

@ -92,7 +92,7 @@ public class DisposeAbilityRouterServiceImpl implements DisposeAbilityRouterServ
if (dev != null) { if (dev != null) {
return disposeAbilityMap.get(getAbilityDeviceHashKey(dev.getIpAddr(), dev.getIpPort(), return disposeAbilityMap.get(getAbilityDeviceHashKey(dev.getIpAddr(), dev.getIpPort(),
String.valueOf(dev.getDeviceType()))); String.valueOf(dev.getDeviceType())));
} }
return null; return null;
@ -122,7 +122,7 @@ public class DisposeAbilityRouterServiceImpl implements DisposeAbilityRouterServ
@Override @Override
public void deleteDisposeDevice(DisposeDevice dev) { public void deleteDisposeDevice(DisposeDevice dev) {
String hashKey = getAbilityDeviceHashKey(dev.getIpAddr(), dev.getIpPort(), String hashKey = getAbilityDeviceHashKey(dev.getIpAddr(), dev.getIpPort(),
String.valueOf(dev.getDeviceType())); String.valueOf(dev.getDeviceType()));
disposeAbilityMap.remove(hashKey); disposeAbilityMap.remove(hashKey);
} }
@ -145,11 +145,19 @@ public class DisposeAbilityRouterServiceImpl implements DisposeAbilityRouterServ
@Override @Override
public ErrorCode addDisposeAbilityDevice(DisposeDevice dev) { public ErrorCode addDisposeAbilityDevice(DisposeDevice dev) {
DisposeAbility db; DisposeAbility db;
String urlSpiltChar = "/";
String url;
String httpType = dev.getUrlType() == HttpType.HTTP ? "http://" : "https://"; String httpType = dev.getUrlType() == HttpType.HTTP ? "http://" : "https://";
String addr = (dev.getIpPort() == null || dev.getIpPort() String addr = (dev.getIpPort() == null || dev.getIpPort()
.length() == 0) ? dev.getIpAddr() : (dev.getIpAddr() + ":" + dev.getIpPort()); .length() == 0) ? dev.getIpAddr() : (dev.getIpAddr() + ":" + dev.getIpPort());
String url = httpType + addr + "/" + dev.getUrlPath();
if (dev.getUrlPath().length() == 0) {
url = httpType + addr + urlSpiltChar;
} else if (dev.getUrlPath().endsWith(urlSpiltChar)) {
url = httpType + addr + urlSpiltChar + dev.getUrlPath();
} else {
url = httpType + addr + urlSpiltChar + dev.getUrlPath() + urlSpiltChar;
}
switch (dev.getDeviceType()) { switch (dev.getDeviceType()) {
case DPTECH_UMC: case DPTECH_UMC:
@ -188,7 +196,7 @@ public class DisposeAbilityRouterServiceImpl implements DisposeAbilityRouterServ
db.getDisposeDeviceProtectObject(); db.getDisposeDeviceProtectObject();
String hashKey = getAbilityDeviceHashKey(dev.getIpAddr(), dev.getIpPort(), String hashKey = getAbilityDeviceHashKey(dev.getIpAddr(), dev.getIpPort(),
String.valueOf(dev.getDeviceType())); String.valueOf(dev.getDeviceType()));
// 缓存处置设备到Hash表中 // 缓存处置设备到Hash表中
disposeAbilityMap.put(hashKey, AbilityInfo.builder() disposeAbilityMap.put(hashKey, AbilityInfo.builder()
@ -250,7 +258,7 @@ public class DisposeAbilityRouterServiceImpl implements DisposeAbilityRouterServ
if (dev == null || !dev.getStatus().equals(ObjectStatus.NORMAL)) { if (dev == null || !dev.getStatus().equals(ObjectStatus.NORMAL)) {
String hashKey = getAbilityDeviceHashKey(v.getDev().getIpAddr(), v.getDev().getIpPort(), String hashKey = getAbilityDeviceHashKey(v.getDev().getIpAddr(), v.getDev().getIpPort(),
String.valueOf(v.getDev().getDeviceType())); String.valueOf(v.getDev().getDeviceType()));
disposeAbilityMap.remove(hashKey); disposeAbilityMap.remove(hashKey);
} else { } else {