diff --git a/adc-da-convert/pom.xml b/adc-da-convert/pom.xml index 3394f4a2..00069d91 100644 --- a/adc-da-convert/pom.xml +++ b/adc-da-convert/pom.xml @@ -22,6 +22,42 @@ adc-da-sys 3.0.0 + + + + com.artofsolving + jodconverter + system + 2.2.2 + ${basedir}/src/main/lib/jodconverter-2.2.2.jar + + + com.aspose + aspose-words + 15.8.0 + system + ${basedir}/src/main/lib/aspose-words-15.8.0-jdk16.jar + + + com.aspose + aspose-cells + 8.5.2 + system + ${basedir}/src/main/lib/aspose-cells-8.5.2.jar + + + com.aspose + aspose-slides + 16.7.0 + system + ${basedir}/src/main/lib/aspose.slides-16.7.0.jar + + + + com.itextpdf + itextpdf + 5.5.13 + @@ -46,7 +82,7 @@ jodconverter-local 4.3.0 - + org.openoffice juh diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/common/AsposeOfficeConvertUtils.java b/adc-da-convert/src/main/java/com/adc/da/convert/common/AsposeOfficeConvertUtils.java new file mode 100644 index 00000000..7fb1ee8a --- /dev/null +++ b/adc-da-convert/src/main/java/com/adc/da/convert/common/AsposeOfficeConvertUtils.java @@ -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; + } + } + + } + + +} diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/common/ExcelTPdfUtils.java b/adc-da-convert/src/main/java/com/adc/da/convert/common/ExcelTPdfUtils.java new file mode 100644 index 00000000..9d5bbfe7 --- /dev/null +++ b/adc-da-convert/src/main/java/com/adc/da/convert/common/ExcelTPdfUtils.java @@ -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 = "Aspose.Total for JavaAspose.Words for JavaEnterprise20991231209912318bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU="; + + /** + * 获取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); + } + } + + +} diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/common/SlidesTPdfUtils.java b/adc-da-convert/src/main/java/com/adc/da/convert/common/SlidesTPdfUtils.java new file mode 100644 index 00000000..8b38b699 --- /dev/null +++ b/adc-da-convert/src/main/java/com/adc/da/convert/common/SlidesTPdfUtils.java @@ -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 = "Aspose.Total for JavaAspose.Words for JavaEnterprise20991231209912318bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU="; + + 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); + } + + +} \ No newline at end of file diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/common/WordTPdfUtils.java b/adc-da-convert/src/main/java/com/adc/da/convert/common/WordTPdfUtils.java new file mode 100644 index 00000000..c8c8a08f --- /dev/null +++ b/adc-da-convert/src/main/java/com/adc/da/convert/common/WordTPdfUtils.java @@ -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 = "Aspose.Total for JavaAspose.Words for JavaEnterprise20991231209912318bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU="; + + 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); + } + } + +} \ No newline at end of file diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/mq/SendConvertMQService.java b/adc-da-convert/src/main/java/com/adc/da/convert/mq/SendConvertMQService.java index 712aa318..dd32104f 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/mq/SendConvertMQService.java +++ b/adc-da-convert/src/main/java/com/adc/da/convert/mq/SendConvertMQService.java @@ -4,12 +4,15 @@ import com.adc.da.att.entity.AttFileEO; import com.adc.da.att.service.IAttFileEOService; import com.adc.da.common.SarTypeEnum; import com.adc.da.common.UseModuleEnum; +import com.adc.da.convert.common.AsposeOfficeConvertUtils; import com.adc.da.convert.common.DocConverterPdf; import com.adc.da.mq.CreateMQService; import com.adc.da.slrs.otConvertMq.entity.OtConvertMq; import com.adc.da.slrs.otConvertMq.service.IOtConvertMqService; import com.adc.da.slrs.sarBussStandFile.dao.SarBussStandFileDao; 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.entity.SarStandFile; import com.adc.da.sys.util.LoginUserUtil; @@ -62,6 +65,9 @@ public class SendConvertMQService { @Autowired private SarBussStandFileDao sarBussStandFileEODao; + @Autowired + private SarLawsFileDao sarLawsFileDao; + private static final Logger logger = LoggerFactory.getLogger(SendConvertMQService.class); @RabbitListener(bindings = @QueueBinding( @@ -152,6 +158,7 @@ public class SendConvertMQService { public ResponseMessage docUploadConvert(OtConvertMq convertMqEO) throws Exception{ //保存在数据库中的ID String path = localFilePath + convertMqEO.getFilePath(); + path = path.replace("//","/"); String convertId = convertMqEO.getId(); try { //进入转换方法中,修改OT_CONVERT表中状态为转换中 @@ -164,24 +171,28 @@ public class SendConvertMQService { String converfilename = path.replaceAll("\\\\", "/"); logger.info("*****上传路径:*******"+localFilePath); logger.info("************文件路径:**********" + convertMqEO.getFilePath()); - logger.info("************接口:**********" + port); +// logger.info("************接口:**********" + port); logger.info("*****上传路径替换,加入文件名*******"+converfilename); //截取文件类型 int index = converfilename.lastIndexOf("."); String fileType = converfilename.substring(index,converfilename.length()); String fileOriName = converfilename.substring(0,index); - //调用转换类DocConverter,并将需要转换的文件传递给该类的构造方法 - DocConverterPdf d = new DocConverterPdf(converfilename,fileType); - d.setConvertHost(convertHost); - //调用conver方法开始转换,先执行doc2pdf()将office文件转换为pdf;再执行pdf2swf()将pdf转换为swf; - File getPdf = d.conver(fileType); - //调用getswfPath()方法,打印转换后的swf文件路径 - String dPath = d.getpdfPath(); - logger.info("*****转换后的pdf文件路径*******"+dPath); +// //调用转换类DocConverter,并将需要转换的文件传递给该类的构造方法 +// DocConverterPdf d = new DocConverterPdf(converfilename,fileType); +// d.setConvertHost(convertHost); +// //调用conver方法开始转换,先执行doc2pdf()将office文件转换为pdf;再执行pdf2swf()将pdf转换为swf; +// File getPdf = d.conver(fileType); +// //调用getswfPath()方法,打印转换后的swf文件路径 +// String dPath = d.getpdfPath(); + 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); int count = 0; if("0".equals(convertMqEO.getAddOrUp())){ @@ -212,11 +223,11 @@ public class SendConvertMQService { convertMqEO.setModifyTime(new Date()); convertMqEO.setMqState(2); convertMqEOService.updateById(convertMqEO); - if(convertMqEO.getAgainNum()<=5){ - throw new Exception("转换失败"); - } +// if(convertMqEO.getAgainNum()<=5){ +// throw new Exception("转换失败"); +// } } - return Result.success(dPath); + return Result.success(savePdfPath); } else { logger.error("转换时未获取到文件路径!"); return Result.error("文件存储失败,请重试"); @@ -228,7 +239,7 @@ public class SendConvertMQService { convertMqEO.setId(convertId); convertMqEO.setMqState(2); convertMqEOService.updateById(convertMqEO); - this.restartUploadConvert(convertMqEO); +// this.restartUploadConvert(convertMqEO); return Result.error("r0072", "文件转换失败,请重试"); } } @@ -270,14 +281,14 @@ public class SendConvertMQService { lawsFile.setModifyTime(new Date()); lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue()); countSuccess = sarStandFileEODao.updateByPrimaryKeySelective(lawsFile); - } else if (SarTypeEnum.LAWS.getValue().equals(convertMq.getConvertType())) { -// SarLawsFile lawsFile = new SarLawsFile(); -// lawsFile.setId(convertMq.getPdfId()); -// lawsFile.setAttId(pdfId); -// lawsFile.setOriAttId(convertMq.getOriAttId()); -// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue()); -// lawsFile.setModifyTime(new Date()); -// countSuccess = sarLawsFileEODao.updateByPrimaryKeySelective(lawsFile); + } else if (SarTypeEnum.LAWS_STAND.getValue().equals(convertMq.getConvertType())) { + SarLawsFile lawsFile = new SarLawsFile(); + lawsFile.setId(convertMq.getPdfId()); + lawsFile.setAttId(pdfId); + lawsFile.setOriAttId(convertMq.getOriAttId()); + lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue()); + lawsFile.setModifyTime(new Date()); + countSuccess = sarLawsFileDao.updateByPrimaryKeySelective(lawsFile); } else if (SarTypeEnum.BUSINESS.getValue().equals(convertMq.getConvertType())) { SarBussStandFile lawsFile = new SarBussStandFile(); lawsFile.setId(convertMq.getPdfId()); @@ -336,21 +347,21 @@ public class SendConvertMQService { lawsFile.setFileName(fileOriName+".pdf"); lawsFile.setFileSuffix("pdf"); countSuccess = sarStandFileEODao.insertSelective(lawsFile); - } else if (SarTypeEnum.LAWS.getValue().equals(convertMq.getConvertType())) { -// SarLawsFile lawsFile = new SarLawsFile(); -// lawsFile.setId(UUID.randomUUID(20)); -// lawsFile.setLawsId(convertMq.getLawsId()); -// lawsFile.setResId(convertMq.getResId()); -// lawsFile.setAttId(pdfId); -// lawsFile.setOriAttId(convertMq.getOriAttId()); -// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue()); -// lawsFile.setValidFlag("0"); -// lawsFile.setCreationTime(new Date()); -// lawsFile.setModifyTime(new Date()); -// lawsFile.setLawsFileClassify(convertMq.getLawsFileClassify()); -// lawsFile.setFileName(fileOriName+".pdf"); -// lawsFile.setFileSuffix("pdf"); -// countSuccess = sarLawsFileEODao.insertSelective(lawsFile); + } else if (SarTypeEnum.LAWS_STAND.getValue().equals(convertMq.getConvertType())) { + SarLawsFile lawsFile = new SarLawsFile(); + lawsFile.setId(UUID.randomUUID(20)); + lawsFile.setLawsId(convertMq.getLawsId()); + lawsFile.setResId(convertMq.getResId()); + lawsFile.setAttId(pdfId); + lawsFile.setOriAttId(convertMq.getOriAttId()); + lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue()); + lawsFile.setValidFlag(0); + lawsFile.setCreationTime(new Date()); + lawsFile.setModifyTime(new Date()); + lawsFile.setLawsFileClassify(convertMq.getLawsFileClassify()); + lawsFile.setFileName(fileOriName+".pdf"); + lawsFile.setFileSuffix("pdf"); + countSuccess = sarLawsFileDao.insertSelective(lawsFile); } else if (SarTypeEnum.BUSINESS.getValue().equals(convertMq.getConvertType())) { SarBussStandFile lawsFile = new SarBussStandFile(); lawsFile.setId(UUID.randomUUID(20)); diff --git a/adc-da-convert/src/main/lib/aspose-cells-8.5.2.jar b/adc-da-convert/src/main/lib/aspose-cells-8.5.2.jar new file mode 100644 index 00000000..d0e1aca3 Binary files /dev/null and b/adc-da-convert/src/main/lib/aspose-cells-8.5.2.jar differ diff --git a/adc-da-convert/src/main/lib/aspose-words-15.8.0-jdk16.jar b/adc-da-convert/src/main/lib/aspose-words-15.8.0-jdk16.jar new file mode 100644 index 00000000..c0e699fc Binary files /dev/null and b/adc-da-convert/src/main/lib/aspose-words-15.8.0-jdk16.jar differ diff --git a/adc-da-convert/src/main/lib/aspose.slides-16.7.0.jar b/adc-da-convert/src/main/lib/aspose.slides-16.7.0.jar new file mode 100644 index 00000000..492ffa72 Binary files /dev/null and b/adc-da-convert/src/main/lib/aspose.slides-16.7.0.jar differ diff --git a/adc-da-convert/src/main/resources/license.xml b/adc-da-convert/src/main/resources/license.xml new file mode 100644 index 00000000..244a16d7 --- /dev/null +++ b/adc-da-convert/src/main/resources/license.xml @@ -0,0 +1,14 @@ + + + + Aspose.Total for Java + Aspose.Words for Java + + Enterprise + 20991231 + 20991231 + 8bfe198c-7f0c-4ef8-8ff0-acc3237bf0d7 + + sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU= + + \ No newline at end of file diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarLawsFile/controller/SarLawsFileController.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarLawsFile/controller/SarLawsFileController.java index 1205d921..c4342677 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarLawsFile/controller/SarLawsFileController.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarLawsFile/controller/SarLawsFileController.java @@ -1,12 +1,22 @@ 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 com.adc.da.slrs.sarLawsFile.entity.SarLawsFile; import io.swagger.annotations.Api; import org.springframework.web.bind.annotation.RestController; import com.adc.da.base.web.BaseController; +import java.util.List; + /** *

* 前端控制器 @@ -17,7 +27,31 @@ import com.adc.da.base.web.BaseController; */ @RestController @Api(description = "|SarLawsFile|") -@RequestMapping("/sarLawsFile/sar-laws-file") +@RequestMapping("/${restPath}/lawss/sarLawsFile") public class SarLawsFileController extends BaseController { + @Autowired + private IAttFileEOService attFileEOService; + @Autowired + private ISarLawsFileService iSarLawsFileService; + + @ApiOperation(value = "|SarBussStandFileEO|查询转换后的文档详情") + @GetMapping("/queryConvertAtt") + /*@RequiresPermissions("lawss:sarLawsFile:list")*/ + public ResponseMessage queryConvertAtt(String attId) throws Exception { + List 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); + } + + } } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarLawsFile/service/ISarLawsFileService.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarLawsFile/service/ISarLawsFileService.java index 333c80c8..c8327fbd 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarLawsFile/service/ISarLawsFileService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarLawsFile/service/ISarLawsFileService.java @@ -3,6 +3,8 @@ package com.adc.da.slrs.sarLawsFile.service; import com.adc.da.slrs.sarLawsFile.entity.SarLawsFile; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + /** *

* 服务类 @@ -13,4 +15,6 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface ISarLawsFileService extends IService { + List selectFileByAttId(String attId) throws Exception; + } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarLawsFile/service/impl/SarLawsFileServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarLawsFile/service/impl/SarLawsFileServiceImpl.java index 5586e2af..fed799f0 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarLawsFile/service/impl/SarLawsFileServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarLawsFile/service/impl/SarLawsFileServiceImpl.java @@ -6,6 +6,8 @@ import com.adc.da.slrs.sarLawsFile.service.ISarLawsFileService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; +import java.util.List; + /** *

* 服务实现类 @@ -17,4 +19,8 @@ import org.springframework.stereotype.Service; @Service public class SarLawsFileServiceImpl extends ServiceImpl implements ISarLawsFileService { + @Override + public List selectFileByAttId(String attId) throws Exception{ + return this.baseMapper.selectFileByAttId(attId); + } } diff --git a/adc-da-slrs/src/main/resources/mybatis/mapper/sarLawsFile/SarLawsFileMapper.xml b/adc-da-slrs/src/main/resources/mybatis/mapper/sarLawsFile/SarLawsFileMapper.xml index 9992bbad..4433dc53 100644 --- a/adc-da-slrs/src/main/resources/mybatis/mapper/sarLawsFile/SarLawsFileMapper.xml +++ b/adc-da-slrs/src/main/resources/mybatis/mapper/sarLawsFile/SarLawsFileMapper.xml @@ -7,7 +7,7 @@ - + @@ -50,8 +50,8 @@ and valid_flag ${validFlagOperator} #{validFlag} - - and use_model ${useModuleOperator} #{useModule} + + and use_model ${useModuleOperator} #{useModel} and att_id ${attIdOperator} #{attId} @@ -74,7 +74,7 @@ modify_time, creation_time, valid_flag, - use_model, + use_model, att_id, laws_id, id, @@ -89,7 +89,7 @@ #{modifyTime, jdbcType=TIMESTAMP}, #{creationTime, jdbcType=TIMESTAMP}, #{validFlag, jdbcType=INTEGER}, - #{useModule, jdbcType=VARCHAR}, + #{useModel, jdbcType=VARCHAR}, #{attId, jdbcType=VARCHAR}, #{lawsId, jdbcType=VARCHAR}, #{id, jdbcType=VARCHAR}, @@ -118,8 +118,8 @@ valid_flag = #{validFlag}, - - use_model = #{useModule}, + + use_model = #{useModel}, att_id = #{attId},