Merge branch 'master' of 47.110.11.213:BY_BE_team/plat2-eladmin into master

master
土豆兄弟 3 years ago
commit 87945cc571

@ -105,11 +105,4 @@ public interface FormdataService {
* @return * @return
*/ */
String parseMediaFileToLocal(MultipartFile file); String parseMediaFileToLocal(MultipartFile file);
/**
* oos
*
* @param file
*/
void uploadOOS(MultipartFile file, List<FormdataDto> list);
} }

@ -16,8 +16,6 @@
package me.zhengjie.modules.formdata.service.impl; package me.zhengjie.modules.formdata.service.impl;
import com.alibaba.excel.EasyExcelFactory; import com.alibaba.excel.EasyExcelFactory;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import me.zhengjie.modules.formdata.domain.Formdata; import me.zhengjie.modules.formdata.domain.Formdata;
@ -28,17 +26,13 @@ import me.zhengjie.modules.formdata.service.dto.FormdataQueryCriteria;
import me.zhengjie.modules.formdata.service.mapstruct.FormdataMapper; import me.zhengjie.modules.formdata.service.mapstruct.FormdataMapper;
import me.zhengjie.modules.uploadnew.listener.EasyExcelListener; import me.zhengjie.modules.uploadnew.listener.EasyExcelListener;
import me.zhengjie.modules.uploadnew.service.dto.ExcelDataDTO; 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.service.impl.BuildPathUtils; import me.zhengjie.modules.uploadnew.service.impl.BuildPathUtils;
import me.zhengjie.modules.uploadnew.task.TransFormDataTask; import me.zhengjie.modules.uploadnew.task.TransFormDataTask;
import me.zhengjie.utils.FileUtil; import me.zhengjie.utils.FileUtil;
import me.zhengjie.utils.PageUtil; import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.QueryHelp; import me.zhengjie.utils.QueryHelp;
import me.zhengjie.utils.ValidationUtil; import me.zhengjie.utils.ValidationUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; 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.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -47,15 +41,11 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.nio.charset.Charset;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import static me.zhengjie.modules.constant.FileConstant.SPLIT_FILE_SYMBOL;
/** /**
* @author x * @author x
@ -70,20 +60,10 @@ public class FormdataServiceImpl implements FormdataService {
private final FormdataRepository formdataRepository; private final FormdataRepository formdataRepository;
private final FormdataMapper formdataMapper; private final FormdataMapper formdataMapper;
@Autowired
private final TransFormDataTask transFormDataTask;
@Autowired @Autowired
private BuildPathUtils buildPathUtils; private BuildPathUtils buildPathUtils;
@Value("${upload.accessKeyId}")
private String accessKeyId;
@Value("${upload.accessKeySecret}")
private String accessKeySecret;
@Value("${upload.bucketName}")
private String bucketName;
@Value("${upload.endpoint}")
private String endpoint;
@Override @Override
public Map<String, Object> queryAll(FormdataQueryCriteria criteria, Pageable pageable) { public Map<String, Object> queryAll(FormdataQueryCriteria criteria, Pageable pageable) {
@ -217,70 +197,4 @@ public class FormdataServiceImpl implements FormdataService {
} }
return path; return path;
} }
/**
* oos
*
* @param file
* @return
*/
@Override
public void uploadOOS(MultipartFile file, List<FormdataDto> list) {
List<WavDTO> wavList = zipUtil(file);
for (WavDTO wavDTO : wavList) {
for (FormdataDto info : list) {
if (wavDTO.getName().equals(info.getPhone())) {
//上传路径
String newFileName = buildPathUtils.buildFileOosPath(wavDTO.getSubFixFile());
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
ossClient.putObject(bucketName, newFileName, wavDTO.getLine());
ossClient.shutdown();
OosDTO oosDTO = toBean(info, newFileName);
//发送下游
transFormDataTask.doRunTask(oosDTO);
}
}
}
}
private List<WavDTO> zipUtil(MultipartFile file) {
List<WavDTO> wavDTOS = new ArrayList<>();
String zipFileName = null;
try {
ZipInputStream zipInputStream = new ZipInputStream(file.getInputStream(), Charset.forName("GBK"));
BufferedInputStream bs = new BufferedInputStream(zipInputStream);
ZipEntry zipEntry;
byte[] bytes = null;
while ((zipEntry = zipInputStream.getNextEntry()) != null) {
WavDTO wavDTO = new WavDTO();
zipFileName = zipEntry.getName();
wavDTO.setName(zipFileName.substring(0, zipFileName.lastIndexOf(".")));
wavDTO.setSubFixFile(StringUtils.substringAfterLast(zipFileName, SPLIT_FILE_SYMBOL));
bytes = new byte[(int) zipEntry.getSize()];
bs.read(bytes, 0, (int) zipEntry.getSize());
InputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
wavDTO.setLine(byteArrayInputStream);
wavDTOS.add(wavDTO);
}
} catch (Exception e) {
log.error("读取部署包文件内容失败,请确认部署包格式正确: {} ", zipFileName, e);
}
return wavDTOS;
}
private OosDTO toBean(FormdataDto info, String newFileName) {
OosDTO oosDTO = new OosDTO();
oosDTO.setId(info.getSourceId().longValue());
oosDTO.setAge(info.getAge());
oosDTO.setCity(info.getCity());
oosDTO.setName(info.getName());
oosDTO.setPhone(info.getPhone());
oosDTO.setProvince(info.getProvince());
oosDTO.setVoiceaddr(newFileName);
return oosDTO;
}
} }

