From cc72c468bd06021e66f60b02446aa5a4cefb3521 Mon Sep 17 00:00:00 2001 From: Raod <1130305001@qq.com> Date: Thu, 8 Jul 2021 11:16:13 +0800 Subject: [PATCH] pom --- report-core/pom.xml | 28 +++++------------ .../service/impl/GaeaFileServiceImpl.java | 4 +-- .../business/modules/file/util/FileUtils.java | 31 +++++++++++++++++++ .../src/main/resources/bootstrap-dev.yml | 2 ++ 4 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 report-core/src/main/java/com/anjiplus/template/gaea/business/modules/file/util/FileUtils.java diff --git a/report-core/pom.xml b/report-core/pom.xml index ccfc264d..4a994834 100644 --- a/report-core/pom.xml +++ b/report-core/pom.xml @@ -65,14 +65,14 @@ 2.10.6 - - com.anji-plus - spring-boot-starter-gaea-export - - - com.anji-plus - spring-boot-starter-gaea-log - + + + + + + + + org.flywaydb @@ -81,18 +81,6 @@ - - org.apache.httpcomponents - httpclient - 4.5.2 - - - - org.apache.httpcomponents - httpcore - 4.4.5 - - com.alibaba druid diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/file/service/impl/GaeaFileServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/file/service/impl/GaeaFileServiceImpl.java index d918748f..7c4e9196 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/file/service/impl/GaeaFileServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/file/service/impl/GaeaFileServiceImpl.java @@ -1,15 +1,15 @@ package com.anjiplus.template.gaea.business.modules.file.service.impl; -import com.alibaba.excel.util.FileUtils; import com.anji.plus.gaea.constant.BaseOperationEnum; import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper; import com.anji.plus.gaea.exception.BusinessException; import com.anji.plus.gaea.exception.BusinessExceptionBuilder; -import com.anjiplus.template.gaea.business.modules.file.util.StringPatternUtil; import com.anjiplus.template.gaea.business.code.ResponseCode; import com.anjiplus.template.gaea.business.modules.file.dao.GaeaFileMapper; import com.anjiplus.template.gaea.business.modules.file.entity.GaeaFile; import com.anjiplus.template.gaea.business.modules.file.service.GaeaFileService; +import com.anjiplus.template.gaea.business.modules.file.util.FileUtils; +import com.anjiplus.template.gaea.business.modules.file.util.StringPatternUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import lombok.extern.slf4j.Slf4j; diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/file/util/FileUtils.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/file/util/FileUtils.java new file mode 100644 index 00000000..c0cb07e1 --- /dev/null +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/file/util/FileUtils.java @@ -0,0 +1,31 @@ +package com.anjiplus.template.gaea.business.modules.file.util; + +import lombok.extern.slf4j.Slf4j; + +import java.io.*; + +/** + * Created by raodeming on 2021/7/8. + */ +@Slf4j +public class FileUtils { + public static byte[] readFileToByteArray(File file) { + byte[] buffer = null; + try { + FileInputStream fis = new FileInputStream(file); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + byte[] b = new byte[1024]; + int n; + while ((n = fis.read(b)) != -1) { + bos.write(b, 0, n); + } + fis.close(); + bos.close(); + buffer = bos.toByteArray(); + } catch (IOException e) { + log.error("{}", e); + } + return buffer; + } + +} diff --git a/report-core/src/main/resources/bootstrap-dev.yml b/report-core/src/main/resources/bootstrap-dev.yml index 64dabe22..19927478 100644 --- a/report-core/src/main/resources/bootstrap-dev.yml +++ b/report-core/src/main/resources/bootstrap-dev.yml @@ -42,6 +42,8 @@ spring: user: ${spring.datasource.username} password: ${spring.datasource.password} placeholder-replacement: false + init-sqls: + - CREATE DATABASE IF NOT EXISTS `aj_report` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; generator: enabled: true workspace: /workspace/gaea