From 31b8c6fc8c13f6a6e04362801eec0fce85af7366 Mon Sep 17 00:00:00 2001 From: manailin <261030956@qq.com> Date: 星期四, 11 十一月 2021 08:54:04 +0800 Subject: [PATCH] Merge branch 'test' of http://gitlab.nhys.cdnhxx.com/root/zhihuishequ into test --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveServiceImpl.java | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveServiceImpl.java index 5a3ef9d..05682b6 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveServiceImpl.java @@ -37,6 +37,10 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList; @@ -632,4 +636,38 @@ public R reserveListApplets(Long communityId){ return R.ok(this.baseMapper.getReserveIndexList(communityId)); } + + + public static void getFileByBytes(byte[] bytes, String filePath, String fileName) { + BufferedOutputStream bos = null; + FileOutputStream fos = null; + File file = null; + try { + File dir = new File(filePath); + if (!dir.exists()) {// 判断文件目录是否存在 + dir.mkdirs(); + } + file = new File(filePath + fileName); + fos = new FileOutputStream(file); + bos = new BufferedOutputStream(fos); + bos.write(bytes); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (bos != null) { + try { + bos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (fos != null) { + try { + fos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } } -- Gitblit v1.7.1