删除多余代码

This commit is contained in:
马超 2021-02-19 18:29:22 +08:00
parent eccc950015
commit 5fc5429594
20 changed files with 38 additions and 343 deletions

View File

@ -41,12 +41,9 @@
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.6.0</version>
<version>0.9.1</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.apache.tomcat.embed</groupId>-->
<!-- <artifactId>tomcat-embed-core</artifactId>-->
<!-- </dependency>-->
</dependencies>

View File

@ -4,6 +4,6 @@ import com.qiwenshare.common.domain.UploadFile;
import com.qiwenshare.common.upload.Uploader;
public interface UploaderFactory {
public Uploader getUploader();
public Uploader getUploader(UploadFile uploadFile);
Uploader getUploader();
Uploader getUploader(UploadFile uploadFile);
}

View File

@ -24,7 +24,6 @@ public class JjwtUtil {
// 过期时间单位毫秒
public static final int EXPIRE_TIME = 60 * 60 * 1000 * 24 * 7; // 一个星期
// public static final long EXPIRE_TIME = 7 * 24 * 3600 * 1000; // 一个星期
// 由字符串生成加密key
public static SecretKey generalKey() {
@ -46,7 +45,7 @@ public class JjwtUtil {
// 指定header那部分签名的时候使用的签名算法jjwt已经将这部分内容封装好了只有{"alg":"HS256"}
SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
// 创建payload的私有声明根据特定的业务需要添加如果要拿这个做验证一般是需要和jwt的接收方提前沟通好验证的方式
Map<String, Object> claims = new HashMap<>();
Map<String, Object> claims = new HashMap<>(2);
claims.put("username", "admin");
claims.put("password", "010203");
// jti用户id例如20da39f8-b74e-4a9b-9a0f-a39f1f73fe64

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>file</artifactId>
<groupId>com.qiwenshare</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>file-office</artifactId>
<version>1.0.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>16.8.0</version>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-cells</artifactId>
<version>9.0.0</version>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-slides</artifactId>
<version>16.7.0</version>
</dependency>
</dependencies>
</project>

View File

@ -1,159 +0,0 @@
package com.qiwenshare.office.test;
import com.qiwenshare.office.utils.AsposeUtil;
public class Test {
// private static void testWord(String path_word, String pafpath) throws Exception {
// String word1 = path_word + "01正方数字.docx";
// String word2 = path_word + "02正方数字.docx";
// String word3 = path_word + "03正方数字.doc";
// String word4 = path_word + "04正方数字.doc";
// String word5 = path_word + "05正方数字.docx";
// String word6 = path_word + "06正方数字.doc";
//
// OpenOfficeUtils.toPdf(word1, pafpath + "Open-word-01测试.pdf");
// OpenOfficeUtils.toPdf(word2, pafpath + "Open-word-02测试.pdf");
// OpenOfficeUtils.toPdf(word3, pafpath + "Open-word-03测试.pdf");
// OpenOfficeUtils.toPdf(word4, pafpath + "Open-word-04测试.pdf");
// OpenOfficeUtils.toPdf(word5, pafpath + "Open-word-05测试.pdf");
// OpenOfficeUtils.toPdf(word6, pafpath + "Open-word-06测试.pdf");
//
// }
//
// private static void testWord2(String path_word, String pafpath) throws Exception {
// String word1 = path_word + "01.docx";
// String word2 = path_word + "02.docx";
// String word3 = path_word + "03.doc";
// String word4 = path_word + "04.doc";
// String word5 = path_word + "05.docx";
// String word6 = path_word + "06.doc";
//
// OpenOfficeUtils.toPdf(word1, pafpath + "Open-word-01.pdf");
// OpenOfficeUtils.toPdf(word2, pafpath + "Open-word-02.pdf");
// OpenOfficeUtils.toPdf(word3, pafpath + "Open-word-03.pdf");
// OpenOfficeUtils.toPdf(word4, pafpath + "Open-word-04.pdf");
// OpenOfficeUtils.toPdf(word5, pafpath + "Open-word-05.pdf");
// OpenOfficeUtils.toPdf(word6, pafpath + "Open-word-06.pdf");
//
// }
//
// private static void testTxt(String path_word, String pafpath) throws Exception {
// String txt1 = path_word + "01jvm.txt";
// String txt2 = path_word + "02jvm.txt";
// String txt3 = path_word + "03jvm.txt";
//
// OpenOfficeUtils.toPdf(txt1, pafpath + "Open-txt-01测试.pdf");
// OpenOfficeUtils.toPdf(txt2, pafpath + "Open-txt-02测试.pdf");
// OpenOfficeUtils.toPdf(txt3, pafpath + "Open-txt-03测试.pdf");
// }
//
// private static void testTxt2(String path_word, String pafpath) throws Exception {
// String txt1 = path_word + "01jvm.txt";
// String txt2 = path_word + "02jvm.txt";
// String txt3 = path_word + "03jvm.txt";
//
// OpenOfficeUtils.toPdf(txt1, pafpath + "Open-txt-01.pdf");
// OpenOfficeUtils.toPdf(txt2, pafpath + "Open-txt-02.pdf");
// OpenOfficeUtils.toPdf(txt3, pafpath + "Open-txt-03.pdf");
// }
//
// private static void testExcel(String path_word, String pafpath) throws Exception {
// String txt1 = path_word + "01部门开发任务管理.xlsx";
// String txt2 = path_word + "02部门开发任务管理.xlsx";
// String txt3 = path_word + "03部门开发任务管理.xlsx";
//
// OpenOfficeUtils.toPdf(txt1, pafpath + "Open-excel-01测试.pdf");
// OpenOfficeUtils.toPdf(txt2, pafpath + "Open-excel-02测试.pdf");
// OpenOfficeUtils.toPdf(txt3, pafpath + "Open-excel-03测试.pdf");
// }
//
// private static void testExcel2(String path_word, String pafpath) throws Exception {
// String txt1 = path_word + "01.xlsx";
// String txt2 = path_word + "02.xlsx";
// String txt3 = path_word + "03.xlsx";
//
// OpenOfficeUtils.toPdf(txt1, pafpath + "Open-excel-01.pdf");
// OpenOfficeUtils.toPdf(txt2, pafpath + "Open-excel-02.pdf");
// OpenOfficeUtils.toPdf(txt3, pafpath + "Open-excel-03.pdf");
// }
//
// private static void testPPt(String path_ppt, String pafpath) throws Exception {
// String txt1 = path_ppt + "01jquery培训.pptx";
// String txt2 = path_ppt + "02jquery培训.pptx";
// String txt3 = path_ppt + "03jquery培训.ppt";
//
// OpenOfficeUtils.toPdf(txt1, pafpath + "Open-ppt-01测试.pdf");
// OpenOfficeUtils.toPdf(txt2, pafpath + "Open-ppt-02测试.pdf");
// OpenOfficeUtils.toPdf(txt3, pafpath + "Open-ppt-03测试.pdf");
// }
//
// private static void testPPt2(String path_ppt, String pafpath) throws Exception {
// String txt1 = path_ppt + "01jquery.pptx";
// String txt2 = path_ppt + "02jquery.pptx";
// String txt3 = path_ppt + "03jquery培训.ppt";
//
// OpenOfficeUtils.toPdf(txt1, pafpath + "Open-ppt-01.pdf");
// OpenOfficeUtils.toPdf(txt2, pafpath + "Open-ppt-02.pdf");
// OpenOfficeUtils.toPdf(txt3, pafpath + "Open-ppt-03.pdf");
// }
//
// public static void LinuxTest() throws Exception {
// String path_word = "/software/songyan/hah/01word/";
// String path_txt = "/software/songyan/hah/02txt/";
// String path_excel = "/software/songyan/hah/03excel/";
// String path_ppt = "/software/songyan/hah/04ppt/";
// String pafpath = "/software/songyan/hah/pdf/";
//
// System.out.println("************************");
// testTxt(path_txt, pafpath);
// System.out.println("************************");
// testExcel(path_excel, pafpath);
// System.out.println("************************");
// testPPt(path_ppt, pafpath);
// System.out.println("************************");
// testWord(path_word, pafpath);
// }
//
// public static void LinuxTest2() throws Exception {
// String path_word = "/software/songyan/hah/01word/";
// String path_txt = "/software/songyan/hah/02txt/";
// String path_excel = "/software/songyan/hah/03excel/";
// String path_ppt = "/software/songyan/hah/04ppt/";
// String pafpath = "/software/songyan/hah/pdf/";
//
// System.out.println("************************");
// testTxt2(path_txt, pafpath);
// System.out.println("************************");
// testExcel2(path_excel, pafpath);
// System.out.println("************************");
// testPPt2(path_ppt, pafpath);
// System.out.println("************************");
// testWord2(path_word, pafpath);
// }
//
// public static void winTest() throws Exception {
// String path_word = "C:/Users/Administrator.DESKTOP-QN9A3AA/Desktop/office/测试文档/转换前文档/01word/";
// String path_txt = "C:/Users/Administrator.DESKTOP-QN9A3AA/Desktop/office/测试文档/转换前文档/02txt/";
// String path_excel = "C:/Users/Administrator.DESKTOP-QN9A3AA/Desktop/office/测试文档/转换前文档/03excel/";
// String path_ppt = "C:/Users/Administrator.DESKTOP-QN9A3AA/Desktop/office/测试文档/转换前文档/04ppt/";
// String pafpath = "C:/Users/Administrator.DESKTOP-QN9A3AA/Desktop/office/测试文档/pdf/";
//
// System.out.println("************************");
// testWord(path_word, pafpath);
// System.out.println("************************");
// testTxt(path_txt, pafpath);
// System.out.println("************************");
// testExcel(path_excel, pafpath);
// System.out.println("************************");
// testPPt(path_ppt, pafpath);
// }
public static void main(String[] args) throws Exception {
//AsposeUtil.trans("C:\\Users\\machaop\\Desktop\\jci操作手册.docx", "D:\\Downloads\\jci.pdf", "word");
//AsposeUtil.trans("C:\\Users\\machaop\\Desktop\\ZDB_统一支付清算平台_接口说明书_V1.2-20210202.xlsx", "D:\\Downloads\\ZDB_统一支付清算平台_接口说明书_V1.2-20210202.pdf", "excel");
AsposeUtil.trans("C:\\Users\\machaop\\Desktop\\Java10(企业级数据库之oracle安装).ppt", "D:\\Downloads\\Java10.pdf", "ppt");
// winTest();
}
}

View File

@ -1,109 +0,0 @@
package com.qiwenshare.office.utils;
import java.io.*;
import com.aspose.cells.Workbook;
import com.aspose.slides.Presentation;
import com.aspose.words.*;
public class AsposeUtil {
//校验license
private static boolean judgeLicense() {
boolean result = false;
try {
InputStream is = AsposeUtil.class.getClassLoader().getResourceAsStream("license.xml");
License aposeLic = new License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
// 转换
public static void trans(String filePath, String pdfPath, String type) {
if (!judgeLicense()) {
System.out.println("license错误");
}
try {
System.out.println("as开始" + filePath);
long old = System.currentTimeMillis();
File file = new File(pdfPath);
toPdf(file, filePath, type);
long now = System.currentTimeMillis();
System.out.println("完成:" + pdfPath);
System.out.println("共耗时:" + ((now - old) / 1000.0) + "");
} catch (Exception e) {
e.printStackTrace();
}
}
private static void toPdf(File file, String filePath, String type) {
if ("word".equals(type) || "txt".equals(type)) {
wordofpdf(file, filePath);
} else if ("excel".equals(type)) {
exceOfPdf(file, filePath);
} else if ("ppt".equals(type)) {
pptofpdf(file, filePath);
}else{
System.out.println("暂不支持该类型:"+type);
}
}
private static void wordofpdf(File file, String filePath) {
FileOutputStream os = null;
Document doc;
try {
os = new FileOutputStream(file);
doc = new Document(filePath);
doc.save(os, com.aspose.words.SaveFormat.PDF);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
private static void exceOfPdf(File file, String filePath) {
FileOutputStream os = null;
try {
os = new FileOutputStream(file);
Workbook wb = new Workbook(filePath);
wb.save(os, com.aspose.cells.SaveFormat.PDF);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
//
private static void pptofpdf(File file, String filePath) {
FileOutputStream os = null;
try {
os = new FileOutputStream(file);
Presentation pres = new Presentation(filePath);// 输入pdf路径
pres.save(os, com.aspose.slides.SaveFormat.Pdf);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

View File

@ -1,13 +0,0 @@
<License>
<Data>
<Products>
<Product>Aspose.Total for Java</Product>
<Product>Aspose.Words for Java</Product>
</Products>
<EditionType>Enterprise</EditionType>
<SubscriptionExpiry>20991231</SubscriptionExpiry>
<LicenseExpiry>20991231</LicenseExpiry>
<SerialNumber>8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7</SerialNumber>
</Data>
<Signature>sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature>
</License>

View File

@ -53,7 +53,6 @@ public class FileController {
public static final String CURRENT_MODULE = "文件接口";
public static int COMPLETE_COUNT = 0;
public static long treeid = 0;

View File

@ -15,7 +15,7 @@ import com.qiwenshare.file.domain.UserBean;
import com.qiwenshare.file.domain.UserFile;
import com.qiwenshare.file.dto.BatchDeleteRecoveryFileDTO;
import com.qiwenshare.file.dto.DeleteRecoveryFileDTO;
import com.qiwenshare.file.dto.recoveryfile.RestoreFileDto;
import com.qiwenshare.file.dto.recoveryfile.RestoreFileDTO;
import com.qiwenshare.file.vo.file.RecoveryFileListVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -91,7 +91,7 @@ public class RecoveryFileController {
@RequestMapping(value = "/restorefile", method = RequestMethod.POST)
@MyLog(operation = "还原文件", module = CURRENT_MODULE)
@ResponseBody
public RestResult restoreFile(@RequestBody RestoreFileDto restoreFileDto, @RequestHeader("token") String token) {
public RestResult restoreFile(@RequestBody RestoreFileDTO restoreFileDto, @RequestHeader("token") String token) {
UserBean sessionUserBean = userService.getUserBeanByToken(token);
LambdaUpdateWrapper<UserFile> userFileLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
userFileLambdaUpdateWrapper.set(UserFile::getDeleteFlag, 0)
@ -112,7 +112,7 @@ public class RecoveryFileController {
UserFile userFile = new UserFile();
userFile.setUserId(sessionUserBean.getUserId());
userFile.setFileName(fileName);
userFile.setFilePath(filePath);
userFile.setFilePath(filePath + "/");
userFile.setDeleteFlag(0);
userFile.setIsDir(1);
userFile.setUploadTime(DateUtil.getCurrentTime());

View File

@ -23,7 +23,7 @@ public class OperationLogBean {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@TableId(type = IdType.AUTO)
private long operationLogId;
private Long operationLogId;
/**
* 用户id

View File

@ -1,5 +1,7 @@
package com.qiwenshare.file.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@ -17,6 +19,7 @@ public class StorageBean {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(columnDefinition="bigint(20)")
@TableId(type = IdType.AUTO)
private Long storageId;
@Column(columnDefinition="bigint(20)")

View File

@ -1,6 +1,8 @@
package com.qiwenshare.file.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@ -24,6 +26,7 @@ public class UserBean {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(columnDefinition = "bigint(20)")
@TableId(type = IdType.AUTO)
private Long userId;
@Column(columnDefinition = "varchar(30)")

View File

@ -2,7 +2,8 @@ package com.qiwenshare.file.dto.recoveryfile;
import io.swagger.v3.oas.annotations.media.Schema;
public class BatchDeleteRecoveryFileDto {
@Schema(name = "批量删除回收文件DTO",required = true)
public class BatchDeleteRecoveryFileDTO {
@Schema(description="恢复文件集合")
private String recoveryFiles;
}

View File

@ -0,0 +1,13 @@
package com.qiwenshare.file.dto.recoveryfile;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(name = "回收文件DTO",required = true)
public class RestoreFileDTO {
@Schema(description="删除批次号")
private String deleteBatchNum;
@Schema(description="文件路径")
private String filePath;
}

View File

@ -1,9 +0,0 @@
package com.qiwenshare.file.dto.recoveryfile;
import lombok.Data;
@Data
public class RestoreFileDto {
private String deleteBatchNum;
private String filePath;
}

View File

@ -1,7 +1,4 @@
set settingDir=file-common/src/main/resources/conf/settings.xml
call mvn install:install-file -s %settingDir% -DgroupId=com.aspose -DartifactId=aspose-words -Dversion=16.8.0 -Dpackaging=jar -Dfile=file-office/src/main/resources/lib/aspose-words-16.8.0-jdk16.jar
call mvn install:install-file -s %settingDir% -DgroupId=com.aspose -DartifactId=aspose-slides -Dversion=16.7.0 -Dpackaging=jar -Dfile=file-office/src/main/resources/lib/aspose.slides-16.7.0.jar
call mvn install:install-file -s %settingDir% -DgroupId=com.aspose -DartifactId=aspose-cells -Dversion=9.0.0 -Dpackaging=jar -Dfile=file-office/src/main/resources/lib/aspose-cells-9.0.0.jar
mvn install -s %settingDir%
pause

12
pom.xml
View File

@ -31,12 +31,16 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>3.0.2</version>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.5.4</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.github.xiaoymin</groupId>-->
<!-- <artifactId>knife4j-spring-boot-starter</artifactId>-->
<!-- <version>3.0.2</version>-->
<!-- </dependency>-->
<dependency>