feat: There is no way the Buss and Convert

This commit is contained in:
super_liu
2021-08-20 18:12:08 +08:00
parent c89a90757c
commit fe89ba9c60
27 changed files with 401 additions and 639 deletions
+15 -5
View File
@@ -22,13 +22,23 @@
<artifactId>adc-da-sys</artifactId>
<version>3.0.0</version>
</dependency>
<!-- openOffice 和 jobconverter-->
<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>
<groupId>org.jodconverter</groupId>
<artifactId>jodconverter-core</artifactId>
<version>4.2.2</version>
</dependency>
<dependency>
<groupId>org.jodconverter</groupId>
<artifactId>jodconverter-spring-boot-starter</artifactId>
<version>4.2.2</version>
</dependency>
<dependency>
<groupId>org.jodconverter</groupId>
<artifactId>jodconverter-local</artifactId>
<version>4.2.2</version>
</dependency>
<!-- openOffice end-->
<dependency>
<groupId>org.openoffice</groupId>
<artifactId>juh</artifactId>
@@ -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);
// 环境 1windows 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");
}
}
}
}
@@ -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;// 环境 1windows 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;
@@ -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;// 环境 1windows 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");
}
}
}
@@ -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();
@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.adc.da.convert.otConvertMq.dao.OtConvertMqDao">
</mapper>
@@ -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
# ==============================================
# 文档存储路径指向
# ==============================================
@@ -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表中添加/修改数据
//判断用户是初次发送还是重新发送,初次将添加到数据库重新发送将修改原数据信息
@@ -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;
@@ -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;
@@ -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;
@@ -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<ConvertMqEO> {
int deleteByAttId(String value);
}
@@ -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;
/**
* <p>
@@ -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<OtConvertMq> {
@@ -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;
/**
* <p>
@@ -11,6 +12,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @author super_liu
* @since 2021-08-20
*/
@Repository
public interface OtConvertMqDao extends BaseMapper<OtConvertMq> {
int deleteByAttId(String value);
}
@@ -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;
/**
* <p>
* 文档转换记录信息表
@@ -95,5 +94,7 @@ public class OtConvertMq extends BaseEntity {
private String oriAttId;
@TableField(exist = false)
private int againNum;
@TableField(exist = false)
private String fileSuffix;
}
@@ -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;
/**
@@ -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;
@@ -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;
/**
* <p>
* 企业标准文件详情表 前端控制器
@@ -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<SarBussStandFile> {
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<SarBussStandFile> queryConvertAtt(String attId) throws Exception {
List<SarBussStandFile> 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);
}
}
}
@@ -30,4 +30,8 @@ public interface SarBussStandFileDao extends BaseMapper<SarBussStandFile> {
int deleteByStandId(String standId);
int insertForeach(List<SarBussStandFile> list); //批量新增
int insertSelective(SarBussStandFile sarBussStandFile);
int updateByPrimaryKeySelective(SarBussStandFile sarBussStandFile);
}
@@ -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;
/**
* <p>
* 企业标准文件详情表 服务类
@@ -13,4 +15,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface ISarBussStandFileService extends IService<SarBussStandFile> {
List<SarBussStandFile> selectFileByAttId(String attId) throws Exception;
}
@@ -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;
/**
* <p>
* 企业标准文件详情表 服务实现类
@@ -17,4 +20,11 @@ import org.springframework.stereotype.Service;
@Service
public class SarBussStandFileServiceImpl extends ServiceImpl<SarBussStandFileDao, SarBussStandFile> implements ISarBussStandFileService {
@Autowired
private SarBussStandFileDao sarStandFileEODao;
@Override
public List<SarBussStandFile> selectFileByAttId(String attId) throws Exception{
return sarStandFileEODao.selectFileByAttId(attId);
}
}
@@ -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<SarBussionessStan
private IPersonCollectEOService personCollectEOService;
@Autowired
private OtConvertEODao otConvertEODao;
private OtConvertMqDao otConvertEODao;
@Autowired
private CreateMQService convertMq;
@@ -458,7 +452,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
standFileList.add(newFileEO);
} else {
String filePath = fileInfo.getFilePath() + fileInfo.getFileName();
ConvertMqEO convert = new ConvertMqEO();
OtConvertMq convert = new OtConvertMq();
convert.setLawsId(standId);
convert.setAttId(fileInfo.getId());
convert.setFilePath(filePath);
@@ -31,4 +31,8 @@ public interface SarStandFileDao extends BaseMapper<SarStandFile> {
int insertForeach(List<SarStandFile> list); //批量新增
int insertSelective(SarStandFile sarStandFile);
int updateByPrimaryKeySelective(SarStandFile sarStandFile);
}
@@ -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<String> idlist = new ArrayList<>();
@TableField(exist = false)
private List<String> 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;
@@ -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<SarStandardsInfoDao
@Autowired
private IAttFileEOService attFileEOService;
@Autowired
private CreateMQService convertMq;
@Autowired
private OtConvertMqDao otConvertEODao;
@Autowired
private DicTypeEODao dicTypeEODao;
@@ -776,7 +775,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
sarStandFileEO.setOriAttId(fileInfo.getId());
standFileList.add(sarStandFileEO);
//多文档转换 PPT|PPTX|ppt|pptx|PDF|pdf|DOC|doc|DOCX|docx
if (verifyFileType(fileInfo.getFileSuffix())) {
if ("pdf".equals(fileInfo.getFileSuffix()) || "PDF".equals(fileInfo.getFileSuffix())) {
SarStandFile newFileEO = new SarStandFile();
newFileEO.setCreationUser(LoginUserUtil.getUserId());
newFileEO.setCreationTime(new Date());
@@ -792,17 +791,17 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
newFileEO.setOriAttId(fileInfo.getId());
standFileList.add(newFileEO);
} else {
// String filePath = fileInfo.getFilePath() + fileInfo.getFileName();
// ConvertMqEO convert = new ConvertMqEO();
// convert.setLawsId(standId);
// convert.setAttId(fileInfo.getId());
// convert.setFilePath(filePath);
// convert.setAddOrUp("0");
// convert.setFileSuffix(fileInfo.getFileSuffix());
// convert.setStandFileClassify(field);
// convert.setConvertType(SarTypeEnum.STAND.getValue());
// convert.setOriAttId(fileInfo.getId());
// convertMq.sendMQ(convert);
String filePath = fileInfo.getFilePath() + fileInfo.getFileName();
OtConvertMq convert = new OtConvertMq();
convert.setLawsId(standId);
convert.setAttId(fileInfo.getId());
convert.setFilePath(filePath);
convert.setAddOrUp("0");
convert.setFileSuffix(fileInfo.getFileSuffix());
convert.setStandFileClassify(field);
convert.setConvertType(SarTypeEnum.STAND.getValue());
convert.setOriAttId(fileInfo.getId());
convertMq.sendMQ(convert);
}
}
}
@@ -1152,18 +1151,18 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
SarStandFile sarStandFileEO = new SarStandFile();
sarStandFileEO.setStandId(sarStandardsInfoEO.getId());
Map map = (Map) JSONObject.fromObject(sarStandardsInfoEO.getSarStandAttrEOStr());
sarStandFileEO.setIdlist(null);
sarStandFileEO.setIdList(null);
List<SarStandFile> 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);
@@ -0,0 +1,167 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.adc.da.slrs.otConvertMq.dao.OtConvertMqDao">
<!-- Result Map-->
<resultMap id="BaseResultMap" type="com.adc.da.slrs.otConvertMq.entity.OtConvertMq" >
<id column="id" property="id" />
<result column="modify_time" property="modifyTime" />
<result column="creation_time" property="creationTime" />
<result column="valid_flag" property="validFlag" />
<result column="att_id" property="attId" />
<result column="file_path" property="filePath" />
<result column="user_id" property="userId" />
<result column="mq_state" property="mqState" />
<result column="mq_code" property="mqCode" />
</resultMap>
<!-- OT_CONVERT_MQ table all fields -->
<sql id="Base_Column_List" >
modify_time, creation_time, valid_flag, att_id, file_path, user_id, mq_state, mq_code, id
</sql>
<!-- 查询条件 -->
<sql id="Base_Where_Clause">
where 1=1
<trim suffixOverrides="," >
<if test="modifyTime != null" >
and modify_time ${modifyTimeOperator} #{modifyTime}
</if>
<if test="modifyTime1 != null" >
and modify_time &gt;= #{modifyTime1}
</if>
<if test="modifyTime2 != null" >
and modify_time &lt;= #{modifyTime2}
</if>
<if test="creationTime != null" >
and creation_time ${creationTimeOperator} #{creationTime}
</if>
<if test="creationTime1 != null" >
and creation_time &gt;= #{creationTime1}
</if>
<if test="creationTime2 != null" >
and creation_time &lt;= #{creationTime2}
</if>
<if test="validFlag != null" >
and valid_flag ${validFlagOperator} #{validFlag}
</if>
<if test="attId != null" >
and att_id ${attIdOperator} #{attId}
</if>
<if test="filePath != null" >
and file_path ${filePathOperator} #{filePath}
</if>
<if test="userId != null" >
and user_id ${userIdOperator} #{userId}
</if>
<if test="mqState != null" >
and mq_state ${mqStateOperator} #{mqState}
</if>
<if test="mqCode != null" >
and mq_code ${mqCodeOperator} #{mqCode}
</if>
<if test="id != null" >
and id ${idOperator} #{id}
</if>
</trim>
</sql>
<!-- 插入记录 -->
<insert id="insert" parameterType="com.adc.da.slrs.otConvertMq.entity.OtConvertMq" >
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
SELECT SEQ_OT_CONVERT_MQ.NEXTVAL FROM DUAL
</selectKey> -->
insert into OT_CONVERT_MQ(<include refid="Base_Column_List" />)
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>
<!-- 动态插入记录 主键是序列 -->
<insert id="insertSelective" parameterType="com.adc.da.slrs.otConvertMq.entity.OtConvertMq" >
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
SELECT SEQ_OT_CONVERT_MQ.NEXTVAL FROM DUAL
</selectKey> -->
insert into OT_CONVERT_MQ
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="modifyTime != null" >modify_time,</if>
<if test="creationTime != null" >creation_time,</if>
<if test="validFlag != null" >valid_flag,</if>
<if test="attId != null" >att_id,</if>
<if test="filePath != null" >file_path,</if>
<if test="userId != null" >user_id,</if>
<if test="mqState != null" >mq_state,</if>
<if test="mqCode != null" >mq_code,</if>
<if test="id != null" >id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<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="attId != null" >#{attId, jdbcType=VARCHAR},</if>
<if test="filePath != null" >#{filePath, jdbcType=VARCHAR},</if>
<if test="userId != null" >#{userId, jdbcType=VARCHAR},</if>
<if test="mqState != null" >#{mqState, jdbcType=INTEGER},</if>
<if test="mqCode != null" >#{mqCode, jdbcType=VARCHAR},</if>
<if test="id != null" >#{id, jdbcType=VARCHAR},</if>
</trim>
</insert>
<!-- 根据pk,修改记录-->
<update id="updateByPrimaryKey" parameterType="com.adc.da.slrs.otConvertMq.entity.OtConvertMq" >
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>
<!-- 修改记录,只修改只不为空的字段 -->
<update id="updateByPrimaryKeySelective" parameterType="com.adc.da.slrs.otConvertMq.entity.OtConvertMq" >
update OT_CONVERT_MQ
<set >
<if test="modifyTime != null" >
modify_time = #{modifyTime},
</if>
<if test="creationTime != null" >
creation_time = #{creationTime},
</if>
<if test="validFlag != null" >
valid_flag = #{validFlag},
</if>
<if test="attId != null" >
att_id = #{attId},
</if>
<if test="filePath != null" >
file_path = #{filePath},
</if>
<if test="userId != null" >
user_id = #{userId},
</if>
<if test="mqState != null" >
mq_state = #{mqState},
</if>
<if test="mqCode != null" >
mq_code = #{mqCode},
</if>
</set>
where id = #{id}
</update>
<!-- 根据id查询 OT_CONVERT_MQ -->
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select <include refid="Base_Column_List" />
from OT_CONVERT_MQ
where id = #{value}
and valid_flag=0
</select>
<delete id="deleteByAttId" parameterType="java.lang.String">
delete from OT_CONVERT_MQ
where att_id = #{value}
</delete>
</mapper>
@@ -228,9 +228,9 @@
<if test="standId != null" >
and stand_id = #{standId}
</if>
<if test="idlist != null">
<if test="idList != null">
and id not in
<foreach collection="idlist" index="index" item="item" open="(" separator="," close=")">
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>