|
@@ -10,6 +10,7 @@ import com.aliyun.oss.OSS;
|
|
import com.aliyun.oss.OSSClientBuilder;
|
|
import com.aliyun.oss.OSSClientBuilder;
|
|
import com.aliyun.oss.OSSException;
|
|
import com.aliyun.oss.OSSException;
|
|
import com.aliyun.oss.model.*;
|
|
import com.aliyun.oss.model.*;
|
|
|
|
+import com.sxtvs.open.core.advice.BizException;
|
|
import lombok.SneakyThrows;
|
|
import lombok.SneakyThrows;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.http.util.TextUtils;
|
|
import org.apache.http.util.TextUtils;
|
|
@@ -158,8 +159,11 @@ public class OSSService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- @SneakyThrows
|
|
|
|
|
|
+
|
|
public String bidDocPut(MultipartFile file, Long id) {
|
|
public String bidDocPut(MultipartFile file, Long id) {
|
|
|
|
+ try {
|
|
|
|
+
|
|
|
|
+
|
|
// 读取DOC文件
|
|
// 读取DOC文件
|
|
ByteArrayInputStream fis = new ByteArrayInputStream(IoUtil.readBytes(file.getInputStream()));
|
|
ByteArrayInputStream fis = new ByteArrayInputStream(IoUtil.readBytes(file.getInputStream()));
|
|
|
|
|
|
@@ -186,6 +190,14 @@ public class OSSService {
|
|
xwpfDocument.close();
|
|
xwpfDocument.close();
|
|
|
|
|
|
return "https://cxzx.smcic.net/" + encodedString;
|
|
return "https://cxzx.smcic.net/" + encodedString;
|
|
|
|
+ }catch (IllegalArgumentException e){
|
|
|
|
+ log.error("doc文件转换错误, {} {}", file.getOriginalFilename(), e.getMessage());
|
|
|
|
+ return bidPut(file, id) + "x";
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ log.error("doc文件转换错误, {} {}", file.getOriginalFilename(), e.getMessage());
|
|
|
|
+ throw new BizException("不支持的文件");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|