|
@@ -163,20 +163,22 @@ public class OSSService {
|
|
|
// 读取DOC文件
|
|
|
ByteArrayInputStream fis = new ByteArrayInputStream(IoUtil.readBytes(file.getInputStream()));
|
|
|
|
|
|
+ XWPFDocument xwpfDocument = new XWPFDocument();
|
|
|
HWPFDocument document = new HWPFDocument(fis);
|
|
|
|
|
|
WordExtractor wordExtractor = new WordExtractor(document);
|
|
|
String text = wordExtractor.getText();
|
|
|
- XWPFDocument xwpfDocument = new XWPFDocument();
|
|
|
XWPFParagraph paragraph = xwpfDocument.createParagraph();
|
|
|
XWPFRun run = paragraph.createRun();
|
|
|
run.setText(text);
|
|
|
+
|
|
|
ByteArrayOutputStream fos = new ByteArrayOutputStream();
|
|
|
xwpfDocument.write(fos);
|
|
|
|
|
|
String dir = "open/bid/" + id + "/";
|
|
|
String fileUrl = dir + file.getOriginalFilename() + "x";
|
|
|
- ossClient.putObject(bucket, fileUrl , xwpfDocument.getDocument().newInputStream());
|
|
|
+ ossClient.putObject(bucket, fileUrl , new ByteArrayInputStream(fos.toByteArray()));
|
|
|
+ fos.close();
|
|
|
fis.reset();
|
|
|
|
|
|
String encodedString = URLEncoder.encode(fileUrl, StandardCharsets.UTF_8);
|