Commit 5dc6af87 authored by qinhu's avatar qinhu

上传pdf的cell包

parent 000322ae
...@@ -138,22 +138,7 @@ ...@@ -138,22 +138,7 @@
<version>2.8.5</version> <version>2.8.5</version>
</dependency> </dependency>
<dependency>
<groupId>com.aspose</groupId> <!--自定义-->
<artifactId>words</artifactId> <!--自定义-->
<version>1.0</version> <!--自定义-->
<scope>system</scope> <!--system,类似provided,需要显式提供依赖的jar以后,Maven就不会在Repository中查找它-->
<systemPath>${basedir}/lib/words.jar</systemPath> <!--项目根目录下的lib文件夹下-->
</dependency>
<!-- https://mvnrepository.com/artifact/com.aspose/aspose-slides --> <!-- https://mvnrepository.com/artifact/com.aspose/aspose-slides -->
<dependency>
<groupId>com.aspose</groupId> <!--自定义-->
<artifactId>sliders</artifactId> <!--自定义-->
<version>1.0</version> <!--自定义-->
<scope>system</scope> <!--system,类似provided,需要显式提供依赖的jar以后,Maven就不会在Repository中查找它-->
<systemPath>${basedir}/lib/aspose.slides-15.9.0.jar</systemPath> <!--项目根目录下的lib文件夹下-->
</dependency>
<dependency> <dependency>
<groupId>com.aspose</groupId> <!--自定义--> <groupId>com.aspose</groupId> <!--自定义-->
<artifactId>cells</artifactId> <!--自定义--> <artifactId>cells</artifactId> <!--自定义-->
......
package cn.wise.sc.cement.business.controller; package cn.wise.sc.cement.business.controller;
import cn.wise.sc.cement.business.enumation.FileExt;
import cn.wise.sc.cement.business.model.BaseResponse; import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.model.LoginUser; import cn.wise.sc.cement.business.model.LoginUser;
import cn.wise.sc.cement.business.service.ISysUserService; import cn.wise.sc.cement.business.service.ISysUserService;
...@@ -61,7 +62,7 @@ public class EntityEnclosureController { ...@@ -61,7 +62,7 @@ public class EntityEnclosureController {
} else { } else {
return BaseResponse.errorMsg("登录信息失效"); return BaseResponse.errorMsg("登录信息失效");
} }
if (!extName.equals(".pdf") && (extName.equals(".xls") || extName.equals(".xlsx"))) { if (extName.contains(FileExt.EXCL.getName()) || extName.contains(FileExt.EXCLX.getName())) {
String pdfPath = FastDFSUtils.conventAndUpload(file.getInputStream(), fileName); String pdfPath = FastDFSUtils.conventAndUpload(file.getInputStream(), fileName);
map.put("pdfPath", pdfPath); map.put("pdfPath", pdfPath);
} else { } else {
...@@ -133,7 +134,7 @@ public class EntityEnclosureController { ...@@ -133,7 +134,7 @@ public class EntityEnclosureController {
mapSub.put("fileUrl", picUrl); mapSub.put("fileUrl", picUrl);
mapSub.put("fileName", fileName); mapSub.put("fileName", fileName);
mapSub.put("extName", extName); mapSub.put("extName", extName);
if (!extName.equals(".pdf") && (extName.equals(".xls") || extName.equals(".xlsx"))) { if (extName.contains(FileExt.EXCL.getName()) || extName.contains(FileExt.EXCLX.getName())) {
String pdfPath = FastDFSUtils.conventAndUpload(file.getInputStream(), fileName); String pdfPath = FastDFSUtils.conventAndUpload(file.getInputStream(), fileName);
mapSub.put("pdfPath", pdfPath); mapSub.put("pdfPath", pdfPath);
} else { } else {
......
package cn.wise.sc.cement.business.enumation; package cn.wise.sc.cement.business.enumation;
import com.alibaba.fastjson.annotation.JSONType;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import lombok.AllArgsConstructor;
import lombok.Getter;
/** /**
* @description: 文件扩展名 * @description: 文件扩展名
...@@ -9,21 +12,18 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; ...@@ -9,21 +12,18 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
* @create: 2020-10-16 13:40 * @create: 2020-10-16 13:40
**/ **/
@JsonFormat(shape = JsonFormat.Shape.OBJECT) @JsonFormat(shape = JsonFormat.Shape.OBJECT)
@JSONType(serializeEnumAsJavaBean = true)
@Getter
@AllArgsConstructor
public enum FileExt { public enum FileExt {
//office后缀名 //office后缀名
DOC(".doc"), DOC(".doc"),
EXCL(".xls"), EXCL(".xls"),
PDF("pdf"),
EXCLX(".xlsx"); EXCLX(".xlsx");
@EnumValue
private String name; private String name;
FileExt(String name) {
this.name = name;
}
public String getName() {
return name;
}
} }
...@@ -4,7 +4,6 @@ import cn.hutool.core.io.FileUtil; ...@@ -4,7 +4,6 @@ import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.file.FileReader; import cn.hutool.core.io.file.FileReader;
import com.aspose.cells.SaveFormat; import com.aspose.cells.SaveFormat;
import com.aspose.cells.Workbook; import com.aspose.cells.Workbook;
import com.aspose.words.Document;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.csource.common.MyException; import org.csource.common.MyException;
import org.csource.common.NameValuePair; import org.csource.common.NameValuePair;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment