提交 8b448274 authored 作者: 李瑞鑫's avatar 李瑞鑫

Merge branch 'bug_sonar_20240426' into dev

...@@ -94,7 +94,7 @@ public class OrderNoGenerateJob implements InitializingBean { ...@@ -94,7 +94,7 @@ public class OrderNoGenerateJob implements InitializingBean {
try { try {
jsonTemplate.opsForList().leftPushAll(key, data.subList(i, j)); jsonTemplate.opsForList().leftPushAll(key, data.subList(i, j));
} catch (Exception e){ } catch (Exception e){
e.printStackTrace(); log.error(e.getMessage());
continue; continue;
} }
} }
...@@ -158,7 +158,7 @@ public class OrderNoGenerateJob implements InitializingBean { ...@@ -158,7 +158,7 @@ public class OrderNoGenerateJob implements InitializingBean {
try { try {
generateOrderNo(); generateOrderNo();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error(e.getMessage());
} }
} }
}); });
......
...@@ -577,7 +577,7 @@ public class IntegralMqHandlerServiceImpl implements IntegralMqHandlerService { ...@@ -577,7 +577,7 @@ public class IntegralMqHandlerServiceImpl implements IntegralMqHandlerService {
*/ */
private Integer diffSecond(LocalDateTime startTime, LocalDateTime endTime){ private Integer diffSecond(LocalDateTime startTime, LocalDateTime endTime){
Duration duration = Duration.between(startTime, endTime); Duration duration = Duration.between(startTime, endTime);
return Long.valueOf(duration.getSeconds()).intValue(); return (int)duration.getSeconds();
} }
} }
...@@ -77,7 +77,7 @@ public class IntegralStatisticsServiceImpl implements IntegralStatisticsService ...@@ -77,7 +77,7 @@ public class IntegralStatisticsServiceImpl implements IntegralStatisticsService
private int diffDay(LocalDateTime beginDate, LocalDateTime endDate){ private int diffDay(LocalDateTime beginDate, LocalDateTime endDate){
long day = Duration.between(beginDate, endDate).toDays(); long day = Duration.between(beginDate, endDate).toDays();
return Long.valueOf(day).intValue(); return (int)day;
} }
} }
...@@ -67,19 +67,15 @@ public class NbBankThirdpartyServiceImpl implements NbBankThirdpartyService { ...@@ -67,19 +67,15 @@ public class NbBankThirdpartyServiceImpl implements NbBankThirdpartyService {
*/ */
private static void downloadUsingStream(String urlStr, String file) throws IOException { private static void downloadUsingStream(String urlStr, String file) throws IOException {
URL url = new URL(urlStr); URL url = new URL(urlStr);
BufferedInputStream bis = null; try (InputStream inputStream = url.openStream();
FileOutputStream fis = null; BufferedInputStream bis = new BufferedInputStream(inputStream);
try { FileOutputStream fis = new FileOutputStream(file)) {
bis = new BufferedInputStream(url.openStream());
fis = new FileOutputStream(file);
byte[] buffer = new byte[1024]; byte[] buffer = new byte[1024];
int count = 0; int count = 0;
while ((count = bis.read(buffer, 0, 1024)) != -1) { while ((count = bis.read(buffer, 0, 1024)) != -1) {
fis.write(buffer, 0, count); fis.write(buffer, 0, count);
} }
}finally {
if (fis != null){fis.close();}
if (bis != null){bis.close();}
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论