|
|
|
@ -211,7 +211,7 @@ public class FormdataServiceImpl implements FormdataService {
|
|
|
|
|
os.close();
|
|
|
|
|
inputStream.close();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
log.error("ERROR FormdataServiceImpl|parseMediaFileToLocal ",e);
|
|
|
|
|
log.error("ERROR FormdataServiceImpl|parseMediaFileToLocal ", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return path;
|
|
|
|
@ -226,14 +226,12 @@ public class FormdataServiceImpl implements FormdataService {
|
|
|
|
|
@Override
|
|
|
|
|
public void uploadOOS(MultipartFile file, List<FormdataDto> list) {
|
|
|
|
|
|
|
|
|
|
String fileName = file.getOriginalFilename();
|
|
|
|
|
String subFixFile = StringUtils.substringAfterLast(fileName, SPLIT_FILE_SYMBOL);
|
|
|
|
|
List<WavDTO> wavList = zipUtil(file);
|
|
|
|
|
for (WavDTO wavDTO : wavList) {
|
|
|
|
|
for (FormdataDto info : list) {
|
|
|
|
|
if (wavDTO.getName().equals(info.getPhone())) {
|
|
|
|
|
//上传路径
|
|
|
|
|
String newFileName = buildPathUtils.buildFileOosPath(subFixFile);
|
|
|
|
|
String newFileName = buildPathUtils.buildFileOosPath(wavDTO.getSubFixFile());
|
|
|
|
|
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
|
|
|
|
|
ossClient.putObject(bucketName, newFileName, wavDTO.getLine());
|
|
|
|
|
ossClient.shutdown();
|
|
|
|
@ -248,9 +246,10 @@ public class FormdataServiceImpl implements FormdataService {
|
|
|
|
|
|
|
|
|
|
private List<WavDTO> zipUtil(MultipartFile file) {
|
|
|
|
|
List<WavDTO> wavDTOS = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
String zipFileName = null;
|
|
|
|
|
try {
|
|
|
|
|
ZipInputStream zipInputStream = new ZipInputStream(file.getInputStream(), Charset.defaultCharset());
|
|
|
|
|
ZipInputStream zipInputStream = new ZipInputStream(file.getInputStream(), Charset.forName("GBK"));
|
|
|
|
|
BufferedInputStream bs = new BufferedInputStream(zipInputStream);
|
|
|
|
|
ZipEntry zipEntry;
|
|
|
|
|
byte[] bytes = null;
|
|
|
|
@ -258,6 +257,8 @@ public class FormdataServiceImpl implements FormdataService {
|
|
|
|
|
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);
|
|
|
|
|