Commit 62d2ef53 authored by AfirSraftGarrier's avatar AfirSraftGarrier

Merge remote-tracking branch 'origin/m33' into for-yx

parents 1694fe28 e1d56c3f
......@@ -27,7 +27,6 @@ public class TcpServer {
EventLoopGroup bossGroup = new NioEventLoopGroup(4);
EventLoopGroup workerGroup = new NioEventLoopGroup(4);
log.debug("Tcp服务,开始监听端口:{}",port);
try {
//创建服务端的启动对象,设置参数
ServerBootstrap b = new ServerBootstrap();
//设置两个线程组boosGroup和workerGroup
......@@ -47,9 +46,7 @@ public class TcpServer {
} catch (InterruptedException e) {
// TODO Auto-generated catch block
log.error("Tcp服务异常,端口:{}",port);
}
} finally {
}finally {
log.debug("Tcp服务,停止退出");
workerGroup.shutdownGracefully();
bossGroup.shutdownGracefully();
......
......@@ -22,7 +22,7 @@ public class ResourceManager {
@Autowired
ResourceService resourceService;
public void downloadDeviceInfoExcle(HttpServletResponse response, int userId){
public void downloadDeviceInfoExcle(HttpServletResponse response, int userId) throws IOException {
OutputStream os = null;
HSSFWorkbook wb = null;
try {
......@@ -115,16 +115,12 @@ public class ResourceManager {
} catch (IOException e) {
log.error("Excel表格信息下载异常,{}",e.getMessage());
} finally {
try {
if (os != null) {
os.close();
}
if (wb != null) {
wb.close();
}
} catch (IOException e) {
log.error("Excel表格信息下载异常,{}",e.getMessage());
}
}
}
}
......@@ -85,11 +85,14 @@ public class CommonUtil {
public static String getLibFilePathByFileName(String fileName) {
String os = System.getProperty("os.name");
String serverParentDirectory = getServerParentDirectory();
if (os != null) {
if (os.toLowerCase(Locale.ENGLISH).startsWith("win")) {
return serverParentDirectory + File.separator + "lib" + File.separator + fileName + ".dll";
} else {
return serverParentDirectory + File.separator + "lib" + File.separator + fileName + ".so";
}
}
return "";
}
}
......@@ -4,13 +4,13 @@ public class HexUtil {
public static String bytes2hex(byte[] bytes) {
StringBuilder sb = new StringBuilder();
String tmp;
StringBuilder tmp;
sb.append("[");
for (byte b : bytes) {
// 将每个字节与0xFF进行与运算,然后转化为10进制,然后借助于Integer再转化为16进制
tmp = Integer.toHexString(0xFF & b);
tmp = new StringBuilder(Integer.toHexString(0xFF & b));
if (tmp.length() == 1) {
tmp = "0" + tmp;//只有一位的前面补个0
tmp = tmp.insert(0, '0');//只有一位的前面补个0
}
sb.append(tmp).append(" ");//每个字节用空格断开
}
......
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