diff --git a/adc-da-convert/pom.xml b/adc-da-convert/pom.xml index b1922377..f11c490a 100644 --- a/adc-da-convert/pom.xml +++ b/adc-da-convert/pom.xml @@ -22,13 +22,23 @@ adc-da-sys 3.0.0 + - com.artofsolving - jodconverter - system - 2.2.2 - ${basedir}/src/main/lib/jodconverter-2.2.2.jar + org.jodconverter + jodconverter-core + 4.2.2 + + org.jodconverter + jodconverter-spring-boot-starter + 4.2.2 + + + org.jodconverter + jodconverter-local + 4.2.2 + + org.openoffice juh diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverter.java b/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverter.java deleted file mode 100644 index 5febe5de..00000000 --- a/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverter.java +++ /dev/null @@ -1,264 +0,0 @@ -package com.adc.da.convert.common; - -import com.artofsolving.jodconverter.DocumentConverter; -import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection; -import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection; -import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; - -import java.io.*; - -/** - * @Author yangxuenan - * @Description 文档转换 - * Date 2018/8/24 13:44 - * @Param - * @return - **/ -public class DocConverter { - - private static final Logger logger = LoggerFactory.getLogger(DocConverter.class); - // 环境 1:windows 2:linux - private static final int ENVIRONMENT = 1; - // (只涉及pdf2swf路径问题) - private String fileString; - // 输入路径 ,如果不设置就输出在默认的位置 - private String outputPath = ""; - //转化文件名称 - private String fileName; - //转换pdf文件 - private File pdfFile; - //转换成swf文件 - private File swfFile; - //待转换doc文件 - private File docFile; - //为文件加水印后文件路径 - String waterPdfPath; - - @Value("${convert.host}") - private String convertHost; - - public DocConverter(String fileString,String fileType) { - ini(fileString,fileType); - } - - /** - * @Author yangxuenan - * @Description 重新设置file - * Date 2018/8/24 13:50 - * @Param [fileString, fileType] - * @return void - **/ - public void setFile(String fileString,String fileType) { - ini(fileString,fileType); - } - - /** - * @Author yangxuenan - * @Description 初始化 - * Date 2018/8/24 13:50 - * @Param [fileString, fileType] - * @return void - **/ - private void ini(String fileString,String fileType) { - this.fileString = fileString; - fileName = fileString.substring(0, fileString.lastIndexOf(".")); - //判断文件类型,进行不同操作 - if(".doc".equals(fileType) || ".docx".equals(fileType)){ - docFile = new File(fileString); - pdfFile = new File(fileName + ".pdf"); - swfFile = new File(fileName + ".swf"); - } else if (".pdf".equals(fileType)){ - pdfFile = new File(fileName + ".pdf"); - swfFile = new File(fileName + ".swf"); - } - } - - /** - * @Author yangxuenan - * @Description 转为PDF - * Date 2018/8/24 13:50 - * @Param [] - * @return void - **/ - private void doc2pdf() throws Exception { - if (docFile.exists()) { - if (!pdfFile.exists()) { - logger.info("转换服务地址接口:"+convertHost); - //连接openOffice - OpenOfficeConnection connection = new SocketOpenOfficeConnection(convertHost,8100); - try { - connection.connect(); - //使用openOffice将doc文件转换问pdf文件 - DocumentConverter converter = new OpenOfficeDocumentConverter(connection); - converter.convert(docFile, pdfFile); - // 关闭连接 - connection.disconnect(); - logger.info("****pdf转换成功,PDF输出:" + pdfFile.getPath()+ "****"); - } catch (java.net.ConnectException e) { - logger.error(e.getMessage(),e); - logger.info("****swf转换器异常,openoffice服务未启动!****"); - throw e; - } catch (com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException e) { - logger.error(e.getMessage(),e); - logger.info("****swf转换器异常,读取转换文件失败****"); - throw e; - } catch (Exception e) { - logger.error(e.getMessage(),e); - throw e; - } - } else { - logger.info("****已经转换为pdf,不需要再进行转化****"); - } - } else { - logger.info("****swf转换器异常,需要转换的文档不存在,无法转换****"); - } - } - - /** - * @Author yangxuenan - * @Description 转换成 swf - * Date 2018/8/24 13:51 - * @Param [fileType] - * @return void - **/ - /*private void pdf2swf(String fileType) throws Exception { - Runtime r = Runtime.getRuntime(); - if (!swfFile.exists()) { - if (pdfFile.exists()) { - // windows环境处理 - if (ENVIRONMENT == 1) { - try { - //使用swfTools工具将pdf文件转换为swf文件 - //String paperSwfFile = swfFile.getPath().replace(".swf","%.swf"); - Process p = r.exec("G:/swftTools/pdf2swf.exe "+ waterPdfPath + " -o "+ swfFile.getPath() + " -f -T 9 -t -s languagedir=G:/xpdf/xpdf-chinese-simplified"); - logger.info("****swf转换成功,文件输出:" + swfFile.getPath() + "****"); - //如果源文件为doc类文件,将过渡的pdf文件删除 - if(".doc".equals(fileType) || ".docx".equals(fileType)){ - if (pdfFile.exists()) { - if(!pdfFile.delete()){ - logger.error("文件删除失败!!!"); - } - } - } - } catch (IOException e) { - logger.error(e.getMessage(),e); - throw e; - } - } else if (ENVIRONMENT == 2) {// linux环境处理 - try { - Process p = r.exec("pdf2swf " + pdfFile.getPath() - + " -o " + swfFile.getPath() + " -f -T 9 -t -s storeallcharacters"); - logger.info("****swf转换成功,文件输出:" + swfFile.getPath() + "****"); - if (pdfFile.exists()) { - if(!pdfFile.delete()){ - logger.error("文件删除失败!!!"); - } - } - } catch (Exception e) { - logger.error(e.getMessage(),e); - throw e; - } - } - } else { - logger.info("****pdf不存在,无法转换****"); - } - } else { - logger.info("****swf已经存在不需要转换****"); - } - }*/ - - static String loadStream(InputStream in) throws IOException { - - int ptr = 0; - in = new BufferedInputStream(in); - StringBuilder buffer = new StringBuilder(); - - while ((ptr = in.read()) != -1) { - buffer.append((char) ptr); - } - - return buffer.toString(); - } - - /** - * @Author yangxuenan - * @Description 转换主方法 - * Date 2018/8/24 13:51 - * @Param [fileType] - * @return boolean - **/ - public boolean conver(String fileType) { - - if (swfFile.exists()) { - logger.info("****swf转换器开始工作,该文件已经转换为swf****"); - return true; - } - - if (ENVIRONMENT == 1) { - logger.info("****swf转换器开始工作,当前设置运行环境windows****"); - } else { - logger.info("****swf转换器开始工作,当前设置运行环境linux****"); - } - try { - //判断待转换文件类型,如果为doc文件需要先转为pdf类型文件 - if(".doc".equals(fileType) || ".docx".equals(fileType)){ - doc2pdf(); -// pdf2swf(fileType); - } else if (".pdf".equals(fileType)){ -// pdf2swf(fileType); - } - - } catch (Exception e) { - logger.error(e.getMessage(),e); - return false; - } - - if (swfFile.exists()) { - return true; - } else { - return false; - } - } - - /** - * @Author yangxuenan - * @Description 返回文件路径 - * Date 2018/8/24 13:52 - * @Param [] - * @return java.lang.String - **/ - public String getswfPath() { - if (swfFile.exists()) { - //获取转换后的swf文件路径 - String tempString = swfFile.getPath(); - tempString = tempString.replaceAll("\\\\", "/"); - return tempString; - } else { - return ""; - } - - } - - /** - * @Author yangxuenan - * @Description 设置输出路径 - * Date 2018/8/24 13:52 - * @Param [outputPath] - * @return void - **/ - public void setOutputPath(String outputPath) { - this.outputPath = outputPath; - if (!outputPath.equals("")) { - String realName = fileName.substring(fileName.lastIndexOf("/"), - fileName.lastIndexOf(".")); - if (outputPath.charAt(outputPath.length()) == '/') { - swfFile = new File(outputPath + realName + ".swf"); - } - } - } - - -} diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverterPdf.java b/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverterPdf.java index 69558ac4..697cf89e 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverterPdf.java +++ b/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverterPdf.java @@ -1,36 +1,24 @@ package com.adc.da.convert.common; -import com.artofsolving.jodconverter.DocumentConverter; -import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection; -import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection; -import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter; -import com.artofsolving.jodconverter.openoffice.converter.StreamOpenOfficeDocumentConverter; import org.apache.commons.lang.StringUtils; +import org.jodconverter.DocumentConverter; +import org.jodconverter.OfficeDocumentConverter; +import org.jodconverter.document.DefaultDocumentFormatRegistry; +import org.jodconverter.office.DefaultOfficeManagerBuilder; +import org.jodconverter.office.OfficeException; +import org.jodconverter.office.OfficeManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + import java.io.*; public class DocConverterPdf { private static final Logger logger = LoggerFactory.getLogger(DocConverterPdf.class); - /** - * 在所需的类里 添加下面配置 - * // 文档转换远程服务IP地址 - * @Value("${convert.host}") - * private String convertHost; - * - * - * fileString : 文件全路径 - * fileType : 文件后缀类型 - * 调用方法如下 - * DocConverterPdf d = new DocConverterPdf(fileString,fileType); - * d.setConvertHost(convertHost); - * //调用conver方法开始转换 - * File getPdf = d.conver(fileType); - * - * - */ + @Autowired + private DocumentConverter converter; private static final int ENVIRONMENT = 1;// 环境 1:windows 2:linux private String fileString;// (只涉及pdf2swf路径问题) @@ -40,6 +28,7 @@ public class DocConverterPdf { private File convertPdfFile; private File swfFile; private File docFile; + private String filesType; String waterPdfPath; private String convertHost; @@ -67,6 +56,7 @@ public class DocConverterPdf { fileName = fileString.substring(0, fileString.lastIndexOf(".")); if(".doc".equals(fileType.toLowerCase()) || ".docx".equals(fileType.toLowerCase()) || ".xlsx".equals(fileType.toLowerCase()) || ".xls".equals(fileType.toLowerCase()) || ".ppt".equals(fileType.toLowerCase()) || ".pptx".equals(fileType.toLowerCase())){ docFile = new File(fileString); + filesType = fileType.toLowerCase(); convertPdfFile=new File(fileName+"_C"+ ".pdf"); pdfFile = new File(fileName + ".pdf"); swfFile = new File(fileName + ".swf"); @@ -76,6 +66,38 @@ public class DocConverterPdf { } } + /** + * openOffice目录,window 可能在C://Program Files (x86)//OpenOffice 4 + */ + private static final String openOfficeHome = "E://Software//rtpro//Foton//File//openOffice//4"; + + /** + * openOffice端口 + */ + private static final int openOfficePort = 8100; + + /** + * 转化文档 + * @param input + * @param output + */ + public static void convertFile(File input , File output) throws OfficeException { + try { + DefaultOfficeManagerBuilder defaultOfficeManagerBuilder = new DefaultOfficeManagerBuilder(); + defaultOfficeManagerBuilder.setOfficeHome(openOfficeHome); + OfficeManager officeManager = defaultOfficeManagerBuilder.build(); + officeManager.start(); + + //转换,自动识别转化类型 + OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager); + converter.convert(input, output); + + officeManager.stop(); + } catch (OfficeException e) { + throw e; + } + } + /** * 转为PDF * @@ -83,22 +105,16 @@ public class DocConverterPdf { */ private void doc2pdf() throws Exception { if (!pdfFile.exists()) { - OpenOfficeConnection connection = null; logger.info("转换服务地址接口:"+convertHost); + InputStream in = null; + OutputStream out = null; try { - if(StringUtils.isNotBlank(convertHost)){ - connection = new SocketOpenOfficeConnection(convertHost,8100); - }else{ - connection = new SocketOpenOfficeConnection(8100); - } - connection.connect(); - DocumentConverter converter = new StreamOpenOfficeDocumentConverter(connection); - converter.convert(docFile, convertPdfFile); - - //addWaterToPdf(pdfFile,userId); - +// in = new FileInputStream(docFile); +// out = new FileOutputStream(convertPdfFile); + convertFile(docFile,convertPdfFile); +// converter.convert(in).as(DefaultDocumentFormatRegistry.getFormatByMediaType(filesType)). +// to(out).as(DefaultDocumentFormatRegistry.PDF); // close the connection - connection.disconnect(); // 开始设置PDF文档相关属性保证其安全性 logger.info("开始设置转换后的PDF文件安全性相关设置"); PDFEditUtils.setPDFFileSecurity(pdfFile.getAbsolutePath(),convertPdfFile.getAbsolutePath()); @@ -107,10 +123,6 @@ public class DocConverterPdf { logger.error(e.getMessage(),e); logger.info("****pdf转换器异常,openoffice服务未启动!****"); throw e; - } catch (com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException e) { - logger.error(e.getMessage(),e); - logger.info("****pdf转换器异常,读取转换文件失败****"); - throw e; } catch (Exception e) { logger.error(e.getMessage(),e); throw e; diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverterPdfOld.java b/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverterPdfOld.java deleted file mode 100644 index d9887b21..00000000 --- a/adc-da-convert/src/main/java/com/adc/da/convert/common/DocConverterPdfOld.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.adc.da.convert.common; - -import com.artofsolving.jodconverter.DocumentConverter; -import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection; -import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection; -import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -public class DocConverterPdfOld { - - private static final Logger logger = LoggerFactory.getLogger(DocConverterPdf.class); - - private static final int ENVIRONMENT = 1;// 环境 1:windows 2:linux - private String fileString;// (只涉及pdf2swf路径问题) - private String outputPath = "";// 输入路径 ,如果不设置就输出在默认的位置 - private String fileName; - private File pdfFile; - private File convertPdfFile; - private File swfFile; - private File docFile; - String waterPdfPath; - - public DocConverterPdfOld(String fileString, String fileType) { - ini(fileString,fileType); - } - - /** - * 重新设置file - * - * @param fileString - */ - public void setFile(String fileString,String fileType) { - ini(fileString,fileType); - } - - /** - * 初始化 - * - * @param fileString - */ - private void ini(String fileString,String fileType) { - this.fileString = fileString; - fileName = fileString.substring(0, fileString.lastIndexOf(".")); - if(".doc".equals(fileType) || ".docx".equals(fileType) || ".xlsx".equals(fileType) || ".xls".equals(fileType) || ".ppt".equals(fileType) || ".pptx".equals(fileType)){ - docFile = new File(fileString); - convertPdfFile=new File(fileName+"_C"+ ".pdf"); - pdfFile = new File(fileName + ".pdf"); - swfFile = new File(fileName + ".swf"); - } else if (".pdf".equals(fileType)){ - pdfFile = new File(fileName + ".pdf"); - swfFile = new File(fileName + ".swf"); - } - } - - /** - * 转为PDF - * - * @param - */ - private void doc2pdf() throws Exception { - if (!pdfFile.exists()) { - OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100); - try { - connection.connect(); - DocumentConverter converter = new OpenOfficeDocumentConverter(connection); - converter.convert(docFile, convertPdfFile); - - //addWaterToPdf(pdfFile,userId); - - // close the connection - connection.disconnect(); - // 开始设置PDF文档相关属性保证其安全性 - logger.info("开始设置转换后的PDF文件安全性相关设置"); - logger.info("****pdf转换成功,PDF输出:" + pdfFile.getPath()+ "****"); - } catch (java.net.ConnectException e) { - logger.error(e.getMessage(),e); - logger.info("****pdf转换器异常,openoffice服务未启动!****"); - throw e; - } catch (com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException e) { - logger.error(e.getMessage(),e); - logger.info("****pdf转换器异常,读取转换文件失败****"); - throw e; - } catch (Exception e) { - logger.error(e.getMessage(),e); - throw e; - } - } else { - logger.info("****已经转换为pdf,不需要再进行转化****"); - } - } - - /** - * 转换成 swf - */ - @SuppressWarnings("unused") - /*private void pdf2swf(String fileType) throws Exception { - Runtime r = Runtime.getRuntime(); - if (!swfFile.exists()) { - if (pdfFile.exists()) { - if (ENVIRONMENT == 1) {// windows环境处理 - try { - //String paperSwfFile = swfFile.getPath().replace(".swf","%.swf"); - Process p = r.exec("G:/swftTools/pdf2swf.exe "+ waterPdfPath + " -o "+ swfFile.getPath() + " -f -T 9 -t -s languagedir=G:/xpdf/xpdf-chinese-simplified"); - logger.info("****swf转换成功,文件输出:" + swfFile.getPath() + "****"); - if(".doc".equals(fileType) || ".docx".equals(fileType)){ - *//*if (pdfFile.exists()) { - pdfFile.delete(); - }*//* - } - } catch (IOException e) { - logger.error(e.getMessage(),e); - throw e; - } - } else if (ENVIRONMENT == 2) {// linux环境处理 - try { - Process p = r.exec("pdf2swf " + pdfFile.getPath() - + " -o " + swfFile.getPath() + " -f -T 9 -t -s storeallcharacters"); - logger.info("****swf转换成功,文件输出:" + swfFile.getPath() + "****"); - if (pdfFile.exists()) { - if(!pdfFile.delete()){ - logger.error("文件删除失败!!!"); - } - } - } catch (Exception e) { - logger.error(e.getMessage(),e); - throw e; - } - } - } else { - logger.info("****pdf不存在,无法转换****"); - } - } else { - logger.info("****swf已经存在不需要转换****"); - } - }*/ - - static String loadStream(InputStream in) throws IOException { - - int ptr = 0; - in = new BufferedInputStream(in); - StringBuilder buffer = new StringBuilder(); - while ((ptr = in.read()) != -1) { - buffer.append((char) ptr); - } - - return buffer.toString(); - } - /** - * 转换主方法 - */ - @SuppressWarnings("unused") - public File conver(String fileType) { - if (ENVIRONMENT == 1) { - logger.info("****swf转换器开始工作,当前设置运行环境windows****"); - } else { - logger.info("****swf转换器开始工作,当前设置运行环境linux****"); - } - try { - if(".doc".equals(fileType) || ".docx".equals(fileType) || ".xlsx".equals(fileType) || ".xls".equals(fileType) || ".ppt".equals(fileType) || ".pptx".equals(fileType)){ - doc2pdf(); - /*pdf2swf(fileType);*/ - } else if (".pdf".equals(fileType)){ - /*pdf2swf(fileType);*/ - } - - } catch (Exception e) { - logger.error(e.getMessage(),e); - return new File(""); - } - - return pdfFile; - - } - - /** - * 返回文件路径 - * - * @param - */ - public String getswfPath() { - if (swfFile.exists()) { - String tempString = swfFile.getPath(); - tempString = tempString.replaceAll("\\\\", "/"); - return tempString; - } else { - return ""; - } - - } - - public String getpdfPath() { - if (!pdfFile.getPath().isEmpty()) { - String tempString = pdfFile.getPath(); - tempString = tempString.replaceAll("\\\\", "/"); - return tempString; - } else { - return ""; - } - - } - - /** - * 设置输出路径 - */ - public void setOutputPath(String outputPath) { - this.outputPath = outputPath; - if (!outputPath.equals("")) { - String realName = fileName.substring(fileName.lastIndexOf("/"), fileName.lastIndexOf(".")); - //TODO 此处的if判断执行的代码逻辑完全一样, 因此将其判断注释掉,直接执行 -/* if (outputPath.charAt(outputPath.length()) == '/') { - swfFile = new File(outputPath + realName + ".swf"); - } else { - swfFile = new File(outputPath + realName + ".swf"); - }*/ - swfFile = new File(outputPath + realName + ".swf"); - } - } - -} 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 810f4fd3..6a576e23 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 @@ -2,13 +2,12 @@ package com.adc.da.convert.mq; import com.adc.da.att.entity.AttFileEO; import com.adc.da.att.service.IAttFileEOService; -import com.adc.da.common.ConvertMqEO; import com.adc.da.common.SarTypeEnum; import com.adc.da.common.UseModuleEnum; import com.adc.da.convert.common.DocConverterPdf; -import com.adc.da.convert.otConvertMq.entity.OtConvertMq; -import com.adc.da.convert.otConvertMq.service.IOtConvertMqService; -import com.adc.da.mq.service.CreateMQService; +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.sarStandFile.dao.SarStandFileDao; @@ -84,7 +83,6 @@ public class SendConvertMQService { }finally { Long tag = (Long) message.getHeaders().get(AmqpHeaders.DELIVERY_TAG); channel.basicAck(tag,false); - logger.debug("文档转换消息确认成功!!!!!!!!!"); } } @@ -236,7 +234,7 @@ public class SendConvertMQService { } public ResponseMessage restartUploadConvert(OtConvertMq convertInfo) throws Exception{ - ConvertMqEO convertMqEO = new ConvertMqEO(); + OtConvertMq convertMqEO = new com.adc.da.slrs.otConvertMq.entity.OtConvertMq(); convertMqEO.setLawsId(convertInfo.getLawsId()); convertMqEO.setConvertType(convertInfo.getConvertType()); convertMqEO.setAttId(convertInfo.getAttId()); @@ -271,7 +269,7 @@ public class SendConvertMQService { lawsFile.setOriAttId(convertMq.getOriAttId()); lawsFile.setModifyTime(new Date()); lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue()); - countSuccess = sarStandFileEODao.updateById(lawsFile); + countSuccess = sarStandFileEODao.updateByPrimaryKeySelective(lawsFile); } else if (SarTypeEnum.LAWS.getValue().equals(convertMq.getConvertType())) { // SarLawsFile lawsFile = new SarLawsFile(); // lawsFile.setId(convertMq.getPdfId()); @@ -287,7 +285,7 @@ public class SendConvertMQService { lawsFile.setOriAttId(convertMq.getOriAttId()); lawsFile.setUseModule(UseModuleEnum.WEB_FILE.getValue()); lawsFile.setModifyTime(new Date()); - countSuccess = sarBussStandFileEODao.updateById(lawsFile); + countSuccess = sarBussStandFileEODao.updateByPrimaryKeySelective(lawsFile); }else if (SarTypeEnum.RECORDS.getValue().equals(convertMq.getConvertType())) { // SarBussRecordsFileEO lawsFile = new SarBussRecordsFileEO(); // lawsFile.setId(convertMq.getPdfId()); @@ -337,7 +335,7 @@ public class SendConvertMQService { lawsFile.setStandFileClassify(convertMq.getStandFileClassify()); lawsFile.setFileName(fileOriName+".pdf"); lawsFile.setFileSuffix("pdf"); - countSuccess = sarStandFileEODao.insert(lawsFile); + countSuccess = sarStandFileEODao.insertSelective(lawsFile); } else if (SarTypeEnum.LAWS.getValue().equals(convertMq.getConvertType())) { // SarLawsFile lawsFile = new SarLawsFile(); // lawsFile.setId(UUID.randomUUID(20)); @@ -367,7 +365,7 @@ public class SendConvertMQService { lawsFile.setValidFlag(0); lawsFile.setCreationTime(new Date()); lawsFile.setModifyTime(new Date()); - countSuccess = sarBussStandFileEODao.insert(lawsFile); + countSuccess = sarBussStandFileEODao.insertSelective(lawsFile); } else if (SarTypeEnum.RECORDS.getValue().equals(convertMq.getConvertType())) { // SarBussRecordsFileEO lawsFile = new SarBussRecordsFileEO(); diff --git a/adc-da-convert/src/main/resources/mybatis/mapper/otConvertMq/OtConvertMqMapper.xml b/adc-da-convert/src/main/resources/mybatis/mapper/otConvertMq/OtConvertMqMapper.xml deleted file mode 100644 index 480951b6..00000000 --- a/adc-da-convert/src/main/resources/mybatis/mapper/otConvertMq/OtConvertMqMapper.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/adc-da-main/src/main/resources/application-dev.properties b/adc-da-main/src/main/resources/application-dev.properties index c9a24e7a..4665a006 100644 --- a/adc-da-main/src/main/resources/application-dev.properties +++ b/adc-da-main/src/main/resources/application-dev.properties @@ -48,6 +48,14 @@ spring.rabbitmq.host=62.234.118.181 spring.rabbitmq.port=5672 spring.rabbitmq.username=admin spring.rabbitmq.password=admin +spring.rabbitmq.listener.simple.acknowledge-mode= manual +#消费失败消息干掉 +spring.rabbitmq.listener.simple.default-requeue-rejected= true +#5秒 +spring.rabbitmq.listener.simple.retry.initial-interval= 5000 +spring.rabbitmq.listener.simple.retry.enabled= true +#最大重试5次 +spring.rabbitmq.listener.simple.retry.max-attempts= 5 # ============================================== # 文档存储路径指向 # ============================================== diff --git a/adc-da-slrs/src/main/java/com/adc/da/mq/service/CreateMQService.java b/adc-da-slrs/src/main/java/com/adc/da/mq/CreateMQService.java similarity index 92% rename from adc-da-slrs/src/main/java/com/adc/da/mq/service/CreateMQService.java rename to adc-da-slrs/src/main/java/com/adc/da/mq/CreateMQService.java index c11456a1..d913c62e 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/mq/service/CreateMQService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/mq/CreateMQService.java @@ -1,7 +1,7 @@ -package com.adc.da.mq.service; +package com.adc.da.mq; -import com.adc.da.common.ConvertMqEO; -import com.adc.da.mq.dao.OtConvertEODao; +import com.adc.da.slrs.otConvertMq.dao.OtConvertMqDao; +import com.adc.da.slrs.otConvertMq.entity.OtConvertMq; import com.adc.da.util.UUIDUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.amqp.core.AmqpTemplate; @@ -18,7 +18,7 @@ public class CreateMQService { private AmqpTemplate rabbitTemplate; @Autowired - private OtConvertEODao otConvertEODao; + private OtConvertMqDao otConvertEODao; /** * @Author yangxuenan * @Description 创建消息队列 @@ -26,7 +26,7 @@ public class CreateMQService { * @Param [convert, convertType] * @return int **/ - public void sendMQ(ConvertMqEO convert) throws Exception{ + public void sendMQ(OtConvertMq convert) throws Exception{ String otId = UUIDUtils.randomUUID20(); //向OT_CONVERT_EO表中添加/修改数据 //判断用户是初次发送还是重新发送,初次将添加到数据库,重新发送将修改原数据信息 diff --git a/adc-da-slrs/src/main/java/com/adc/da/mq/service/CreateStandMQService.java b/adc-da-slrs/src/main/java/com/adc/da/mq/CreateStandMQService.java similarity index 98% rename from adc-da-slrs/src/main/java/com/adc/da/mq/service/CreateStandMQService.java rename to adc-da-slrs/src/main/java/com/adc/da/mq/CreateStandMQService.java index b3271e42..d4592457 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/mq/service/CreateStandMQService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/mq/CreateStandMQService.java @@ -1,4 +1,4 @@ -package com.adc.da.mq.service; +package com.adc.da.mq; import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand; import com.adc.da.slrs.sarLawsInfo.entity.SarLawsInfo; diff --git a/adc-da-slrs/src/main/java/com/adc/da/mq/service/SendBussMQService.java b/adc-da-slrs/src/main/java/com/adc/da/mq/SendBussMQService.java similarity index 99% rename from adc-da-slrs/src/main/java/com/adc/da/mq/service/SendBussMQService.java rename to adc-da-slrs/src/main/java/com/adc/da/mq/SendBussMQService.java index 36afcafe..32692c49 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/mq/service/SendBussMQService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/mq/SendBussMQService.java @@ -1,6 +1,5 @@ -package com.adc.da.mq.service; +package com.adc.da.mq; -import com.adc.da.search.entity.StandLawsEO; import com.adc.da.slrs.otSvpps.service.IOtSvppsService; import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand; import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService; diff --git a/adc-da-slrs/src/main/java/com/adc/da/mq/service/SendStandMQService.java b/adc-da-slrs/src/main/java/com/adc/da/mq/SendStandMQService.java similarity index 99% rename from adc-da-slrs/src/main/java/com/adc/da/mq/service/SendStandMQService.java rename to adc-da-slrs/src/main/java/com/adc/da/mq/SendStandMQService.java index 7c20c0bc..c713507b 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/mq/service/SendStandMQService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/mq/SendStandMQService.java @@ -1,6 +1,5 @@ -package com.adc.da.mq.service; +package com.adc.da.mq; -import com.adc.da.slrs.otSvpps.entity.OtSvpps; import com.adc.da.slrs.otSvpps.service.IOtSvppsService; import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo; import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService; diff --git a/adc-da-slrs/src/main/java/com/adc/da/mq/dao/OtConvertEODao.java b/adc-da-slrs/src/main/java/com/adc/da/mq/dao/OtConvertEODao.java deleted file mode 100644 index 502fcb5c..00000000 --- a/adc-da-slrs/src/main/java/com/adc/da/mq/dao/OtConvertEODao.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.adc.da.mq.dao; - -import com.adc.da.common.ConvertMqEO; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.springframework.stereotype.Repository; - -@Repository -public interface OtConvertEODao extends BaseMapper { - - int deleteByAttId(String value); - -} diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/controller/OtConvertMqController.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/controller/OtConvertMqController.java similarity index 76% rename from adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/controller/OtConvertMqController.java rename to adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/controller/OtConvertMqController.java index 4d6a5473..80de0998 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/controller/OtConvertMqController.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/controller/OtConvertMqController.java @@ -1,11 +1,11 @@ -package com.adc.da.convert.otConvertMq.controller; +package com.adc.da.slrs.otConvertMq.controller; -import org.springframework.web.bind.annotation.RequestMapping; -import com.adc.da.convert.otConvertMq.entity.OtConvertMq; -import io.swagger.annotations.Api; -import org.springframework.web.bind.annotation.RestController; import com.adc.da.base.web.BaseController; +import com.adc.da.slrs.otConvertMq.entity.OtConvertMq; +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; /** *

@@ -16,7 +16,7 @@ import com.adc.da.base.web.BaseController; * @since 2021-08-20 */ @RestController -@Api(description = "|OtConvertMq|") +@Api(tags = "|OtConvertMq|") @RequestMapping("/otConvertMq/ot-convert-mq") public class OtConvertMqController extends BaseController { diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/dao/OtConvertMqDao.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/dao/OtConvertMqDao.java similarity index 55% rename from adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/dao/OtConvertMqDao.java rename to adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/dao/OtConvertMqDao.java index 51d2338c..f976f3ae 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/dao/OtConvertMqDao.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/dao/OtConvertMqDao.java @@ -1,7 +1,8 @@ -package com.adc.da.convert.otConvertMq.dao; +package com.adc.da.slrs.otConvertMq.dao; -import com.adc.da.convert.otConvertMq.entity.OtConvertMq; +import com.adc.da.slrs.otConvertMq.entity.OtConvertMq; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; /** *

@@ -11,6 +12,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; * @author super_liu * @since 2021-08-20 */ +@Repository public interface OtConvertMqDao extends BaseMapper { + int deleteByAttId(String value); + } diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/entity/OtConvertMq.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/entity/OtConvertMq.java similarity index 96% rename from adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/entity/OtConvertMq.java rename to adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/entity/OtConvertMq.java index 98d3b953..29043ef4 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/entity/OtConvertMq.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/entity/OtConvertMq.java @@ -1,11 +1,8 @@ -package com.adc.da.convert.otConvertMq.entity; +package com.adc.da.slrs.otConvertMq.entity; import com.adc.da.base.entity.BaseEntity; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import java.util.Date; - import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -14,6 +11,8 @@ import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import org.springframework.format.annotation.DateTimeFormat; +import java.util.Date; + /** *

* 文档转换记录信息表 @@ -95,5 +94,7 @@ public class OtConvertMq extends BaseEntity { private String oriAttId; @TableField(exist = false) private int againNum; + @TableField(exist = false) + private String fileSuffix; } diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/IOtConvertMqService.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/service/IOtConvertMqService.java similarity index 69% rename from adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/IOtConvertMqService.java rename to adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/service/IOtConvertMqService.java index 52c0d7c9..9a9f8c0a 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/IOtConvertMqService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/service/IOtConvertMqService.java @@ -1,6 +1,6 @@ -package com.adc.da.convert.otConvertMq.service; +package com.adc.da.slrs.otConvertMq.service; -import com.adc.da.convert.otConvertMq.entity.OtConvertMq; +import com.adc.da.slrs.otConvertMq.entity.OtConvertMq; import com.baomidou.mybatisplus.extension.service.IService; /** diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/impl/OtConvertMqServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/service/impl/OtConvertMqServiceImpl.java similarity index 60% rename from adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/impl/OtConvertMqServiceImpl.java rename to adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/service/impl/OtConvertMqServiceImpl.java index 41d28dcb..44f6cad1 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/otConvertMq/service/impl/OtConvertMqServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/otConvertMq/service/impl/OtConvertMqServiceImpl.java @@ -1,8 +1,8 @@ -package com.adc.da.convert.otConvertMq.service.impl; +package com.adc.da.slrs.otConvertMq.service.impl; -import com.adc.da.convert.otConvertMq.dao.OtConvertMqDao; -import com.adc.da.convert.otConvertMq.entity.OtConvertMq; -import com.adc.da.convert.otConvertMq.service.IOtConvertMqService; +import com.adc.da.slrs.otConvertMq.dao.OtConvertMqDao; +import com.adc.da.slrs.otConvertMq.entity.OtConvertMq; +import com.adc.da.slrs.otConvertMq.service.IOtConvertMqService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/controller/SarBussStandFileController.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/controller/SarBussStandFileController.java index 2cf846c3..fb811286 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/controller/SarBussStandFileController.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/controller/SarBussStandFileController.java @@ -1,12 +1,28 @@ package com.adc.da.slrs.sarBussStandFile.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.sarBussStandFile.service.ISarBussStandFileService; +import com.adc.da.slrs.standardSplit.controller.SarStandFileEOController; +import com.adc.da.slrs.standardSplit.service.SarStandAttrDetailsEOService; +import com.adc.da.slrs.standardSplit.service.SarStandFileEOService; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +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.sarBussStandFile.entity.SarBussStandFile; import io.swagger.annotations.Api; import org.springframework.web.bind.annotation.RestController; import com.adc.da.base.web.BaseController; +import java.util.List; + + /** *

* 企业标准文件详情表 前端控制器 @@ -16,8 +32,39 @@ import com.adc.da.base.web.BaseController; * @since 2021-07-25 */ @RestController -@Api(description = "|SarBussStandFile|") -@RequestMapping("/sarBussStandFile/sar-buss-stand-file") +@Api(tags = "|SarBussStandFile|") +@RequestMapping("/${restPath}/lawss/sarBussStandFile") public class SarBussStandFileController extends BaseController { + private static final Logger logger = LoggerFactory.getLogger(SarStandFileEOController.class); + + @Autowired + private IAttFileEOService attFileEOService; + @Autowired + private SarStandAttrDetailsEOService sarStandAttrDetailsEOService; + + public static final String APPLICATION_JSON_UTF8_VALUE = "application/json;charset=UTF-8"; + + @Autowired + private ISarBussStandFileService sarBussStandFileEOService; + + @ApiOperation(value = "|SarBussStandFileEO|查询转换后的文档详情") + @GetMapping("/queryConvertAtt") + /*@RequiresPermissions("lawss:sarLawsFile:list")*/ + public ResponseMessage queryConvertAtt(String attId) throws Exception { + List getList = sarBussStandFileEOService.selectFileByAttId(attId); + SarBussStandFile sarBussStandFileEO = new SarBussStandFile(); + 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/sarBussStandFile/dao/SarBussStandFileDao.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/dao/SarBussStandFileDao.java index 23b127bc..f6a592ea 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/dao/SarBussStandFileDao.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/dao/SarBussStandFileDao.java @@ -30,4 +30,8 @@ public interface SarBussStandFileDao extends BaseMapper { int deleteByStandId(String standId); int insertForeach(List list); //批量新增 + + int insertSelective(SarBussStandFile sarBussStandFile); + + int updateByPrimaryKeySelective(SarBussStandFile sarBussStandFile); } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/service/ISarBussStandFileService.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/service/ISarBussStandFileService.java index dfd0482c..ed6da497 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/service/ISarBussStandFileService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/service/ISarBussStandFileService.java @@ -3,6 +3,8 @@ package com.adc.da.slrs.sarBussStandFile.service; import com.adc.da.slrs.sarBussStandFile.entity.SarBussStandFile; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + /** *

* 企业标准文件详情表 服务类 @@ -13,4 +15,6 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface ISarBussStandFileService extends IService { + List selectFileByAttId(String attId) throws Exception; + } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/service/impl/SarBussStandFileServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/service/impl/SarBussStandFileServiceImpl.java index acc8b11b..d95024f3 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/service/impl/SarBussStandFileServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussStandFile/service/impl/SarBussStandFileServiceImpl.java @@ -4,8 +4,11 @@ import com.adc.da.slrs.sarBussStandFile.entity.SarBussStandFile; import com.adc.da.slrs.sarBussStandFile.dao.SarBussStandFileDao; import com.adc.da.slrs.sarBussStandFile.service.ISarBussStandFileService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + /** *

* 企业标准文件详情表 服务实现类 @@ -17,4 +20,11 @@ import org.springframework.stereotype.Service; @Service public class SarBussStandFileServiceImpl extends ServiceImpl implements ISarBussStandFileService { + @Autowired + private SarBussStandFileDao sarStandFileEODao; + + @Override + public List selectFileByAttId(String attId) throws Exception{ + return sarStandFileEODao.selectFileByAttId(attId); + } } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java index 9754981c..2a65a976 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java @@ -6,15 +6,13 @@ import com.adc.da.common.ConvertMqEO; import com.adc.da.common.SarTypeEnum; import com.adc.da.common.SelectionTypeEnum; import com.adc.da.common.UseModuleEnum; -import com.adc.da.http.Result; -import com.adc.da.mq.dao.OtConvertEODao; -import com.adc.da.mq.service.CreateMQService; -import com.adc.da.mq.service.CreateStandMQService; -import com.adc.da.person.entity.PersonShareEO; +import com.adc.da.mq.CreateMQService; +import com.adc.da.mq.CreateStandMQService; import com.adc.da.person.entity.TsPersonCollect; import com.adc.da.person.page.PersonCollectEOPage; -import com.adc.da.person.page.PersonShareEOPage; import com.adc.da.person.service.IPersonCollectEOService; +import com.adc.da.slrs.otConvertMq.dao.OtConvertMqDao; +import com.adc.da.slrs.otConvertMq.entity.OtConvertMq; import com.adc.da.slrs.sarBussStandAttrInfo.dao.SarBussStandAttrInfoDao; import com.adc.da.slrs.sarBussStandFile.dao.SarBussStandFileDao; import com.adc.da.slrs.sarBussStandFile.entity.SarBussStandFile; @@ -22,18 +20,14 @@ import com.adc.da.slrs.sarBussStandMenu.dao.SarBussStandMenuDao; import com.adc.da.slrs.sarBussStandMenu.entity.SarBussStandMenu; import com.adc.da.slrs.sarBussStandVal.dao.SarBussStandValDao; import com.adc.da.slrs.sarBussStandVal.entity.SarBussStandVal; -import com.adc.da.slrs.sarBussionessStand.entity.SarBussStandMenuEO; import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand; import com.adc.da.slrs.sarBussionessStand.dao.SarBussionessStandDao; import com.adc.da.slrs.sarBussionessStand.service.ISarBussionessStandService; import com.adc.da.slrs.sarResource.entity.TsResource; import com.adc.da.slrs.sarResource.service.ITsResourceService; import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao; -import com.adc.da.slrs.sarStandFile.entity.SarStandFile; import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao; import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage; -import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo; -import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfoEOPage; import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService; import com.adc.da.slrs.sarUser.service.ITsUserService; import com.adc.da.slrs.sysInfo.service.SysInfoEOService; @@ -106,7 +100,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl { int insertForeach(List list); //批量新增 + int insertSelective(SarStandFile sarStandFile); + + int updateByPrimaryKeySelective(SarStandFile sarStandFile); + } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandFile/entity/SarStandFile.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandFile/entity/SarStandFile.java index 49c3059f..45a89d18 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandFile/entity/SarStandFile.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandFile/entity/SarStandFile.java @@ -86,20 +86,28 @@ public class SarStandFile extends BaseEntity { private String oriAttId; @Transient + @TableField(exist = false) private String resId; @Transient + @TableField(exist = false) private Integer pageCount; @Transient + @TableField(exist = false) private String fileOldName; @Transient - private List idlist = new ArrayList<>(); + @TableField(exist = false) + private List idList = new ArrayList<>(); @Transient + @TableField(exist = false) private String standFileClassifyShow; @Transient + @TableField(exist = false) private String standNumber; @Transient + @TableField(exist = false) private String standName; @Transient + @TableField(exist = false) private String sarType; diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java index 0b3baafc..e233314c 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java @@ -6,11 +6,14 @@ import com.adc.da.att.vo.AttFileVo; import com.adc.da.common.*; import com.adc.da.http.ResponseMessage; import com.adc.da.http.Result; -import com.adc.da.mq.service.CreateStandMQService; +import com.adc.da.mq.CreateMQService; +import com.adc.da.mq.CreateStandMQService; import com.adc.da.person.dao.PersonCollectEODao; import com.adc.da.person.dao.PersonShareEODao; import com.adc.da.person.service.IPersonCollectEOService; import com.adc.da.search.service.StandLawsSearchService; +import com.adc.da.slrs.otConvertMq.dao.OtConvertMqDao; +import com.adc.da.slrs.otConvertMq.entity.OtConvertMq; import com.adc.da.slrs.sarLawsInfo.entity.SarLawsInfo; import com.adc.da.slrs.sarLawsInfo.page.SarLawsInfoEOPage; import com.adc.da.slrs.sarLawsInfo.page.SarLawsItemsEOPage; @@ -29,7 +32,6 @@ import com.adc.da.slrs.sarStandFile.dao.SarStandFileDao; import com.adc.da.slrs.sarStandFile.entity.SarStandFile; import com.adc.da.slrs.sarStandItems.dao.SarStandItemsDao; import com.adc.da.slrs.sarStandItems.entity.FindSarItemsPageReqDTO; -import com.adc.da.slrs.sarStandItems.entity.SarItemVO; import com.adc.da.slrs.sarStandItems.entity.SarStandItems; import com.adc.da.slrs.sarStandItems.page.SarStandItemsEOPage; import com.adc.da.slrs.sarStandItems.service.ISarStandItemsService; @@ -74,24 +76,15 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; -import java.beans.BeanInfo; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; import java.io.File; import java.io.FileInputStream; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Modifier; import java.sql.Clob; import java.text.SimpleDateFormat; import java.util.*; -import java.util.concurrent.atomic.AtomicInteger; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -182,6 +175,12 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl listFile = sarStandFileEODao.selectFileByStandIdAndId(sarStandFileEO); -// if (listFile != null) { -// if (!listFile.isEmpty()) { -// for (int f = 0; f < listFile.size(); f++) { -// //删除文件信息表数据 + if (listFile != null) { + if (!listFile.isEmpty()) { + for (int f = 0; f < listFile.size(); f++) { + //删除文件信息表数据 // sarFileInfoEODao.deleteByfileId(listFile.get(f).getId()); -// //删除转换表ot_convert数据 -// otConvertEODao.deleteByAttId(listFile.get(f).getAttId()); -// } -// } -// } + //删除转换表ot_convert数据 + otConvertEODao.deleteByAttId(listFile.get(f).getAttId()); + } + } + } sarStandPutTimeEODao.deleteByStandId(standId); // 修改属性表数据 sarStandAttrInfoEODao.deleteStandAttrByStandId(standId); diff --git a/adc-da-slrs/src/main/resources/mybatis/mapper/otConvertMq/OtConvertMqMapper.xml b/adc-da-slrs/src/main/resources/mybatis/mapper/otConvertMq/OtConvertMqMapper.xml new file mode 100644 index 00000000..687401d3 --- /dev/null +++ b/adc-da-slrs/src/main/resources/mybatis/mapper/otConvertMq/OtConvertMqMapper.xml @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + modify_time, creation_time, valid_flag, att_id, file_path, user_id, mq_state, mq_code, id + + + + + where 1=1 + + + and modify_time ${modifyTimeOperator} #{modifyTime} + + + and modify_time >= #{modifyTime1} + + + and modify_time <= #{modifyTime2} + + + and creation_time ${creationTimeOperator} #{creationTime} + + + and creation_time >= #{creationTime1} + + + and creation_time <= #{creationTime2} + + + and valid_flag ${validFlagOperator} #{validFlag} + + + and att_id ${attIdOperator} #{attId} + + + and file_path ${filePathOperator} #{filePath} + + + and user_id ${userIdOperator} #{userId} + + + and mq_state ${mqStateOperator} #{mqState} + + + and mq_code ${mqCodeOperator} #{mqCode} + + + and id ${idOperator} #{id} + + + + + + + + insert into OT_CONVERT_MQ() + values (#{modifyTime, jdbcType=TIMESTAMP}, #{creationTime, jdbcType=TIMESTAMP}, #{validFlag, jdbcType=INTEGER}, #{attId, jdbcType=VARCHAR}, #{filePath, jdbcType=VARCHAR}, #{userId, jdbcType=VARCHAR}, #{mqState, jdbcType=INTEGER}, #{mqCode, jdbcType=VARCHAR}, #{id, jdbcType=VARCHAR}) + + + + + + insert into OT_CONVERT_MQ + + modify_time, + creation_time, + valid_flag, + att_id, + file_path, + user_id, + mq_state, + mq_code, + id, + + + #{modifyTime, jdbcType=TIMESTAMP}, + #{creationTime, jdbcType=TIMESTAMP}, + #{validFlag, jdbcType=INTEGER}, + #{attId, jdbcType=VARCHAR}, + #{filePath, jdbcType=VARCHAR}, + #{userId, jdbcType=VARCHAR}, + #{mqState, jdbcType=INTEGER}, + #{mqCode, jdbcType=VARCHAR}, + #{id, jdbcType=VARCHAR}, + + + + + + update OT_CONVERT_MQ + set modify_time = #{modifyTime}, + creation_time = #{creationTime}, + valid_flag = #{validFlag}, + att_id = #{attId}, + file_path = #{filePath}, + user_id = #{userId}, + mq_state = #{mqState}, + mq_code = #{mqCode} + where id = #{id} + + + + + update OT_CONVERT_MQ + + + modify_time = #{modifyTime}, + + + creation_time = #{creationTime}, + + + valid_flag = #{validFlag}, + + + att_id = #{attId}, + + + file_path = #{filePath}, + + + user_id = #{userId}, + + + mq_state = #{mqState}, + + + mq_code = #{mqCode}, + + + where id = #{id} + + + + + + + delete from OT_CONVERT_MQ + where att_id = #{value} + + + diff --git a/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandFile/SarStandFileMapper.xml b/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandFile/SarStandFileMapper.xml index d0c68d5c..fe7091e7 100644 --- a/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandFile/SarStandFileMapper.xml +++ b/adc-da-slrs/src/main/resources/mybatis/mapper/sarStandFile/SarStandFileMapper.xml @@ -228,9 +228,9 @@ and stand_id = #{standId} - + and id not in - + #{item}