diff --git a/eladmin-system/pom.xml b/eladmin-system/pom.xml
index efaf132..9ad3b09 100644
--- a/eladmin-system/pom.xml
+++ b/eladmin-system/pom.xml
@@ -40,10 +40,10 @@
-
- org.springframework.boot
- spring-boot-starter-websocket
-
+
+ org.springframework.boot
+ spring-boot-starter-websocket
+
com.aliyun.oss
@@ -87,16 +87,16 @@
-
- ch.ethz.ganymed
- ganymed-ssh2
- build210
-
-
- com.jcraft
- jsch
- 0.1.55
-
+
+ ch.ethz.ganymed
+ ganymed-ssh2
+ build210
+
+
+ com.jcraft
+ jsch
+ 0.1.55
+
@@ -106,12 +106,18 @@
-
-
-
+
+
+
+
+ com.aliyun.oss
+ aliyun-sdk-oss
+ 3.10.0
+
+
diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/formdata/service/FormdataService.java b/eladmin-system/src/main/java/me/zhengjie/modules/formdata/service/FormdataService.java
index fcdd78d..03039df 100644
--- a/eladmin-system/src/main/java/me/zhengjie/modules/formdata/service/FormdataService.java
+++ b/eladmin-system/src/main/java/me/zhengjie/modules/formdata/service/FormdataService.java
@@ -1,18 +1,18 @@
/*
-* Copyright 2019-2020 Zheng Jie
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright 2019-2020 Zheng Jie
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package me.zhengjie.modules.formdata.service;
import me.zhengjie.modules.formdata.domain.Formdata;
@@ -27,60 +27,67 @@ import java.util.List;
import java.util.Map;
/**
-* @website https://el-admin.vip
-* @description 服务接口
-* @author x
-* @date 2021-08-05
-**/
+ * @author x
+ * @website https://el-admin.vip
+ * @description 服务接口
+ * @date 2021-08-05
+ **/
public interface FormdataService {
/**
- * 查询数据分页
- * @param criteria 条件
- * @param pageable 分页参数
- * @return Map
- */
- Map queryAll(FormdataQueryCriteria criteria, Pageable pageable);
+ * 查询数据分页
+ *
+ * @param criteria 条件
+ * @param pageable 分页参数
+ * @return Map
+ */
+ Map queryAll(FormdataQueryCriteria criteria, Pageable pageable);
/**
- * 查询所有数据不分页
- * @param criteria 条件参数
- * @return List
- */
+ * 查询所有数据不分页
+ *
+ * @param criteria 条件参数
+ * @return List
+ */
List queryAll(FormdataQueryCriteria criteria);
/**
* 根据ID查询
+ *
* @param id ID
* @return FormdataDto
*/
FormdataDto findById(Long id);
/**
- * 创建
- * @param resources /
- * @return FormdataDto
- */
+ * 创建
+ *
+ * @param resources /
+ * @return FormdataDto
+ */
FormdataDto create(Formdata resources);
/**
- * 编辑
- * @param resources /
- */
+ * 编辑
+ *
+ * @param resources /
+ */
void update(Formdata resources);
/**
- * 多选删除
- * @param ids /
- */
+ * 多选删除
+ *
+ * @param ids /
+ */
void deleteAll(Long[] ids);
/**
- * 导出数据
- * @param all 待导出的数据
- * @param response /
- * @throws IOException /
- */
+ * 导出数据
+ *
+ * @param all 待导出的数据
+ * @param response /
+ * @throws IOException /
+ */
void download(List all, HttpServletResponse response) throws IOException;
/**
@@ -98,4 +105,11 @@ public interface FormdataService {
* @return
*/
String parseMediaFileToLocal(MultipartFile file);
+
+ /**
+ * 上传oos
+ *
+ * @param file
+ */
+ void uploadOOS(MultipartFile file);
}
\ No newline at end of file
diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/formdata/service/impl/FormdataServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/formdata/service/impl/FormdataServiceImpl.java
index 295aaff..b2c8d36 100644
--- a/eladmin-system/src/main/java/me/zhengjie/modules/formdata/service/impl/FormdataServiceImpl.java
+++ b/eladmin-system/src/main/java/me/zhengjie/modules/formdata/service/impl/FormdataServiceImpl.java
@@ -1,33 +1,54 @@
/*
-* Copyright 2019-2020 Zheng Jie
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright 2019-2020 Zheng Jie
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package me.zhengjie.modules.formdata.service.impl;
+import cn.hutool.core.date.DateUnit;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.system.OsInfo;
+import cn.hutool.system.SystemUtil;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.EasyExcelFactory;
+import com.alibaba.excel.ExcelReader;
+import com.aliyun.oss.OSS;
+import com.aliyun.oss.OSSClientBuilder;
+import com.aliyun.oss.model.PutObjectRequest;
+import lombok.Data;
import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import me.zhengjie.common.http.CommonResponse;
+import me.zhengjie.common.http.ResponseCode;
import me.zhengjie.modules.formdata.domain.Formdata;
import me.zhengjie.modules.formdata.repository.FormdataRepository;
import me.zhengjie.modules.formdata.service.FormdataService;
import me.zhengjie.modules.formdata.service.dto.FormdataDto;
import me.zhengjie.modules.formdata.service.dto.FormdataQueryCriteria;
import me.zhengjie.modules.formdata.service.mapstruct.FormdataMapper;
+import me.zhengjie.modules.uploadnew.listener.EasyExcelListener;
+import me.zhengjie.modules.uploadnew.service.dto.ExcelDataDTO;
+import me.zhengjie.modules.uploadnew.service.dto.OosDTO;
+import me.zhengjie.modules.uploadnew.service.dto.WavDTO;
import me.zhengjie.modules.uploadnew.task.TransFormDataTask;
import me.zhengjie.utils.FileUtil;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp;
import me.zhengjie.utils.ValidationUtil;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@@ -35,44 +56,67 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import java.io.*;
+import java.nio.charset.Charset;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import static me.zhengjie.modules.constant.FileConstant.SPLIT_FILE_SYMBOL;
/**
-* @website https://el-admin.vip
-* @description 服务实现
-* @author x
-* @date 2021-08-05
-**/
+ * @author x
+ * @website https://el-admin.vip
+ * @description 服务实现
+ * @date 2021-08-05
+ **/
+@Slf4j
@Service
@RequiredArgsConstructor
public class FormdataServiceImpl implements FormdataService {
private final FormdataRepository formdataRepository;
private final FormdataMapper formdataMapper;
-
@Autowired
- private TransFormDataTask transFormDataTask;
+ private final TransFormDataTask transFormDataTask;
+ /**
+ * 远程上传临时存放文件地址 - linux环境
+ */
+ @Value("${remote.link.file-base-path-linux}")
+ private String remoteLinkFileBasePathLinux;
+
+ /**
+ * 远程上传临时存放文件地址 - linux环境
+ */
+ @Value("${remote.link.file-base-path-windows}")
+ private String remoteLinkFileBasePathWindows;
+
+ /**
+ * 远程上传临时存放文件地址 - linux环境
+ */
+ @Value("${remote.link.file-base-path-mac}")
+ private String remoteLinkFileBasePathMac;
+
+ private List list = new ArrayList<>();
+
@Override
- public Map queryAll(FormdataQueryCriteria criteria, Pageable pageable){
- Page page = formdataRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
+ public Map queryAll(FormdataQueryCriteria criteria, Pageable pageable) {
+ Page page = formdataRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
return PageUtil.toPage(page.map(formdataMapper::toDto));
}
@Override
- public List queryAll(FormdataQueryCriteria criteria){
- return formdataMapper.toDto(formdataRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
+ public List queryAll(FormdataQueryCriteria criteria) {
+ return formdataMapper.toDto(formdataRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
}
@Override
@Transactional
public FormdataDto findById(Long id) {
Formdata formdata = formdataRepository.findById(id).orElseGet(Formdata::new);
- ValidationUtil.isNull(formdata.getId(),"Formdata","id",id);
+ ValidationUtil.isNull(formdata.getId(), "Formdata", "id", id);
return formdataMapper.toDto(formdata);
}
@@ -86,7 +130,7 @@ public class FormdataServiceImpl implements FormdataService {
@Transactional(rollbackFor = Exception.class)
public void update(Formdata resources) {
Formdata formdata = formdataRepository.findById(resources.getId()).orElseGet(Formdata::new);
- ValidationUtil.isNull( formdata.getId(),"Formdata","id",resources.getId());
+ ValidationUtil.isNull(formdata.getId(), "Formdata", "id", resources.getId());
formdata.copy(resources);
formdataRepository.save(formdata);
}
@@ -102,7 +146,7 @@ public class FormdataServiceImpl implements FormdataService {
public void download(List all, HttpServletResponse response) throws IOException {
List