Merge branch 'develop_migration' into 'develop_master'
feat: There is no way the, convert See merge request LiuChao/foton-slrs-system-rest!235
This commit is contained in:
+37
-1
@@ -22,6 +22,42 @@
|
|||||||
<artifactId>adc-da-sys</artifactId>
|
<artifactId>adc-da-sys</artifactId>
|
||||||
<version>3.0.0</version>
|
<version>3.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- 导入本地jar -->
|
||||||
|
<!-- 操作ppt -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.artofsolving</groupId>
|
||||||
|
<artifactId>jodconverter</artifactId>
|
||||||
|
<scope>system</scope>
|
||||||
|
<version>2.2.2</version>
|
||||||
|
<systemPath>${basedir}/src/main/lib/jodconverter-2.2.2.jar</systemPath>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aspose</groupId>
|
||||||
|
<artifactId>aspose-words</artifactId>
|
||||||
|
<version>15.8.0</version>
|
||||||
|
<scope>system</scope>
|
||||||
|
<systemPath>${basedir}/src/main/lib/aspose-words-15.8.0-jdk16.jar</systemPath>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aspose</groupId>
|
||||||
|
<artifactId>aspose-cells</artifactId>
|
||||||
|
<version>8.5.2</version>
|
||||||
|
<scope>system</scope>
|
||||||
|
<systemPath>${basedir}/src/main/lib/aspose-cells-8.5.2.jar</systemPath>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aspose</groupId>
|
||||||
|
<artifactId>aspose-slides</artifactId>
|
||||||
|
<version>16.7.0</version>
|
||||||
|
<scope>system</scope>
|
||||||
|
<systemPath>${basedir}/src/main/lib/aspose.slides-16.7.0.jar</systemPath>
|
||||||
|
</dependency>
|
||||||
|
<!-- 操作文本文件-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.itextpdf</groupId>
|
||||||
|
<artifactId>itextpdf</artifactId>
|
||||||
|
<version>5.5.13</version>
|
||||||
|
</dependency>
|
||||||
<!-- openOffice 和 jobconverter-->
|
<!-- openOffice 和 jobconverter-->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -46,7 +82,7 @@
|
|||||||
<artifactId>jodconverter-local</artifactId>
|
<artifactId>jodconverter-local</artifactId>
|
||||||
<version>4.3.0</version>
|
<version>4.3.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- openOffice end-->
|
<!-- openOffice end-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openoffice</groupId>
|
<groupId>org.openoffice</groupId>
|
||||||
<artifactId>juh</artifactId>
|
<artifactId>juh</artifactId>
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.adc.da.convert.common;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
public class AsposeOfficeConvertUtils {
|
||||||
|
|
||||||
|
public static void convertOfficeFileToPDF(String fileType,String attFilePath,String savePdfPath) throws Exception {
|
||||||
|
if(StringUtils.isNotBlank(fileType)){
|
||||||
|
//去掉文件类型中的点
|
||||||
|
fileType = fileType.replace(".","");
|
||||||
|
fileType = fileType.toUpperCase();
|
||||||
|
switch (fileType){
|
||||||
|
case "DOC":
|
||||||
|
WordTPdfUtils.doc2pdf(attFilePath,savePdfPath);
|
||||||
|
break;
|
||||||
|
case "DOCX":
|
||||||
|
WordTPdfUtils.doc2pdf(attFilePath,savePdfPath);
|
||||||
|
break;
|
||||||
|
case "PPT":
|
||||||
|
SlidesTPdfUtils.ppt2pdf(attFilePath,savePdfPath);
|
||||||
|
break;
|
||||||
|
case "PPTX":
|
||||||
|
SlidesTPdfUtils.ppt2pdf(attFilePath,savePdfPath);
|
||||||
|
break;
|
||||||
|
case "XLS":
|
||||||
|
ExcelTPdfUtils.excel2pdf(attFilePath,savePdfPath);
|
||||||
|
break;
|
||||||
|
case "XLSX":
|
||||||
|
ExcelTPdfUtils.excel2pdf(attFilePath,savePdfPath);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
package com.adc.da.convert.common;
|
||||||
|
|
||||||
|
import com.aspose.cells.PdfSaveOptions;
|
||||||
|
import com.aspose.cells.Workbook;
|
||||||
|
import com.aspose.cells.License;
|
||||||
|
import com.aspose.slides.Presentation;
|
||||||
|
import com.aspose.slides.SaveFormat;
|
||||||
|
import org.aspectj.weaver.ast.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
public class ExcelTPdfUtils {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(WordTPdfUtils.class);
|
||||||
|
private static final String myLicense = "<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>";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取license 去除水印
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean getLicense() {
|
||||||
|
boolean result = false;
|
||||||
|
try {
|
||||||
|
ByteArrayInputStream is = new ByteArrayInputStream(myLicense.getBytes());
|
||||||
|
License aposeLic = new License();
|
||||||
|
aposeLic.setLicense(is);
|
||||||
|
result = true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.getMessage(),e);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* excel 转为pdf 输出。
|
||||||
|
*
|
||||||
|
* @param sourceFilePath excel文件
|
||||||
|
* @param desFilePathd pad 输出文件目录
|
||||||
|
*/
|
||||||
|
public static void excel2pdf(String sourceFilePath, String desFilePathd ) throws Exception {
|
||||||
|
if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
File file = new File(desFilePathd); // 新建一个空白pdf文档
|
||||||
|
FileOutputStream fileOS = null;
|
||||||
|
try {
|
||||||
|
fileOS = new FileOutputStream(desFilePathd);
|
||||||
|
long old = System.currentTimeMillis();
|
||||||
|
Workbook wb = new Workbook(sourceFilePath);// 原始excel路径
|
||||||
|
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
|
||||||
|
pdfSaveOptions.setOnePagePerSheet(true);
|
||||||
|
int[] autoDrawSheets={3};
|
||||||
|
//当excel中对应的sheet页宽度太大时,在PDF中会拆断并分页。此处等比缩放。
|
||||||
|
// autoDraw(wb,autoDrawSheets);
|
||||||
|
int[] showSheets={0};
|
||||||
|
//隐藏workbook中不需要的sheet页。
|
||||||
|
printSheetPage(wb,showSheets);
|
||||||
|
wb.save(fileOS, pdfSaveOptions);
|
||||||
|
fileOS.flush();
|
||||||
|
fileOS.close();
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
logger.info("转换文档:"+sourceFilePath+" "+"共耗时:" + ((now - old) / 1000.0) + "秒");
|
||||||
|
} catch (Exception e) {
|
||||||
|
if(fileOS!=null){
|
||||||
|
fileOS.flush();
|
||||||
|
fileOS.close();
|
||||||
|
}
|
||||||
|
file.delete();
|
||||||
|
logger.error("Document Convert Error:"+sourceFilePath);
|
||||||
|
logger.error(e.getMessage(),e);
|
||||||
|
throw new Exception("Document Convert Error:"+sourceFilePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置打印的sheet 自动拉伸比例
|
||||||
|
* @param wb
|
||||||
|
* @param page 自动拉伸的页的sheet数组
|
||||||
|
*/
|
||||||
|
public static void autoDraw(Workbook wb,int[] page){
|
||||||
|
if(null!=page&&page.length>0){
|
||||||
|
for (int i = 0; i < page.length; i++) {
|
||||||
|
wb.getWorksheets().get(i).getHorizontalPageBreaks().clear();
|
||||||
|
wb.getWorksheets().get(i).getVerticalPageBreaks().clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 隐藏workbook中不需要的sheet页。
|
||||||
|
* @param wb
|
||||||
|
* @param page 显示页的sheet数组
|
||||||
|
*/
|
||||||
|
public static void printSheetPage(Workbook wb,int[] page){
|
||||||
|
for (int i= 1; i < wb.getWorksheets().getCount(); i++) {
|
||||||
|
wb.getWorksheets().get(i).setVisible(false);
|
||||||
|
}
|
||||||
|
if(null==page||page.length==0){
|
||||||
|
wb.getWorksheets().get(0).setVisible(true);
|
||||||
|
}else{
|
||||||
|
for (int i = 0; i < page.length; i++) {
|
||||||
|
wb.getWorksheets().get(i).setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String sourceFilePath="E:\\EXCELTEXT\\一阶段问题清单426.xlsx";
|
||||||
|
String desFilePath="E:\\EXCELTEXT\\一阶段问题清单426.pdf";
|
||||||
|
try {
|
||||||
|
excel2pdf(sourceFilePath, desFilePath);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.getMessage(),e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package com.adc.da.convert.common;
|
||||||
|
|
||||||
|
import com.aspose.slides.Presentation;
|
||||||
|
import com.aspose.slides.License;
|
||||||
|
import com.aspose.slides.SaveFormat;
|
||||||
|
import org.aspectj.weaver.ast.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采用破解版的Aspire插件转换文件
|
||||||
|
*/
|
||||||
|
public class SlidesTPdfUtils {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(SlidesTPdfUtils.class);
|
||||||
|
private static final String myLicense = "<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>";
|
||||||
|
|
||||||
|
public static boolean getLicense() {
|
||||||
|
boolean result = false;
|
||||||
|
try {
|
||||||
|
ByteArrayInputStream is = new ByteArrayInputStream(myLicense.getBytes());
|
||||||
|
License aposeLic = new License();
|
||||||
|
aposeLic.setLicense(is);
|
||||||
|
result = true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.getMessage(),e);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void ppt2pdf(String inPath, String outPath) throws Exception{
|
||||||
|
if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
File file = new File(outPath); // 新建一个空白pdf文档
|
||||||
|
FileOutputStream os =null;
|
||||||
|
try {
|
||||||
|
long old = System.currentTimeMillis();
|
||||||
|
os = new FileOutputStream(file);
|
||||||
|
Presentation pres = new Presentation(inPath);
|
||||||
|
pres.save(os, SaveFormat.Pdf);
|
||||||
|
os.flush();
|
||||||
|
os.close();
|
||||||
|
// EPUB, XPS, SWF 相互转换
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
logger.info("转换文档:"+inPath+" "+"共耗时:" + ((now - old) / 1000.0) + "秒");
|
||||||
|
} catch (Exception e) {
|
||||||
|
if(os!=null){
|
||||||
|
os.flush();
|
||||||
|
os.close();
|
||||||
|
}
|
||||||
|
file.delete();
|
||||||
|
logger.error("Document Convert Error:"+inPath);
|
||||||
|
logger.error(e.getMessage(),e);
|
||||||
|
throw new Exception("Document Convert Error:"+inPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
String sourceFilePath="E:\\PPTTEXT\\2.pptx";
|
||||||
|
String desFilePath="E:\\PPTTEXT\\2.pdf";
|
||||||
|
ppt2pdf(sourceFilePath, desFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package com.adc.da.convert.common;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import com.adc.da.util.exception.AdcDaBaseException;
|
||||||
|
import com.aspose.words.Document;
|
||||||
|
import org.aspectj.weaver.ast.Test;
|
||||||
|
import com.aspose.words.License;
|
||||||
|
import com.aspose.words.SaveFormat;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采用破解版的Aspire插件转换文件
|
||||||
|
*/
|
||||||
|
public class WordTPdfUtils {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(WordTPdfUtils.class);
|
||||||
|
|
||||||
|
private static final String myLicense = "<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>";
|
||||||
|
|
||||||
|
public static boolean getLicense() {
|
||||||
|
boolean result = false;
|
||||||
|
try {
|
||||||
|
ByteArrayInputStream is = new ByteArrayInputStream(myLicense.getBytes());
|
||||||
|
License aposeLic = new License();
|
||||||
|
aposeLic.setLicense(is);
|
||||||
|
result = true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.getMessage(),e);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void doc2pdf(String inPath, String outPath) throws Exception{
|
||||||
|
if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
File file = new File(outPath); // 新建一个空白pdf文档
|
||||||
|
FileOutputStream os = new FileOutputStream(file);
|
||||||
|
try {
|
||||||
|
long old = System.currentTimeMillis();
|
||||||
|
Document doc = new Document(inPath); // Address是将要被转化的word文档
|
||||||
|
doc.save(os, SaveFormat.PDF);// 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF,
|
||||||
|
os.flush();
|
||||||
|
os.close();
|
||||||
|
// EPUB, XPS, SWF 相互转换
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
logger.info("转换文档:"+inPath+" "+"共耗时:" + ((now - old) / 1000.0) + "秒");
|
||||||
|
} catch (Exception e) {
|
||||||
|
if(os!=null){
|
||||||
|
os.flush();
|
||||||
|
os.close();
|
||||||
|
}
|
||||||
|
file.delete();
|
||||||
|
logger.error("Document Convert Error:"+inPath);
|
||||||
|
logger.error(e.getMessage(),e);
|
||||||
|
throw new Exception("Document Convert Error:"+inPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,12 +4,15 @@ import com.adc.da.att.entity.AttFileEO;
|
|||||||
import com.adc.da.att.service.IAttFileEOService;
|
import com.adc.da.att.service.IAttFileEOService;
|
||||||
import com.adc.da.common.SarTypeEnum;
|
import com.adc.da.common.SarTypeEnum;
|
||||||
import com.adc.da.common.UseModuleEnum;
|
import com.adc.da.common.UseModuleEnum;
|
||||||
|
import com.adc.da.convert.common.AsposeOfficeConvertUtils;
|
||||||
import com.adc.da.convert.common.DocConverterPdf;
|
import com.adc.da.convert.common.DocConverterPdf;
|
||||||
import com.adc.da.mq.CreateMQService;
|
import com.adc.da.mq.CreateMQService;
|
||||||
import com.adc.da.slrs.otConvertMq.entity.OtConvertMq;
|
import com.adc.da.slrs.otConvertMq.entity.OtConvertMq;
|
||||||
import com.adc.da.slrs.otConvertMq.service.IOtConvertMqService;
|
import com.adc.da.slrs.otConvertMq.service.IOtConvertMqService;
|
||||||
import com.adc.da.slrs.sarBussStandFile.dao.SarBussStandFileDao;
|
import com.adc.da.slrs.sarBussStandFile.dao.SarBussStandFileDao;
|
||||||
import com.adc.da.slrs.sarBussStandFile.entity.SarBussStandFile;
|
import com.adc.da.slrs.sarBussStandFile.entity.SarBussStandFile;
|
||||||
|
import com.adc.da.slrs.sarLawsFile.dao.SarLawsFileDao;
|
||||||
|
import com.adc.da.slrs.sarLawsFile.entity.SarLawsFile;
|
||||||
import com.adc.da.slrs.sarStandFile.dao.SarStandFileDao;
|
import com.adc.da.slrs.sarStandFile.dao.SarStandFileDao;
|
||||||
import com.adc.da.slrs.sarStandFile.entity.SarStandFile;
|
import com.adc.da.slrs.sarStandFile.entity.SarStandFile;
|
||||||
import com.adc.da.sys.util.LoginUserUtil;
|
import com.adc.da.sys.util.LoginUserUtil;
|
||||||
@@ -62,6 +65,9 @@ public class SendConvertMQService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private SarBussStandFileDao sarBussStandFileEODao;
|
private SarBussStandFileDao sarBussStandFileEODao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SarLawsFileDao sarLawsFileDao;
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SendConvertMQService.class);
|
private static final Logger logger = LoggerFactory.getLogger(SendConvertMQService.class);
|
||||||
|
|
||||||
@RabbitListener(bindings = @QueueBinding(
|
@RabbitListener(bindings = @QueueBinding(
|
||||||
@@ -152,6 +158,7 @@ public class SendConvertMQService {
|
|||||||
public ResponseMessage docUploadConvert(OtConvertMq convertMqEO) throws Exception{
|
public ResponseMessage docUploadConvert(OtConvertMq convertMqEO) throws Exception{
|
||||||
//保存在数据库中的ID
|
//保存在数据库中的ID
|
||||||
String path = localFilePath + convertMqEO.getFilePath();
|
String path = localFilePath + convertMqEO.getFilePath();
|
||||||
|
path = path.replace("//","/");
|
||||||
String convertId = convertMqEO.getId();
|
String convertId = convertMqEO.getId();
|
||||||
try {
|
try {
|
||||||
//进入转换方法中,修改OT_CONVERT表中状态为转换中
|
//进入转换方法中,修改OT_CONVERT表中状态为转换中
|
||||||
@@ -164,24 +171,28 @@ public class SendConvertMQService {
|
|||||||
String converfilename = path.replaceAll("\\\\", "/");
|
String converfilename = path.replaceAll("\\\\", "/");
|
||||||
logger.info("*****上传路径:*******"+localFilePath);
|
logger.info("*****上传路径:*******"+localFilePath);
|
||||||
logger.info("************文件路径:**********" + convertMqEO.getFilePath());
|
logger.info("************文件路径:**********" + convertMqEO.getFilePath());
|
||||||
logger.info("************接口:**********" + port);
|
// logger.info("************接口:**********" + port);
|
||||||
logger.info("*****上传路径替换,加入文件名*******"+converfilename);
|
logger.info("*****上传路径替换,加入文件名*******"+converfilename);
|
||||||
//截取文件类型
|
//截取文件类型
|
||||||
int index = converfilename.lastIndexOf(".");
|
int index = converfilename.lastIndexOf(".");
|
||||||
String fileType = converfilename.substring(index,converfilename.length());
|
String fileType = converfilename.substring(index,converfilename.length());
|
||||||
String fileOriName = converfilename.substring(0,index);
|
String fileOriName = converfilename.substring(0,index);
|
||||||
//调用转换类DocConverter,并将需要转换的文件传递给该类的构造方法
|
// //调用转换类DocConverter,并将需要转换的文件传递给该类的构造方法
|
||||||
DocConverterPdf d = new DocConverterPdf(converfilename,fileType);
|
// DocConverterPdf d = new DocConverterPdf(converfilename,fileType);
|
||||||
d.setConvertHost(convertHost);
|
// d.setConvertHost(convertHost);
|
||||||
//调用conver方法开始转换,先执行doc2pdf()将office文件转换为pdf;再执行pdf2swf()将pdf转换为swf;
|
// //调用conver方法开始转换,先执行doc2pdf()将office文件转换为pdf;再执行pdf2swf()将pdf转换为swf;
|
||||||
File getPdf = d.conver(fileType);
|
// File getPdf = d.conver(fileType);
|
||||||
//调用getswfPath()方法,打印转换后的swf文件路径
|
// //调用getswfPath()方法,打印转换后的swf文件路径
|
||||||
String dPath = d.getpdfPath();
|
// String dPath = d.getpdfPath();
|
||||||
logger.info("*****转换后的pdf文件路径*******"+dPath);
|
String savePdfFileName = converfilename.substring(0, converfilename.lastIndexOf("."));
|
||||||
|
String savePdfPath = savePdfFileName+".pdf";
|
||||||
|
AsposeOfficeConvertUtils.convertOfficeFileToPDF(fileType,converfilename,savePdfPath);
|
||||||
|
File pdfFile = new File(savePdfPath);
|
||||||
|
logger.info("*****转换后的pdf文件路径*******"+savePdfPath);
|
||||||
//判断是否转换成功,修改数据状态
|
//判断是否转换成功,修改数据状态
|
||||||
if(!dPath.isEmpty() && getPdf.length()>0){
|
if(!savePdfPath.isEmpty() && pdfFile.length()>0){
|
||||||
// 上传转换后文件
|
// 上传转换后文件
|
||||||
String pdfId = attFileEOService.saveFileAttId(getPdf);
|
String pdfId = attFileEOService.saveFileAttId(pdfFile);
|
||||||
logger.info("////////转换后文件id"+pdfId);
|
logger.info("////////转换后文件id"+pdfId);
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if("0".equals(convertMqEO.getAddOrUp())){
|
if("0".equals(convertMqEO.getAddOrUp())){
|
||||||
@@ -212,11 +223,11 @@ public class SendConvertMQService {
|
|||||||
convertMqEO.setModifyTime(new Date());
|
convertMqEO.setModifyTime(new Date());
|
||||||
convertMqEO.setMqState(2);
|
convertMqEO.setMqState(2);
|
||||||
convertMqEOService.updateById(convertMqEO);
|
convertMqEOService.updateById(convertMqEO);
|
||||||
if(convertMqEO.getAgainNum()<=5){
|
// if(convertMqEO.getAgainNum()<=5){
|
||||||
throw new Exception("转换失败");
|
// throw new Exception("转换失败");
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
return Result.success(dPath);
|
return Result.success(savePdfPath);
|
||||||
} else {
|
} else {
|
||||||
logger.error("转换时未获取到文件路径!");
|
logger.error("转换时未获取到文件路径!");
|
||||||
return Result.error("文件存储失败,请重试");
|
return Result.error("文件存储失败,请重试");
|
||||||
@@ -228,7 +239,7 @@ public class SendConvertMQService {
|
|||||||
convertMqEO.setId(convertId);
|
convertMqEO.setId(convertId);
|
||||||
convertMqEO.setMqState(2);
|
convertMqEO.setMqState(2);
|
||||||
convertMqEOService.updateById(convertMqEO);
|
convertMqEOService.updateById(convertMqEO);
|
||||||
this.restartUploadConvert(convertMqEO);
|
// this.restartUploadConvert(convertMqEO);
|
||||||
return Result.error("r0072", "文件转换失败,请重试");
|
return Result.error("r0072", "文件转换失败,请重试");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -270,14 +281,14 @@ public class SendConvertMQService {
|
|||||||
lawsFile.setModifyTime(new Date());
|
lawsFile.setModifyTime(new Date());
|
||||||
lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
|
lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
|
||||||
countSuccess = sarStandFileEODao.updateByPrimaryKeySelective(lawsFile);
|
countSuccess = sarStandFileEODao.updateByPrimaryKeySelective(lawsFile);
|
||||||
} else if (SarTypeEnum.LAWS.getValue().equals(convertMq.getConvertType())) {
|
} else if (SarTypeEnum.LAWS_STAND.getValue().equals(convertMq.getConvertType())) {
|
||||||
// SarLawsFile lawsFile = new SarLawsFile();
|
SarLawsFile lawsFile = new SarLawsFile();
|
||||||
// lawsFile.setId(convertMq.getPdfId());
|
lawsFile.setId(convertMq.getPdfId());
|
||||||
// lawsFile.setAttId(pdfId);
|
lawsFile.setAttId(pdfId);
|
||||||
// lawsFile.setOriAttId(convertMq.getOriAttId());
|
lawsFile.setOriAttId(convertMq.getOriAttId());
|
||||||
// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
|
lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
|
||||||
// lawsFile.setModifyTime(new Date());
|
lawsFile.setModifyTime(new Date());
|
||||||
// countSuccess = sarLawsFileEODao.updateByPrimaryKeySelective(lawsFile);
|
countSuccess = sarLawsFileDao.updateByPrimaryKeySelective(lawsFile);
|
||||||
} else if (SarTypeEnum.BUSINESS.getValue().equals(convertMq.getConvertType())) {
|
} else if (SarTypeEnum.BUSINESS.getValue().equals(convertMq.getConvertType())) {
|
||||||
SarBussStandFile lawsFile = new SarBussStandFile();
|
SarBussStandFile lawsFile = new SarBussStandFile();
|
||||||
lawsFile.setId(convertMq.getPdfId());
|
lawsFile.setId(convertMq.getPdfId());
|
||||||
@@ -336,21 +347,21 @@ public class SendConvertMQService {
|
|||||||
lawsFile.setFileName(fileOriName+".pdf");
|
lawsFile.setFileName(fileOriName+".pdf");
|
||||||
lawsFile.setFileSuffix("pdf");
|
lawsFile.setFileSuffix("pdf");
|
||||||
countSuccess = sarStandFileEODao.insertSelective(lawsFile);
|
countSuccess = sarStandFileEODao.insertSelective(lawsFile);
|
||||||
} else if (SarTypeEnum.LAWS.getValue().equals(convertMq.getConvertType())) {
|
} else if (SarTypeEnum.LAWS_STAND.getValue().equals(convertMq.getConvertType())) {
|
||||||
// SarLawsFile lawsFile = new SarLawsFile();
|
SarLawsFile lawsFile = new SarLawsFile();
|
||||||
// lawsFile.setId(UUID.randomUUID(20));
|
lawsFile.setId(UUID.randomUUID(20));
|
||||||
// lawsFile.setLawsId(convertMq.getLawsId());
|
lawsFile.setLawsId(convertMq.getLawsId());
|
||||||
// lawsFile.setResId(convertMq.getResId());
|
lawsFile.setResId(convertMq.getResId());
|
||||||
// lawsFile.setAttId(pdfId);
|
lawsFile.setAttId(pdfId);
|
||||||
// lawsFile.setOriAttId(convertMq.getOriAttId());
|
lawsFile.setOriAttId(convertMq.getOriAttId());
|
||||||
// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
|
lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
|
||||||
// lawsFile.setValidFlag("0");
|
lawsFile.setValidFlag(0);
|
||||||
// lawsFile.setCreationTime(new Date());
|
lawsFile.setCreationTime(new Date());
|
||||||
// lawsFile.setModifyTime(new Date());
|
lawsFile.setModifyTime(new Date());
|
||||||
// lawsFile.setLawsFileClassify(convertMq.getLawsFileClassify());
|
lawsFile.setLawsFileClassify(convertMq.getLawsFileClassify());
|
||||||
// lawsFile.setFileName(fileOriName+".pdf");
|
lawsFile.setFileName(fileOriName+".pdf");
|
||||||
// lawsFile.setFileSuffix("pdf");
|
lawsFile.setFileSuffix("pdf");
|
||||||
// countSuccess = sarLawsFileEODao.insertSelective(lawsFile);
|
countSuccess = sarLawsFileDao.insertSelective(lawsFile);
|
||||||
} else if (SarTypeEnum.BUSINESS.getValue().equals(convertMq.getConvertType())) {
|
} else if (SarTypeEnum.BUSINESS.getValue().equals(convertMq.getConvertType())) {
|
||||||
SarBussStandFile lawsFile = new SarBussStandFile();
|
SarBussStandFile lawsFile = new SarBussStandFile();
|
||||||
lawsFile.setId(UUID.randomUUID(20));
|
lawsFile.setId(UUID.randomUUID(20));
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,14 @@
|
|||||||
|
<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>
|
||||||
+35
-1
@@ -1,12 +1,22 @@
|
|||||||
package com.adc.da.slrs.sarLawsFile.controller;
|
package com.adc.da.slrs.sarLawsFile.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.adc.da.att.entity.AttFileEO;
|
||||||
|
import com.adc.da.att.service.IAttFileEOService;
|
||||||
|
import com.adc.da.http.ResponseMessage;
|
||||||
|
import com.adc.da.http.Result;
|
||||||
|
import com.adc.da.slrs.sarLawsFile.service.ISarLawsFileService;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import com.adc.da.slrs.sarLawsFile.entity.SarLawsFile;
|
import com.adc.da.slrs.sarLawsFile.entity.SarLawsFile;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.adc.da.base.web.BaseController;
|
import com.adc.da.base.web.BaseController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 前端控制器
|
* 前端控制器
|
||||||
@@ -17,7 +27,31 @@ import com.adc.da.base.web.BaseController;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@Api(description = "|SarLawsFile|")
|
@Api(description = "|SarLawsFile|")
|
||||||
@RequestMapping("/sarLawsFile/sar-laws-file")
|
@RequestMapping("/${restPath}/lawss/sarLawsFile")
|
||||||
public class SarLawsFileController extends BaseController<SarLawsFile> {
|
public class SarLawsFileController extends BaseController<SarLawsFile> {
|
||||||
|
@Autowired
|
||||||
|
private IAttFileEOService attFileEOService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISarLawsFileService iSarLawsFileService;
|
||||||
|
|
||||||
|
@ApiOperation(value = "|SarBussStandFileEO|查询转换后的文档详情")
|
||||||
|
@GetMapping("/queryConvertAtt")
|
||||||
|
/*@RequiresPermissions("lawss:sarLawsFile:list")*/
|
||||||
|
public ResponseMessage<SarLawsFile> queryConvertAtt(String attId) throws Exception {
|
||||||
|
List<SarLawsFile> getList = iSarLawsFileService.selectFileByAttId(attId);
|
||||||
|
SarLawsFile sarBussStandFileEO = new SarLawsFile();
|
||||||
|
if(getList != null && !getList.isEmpty()){
|
||||||
|
sarBussStandFileEO = getList.get(0);
|
||||||
|
AttFileEO attFileEO = attFileEOService.getFileInfo(attId);
|
||||||
|
if(attFileEO != null){
|
||||||
|
sarBussStandFileEO.setFileOldName(attFileEO.getOldFileName());
|
||||||
|
}
|
||||||
|
// readStandOrLawsLogService.sendReadSOLLog("BUSS",sarBussStandFileEO);
|
||||||
|
return Result.success(sarBussStandFileEO);
|
||||||
|
} else {
|
||||||
|
return Result.success(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.adc.da.slrs.sarLawsFile.service;
|
|||||||
import com.adc.da.slrs.sarLawsFile.entity.SarLawsFile;
|
import com.adc.da.slrs.sarLawsFile.entity.SarLawsFile;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务类
|
* 服务类
|
||||||
@@ -13,4 +15,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
*/
|
*/
|
||||||
public interface ISarLawsFileService extends IService<SarLawsFile> {
|
public interface ISarLawsFileService extends IService<SarLawsFile> {
|
||||||
|
|
||||||
|
List<SarLawsFile> selectFileByAttId(String attId) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -6,6 +6,8 @@ import com.adc.da.slrs.sarLawsFile.service.ISarLawsFileService;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务实现类
|
* 服务实现类
|
||||||
@@ -17,4 +19,8 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class SarLawsFileServiceImpl extends ServiceImpl<SarLawsFileDao, SarLawsFile> implements ISarLawsFileService {
|
public class SarLawsFileServiceImpl extends ServiceImpl<SarLawsFileDao, SarLawsFile> implements ISarLawsFileService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SarLawsFile> selectFileByAttId(String attId) throws Exception{
|
||||||
|
return this.baseMapper.selectFileByAttId(attId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<result column="modify_time" property="modifyTime" />
|
<result column="modify_time" property="modifyTime" />
|
||||||
<result column="creation_time" property="creationTime" />
|
<result column="creation_time" property="creationTime" />
|
||||||
<result column="valid_flag" property="validFlag" />
|
<result column="valid_flag" property="validFlag" />
|
||||||
<result column="use_model" property="useModule" />
|
<result column="use_model" property="useModel" />
|
||||||
<result column="att_id" property="attId" />
|
<result column="att_id" property="attId" />
|
||||||
<result column="ori_att_id" property="oriAttId" />
|
<result column="ori_att_id" property="oriAttId" />
|
||||||
<result column="laws_id" property="lawsId" />
|
<result column="laws_id" property="lawsId" />
|
||||||
@@ -50,8 +50,8 @@
|
|||||||
<if test="validFlag != null" >
|
<if test="validFlag != null" >
|
||||||
and valid_flag ${validFlagOperator} #{validFlag}
|
and valid_flag ${validFlagOperator} #{validFlag}
|
||||||
</if>
|
</if>
|
||||||
<if test="useModule != null" >
|
<if test="useModel != null" >
|
||||||
and use_model ${useModuleOperator} #{useModule}
|
and use_model ${useModuleOperator} #{useModel}
|
||||||
</if>
|
</if>
|
||||||
<if test="attId != null" >
|
<if test="attId != null" >
|
||||||
and att_id ${attIdOperator} #{attId}
|
and att_id ${attIdOperator} #{attId}
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
<if test="modifyTime != null" >modify_time,</if>
|
<if test="modifyTime != null" >modify_time,</if>
|
||||||
<if test="creationTime != null" >creation_time,</if>
|
<if test="creationTime != null" >creation_time,</if>
|
||||||
<if test="validFlag != null" >valid_flag,</if>
|
<if test="validFlag != null" >valid_flag,</if>
|
||||||
<if test="useModule != null" >use_model,</if>
|
<if test="useModel != null" >use_model,</if>
|
||||||
<if test="attId != null" >att_id,</if>
|
<if test="attId != null" >att_id,</if>
|
||||||
<if test="lawsId != null" >laws_id,</if>
|
<if test="lawsId != null" >laws_id,</if>
|
||||||
<if test="id != null" >id,</if>
|
<if test="id != null" >id,</if>
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
<if test="modifyTime != null" >#{modifyTime, jdbcType=TIMESTAMP},</if>
|
<if test="modifyTime != null" >#{modifyTime, jdbcType=TIMESTAMP},</if>
|
||||||
<if test="creationTime != null" >#{creationTime, jdbcType=TIMESTAMP},</if>
|
<if test="creationTime != null" >#{creationTime, jdbcType=TIMESTAMP},</if>
|
||||||
<if test="validFlag != null" >#{validFlag, jdbcType=INTEGER},</if>
|
<if test="validFlag != null" >#{validFlag, jdbcType=INTEGER},</if>
|
||||||
<if test="useModule != null" >#{useModule, jdbcType=VARCHAR},</if>
|
<if test="useModel != null" >#{useModel, jdbcType=VARCHAR},</if>
|
||||||
<if test="attId != null" >#{attId, jdbcType=VARCHAR},</if>
|
<if test="attId != null" >#{attId, jdbcType=VARCHAR},</if>
|
||||||
<if test="lawsId != null" >#{lawsId, jdbcType=VARCHAR},</if>
|
<if test="lawsId != null" >#{lawsId, jdbcType=VARCHAR},</if>
|
||||||
<if test="id != null" >#{id, jdbcType=VARCHAR},</if>
|
<if test="id != null" >#{id, jdbcType=VARCHAR},</if>
|
||||||
@@ -118,8 +118,8 @@
|
|||||||
<if test="validFlag != null" >
|
<if test="validFlag != null" >
|
||||||
valid_flag = #{validFlag},
|
valid_flag = #{validFlag},
|
||||||
</if>
|
</if>
|
||||||
<if test="useModule != null" >
|
<if test="useModel != null" >
|
||||||
use_model = #{useModule},
|
use_model = #{useModel},
|
||||||
</if>
|
</if>
|
||||||
<if test="attId != null" >
|
<if test="attId != null" >
|
||||||
att_id = #{attId},
|
att_id = #{attId},
|
||||||
|
|||||||
Reference in New Issue
Block a user