|
@@ -1,28 +1,8 @@
|
|
|
package top.lvzhiqiang.service.impl;
|
|
package top.lvzhiqiang.service.impl;
|
|
|
|
|
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
-import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
|
|
-import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
-import com.zaxxer.hikari.HikariDataSource;
|
|
|
|
|
-
|
|
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
-import org.springframework.core.io.ClassPathResource;
|
|
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
|
|
-import org.yaml.snakeyaml.DumperOptions;
|
|
|
|
|
-import org.yaml.snakeyaml.Yaml;
|
|
|
|
|
-import top.lvzhiqiang.entity.NetAccount;
|
|
|
|
|
-import top.lvzhiqiang.entity.NetNode;
|
|
|
|
|
-import top.lvzhiqiang.exception.BusinessException;
|
|
|
|
|
-import top.lvzhiqiang.mapper.NetMapper;
|
|
|
|
|
-import top.lvzhiqiang.service.SubscribeService;
|
|
|
|
|
-import top.lvzhiqiang.util.StringUtils;
|
|
|
|
|
-
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
|
import java.sql.Connection;
|
|
import java.sql.Connection;
|
|
|
-import java.sql.DriverManager;
|
|
|
|
|
import java.sql.PreparedStatement;
|
|
import java.sql.PreparedStatement;
|
|
|
import java.sql.ResultSet;
|
|
import java.sql.ResultSet;
|
|
|
import java.sql.SQLException;
|
|
import java.sql.SQLException;
|
|
@@ -38,6 +18,25 @@ import java.util.Map;
|
|
|
import javax.annotation.PostConstruct;
|
|
import javax.annotation.PostConstruct;
|
|
|
import javax.annotation.PreDestroy;
|
|
import javax.annotation.PreDestroy;
|
|
|
|
|
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
+import org.springframework.core.io.ClassPathResource;
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
+import org.yaml.snakeyaml.DumperOptions;
|
|
|
|
|
+import org.yaml.snakeyaml.Yaml;
|
|
|
|
|
+
|
|
|
|
|
+import com.fasterxml.jackson.core.type.TypeReference;
|
|
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
+import com.zaxxer.hikari.HikariDataSource;
|
|
|
|
|
+
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import top.lvzhiqiang.entity.NetAccount;
|
|
|
|
|
+import top.lvzhiqiang.entity.NetNode;
|
|
|
|
|
+import top.lvzhiqiang.exception.BusinessException;
|
|
|
|
|
+import top.lvzhiqiang.mapper.NetMapper;
|
|
|
|
|
+import top.lvzhiqiang.service.SubscribeService;
|
|
|
|
|
+import top.lvzhiqiang.util.StringUtils;
|
|
|
|
|
+
|
|
|
@Service
|
|
@Service
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
public class SubscribeServiceImpl implements SubscribeService {
|
|
public class SubscribeServiceImpl implements SubscribeService {
|
|
@@ -67,7 +66,7 @@ public class SubscribeServiceImpl implements SubscribeService {
|
|
|
*/
|
|
*/
|
|
|
@PostConstruct
|
|
@PostConstruct
|
|
|
public void init() {
|
|
public void init() {
|
|
|
- System.out.println("正在初始化 Service 私有的连接池...");
|
|
|
|
|
|
|
+ log.info("正在初始化 Service 私有的连接池...");
|
|
|
|
|
|
|
|
privateDataSource = new HikariDataSource();
|
|
privateDataSource = new HikariDataSource();
|
|
|
privateDataSource.setJdbcUrl(url);
|
|
privateDataSource.setJdbcUrl(url);
|
|
@@ -89,7 +88,8 @@ public class SubscribeServiceImpl implements SubscribeService {
|
|
|
@PreDestroy
|
|
@PreDestroy
|
|
|
public void cleanup() {
|
|
public void cleanup() {
|
|
|
if (privateDataSource != null && !privateDataSource.isClosed()) {
|
|
if (privateDataSource != null && !privateDataSource.isClosed()) {
|
|
|
- System.out.println("正在关闭 Service 私有的连接池...");
|
|
|
|
|
|
|
+ log.info("正在关闭 Service 私有的连接池...");
|
|
|
|
|
+
|
|
|
privateDataSource.close();
|
|
privateDataSource.close();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|