@ -1,13 +1,17 @@
package me.zhengjie.modules.uploadnew.listener; package me.zhengjie.modules.uploadnew.listener;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener; import com.alibaba.excel.event.AnalysisEventListener;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import me.zhengjie.modules.formdata.domain.Formdata; import me.zhengjie.modules.formdata.domain.Formdata;
import me.zhengjie.modules.system.service.dto.UserDto;
import me.zhengjie.modules.system.service.impl.UserServiceImpl;
import me.zhengjie.modules.uploadnew.service.dto.ExcelDataDTO; import me.zhengjie.modules.uploadnew.service.dto.ExcelDataDTO;
import me.zhengjie.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -20,6 +24,8 @@ import java.util.List;
public class EasyExcelListener extends AnalysisEventListener<ExcelDataDTO> { public class EasyExcelListener extends AnalysisEventListener<ExcelDataDTO> {
@Autowired
private UserServiceImpl userServiceImpl;
/** /**
* *
*/ */
@ -28,8 +34,18 @@ public class EasyExcelListener extends AnalysisEventListener<ExcelDataDTO> {
@Override @Override
public void invoke(ExcelDataDTO excelDataDTO, AnalysisContext analysisContext) { public void invoke(ExcelDataDTO excelDataDTO, AnalysisContext analysisContext) {
log.info("解析到一条数据:{}", JSONUtil.toJsonStr(excelDataDTO)); log.info("解析到一条数据:{}", JSONUtil.toJsonStr(excelDataDTO));
//获取操作人id
UserDto byName = userServiceImpl.findByName(SecurityUtils.getCurrentUser().getUsername());
int sourceId;
if (ObjectUtil.isEmpty(byName)) {
//登录用户id
sourceId = byName.getId().intValue();
} else {
//系统id
sourceId = SecurityUtils.getCurrentUserId().intValue();
}
Formdata formdata = new Formdata(); Formdata formdata = new Formdata();
formdata.setSourceId((int) IdUtil.getSnowflake(1, 1).nextId()); formdata.setSourceId(sourceId);
formdata.setUploadTime(DateUtil.date().toTimestamp()); formdata.setUploadTime(DateUtil.date().toTimestamp());
formdata.setName(excelDataDTO.getName()); formdata.setName(excelDataDTO.getName());
formdata.setAge(excelDataDTO.getAge()); formdata.setAge(excelDataDTO.getAge());

@ -37,6 +37,7 @@ import me.zhengjie.modules.uploadnew.service.TbUploadFileNewService;
import me.zhengjie.modules.uploadnew.service.dto.TbUploadFileNewDto; import me.zhengjie.modules.uploadnew.service.dto.TbUploadFileNewDto;
import me.zhengjie.modules.uploadnew.service.dto.TbUploadFileNewQueryCriteria; import me.zhengjie.modules.uploadnew.service.dto.TbUploadFileNewQueryCriteria;
import me.zhengjie.modules.uploadnew.task.SaveToFileNewTask; import me.zhengjie.modules.uploadnew.task.SaveToFileNewTask;
import me.zhengjie.modules.uploadnew.task.UploadOssTask;
import me.zhengjie.utils.SecurityUtils; import me.zhengjie.utils.SecurityUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -85,6 +86,8 @@ public class TbUploadFileNewController {
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
private FormdataService formdataService; private FormdataService formdataService;
@Autowired
private UploadOssTask uploadOssTask;
@Autowired @Autowired
public TbUploadFileNewController(TbUploadFileNewService tbUploadFileNewService, SaveToFileNewTask saveToFileNewTask, RedisTemplate redisTemplate, FormdataService formdataService) { public TbUploadFileNewController(TbUploadFileNewService tbUploadFileNewService, SaveToFileNewTask saveToFileNewTask, RedisTemplate redisTemplate, FormdataService formdataService) {
@ -174,13 +177,12 @@ public class TbUploadFileNewController {
@RequestParam(value = "taskName") String taskName) { @RequestParam(value = "taskName") String taskName) {
// 记录日志 // 记录日志
log.info("TbUploadFileNewController:newFileUpload | taskName : {} start ", taskName); log.info("TbUploadFileNewController:newFileUpload | taskName : {} start ", taskName);
// 校验上传是否有文件 // 校验上传是否有文件
if (null == files) { if (null == files) {
return new ResponseEntity<>(CommonResponse.createByError(ResponseCode.NO_FILE_INPUT), HttpStatus.OK); return new ResponseEntity<>(CommonResponse.createByError(ResponseCode.NO_FILE_INPUT), HttpStatus.OK);
} }
//记录文件上传记录 //记录文件上传记录
TbUploadFileNew resources = new TbUploadFileNew(); TbUploadFileNew resources = new TbUploadFileNew();
resources.setUploadTime(DateUtil.date().toTimestamp()); resources.setUploadTime(DateUtil.date().toTimestamp());
resources.setUploadFileTaskName(taskName); resources.setUploadFileTaskName(taskName);
@ -188,12 +190,10 @@ public class TbUploadFileNewController {
resources.setGmtCreate(DateUtil.date().toTimestamp()); resources.setGmtCreate(DateUtil.date().toTimestamp());
resources.setOperation(SecurityUtils.getCurrentUser().getUsername()); resources.setOperation(SecurityUtils.getCurrentUser().getUsername());
TbUploadFileNewDto resourcesDto = tbUploadFileNewService.create(resources); TbUploadFileNewDto resourcesDto = tbUploadFileNewService.create(resources);
if (ObjectUtil.isEmpty(resourcesDto)) { if (ObjectUtil.isEmpty(resourcesDto)) {
log.error("上传记录创建失败, resources is {} ", resources.toString()); log.error("上传记录创建失败, resources is {} ", resources.toString());
return new ResponseEntity<>(CommonResponse.createByError(ResponseCode.FILE_HANDLE_FAIL), HttpStatus.OK); return new ResponseEntity<>(CommonResponse.createByError(ResponseCode.FILE_HANDLE_FAIL), HttpStatus.OK);
} }
//解析文件 //解析文件
int finishTag = 0; int finishTag = 0;
List<FormdataDto> list = new ArrayList<>(); List<FormdataDto> list = new ArrayList<>();
@ -220,33 +220,22 @@ public class TbUploadFileNewController {
finishTag += 1; finishTag += 1;
} }
} }
// finishTag = handleEachUploadFile(file, subOriginalFilename, finishTag, resourcesDto, list);
}
}
for (MultipartFile file : files) {
String subOriginalFilename = StringUtils.substringAfterLast(file.getOriginalFilename(), SPLIT_FILE_SYMBOL);
if (CollectionUtil.isNotEmpty(list)) {
if (RAR_FILE_SUB_NAME.equalsIgnoreCase(subOriginalFilename) || ZIP_FILE_SUB_NAME.equalsIgnoreCase(subOriginalFilename)) {
// 3. 上传oos 并 异步发送给 下游接口
formdataService.uploadOOS(file, list);
}
} }
} }
//异步上传oss并传给下游
uploadOssTask.uploadOss(files, list);
// 确保所有文件都经过了响应的处理 // 确保所有文件都经过了响应的处理
if (finishTag != files.length) { if (finishTag != files.length) {
// 上传完成更新文件上传记录 //上传失败更新文件上传记录
resourcesDto.setUploadTag(DefaultConstant.TWO_NUMBER); resourcesDto.setUploadTag(DefaultConstant.TWO_NUMBER);
resourcesDto.setGmtModified(DateUtil.date().toTimestamp()); resourcesDto.setGmtModified(DateUtil.date().toTimestamp());
TbUploadFileNew tbUploadFileNew = new TbUploadFileNew(); TbUploadFileNew tbUploadFileNew = new TbUploadFileNew();
BeanUtils.copyProperties(resourcesDto, tbUploadFileNew); BeanUtils.copyProperties(resourcesDto, tbUploadFileNew);
tbUploadFileNewService.update(tbUploadFileNew); tbUploadFileNewService.update(tbUploadFileNew);
log.error("TbUploadFileNewController:newFileUpload | taskName : {} fail ", taskName); log.error("TbUploadFileNewController:newFileUpload | taskName : {} fail ", taskName);
return new ResponseEntity<>(CommonResponse.createByError(ResponseCode.FILE_HANDLE_FAIL), HttpStatus.OK); return new ResponseEntity<>(CommonResponse.createByError(ResponseCode.FILE_HANDLE_FAIL), HttpStatus.OK);
} }
// 上传完成更新文件上传记录 // 上传完成更新文件上传记录
resourcesDto.setUploadTag(DefaultConstant.ZERO_NUMBER); resourcesDto.setUploadTag(DefaultConstant.ZERO_NUMBER);
resourcesDto.setGmtModified(DateUtil.date().toTimestamp()); resourcesDto.setGmtModified(DateUtil.date().toTimestamp());
@ -254,7 +243,6 @@ public class TbUploadFileNewController {
TbUploadFileNew tbUploadFileNew = new TbUploadFileNew(); TbUploadFileNew tbUploadFileNew = new TbUploadFileNew();
BeanUtils.copyProperties(resourcesDto, tbUploadFileNew); BeanUtils.copyProperties(resourcesDto, tbUploadFileNew);
tbUploadFileNewService.update(tbUploadFileNew); tbUploadFileNewService.update(tbUploadFileNew);
return new ResponseEntity<>(CommonResponse.createBySuccess(ResponseCode.SUCCESS), HttpStatus.OK); return new ResponseEntity<>(CommonResponse.createBySuccess(ResponseCode.SUCCESS), HttpStatus.OK);
} }

@ -1,5 +1,6 @@
package me.zhengjie.modules.uploadnew.service.dto; package me.zhengjie.modules.uploadnew.service.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -12,11 +13,11 @@ import javax.persistence.Column;
@Data @Data
public class ExcelDataDTO { public class ExcelDataDTO {
@Column(name = "name") @Column(name = "name")
@ApiModelProperty(value = "称呼") @ApiModelProperty(value = "姓名")
private String name; private String name;
@Column(name = "phone") @Column(name = "phone")
@ApiModelProperty(value = "联系方式") @ApiModelProperty(value = "手机号")
private String phone; private String phone;
@Column(name = "age") @Column(name = "age")
@ -28,6 +29,6 @@ public class ExcelDataDTO {
private String province; private String province;
@Column(name = "city") @Column(name = "city")
@ApiModelProperty(value = "市") @ApiModelProperty(value = "市")
private String city; private String city;
} }

@ -32,6 +32,8 @@ public class TbUploadFileNewQueryCriteria{
@Query(type = Query.Type.INNER_LIKE) @Query(type = Query.Type.INNER_LIKE)
private String uploadFileTaskName; private String uploadFileTaskName;
/** 模糊 */ /** 模糊 */
@Query(type = Query.Type.INNER_LIKE) @Query(type = Query.Type.INNER_LIKE)
private String operation; private String operation;

@ -50,9 +50,9 @@ import static me.zhengjie.modules.uploadnew.consts.SysConstNew.TEST_USER_NAME;
import static me.zhengjie.modules.uploadnew.consts.UploadFileNewConst.*; import static me.zhengjie.modules.uploadnew.consts.UploadFileNewConst.*;
/** /**
* @author weizhongxi
* @website https://el-admin.vip * @website https://el-admin.vip
* @description * @description
* @author weizhongxi
* @date 2021-04-14 * @date 2021-04-14
**/ **/
@Service @Service

@ -18,7 +18,6 @@ import java.time.LocalDateTime;
import java.time.ZoneOffset; import java.time.ZoneOffset;
@Component @Component
@Scope("prototype") @Scope("prototype")
@Slf4j @Slf4j

@ -0,0 +1,97 @@
package me.zhengjie.modules.uploadnew.task;
import cn.hutool.core.collection.CollectionUtil;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.modules.formdata.service.dto.FormdataDto;
import me.zhengjie.modules.formdata.service.impl.FormdataServiceImpl;
import me.zhengjie.modules.uploadnew.service.dto.OosDTO;
import me.zhengjie.modules.uploadnew.service.dto.WavDTO;
import me.zhengjie.modules.uploadnew.service.impl.BuildPathUtils;
import me.zhengjie.modules.uploadnew.util.ZipUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
import static java.util.stream.Collectors.toMap;
import static me.zhengjie.modules.constant.FileConstant.*;
/**
* @author wjt
* @date 2021/8/10
* oss
*/
@Slf4j
@Scope("prototype")
@Component
public class UploadOssTask {
@Value("${upload.accessKeyId}")
private String accessKeyId;
@Value("${upload.accessKeySecret}")
private String accessKeySecret;
@Value("${upload.bucketName}")
private String bucketName;
@Value("${upload.endpoint}")
private String endpoint;
@Autowired
FormdataServiceImpl formdataService;
@Autowired
private ZipUtils zipUtils;
@Autowired
private BuildPathUtils buildPathUtils;
@Autowired
private TransFormDataTask transFormDataTask;
@Async(value = "SendBigDataTaskExecutor")
public void uploadOss(MultipartFile[] files, List<FormdataDto> list) {
for (MultipartFile file : files) {
String subOriginalFilename = StringUtils.substringAfterLast(file.getOriginalFilename(), SPLIT_FILE_SYMBOL);
if (CollectionUtil.isNotEmpty(list)) {
if (RAR_FILE_SUB_NAME.equalsIgnoreCase(subOriginalFilename) || ZIP_FILE_SUB_NAME.equalsIgnoreCase(subOriginalFilename)) {
// 上传oos 并 异步发送给 下游接口
upload(file, list);
}
}
}
}
private void upload(MultipartFile file, List<FormdataDto> list) {
List<WavDTO> wavList = zipUtils.zipUtil(file);
Map<String, FormdataDto> map = list.stream().collect(toMap(FormdataDto::getPhone, p -> p, (key1, key2) -> key2));
for (WavDTO wav : wavList) {
if (map.containsKey(wav.getName())) {
//上传路径
String newFileName = buildPathUtils.buildFileOosPath(wav.getSubFixFile());
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
ossClient.putObject(bucketName, newFileName, wav.getLine());
ossClient.shutdown();
log.info("上传oos{}", wav.getLine());
OosDTO oosDTO = toBean(map.get(wav.getName()), newFileName);
//发送下游
transFormDataTask.doRunTask(oosDTO);
}
}
}
private OosDTO toBean(FormdataDto info, String newFileName) {
OosDTO oosDTO = new OosDTO();
oosDTO.setId(info.getSourceId().longValue());
oosDTO.setAge(info.getAge());
oosDTO.setCity(info.getCity());
oosDTO.setName(info.getName());
oosDTO.setPhone(info.getPhone());
oosDTO.setProvince(info.getProvince());
oosDTO.setVoiceaddr(newFileName);
return oosDTO;
}
}

@ -0,0 +1,56 @@
package me.zhengjie.modules.uploadnew.util;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.modules.uploadnew.service.dto.WavDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import static me.zhengjie.modules.constant.FileConstant.SPLIT_FILE_SYMBOL;
/**
* @author wjt
* @date 2021/8/10
*/
@Component
@Slf4j
public class ZipUtils {
public List<WavDTO> zipUtil(MultipartFile file) {
List<WavDTO> wavs = new ArrayList<>();
String zipFileName = null;
try {
ZipInputStream zipInputStream = new ZipInputStream(file.getInputStream(), Charset.forName("GBK"));
BufferedInputStream bs = new BufferedInputStream(zipInputStream);
ZipEntry zipEntry;
byte[] bytes = null;
while ((zipEntry = zipInputStream.getNextEntry()) != null) {
if (!zipEntry.isDirectory()) {
if (zipEntry.getSize() > 0) {
WavDTO wavDTO = new WavDTO();
zipFileName = zipEntry.getName();
wavDTO.setName(zipFileName.substring(zipFileName.lastIndexOf("/") + 1, zipFileName.lastIndexOf(SPLIT_FILE_SYMBOL)));
wavDTO.setSubFixFile(StringUtils.substringAfterLast(zipFileName, SPLIT_FILE_SYMBOL));
bytes = new byte[(int) zipEntry.getSize()];
bs.read(bytes, 0, (int) zipEntry.getSize());
InputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
wavDTO.setLine(byteArrayInputStream);
wavs.add(wavDTO);
}
}
}
} catch (Exception e) {
log.error("读取部署包文件内容失败,请确认部署包格式正确: {} ", zipFileName, e);
}
return wavs;
}
}
Loading…
Cancel
Save