feat: There is no way the, convert

This commit is contained in:
super_liu
2021-11-14 17:25:47 +08:00
parent d39aabd835
commit 21acca5bee
14 changed files with 449 additions and 48 deletions
+37 -1
View File
@@ -22,6 +22,42 @@
<artifactId>adc-da-sys</artifactId>
<version>3.0.0</version>
</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-->
<dependency>
@@ -46,7 +82,7 @@
<artifactId>jodconverter-local</artifactId>
<version>4.3.0</version>
</dependency>
<!-- openOffice end-->
<!-- openOffice end-->
<dependency>
<groupId>org.openoffice</groupId>
<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.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));
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>
@@ -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;
/**
* <p>
* 前端控制器
@@ -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<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.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 服务类
@@ -13,4 +15,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface ISarLawsFileService extends IService<SarLawsFile> {
List<SarLawsFile> selectFileByAttId(String attId) throws Exception;
}
@@ -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;
/**
* <p>
* 服务实现类
@@ -17,4 +19,8 @@ import org.springframework.stereotype.Service;
@Service
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="creation_time" property="creationTime" />
<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="ori_att_id" property="oriAttId" />
<result column="laws_id" property="lawsId" />
@@ -50,8 +50,8 @@
<if test="validFlag != null" >
and valid_flag ${validFlagOperator} #{validFlag}
</if>
<if test="useModule != null" >
and use_model ${useModuleOperator} #{useModule}
<if test="useModel != null" >
and use_model ${useModuleOperator} #{useModel}
</if>
<if test="attId != null" >
and att_id ${attIdOperator} #{attId}
@@ -74,7 +74,7 @@
<if test="modifyTime != null" >modify_time,</if>
<if test="creationTime != null" >creation_time,</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="lawsId != null" >laws_id,</if>
<if test="id != null" >id,</if>
@@ -89,7 +89,7 @@
<if test="modifyTime != null" >#{modifyTime, jdbcType=TIMESTAMP},</if>
<if test="creationTime != null" >#{creationTime, jdbcType=TIMESTAMP},</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="lawsId != null" >#{lawsId, jdbcType=VARCHAR},</if>
<if test="id != null" >#{id, jdbcType=VARCHAR},</if>
@@ -118,8 +118,8 @@
<if test="validFlag != null" >
valid_flag = #{validFlag},
</if>
<if test="useModule != null" >
use_model = #{useModule},
<if test="useModel != null" >
use_model = #{useModel},
</if>
<if test="attId != null" >
att_id = #{attId},