Merge remote-tracking branch 'origin/develop_master' into develop_1
This commit is contained in:
+21
-5
@@ -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>
|
||||
@@ -87,6 +97,12 @@
|
||||
<artifactId>dom4j</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.adc</groupId>
|
||||
<artifactId>adc-da-slrs</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,6 +22,6 @@ public class CreateConvertMQService {
|
||||
public void sendConvertMQ(AttFileEO attFileEO){
|
||||
// 中间转换业务逻辑
|
||||
//发送消息队列
|
||||
this.rabbitTemplate.convertAndSend("convert-exchange_SQ_GSAR", "convert-key_SQ_GSAR", attFileEO);
|
||||
// this.rabbitTemplate.convertAndSend("convert-exchange_SQ_GSAR", "convert-key_SQ_GSAR", attFileEO);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,217 +1,410 @@
|
||||
//package com.adc.da.convert.mq;
|
||||
//
|
||||
//import com.adc.da.att.entity.AttFileEO;
|
||||
//import com.adc.da.att.service.IAttFileEOService;
|
||||
//import com.adc.da.convert.common.DocConverterPdf;
|
||||
//import com.adc.da.util.http.ResponseMessage;
|
||||
//import com.adc.da.util.http.Result;
|
||||
//import com.adc.da.util.utils.StringUtils;
|
||||
//import com.rabbitmq.client.Channel;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
//import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
//import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
//import org.springframework.amqp.support.AmqpHeaders;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.messaging.Message;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import java.io.File;
|
||||
//import java.util.Date;
|
||||
//import java.util.Map;
|
||||
//
|
||||
//@Component
|
||||
//public class SendConvertMQService {
|
||||
//
|
||||
// // 文档转换远程服务IP地址
|
||||
// @Value("${convert.host}")
|
||||
// private String convertHost;
|
||||
//
|
||||
// @Autowired
|
||||
// private IAttFileEOService iAttFileEOService;
|
||||
//
|
||||
// private static final Logger logger = LoggerFactory.getLogger(SendConvertMQService.class);
|
||||
//
|
||||
// @RabbitListener(bindings = @QueueBinding(
|
||||
// value = @Queue(value = "createConvertStandMQ_SQ_GSAR", durable = "true"),
|
||||
// exchange = @Exchange(value = "convert-exchange_SQ_GSAR", ignoreDeclarationExceptions = "true"),
|
||||
// key = "convert-key_SQ_GSAR"))
|
||||
// public void createMQ(AttFileEO attFileEO, Message message, Channel channel) throws Exception{
|
||||
// try{
|
||||
// try{
|
||||
// Thread.sleep(5000);
|
||||
// insertOrUpdateStandInfo(attFileEO);
|
||||
// }catch(InterruptedException e){
|
||||
// logger.error(e.toString());
|
||||
// Thread.currentThread().interrupt();
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// logger.error("文档转换消息队列进入添加数据方法前失败!");
|
||||
// logger.error(e.getMessage(),e);
|
||||
// }finally {
|
||||
// Long tag = (Long) message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
|
||||
// channel.basicAck(tag,false);
|
||||
// logger.debug("文档转换消息确认成功!!!!!!!!!");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public void insertConvertMsg(Map<String,Object> convertInfo) throws Exception{
|
||||
// String attId = "";
|
||||
// String filePath = "";
|
||||
// String otId = "";
|
||||
// String addUpFlag = "";
|
||||
// String convertType = "";
|
||||
// String standFileClassify = "";
|
||||
// String lawsFileClassify = "";
|
||||
// //资源与文件关联表转换成功的ID
|
||||
// String standFilePdfId = "";
|
||||
// if(convertInfo.get("attId") != null){
|
||||
// attId = convertInfo.get("attId").toString();
|
||||
// }
|
||||
// if(convertInfo.get("path") != null){
|
||||
// filePath = convertInfo.get("path").toString();
|
||||
// }
|
||||
// if(convertInfo.get("otId") != null){
|
||||
// otId = convertInfo.get("otId").toString();
|
||||
// }
|
||||
// if(convertInfo.get("addUpFlag") != null){
|
||||
// addUpFlag = convertInfo.get("addUpFlag").toString();
|
||||
// }
|
||||
// if(convertInfo.get("convertType") != null){
|
||||
// convertType = convertInfo.get("convertType").toString();
|
||||
// }
|
||||
// if(convertInfo.get("standFilePdfId") != null){
|
||||
// standFilePdfId = convertInfo.get("standFilePdfId").toString();
|
||||
// }
|
||||
// if(convertInfo.get("standFileClassify") != null){
|
||||
// standFileClassify = convertInfo.get("standFileClassify").toString();
|
||||
// }
|
||||
// if(convertInfo.get("lawsFileClassify") != null){
|
||||
// lawsFileClassify = convertInfo.get("lawsFileClassify").toString();
|
||||
// }
|
||||
//
|
||||
// //更改完转换表信息后开始转换
|
||||
// OtConvertMqEO convertMqEO = new OtConvertMqEO();
|
||||
// if("0".equals(addUpFlag)){
|
||||
// convertMqEO.setLawsId(convertInfo.get("lawsId").toString());
|
||||
//// convertMqEO.setResId(convertInfo.get("resId").toString());
|
||||
// }
|
||||
// convertMqEO.setConvertType(convertType);
|
||||
// convertMqEO.setAttId(attId);
|
||||
// convertMqEO.setOriAttId(attId);
|
||||
// convertMqEO.setId(otId);
|
||||
// convertMqEO.setFilePath(filePath);
|
||||
// convertMqEO.setAddOrUp(addUpFlag);
|
||||
// convertMqEO.setPdfId(standFilePdfId);
|
||||
// convertMqEO.setStandFileClassify(standFileClassify);
|
||||
// convertMqEO.setLawsFileClassify(lawsFileClassify);
|
||||
// int i = Integer.valueOf(convertInfo.get("againNum").toString());
|
||||
// convertMqEO.setAgainNum(i);
|
||||
// docUploadConvert(convertMqEO);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @Author yangxuenan
|
||||
// * @Description 文件转换
|
||||
// * Date 2018/8/21 15:51
|
||||
// * @Param [path]
|
||||
// * @return com.adc.da.util.http.ResponseMessage
|
||||
// **/
|
||||
// public ResponseMessage docUploadConvert(OtConvertMqEO convertMqEO) throws Exception{
|
||||
// //保存在数据库中的ID
|
||||
// String path = localFilePath + convertMqEO.getFilePath();
|
||||
// String convertId = convertMqEO.getId();
|
||||
// try {
|
||||
// //进入转换方法中,修改OT_CONVERT表中状态为转换中
|
||||
// convertMqEO.setId(convertId);
|
||||
// convertMqEO.setModifyTime(new Date());
|
||||
// convertMqEO.setMqState(3);
|
||||
// convertMqEOService.updateByPrimaryKeySelective(convertMqEO);
|
||||
// //开始转换。。。。。。
|
||||
// if(!"".equals(path)){
|
||||
// String converfilename = path.replaceAll("\\\\", "/");
|
||||
// logger.info("*****上传路径:*******"+localFilePath);
|
||||
// logger.info("************文件路径:**********" + convertMqEO.getFilePath());
|
||||
// logger.info("************接口:**********" + port);
|
||||
// logger.info("*****上传路径替换,加入文件名*******"+converfilename);
|
||||
// //截取文件类型
|
||||
// int index = converfilename.lastIndexOf(".");
|
||||
// String fileType = converfilename.substring(index,converfilename.length());
|
||||
// String fileOriName = converfilename.substring(0,index);
|
||||
// //调用转换类DocConverter,并将需要转换的文件传递给该类的构造方法
|
||||
// DocConverterPdf d = new DocConverterPdf(converfilename,fileType);
|
||||
// d.setConvertHost(convertHost);
|
||||
// //调用conver方法开始转换,先执行doc2pdf()将office文件转换为pdf;再执行pdf2swf()将pdf转换为swf;
|
||||
// File getPdf = d.conver(fileType);
|
||||
// //调用getswfPath()方法,打印转换后的swf文件路径
|
||||
// String dPath = d.getpdfPath();
|
||||
// logger.info("*****转换后的pdf文件路径*******"+dPath);
|
||||
// //判断是否转换成功,修改数据状态
|
||||
// if(!dPath.isEmpty() && getPdf.length()>0){
|
||||
// // 上传转换后文件
|
||||
// String pdfId = attFileEOService.saveFileAttId(getPdf);
|
||||
// logger.info("////////转换后文件id"+pdfId);
|
||||
// int count = 0;
|
||||
// if("0".equals(convertMqEO.getAddOrUp())){
|
||||
// count = insertConvertDocToFiles(convertMqEO,pdfId,fileOriName,fileType);
|
||||
// } else {
|
||||
// //查询之前在资源与文件关联表中是否有转换成功的数据,如果有执行修改,没有执行新增
|
||||
// if(StringUtils.isNotEmpty(convertMqEO.getPdfId())){
|
||||
// count = updateConvertDocToFIles(convertMqEO,pdfId);
|
||||
// } else {
|
||||
// count = insertConvertDocToFiles(convertMqEO,pdfId,fileOriName,fileType);
|
||||
// }
|
||||
// }
|
||||
// convertMqEO.setId(convertId);
|
||||
// if (count>0) {
|
||||
// // 转换成功
|
||||
// convertMqEO.setModifyTime(new Date());
|
||||
// convertMqEO.setMqState(1);
|
||||
// convertMqEOService.updateByPrimaryKeySelective(convertMqEO);
|
||||
// } else {
|
||||
// // 转换失败
|
||||
// convertMqEO.setModifyTime(new Date());
|
||||
// convertMqEO.setMqState(2);
|
||||
// convertMqEOService.updateByPrimaryKeySelective(convertMqEO);
|
||||
// }
|
||||
// } else {
|
||||
// // 转换失败
|
||||
// convertMqEO.setId(convertId);
|
||||
// convertMqEO.setModifyTime(new Date());
|
||||
// convertMqEO.setMqState(2);
|
||||
// convertMqEOService.updateByPrimaryKeySelective(convertMqEO);
|
||||
// if(convertMqEO.getAgainNum()<=5){
|
||||
// throw new Exception("转换失败");
|
||||
// }
|
||||
// }
|
||||
// return Result.success(dPath);
|
||||
// } else {
|
||||
// logger.error("转换时未获取到文件路径!");
|
||||
// return Result.error("文件存储失败,请重试");
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// // 转换失败
|
||||
// logger.error("转换过程中失败!");
|
||||
// logger.error(e.getMessage(),e);
|
||||
// convertMqEO.setId(convertId);
|
||||
// convertMqEO.setMqState(2);
|
||||
// convertMqEOService.updateByPrimaryKeySelective(convertMqEO);
|
||||
// this.restartUploadConvert(convertMqEO);
|
||||
// return Result.error("r0072", "文件转换失败,请重试");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 文档转换逻辑
|
||||
// * @param attFileEO
|
||||
// */
|
||||
// public void insertOrUpdateStandInfo(AttFileEO attFileEO){
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
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.SarTypeEnum;
|
||||
import com.adc.da.common.UseModuleEnum;
|
||||
import com.adc.da.convert.common.DocConverterPdf;
|
||||
import com.adc.da.mq.CreateMQService;
|
||||
import com.adc.da.slrs.otConvertMq.entity.OtConvertMq;
|
||||
import com.adc.da.slrs.otConvertMq.service.IOtConvertMqService;
|
||||
import com.adc.da.slrs.sarBussStandFile.dao.SarBussStandFileDao;
|
||||
import com.adc.da.slrs.sarBussStandFile.entity.SarBussStandFile;
|
||||
import com.adc.da.slrs.sarStandFile.dao.SarStandFileDao;
|
||||
import com.adc.da.slrs.sarStandFile.entity.SarStandFile;
|
||||
import com.adc.da.sys.util.LoginUserUtil;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.adc.da.util.utils.StringUtils;
|
||||
import com.adc.da.util.utils.UUID;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.amqp.support.AmqpHeaders;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class SendConvertMQService {
|
||||
|
||||
// 文档转换远程服务IP地址
|
||||
@Value("${convert.host}")
|
||||
private String convertHost;
|
||||
|
||||
@Value("${server.port}")
|
||||
private String port;
|
||||
|
||||
@Value("${file.path}")
|
||||
private String localFilePath;
|
||||
|
||||
@Autowired
|
||||
private IAttFileEOService attFileEOService;
|
||||
|
||||
@Autowired
|
||||
private CreateMQService convertMq;
|
||||
|
||||
@Autowired
|
||||
private IOtConvertMqService convertMqEOService;
|
||||
|
||||
@Autowired
|
||||
private SarStandFileDao sarStandFileEODao;
|
||||
|
||||
@Autowired
|
||||
private SarBussStandFileDao sarBussStandFileEODao;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SendConvertMQService.class);
|
||||
|
||||
@RabbitListener(bindings = @QueueBinding(
|
||||
value = @Queue(value = "createConvertStandMQ_SQ_GSAR", durable = "true"),
|
||||
exchange = @Exchange(value = "convert-exchange_SQ_GSAR", ignoreDeclarationExceptions = "true"),
|
||||
key = "convert-key_SQ_GSAR"))
|
||||
public void createMQ(Map<String,Object> convertInfo, Message message, Channel channel) throws Exception{
|
||||
try{
|
||||
try{
|
||||
Thread.sleep(5000);
|
||||
insertConvertMsg(convertInfo);
|
||||
}catch(InterruptedException e){
|
||||
logger.error(e.toString());
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("文档转换消息队列进入添加数据方法前失败!");
|
||||
logger.error(e.getMessage(),e);
|
||||
}finally {
|
||||
Long tag = (Long) message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
|
||||
channel.basicAck(tag,false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void insertConvertMsg(Map<String,Object> convertInfo) throws Exception{
|
||||
String attId = "";
|
||||
String filePath = "";
|
||||
String otId = "";
|
||||
String addUpFlag = "";
|
||||
String convertType = "";
|
||||
String standFileClassify = "";
|
||||
String lawsFileClassify = "";
|
||||
//资源与文件关联表转换成功的ID
|
||||
String standFilePdfId = "";
|
||||
if(convertInfo.get("attId") != null){
|
||||
attId = convertInfo.get("attId").toString();
|
||||
}
|
||||
if(convertInfo.get("path") != null){
|
||||
filePath = convertInfo.get("path").toString();
|
||||
}
|
||||
if(convertInfo.get("otId") != null){
|
||||
otId = convertInfo.get("otId").toString();
|
||||
}
|
||||
if(convertInfo.get("addUpFlag") != null){
|
||||
addUpFlag = convertInfo.get("addUpFlag").toString();
|
||||
}
|
||||
if(convertInfo.get("convertType") != null){
|
||||
convertType = convertInfo.get("convertType").toString();
|
||||
}
|
||||
if(convertInfo.get("standFilePdfId") != null){
|
||||
standFilePdfId = convertInfo.get("standFilePdfId").toString();
|
||||
}
|
||||
if(convertInfo.get("standFileClassify") != null){
|
||||
standFileClassify = convertInfo.get("standFileClassify").toString();
|
||||
}
|
||||
if(convertInfo.get("lawsFileClassify") != null){
|
||||
lawsFileClassify = convertInfo.get("lawsFileClassify").toString();
|
||||
}
|
||||
|
||||
//更改完转换表信息后开始转换
|
||||
OtConvertMq convertMqEO = new OtConvertMq();
|
||||
if("0".equals(addUpFlag)){
|
||||
convertMqEO.setLawsId(convertInfo.get("lawsId").toString());
|
||||
// convertMqEO.setResId(convertInfo.get("resId").toString());
|
||||
}
|
||||
convertMqEO.setConvertType(convertType);
|
||||
convertMqEO.setAttId(attId);
|
||||
convertMqEO.setOriAttId(attId);
|
||||
convertMqEO.setId(otId);
|
||||
convertMqEO.setFilePath(filePath);
|
||||
convertMqEO.setAddOrUp(addUpFlag);
|
||||
convertMqEO.setPdfId(standFilePdfId);
|
||||
convertMqEO.setStandFileClassify(standFileClassify);
|
||||
convertMqEO.setLawsFileClassify(lawsFileClassify);
|
||||
int i = Integer.valueOf(convertInfo.get("againNum").toString());
|
||||
convertMqEO.setAgainNum(i);
|
||||
docUploadConvert(convertMqEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author yangxuenan
|
||||
* @Description 文件转换
|
||||
* Date 2018/8/21 15:51
|
||||
* @Param [path]
|
||||
* @return com.adc.da.util.http.ResponseMessage
|
||||
**/
|
||||
public ResponseMessage docUploadConvert(OtConvertMq convertMqEO) throws Exception{
|
||||
//保存在数据库中的ID
|
||||
String path = localFilePath + convertMqEO.getFilePath();
|
||||
String convertId = convertMqEO.getId();
|
||||
try {
|
||||
//进入转换方法中,修改OT_CONVERT表中状态为转换中
|
||||
convertMqEO.setId(convertId);
|
||||
convertMqEO.setModifyTime(new Date());
|
||||
convertMqEO.setMqState(3);
|
||||
convertMqEOService.updateById(convertMqEO);
|
||||
//开始转换。。。。。。
|
||||
if(!"".equals(path)){
|
||||
String converfilename = path.replaceAll("\\\\", "/");
|
||||
logger.info("*****上传路径:*******"+localFilePath);
|
||||
logger.info("************文件路径:**********" + convertMqEO.getFilePath());
|
||||
logger.info("************接口:**********" + port);
|
||||
logger.info("*****上传路径替换,加入文件名*******"+converfilename);
|
||||
//截取文件类型
|
||||
int index = converfilename.lastIndexOf(".");
|
||||
String fileType = converfilename.substring(index,converfilename.length());
|
||||
String fileOriName = converfilename.substring(0,index);
|
||||
//调用转换类DocConverter,并将需要转换的文件传递给该类的构造方法
|
||||
DocConverterPdf d = new DocConverterPdf(converfilename,fileType);
|
||||
d.setConvertHost(convertHost);
|
||||
//调用conver方法开始转换,先执行doc2pdf()将office文件转换为pdf;再执行pdf2swf()将pdf转换为swf;
|
||||
File getPdf = d.conver(fileType);
|
||||
//调用getswfPath()方法,打印转换后的swf文件路径
|
||||
String dPath = d.getpdfPath();
|
||||
logger.info("*****转换后的pdf文件路径*******"+dPath);
|
||||
//判断是否转换成功,修改数据状态
|
||||
if(!dPath.isEmpty() && getPdf.length()>0){
|
||||
// 上传转换后文件
|
||||
String pdfId = attFileEOService.saveFileAttId(getPdf);
|
||||
logger.info("////////转换后文件id"+pdfId);
|
||||
int count = 0;
|
||||
if("0".equals(convertMqEO.getAddOrUp())){
|
||||
count = insertConvertDocToFiles(convertMqEO,pdfId,fileOriName,fileType);
|
||||
} else {
|
||||
//查询之前在资源与文件关联表中是否有转换成功的数据,如果有执行修改,没有执行新增
|
||||
if(StringUtils.isNotEmpty(convertMqEO.getPdfId())){
|
||||
count = updateConvertDocToFIles(convertMqEO,pdfId);
|
||||
} else {
|
||||
count = insertConvertDocToFiles(convertMqEO,pdfId,fileOriName,fileType);
|
||||
}
|
||||
}
|
||||
convertMqEO.setId(convertId);
|
||||
if (count>0) {
|
||||
// 转换成功
|
||||
convertMqEO.setModifyTime(new Date());
|
||||
convertMqEO.setMqState(1);
|
||||
convertMqEOService.updateById(convertMqEO);
|
||||
} else {
|
||||
// 转换失败
|
||||
convertMqEO.setModifyTime(new Date());
|
||||
convertMqEO.setMqState(2);
|
||||
convertMqEOService.updateById(convertMqEO);
|
||||
}
|
||||
} else {
|
||||
// 转换失败
|
||||
convertMqEO.setId(convertId);
|
||||
convertMqEO.setModifyTime(new Date());
|
||||
convertMqEO.setMqState(2);
|
||||
convertMqEOService.updateById(convertMqEO);
|
||||
if(convertMqEO.getAgainNum()<=5){
|
||||
throw new Exception("转换失败");
|
||||
}
|
||||
}
|
||||
return Result.success(dPath);
|
||||
} else {
|
||||
logger.error("转换时未获取到文件路径!");
|
||||
return Result.error("文件存储失败,请重试");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 转换失败
|
||||
logger.error("转换过程中失败!");
|
||||
logger.error(e.getMessage(),e);
|
||||
convertMqEO.setId(convertId);
|
||||
convertMqEO.setMqState(2);
|
||||
convertMqEOService.updateById(convertMqEO);
|
||||
this.restartUploadConvert(convertMqEO);
|
||||
return Result.error("r0072", "文件转换失败,请重试");
|
||||
}
|
||||
}
|
||||
|
||||
public ResponseMessage restartUploadConvert(OtConvertMq convertInfo) throws Exception{
|
||||
OtConvertMq convertMqEO = new com.adc.da.slrs.otConvertMq.entity.OtConvertMq();
|
||||
convertMqEO.setLawsId(convertInfo.getLawsId());
|
||||
convertMqEO.setConvertType(convertInfo.getConvertType());
|
||||
convertMqEO.setAttId(convertInfo.getAttId());
|
||||
convertMqEO.setOriAttId(convertInfo.getOriAttId());
|
||||
convertMqEO.setId(convertInfo.getId());
|
||||
convertMqEO.setFilePath(convertInfo.getFilePath());
|
||||
convertMqEO.setAddOrUp(convertInfo.getAddOrUp());
|
||||
convertMqEO.setPdfId(convertInfo.getPdfId());
|
||||
convertMqEO.setStandFileClassify(convertInfo.getStandFileClassify());
|
||||
int countAdd = 0;
|
||||
convertMqEO.setAddOrUp("1");
|
||||
int againNumNew = Integer.valueOf(convertInfo.getAgainNum());
|
||||
convertMqEO.setAgainNum(againNumNew+1);
|
||||
convertMq.sendMQ(convertMqEO);
|
||||
return Result.success("true","已重新加入转换","");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author yangxuenan
|
||||
* @Description 修改标准法规文件表pdf信息
|
||||
* Date 2018/10/31 17:09
|
||||
* @Param [convertMq, pdfId]
|
||||
* @return int
|
||||
**/
|
||||
public int updateConvertDocToFIles(OtConvertMq convertMq,String pdfId){
|
||||
int countSuccess = 0;
|
||||
if(SarTypeEnum.STAND.getValue().equals(convertMq.getConvertType())){
|
||||
SarStandFile lawsFile = new SarStandFile();
|
||||
lawsFile.setId(convertMq.getPdfId());
|
||||
lawsFile.setAttId(pdfId);
|
||||
lawsFile.setOriAttId(convertMq.getOriAttId());
|
||||
lawsFile.setModifyTime(new Date());
|
||||
lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
|
||||
countSuccess = sarStandFileEODao.updateByPrimaryKeySelective(lawsFile);
|
||||
} else if (SarTypeEnum.LAWS.getValue().equals(convertMq.getConvertType())) {
|
||||
// SarLawsFile lawsFile = new SarLawsFile();
|
||||
// lawsFile.setId(convertMq.getPdfId());
|
||||
// lawsFile.setAttId(pdfId);
|
||||
// lawsFile.setOriAttId(convertMq.getOriAttId());
|
||||
// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
|
||||
// lawsFile.setModifyTime(new Date());
|
||||
// countSuccess = sarLawsFileEODao.updateByPrimaryKeySelective(lawsFile);
|
||||
} else if (SarTypeEnum.BUSINESS.getValue().equals(convertMq.getConvertType())) {
|
||||
SarBussStandFile lawsFile = new SarBussStandFile();
|
||||
lawsFile.setId(convertMq.getPdfId());
|
||||
lawsFile.setAttId(pdfId);
|
||||
lawsFile.setOriAttId(convertMq.getOriAttId());
|
||||
lawsFile.setUseModule(UseModuleEnum.WEB_FILE.getValue());
|
||||
lawsFile.setModifyTime(new Date());
|
||||
countSuccess = sarBussStandFileEODao.updateByPrimaryKeySelective(lawsFile);
|
||||
}else if (SarTypeEnum.RECORDS.getValue().equals(convertMq.getConvertType())) {
|
||||
// SarBussRecordsFileEO lawsFile = new SarBussRecordsFileEO();
|
||||
// lawsFile.setId(convertMq.getPdfId());
|
||||
// lawsFile.setRecordsId(convertMq.getLawsId());
|
||||
// lawsFile.setAttId(pdfId);
|
||||
// lawsFile.setOriAttId(convertMq.getOriAttId());
|
||||
// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
|
||||
// lawsFile.setValidFlag("0");
|
||||
// lawsFile.setCreationTime(new Date());
|
||||
// lawsFile.setModifyTime(new Date());
|
||||
// countSuccess = sarBussRecordsFileEODao.updateByPrimaryKeySelective(lawsFile);
|
||||
}
|
||||
else {
|
||||
// SarFileSplitItemsFileEO lawsFile = new SarFileSplitItemsFileEO();
|
||||
// lawsFile.setId(convertMq.getPdfId());
|
||||
// lawsFile.setAttId(pdfId);
|
||||
//// lawsFile.setOriAttId(convertMq.getOriAttId());
|
||||
// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
|
||||
// lawsFile.setModifyTime(new Date());
|
||||
// countSuccess = sarFileSplitItemsFileEODao.updateByPrimaryKeySelective(lawsFile);
|
||||
}
|
||||
return countSuccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author yangxuenan
|
||||
* @Description 添加标准法规文件表pdf信息
|
||||
* Date 2018/10/30 21:52
|
||||
* @Param [convertMq]
|
||||
* @return int
|
||||
**/
|
||||
public int insertConvertDocToFiles(OtConvertMq convertMq,String pdfId,String fileOriName,String fileType) {
|
||||
int countSuccess = 0;
|
||||
String creationUser = LoginUserUtil.getUserId();
|
||||
if(SarTypeEnum.STAND.getValue().equals(convertMq.getConvertType())){
|
||||
SarStandFile lawsFile = new SarStandFile();
|
||||
lawsFile.setId(UUID.randomUUID(20));
|
||||
lawsFile.setStandId(convertMq.getLawsId());
|
||||
// lawsFile.setResId(convertMq.getResId());
|
||||
lawsFile.setAttId(pdfId);
|
||||
lawsFile.setOriAttId(convertMq.getOriAttId());
|
||||
lawsFile.setValidFlag("0");
|
||||
lawsFile.setCreationUser(creationUser);
|
||||
lawsFile.setCreationTime(new Date());
|
||||
lawsFile.setModifyTime(new Date());
|
||||
lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
|
||||
lawsFile.setStandFileClassify(convertMq.getStandFileClassify());
|
||||
lawsFile.setFileName(fileOriName+".pdf");
|
||||
lawsFile.setFileSuffix("pdf");
|
||||
countSuccess = sarStandFileEODao.insertSelective(lawsFile);
|
||||
} else if (SarTypeEnum.LAWS.getValue().equals(convertMq.getConvertType())) {
|
||||
// SarLawsFile lawsFile = new SarLawsFile();
|
||||
// lawsFile.setId(UUID.randomUUID(20));
|
||||
// lawsFile.setLawsId(convertMq.getLawsId());
|
||||
// lawsFile.setResId(convertMq.getResId());
|
||||
// lawsFile.setAttId(pdfId);
|
||||
// lawsFile.setOriAttId(convertMq.getOriAttId());
|
||||
// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
|
||||
// lawsFile.setValidFlag("0");
|
||||
// lawsFile.setCreationTime(new Date());
|
||||
// lawsFile.setModifyTime(new Date());
|
||||
// lawsFile.setLawsFileClassify(convertMq.getLawsFileClassify());
|
||||
// lawsFile.setFileName(fileOriName+".pdf");
|
||||
// lawsFile.setFileSuffix("pdf");
|
||||
// countSuccess = sarLawsFileEODao.insertSelective(lawsFile);
|
||||
} else if (SarTypeEnum.BUSINESS.getValue().equals(convertMq.getConvertType())) {
|
||||
SarBussStandFile lawsFile = new SarBussStandFile();
|
||||
lawsFile.setId(UUID.randomUUID(20));
|
||||
lawsFile.setStandId(convertMq.getLawsId());
|
||||
lawsFile.setResId(convertMq.getResId());
|
||||
lawsFile.setAttId(pdfId);
|
||||
lawsFile.setOriAttId(convertMq.getOriAttId());
|
||||
lawsFile.setUseModule(UseModuleEnum.WEB_FILE.getValue());
|
||||
lawsFile.setStandFileClassify(convertMq.getStandFileClassify());
|
||||
lawsFile.setFileName(fileOriName+".pdf");
|
||||
lawsFile.setFileSuffix("pdf");
|
||||
lawsFile.setValidFlag(0);
|
||||
lawsFile.setCreationTime(new Date());
|
||||
lawsFile.setModifyTime(new Date());
|
||||
countSuccess = sarBussStandFileEODao.insertSelective(lawsFile);
|
||||
}
|
||||
else if (SarTypeEnum.RECORDS.getValue().equals(convertMq.getConvertType())) {
|
||||
// SarBussRecordsFileEO lawsFile = new SarBussRecordsFileEO();
|
||||
// lawsFile.setId(UUID.randomUUID(20));
|
||||
// lawsFile.setRecordsId(convertMq.getLawsId());
|
||||
// lawsFile.setResId(convertMq.getResId());
|
||||
// lawsFile.setAttId(pdfId);
|
||||
// lawsFile.setOriAttId(convertMq.getOriAttId());
|
||||
// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
|
||||
// lawsFile.setRecordsFileClassify(convertMq.getStandFileClassify());
|
||||
// lawsFile.setFileName(fileOriName+".pdf");
|
||||
// lawsFile.setFileSuffix("pdf");
|
||||
// lawsFile.setValidFlag("0");
|
||||
// lawsFile.setCreationTime(new Date());
|
||||
// lawsFile.setModifyTime(new Date());
|
||||
// countSuccess = sarBussRecordsFileEODao.insertSelective(lawsFile);
|
||||
}else {
|
||||
// SarFileSplitItemsFileEO lawsFile = new SarFileSplitItemsFileEO();
|
||||
// lawsFile.setId(UUID.randomUUID(20));
|
||||
// lawsFile.setStandId(convertMq.getLawsId());
|
||||
// lawsFile.setResId(convertMq.getResId());
|
||||
// lawsFile.setAttId(pdfId);
|
||||
//// lawsFile.setOriAttId(convertMq.getOriAttId());
|
||||
// lawsFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
|
||||
// lawsFile.setValidFlag(0);
|
||||
// lawsFile.setCreationTime(new Date());
|
||||
// lawsFile.setModifyTime(new Date());
|
||||
// countSuccess = sarFileSplitItemsFileEODao.insertSelective(lawsFile);
|
||||
}
|
||||
return countSuccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文档转换逻辑
|
||||
* @param attFileEO
|
||||
*/
|
||||
public void insertOrUpdateStandInfo(AttFileEO attFileEO){
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.adc.da.convert.OtConvert.controller;
|
||||
package com.adc.da.convert.otConvert.controller;
|
||||
|
||||
|
||||
import com.adc.da.att.entity.AttFileEO;
|
||||
@@ -9,7 +9,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.adc.da.convert.OtConvert.entity.OtConvert;
|
||||
import com.adc.da.convert.otConvert.entity.OtConvert;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.adc.da.convert.OtConvert.dao;
|
||||
package com.adc.da.convert.otConvert.dao;
|
||||
|
||||
import com.adc.da.convert.OtConvert.entity.OtConvert;
|
||||
import com.adc.da.convert.otConvert.entity.OtConvert;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package com.adc.da.convert.OtConvert.entity;
|
||||
package com.adc.da.convert.otConvert.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;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.adc.da.convert.OtConvert.service;
|
||||
package com.adc.da.convert.otConvert.service;
|
||||
|
||||
import com.adc.da.convert.OtConvert.entity.OtConvert;
|
||||
import com.adc.da.convert.otConvert.entity.OtConvert;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
package com.adc.da.convert.OtConvert.service.impl;
|
||||
package com.adc.da.convert.otConvert.service.impl;
|
||||
|
||||
import com.adc.da.convert.OtConvert.entity.OtConvert;
|
||||
import com.adc.da.convert.OtConvert.dao.OtConvertDao;
|
||||
import com.adc.da.convert.OtConvert.service.IOtConvertService;
|
||||
import com.adc.da.convert.otConvert.entity.OtConvert;
|
||||
import com.adc.da.convert.otConvert.dao.OtConvertDao;
|
||||
import com.adc.da.convert.otConvert.service.IOtConvertService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?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.OtConvert.dao.OtConvertDao">
|
||||
<mapper namespace="com.adc.da.convert.otConvert.dao.OtConvertDao">
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<!-- scheduled所属资源为spring-context-support -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.adc</groupId>
|
||||
<artifactId>adc-da-convert</artifactId>
|
||||
|
||||
@@ -12,11 +12,13 @@ import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerF
|
||||
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@EnableEurekaClient
|
||||
@EnableFeignClients
|
||||
@ServletComponentScan
|
||||
@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
|
||||
@EnableScheduling
|
||||
@MapperScan(value = {"com.adc.da.file.store"})
|
||||
public class AdcDaApplication {
|
||||
|
||||
|
||||
@@ -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
|
||||
# ==============================================
|
||||
# 文档存储路径指向
|
||||
# ==============================================
|
||||
|
||||
@@ -152,3 +152,8 @@ elas.flag=true
|
||||
# 文档转换TCP通讯地址
|
||||
convert.host=127.0.0.1
|
||||
#convert.host=0.0.0.0
|
||||
|
||||
# =============================================================================
|
||||
# scheduled 配置
|
||||
# =============================================================================
|
||||
isNotScheduled=true
|
||||
@@ -11,6 +11,11 @@
|
||||
|
||||
<artifactId>adc-da-slrs</artifactId>
|
||||
<dependencies>
|
||||
<!-- scheduled所属资源为spring-context-support -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.adc</groupId>
|
||||
<artifactId>adc-da-base</artifactId>
|
||||
|
||||
+5
-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表中添加/修改数据
|
||||
//判断用户是初次发送还是重新发送,初次将添加到数据库,重新发送将修改原数据信息
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.adc.da.mq;
|
||||
|
||||
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
|
||||
import com.adc.da.slrs.sarLawsInfo.entity.SarLawsInfo;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.springframework.amqp.core.AmqpTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class CreateStandMQService {
|
||||
@Autowired
|
||||
private AmqpTemplate rabbitTemplate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sarStandardsInfoEO 标准实体
|
||||
* @param addOrUpdate
|
||||
* @throws Exception
|
||||
*/
|
||||
public void sendStandMQ(Object sarStandardsInfoEO, String addOrUpdate) throws Exception{
|
||||
JSONObject json = JSONObject.fromObject(sarStandardsInfoEO);
|
||||
String sarStandardsInfoStr = json.toString();
|
||||
Map<String,Object> standMap = new HashMap<String,Object>();
|
||||
standMap.put("sarStandards", sarStandardsInfoStr);
|
||||
standMap.put("addOrUpdate", addOrUpdate);
|
||||
|
||||
//发送消息队列
|
||||
this.rabbitTemplate.convertAndSend("stand-exchange_SQ_GSAR", "stand-key_SQ_GSAR", standMap);
|
||||
}
|
||||
|
||||
public void sendLawsMQ(SarLawsInfo sarLawsInfoEO, String addOrUpdate) throws Exception{
|
||||
JSONObject json = JSONObject.fromObject(sarLawsInfoEO);
|
||||
String sarLawsInfoStr = json.toString();
|
||||
Map<String,Object> lawsMap = new HashMap<String,Object>();
|
||||
lawsMap.put("sarLaws", sarLawsInfoStr);
|
||||
lawsMap.put("addOrUpdate", addOrUpdate);
|
||||
|
||||
//发送消息队列
|
||||
this.rabbitTemplate.convertAndSend("laws-exchange_SQ_GSAR", "laws-key_SQ_GSAR", lawsMap);
|
||||
}
|
||||
|
||||
public void sendBussStandMQ(SarBussionessStand sarBussionessStandEO, String addOrUpdate) throws Exception{
|
||||
JSONObject json = JSONObject.fromObject(sarBussionessStandEO);
|
||||
String sarBussInfoStr = json.toString();
|
||||
Map<String,Object> bussMap = new HashMap<String,Object>();
|
||||
bussMap.put("sarBuss", sarBussInfoStr);
|
||||
bussMap.put("addOrUpdate", addOrUpdate);
|
||||
|
||||
//发送消息队列
|
||||
this.rabbitTemplate.convertAndSend("buss-exchange_SQ_GSAR", "buss-key_SQ_GSAR", bussMap);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
package com.adc.da.mq;
|
||||
|
||||
import com.adc.da.slrs.otSvpps.service.IOtSvppsService;
|
||||
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
|
||||
import com.adc.da.slrs.sarStandardsInfo.service.ISarStandardsInfoService;
|
||||
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
|
||||
import com.adc.da.sys.dao.DicTypeEODao;
|
||||
import com.adc.da.utils.util.InitStandAttrUtil;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.json.JSONTokener;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.amqp.support.AmqpHeaders;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class SendBussMQService {
|
||||
|
||||
@Autowired
|
||||
private ISarStandardsInfoService sarStandardsInfoService;
|
||||
|
||||
@Autowired
|
||||
private SysInfoEOService sysInfoEOService;
|
||||
|
||||
@Autowired
|
||||
private DicTypeEODao dicTypeEODao;
|
||||
|
||||
@Autowired
|
||||
private IOtSvppsService otSvppsEOService;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SendBussMQService.class);
|
||||
|
||||
|
||||
@RabbitListener(bindings = @QueueBinding(
|
||||
value = @Queue(value = "createBussMQ_SQ_GSAR", durable = "true"),
|
||||
exchange = @Exchange(value = "buss-exchange_SQ_GSAR", ignoreDeclarationExceptions = "true"),
|
||||
key = "buss-key_SQ_GSAR"))
|
||||
public void createMQ(Map<String,Object> bussMap, Message message, Channel channel) throws Exception{
|
||||
try{
|
||||
try{
|
||||
Thread.sleep(5000);
|
||||
insertOrUpdateBussInfo(bussMap);
|
||||
}catch(InterruptedException e){
|
||||
logger.error(e.toString());
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("搜索中心企业标准消息队列进入转换前失败!");
|
||||
logger.error(e.getMessage(),e);
|
||||
} finally {
|
||||
Long tag = (Long) message.getHeaders().get(AmqpHeaders.DELIVERY_TAG);
|
||||
channel.basicAck(tag,false);
|
||||
logger.debug("消息确认成功!!!!!!!!!");
|
||||
}
|
||||
}
|
||||
|
||||
public void insertOrUpdateBussInfo(Map<String,Object> bussMap) throws Exception {
|
||||
String addOrUpdate = bussMap.get("addOrUpdate").toString();
|
||||
String FZRQFSRQ = null;
|
||||
if ("updateFromAct".equals(addOrUpdate)){
|
||||
addOrUpdate = "update";
|
||||
FZRQFSRQ = "1";
|
||||
}
|
||||
String sarBuss = bussMap.get("sarBuss").toString();
|
||||
JSONObject jsonobject = JSONObject.fromObject(sarBuss);
|
||||
SarBussionessStand infoEO = (SarBussionessStand) JSONObject.toBean(jsonobject, SarBussionessStand.class);
|
||||
String jsonobject1 = infoEO.getSarStandAttrEOStr();
|
||||
Map<String,Object> map1 = new HashMap<>();
|
||||
if (StringUtils.isEmpty(jsonobject1)){
|
||||
map1.put("null","null");
|
||||
}else {
|
||||
map1 = JSONObject.fromObject(jsonobject1);
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
//修改索引信息表
|
||||
// 往索引表中插入数据
|
||||
String baseSearchContent = "";
|
||||
String getCodeName = "";
|
||||
Map<String,Object> saveMap = new HashMap<>();
|
||||
String a = null;
|
||||
try{
|
||||
a = sdf.format(infoEO.getIssueTime());
|
||||
saveMap.put("issue_time"," "+a);
|
||||
}catch (Exception e){
|
||||
saveMap.put("issue_time"," ");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//发布日期 高级查询
|
||||
Date issue_time_data = null;
|
||||
if (StringUtils.isNotBlank(a)) {
|
||||
try {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
issue_time_data = format.parse(saveMap.get("issue_time")+" 00:00:00");
|
||||
} catch (ParseException ignored) {
|
||||
}
|
||||
}
|
||||
if (issue_time_data != null) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(issue_time_data);
|
||||
int month = calendar.get(Calendar.MONTH)+1;
|
||||
String times = calendar.get(Calendar.YEAR) + String.format("%02d", month) + String.format("%02d",calendar.get(Calendar.DAY_OF_MONTH));
|
||||
saveMap.put("issue_time_data",Long.valueOf(times));
|
||||
}else{
|
||||
saveMap.put("issue_time_data",-1000000000000000000L);
|
||||
}
|
||||
|
||||
try{
|
||||
saveMap.put("put_time"," "+ sdf.format(infoEO.getPutTime()));
|
||||
}catch (Exception e){
|
||||
saveMap.put("put_time"," ");
|
||||
}
|
||||
|
||||
//实施日期 高级查询
|
||||
Date put_time_data = null;
|
||||
if (StringUtils.isNotBlank(a)) {
|
||||
try {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
put_time_data = format.parse(saveMap.get("put_time")+" 00:00:00");
|
||||
} catch (ParseException ignored) {
|
||||
}
|
||||
}
|
||||
if (put_time_data != null) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(put_time_data);
|
||||
int month = calendar.get(Calendar.MONTH)+1;
|
||||
String times = calendar.get(Calendar.YEAR) + String.format("%02d", month) + String.format("%02d",calendar.get(Calendar.DAY_OF_MONTH));
|
||||
saveMap.put("put_time_data",Long.valueOf(times));
|
||||
}else{
|
||||
saveMap.put("put_time_data",-1000000000000000000L);
|
||||
}
|
||||
// saveMap.put("put_time",sdf.format(infoEO.getPutTime()));
|
||||
|
||||
saveMap.put("id",infoEO.getId());
|
||||
saveMap.put("standSort",infoEO.getStandSort());
|
||||
saveMap.put("stand_sort",infoEO.getStandSort());
|
||||
if(StringUtils.isNotEmpty(infoEO.getStandSort())){
|
||||
String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandSort());
|
||||
saveMap.put("standSortShow",codeName);
|
||||
getCodeName = codeName;
|
||||
}
|
||||
saveMap.put("standYear",infoEO.getStandYear());
|
||||
saveMap.put("stand_year",infoEO.getStandYear());
|
||||
saveMap.put("standNumber",infoEO.getStandCode());
|
||||
saveMap.put("stand_code",infoEO.getStandCode());
|
||||
saveMap = dealNumberMsg(saveMap,infoEO,getCodeName);
|
||||
saveMap.put("nameshow",infoEO.getStandName());
|
||||
saveMap.put("stand_name",infoEO.getStandName());
|
||||
saveMap.put("standEnName",infoEO.getStandEnName());
|
||||
saveMap.put("stand_en_name",infoEO.getStandEnName());
|
||||
saveMap.put("replaceStandNum",infoEO.getReplaceStandNum());
|
||||
saveMap.put("replace_stand_num",infoEO.getReplaceStandNum());
|
||||
saveMap.put("replacedStandNum",infoEO.getReplacedStandNum());
|
||||
saveMap.put("replaced_stand_num",infoEO.getReplacedStandNum());
|
||||
saveMap.put("statecode",infoEO.getStandStatus());
|
||||
saveMap.put("stand_status",infoEO.getStandStatus());
|
||||
if (StringUtils.isNotEmpty(infoEO.getStandStatus())) {
|
||||
String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandStatus());
|
||||
saveMap.put("standstateshow",codeName);
|
||||
}
|
||||
//新加字段
|
||||
saveMap.put("country",infoEO.getApplyCountry());
|
||||
if(StringUtils.isNotEmpty(infoEO.getApplyCountry())){
|
||||
String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getApplyCountry());
|
||||
saveMap.put("countryShow",codeName);
|
||||
}
|
||||
// 自定义属性字段
|
||||
String sarStandAttrEOStr = infoEO.getSarStandAttrEOStr();
|
||||
Map<String,Object> attrInfoMap = JSONObject.fromObject(sarStandAttrEOStr);
|
||||
Map<String,Object> infoMap = infoEO.getAttrInfoMap();
|
||||
|
||||
if (attrInfoMap != null && !attrInfoMap.isEmpty()) {
|
||||
attrInfoMap = sysInfoEOService.changeSelectInfo(attrInfoMap, "stand",baseSearchContent);
|
||||
saveMap.putAll(attrInfoMap);
|
||||
}
|
||||
|
||||
saveMap.put("type","bussstand");
|
||||
saveMap.put("validFlag","0");
|
||||
saveMap.put("content",infoEO.getFileIds());
|
||||
|
||||
String fieldInfo = InitStandAttrUtil.queryField;
|
||||
List<String> fieldInfoList = Arrays.asList(fieldInfo .split(",")).stream().map(s -> (s.trim())).collect(Collectors.toList());
|
||||
|
||||
// 动态存储属性字段
|
||||
for (String field : fieldInfoList) {
|
||||
saveMap.put(field,attrInfoMap.getOrDefault(field,""));
|
||||
String fieldValue = "";
|
||||
if(infoMap.get(field) != null && StringUtils.isNotBlank(infoMap.get(field).toString())){
|
||||
Object json= new JSONTokener(infoMap.get(field).toString()).nextValue();
|
||||
if(!json.toString().equals("null")){
|
||||
fieldValue = infoMap.get(field).toString();
|
||||
}
|
||||
}
|
||||
saveMap.put(field+"Name",fieldValue);
|
||||
}
|
||||
|
||||
//当建立代替时,产生的没有文件的问题
|
||||
if (StringUtils.isBlank(String.valueOf(saveMap.get("content")))) {
|
||||
String context = filterStringIsNotBlank(String.valueOf(saveMap.get("FBGBUSS")),true)
|
||||
+ filterStringIsNotBlank(String.valueOf(saveMap.get("BZSMBUSS")),true)
|
||||
+ filterStringIsNotBlank(String.valueOf(saveMap.get("LSBBBUSS")),true)
|
||||
+ filterStringIsNotBlank(String.valueOf(saveMap.get("QTWJBUSS")),true)
|
||||
+ filterStringIsNotBlank(String.valueOf(saveMap.get("GLWJBUSS")),true);
|
||||
context = context.replace(",,", ",");
|
||||
saveMap.put("content", context);
|
||||
}
|
||||
if("add".equals(addOrUpdate)){
|
||||
sarStandardsInfoService.insertIntoIndexForMap(saveMap);
|
||||
} else {
|
||||
sarStandardsInfoService.updateIntoIndexForMap(saveMap);
|
||||
}
|
||||
}
|
||||
|
||||
private String filterStringIsNotBlank(String str,boolean boo){
|
||||
String f = ",";
|
||||
return (str == null || str.equals("") || str.equals("null")) ? "" : (boo ? str+f : str);
|
||||
}
|
||||
|
||||
private String dateFormatToStr(String dateStr){
|
||||
if(dateStr == null || dateStr.equals("")){
|
||||
return "";
|
||||
}
|
||||
String dateToStr = "";
|
||||
try {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
dateToStr = dateFormat.format(dateFormat.parse(dateStr.trim().substring(0,10)));
|
||||
}catch (Exception e){
|
||||
e.getMessage();
|
||||
}
|
||||
return dateToStr;
|
||||
}
|
||||
|
||||
public Map<String,Object> dealNumberMsg (Map<String,Object> saveMap,SarBussionessStand infoEO,String getCodeName) {
|
||||
/*if(StringUtils.isNotEmpty(infoEO.getStandYear())){
|
||||
String num = getCodeName + " " + infoEO.getStandCode() + "-" + infoEO.getStandYear();
|
||||
saveMap.put("numbershow",num);
|
||||
int index = infoEO.getStandCode().indexOf(".");
|
||||
int index1 = infoEO.getStandCode().indexOf(":");
|
||||
String numberExpNull = "";
|
||||
if(index > -1){
|
||||
numberExpNull = getCodeName + infoEO.getStandCode() + "-" + num.replaceAll(" ","")
|
||||
+ "-" + getCodeName + infoEO.getStandCode().substring(0,index) + "-" + infoEO.getStandCode().substring(0,index);
|
||||
}else if(index1 > -1){
|
||||
numberExpNull = getCodeName + infoEO.getStandCode() + "-" + num.replaceAll(" ","")
|
||||
+ "-" + getCodeName + infoEO.getStandCode().substring(0,index1) + "-" + infoEO.getStandCode().substring(0,index1);
|
||||
}else{
|
||||
numberExpNull = getCodeName + infoEO.getStandCode() + "-" + num.replaceAll(" ","");
|
||||
}
|
||||
} else {
|
||||
String number = getCodeName + " " + infoEO.getStandCode();
|
||||
saveMap.put("numbershow",number);
|
||||
String numberExpNull = "";
|
||||
int index = infoEO.getStandCode().indexOf(".");
|
||||
if(index > -1){
|
||||
numberExpNull = getCodeName + infoEO.getStandCode() + "-" + number.replaceAll(" ","")
|
||||
+ "-" + getCodeName + infoEO.getStandCode().substring(0,index) + "-" + infoEO.getStandCode().substring(0,index);
|
||||
}else{
|
||||
numberExpNull = getCodeName + infoEO.getStandCode() + "-" + number.replaceAll(" ","");
|
||||
}
|
||||
saveMap.put("numberExpNull",numberExpNull);
|
||||
}*/
|
||||
String number = infoEO.getStandCode();
|
||||
saveMap.put("numbershow",number);
|
||||
String numberExpNull = "";
|
||||
int index = infoEO.getStandCode().indexOf(".");
|
||||
if(index > -1){
|
||||
numberExpNull = infoEO.getStandCode() + "-" + number.replaceAll(" ","")
|
||||
+ "-" + infoEO.getStandCode().substring(0,index) + "-" + infoEO.getStandCode().substring(0,index);
|
||||
}else{
|
||||
numberExpNull = infoEO.getStandCode() + "-" + number.replaceAll(" ","");
|
||||
}
|
||||
saveMap.put("numberExpNull",numberExpNull);
|
||||
return saveMap;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-2
@@ -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,32 +0,0 @@
|
||||
package com.adc.da.mq.service;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
import org.springframework.amqp.core.AmqpTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class CreateStandMQService {
|
||||
@Autowired
|
||||
private AmqpTemplate rabbitTemplate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sarStandardsInfoEO 标准实体
|
||||
* @param addOrUpdate
|
||||
* @throws Exception
|
||||
*/
|
||||
public void sendStandMQ(Object sarStandardsInfoEO, String addOrUpdate) throws Exception{
|
||||
JSONObject json = JSONObject.fromObject(sarStandardsInfoEO);
|
||||
String sarStandardsInfoStr = json.toString();
|
||||
Map<String,Object> standMap = new HashMap<String,Object>();
|
||||
standMap.put("sarStandards", sarStandardsInfoStr);
|
||||
standMap.put("addOrUpdate", addOrUpdate);
|
||||
|
||||
//发送消息队列
|
||||
this.rabbitTemplate.convertAndSend("stand-exchange_SQ_GSAR", "stand-key_SQ_GSAR", standMap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package com.adc.da.scheduled;
|
||||
|
||||
import com.adc.da.scheduled.dao.SarStandardInfoDao;
|
||||
import com.adc.da.scheduled.dao.SarStandardItemDao;
|
||||
import com.adc.da.scheduled.dao.SarStandardWarningDao;
|
||||
import com.adc.da.scheduled.entity.DataDTO;
|
||||
import com.adc.da.scheduled.entity.WarningEO;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@EnableScheduling
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ScheduledJob {
|
||||
|
||||
/**
|
||||
* 根据配置文件设置是否开启定时器
|
||||
*/
|
||||
|
||||
@Value("${isNotScheduled}")
|
||||
private boolean isNotScheduled; //是否开启定时器
|
||||
|
||||
//
|
||||
// @Scheduled(cron="*/5 * * * * ?")
|
||||
// @Async
|
||||
// public void StandScheduledJob(){
|
||||
// System.out.println("hello");
|
||||
//// if(isNotScheduled){
|
||||
//// System.out.println(Thread.currentThread().getName() + " cron=0 0 1 1 * ? --- " + new Date()+"---START-01");
|
||||
//// System.out.println(Thread.currentThread().getName() + " cron=0 0 1 1 * ? --- " + new Date()+"---End-01");
|
||||
//// try{
|
||||
//// Thread.sleep(2000);
|
||||
//// }catch(Exception e){
|
||||
//// }
|
||||
//// }
|
||||
// }
|
||||
|
||||
|
||||
@Autowired
|
||||
private SarStandardWarningDao sarStandardWarningDao;
|
||||
|
||||
@Autowired
|
||||
private SarStandardItemDao sarStandardItemDao;
|
||||
|
||||
@Autowired
|
||||
private SarStandardInfoDao sarStandardInfoDao;
|
||||
|
||||
|
||||
@Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行
|
||||
// @Scheduled(cron="*/5 * * * * ?")
|
||||
@Async
|
||||
public void schedulingTasks() {
|
||||
|
||||
|
||||
/**
|
||||
* 1.查询标准属性字段表(sar_stand_attr_info) XCXSSEQ ZCCSSRQ ZRGCS
|
||||
* 联接标准信息表sar_standards_info表的STAND_NAME
|
||||
* 2.查询分解单(条款表)
|
||||
* 3.查询预警表
|
||||
* 4.去掉预警表中已存在的的数据
|
||||
* 5.插入预警表
|
||||
*/
|
||||
|
||||
/**
|
||||
mark:标识预警的种类
|
||||
3:新车标准预警
|
||||
4:在产车标准预警
|
||||
1:新车条款预警
|
||||
2:在产车条款预警
|
||||
*/
|
||||
System.out.println("开始执行预警!!!");
|
||||
//预警期限
|
||||
DataDTO dataDTO = new DataDTO();
|
||||
dataDTO.setStartDate(LocalDate.now().plusDays(1)) //系统日期的下一天
|
||||
.setEndDate(LocalDate.now().plusMonths(3).plusDays(1));//系统日期3个月后
|
||||
|
||||
LinkedList<WarningEO> warningList = new LinkedList<>();
|
||||
|
||||
//分解单(条款) 新车型 mark=1
|
||||
List<WarningEO> itemForXCXSSRQ = sarStandardItemDao.select(dataDTO, "XCXSSRQ");
|
||||
for (WarningEO warningEO : itemForXCXSSRQ) {
|
||||
warningEO.setId(UUIDUtils.randomUUID20())
|
||||
.setPower("1")
|
||||
.setMark("1")
|
||||
.setPutTime(warningEO.getXCXSSRQ());
|
||||
}
|
||||
warningList.addAll(itemForXCXSSRQ);
|
||||
|
||||
//分解单(条款) 在产车型 mark=2
|
||||
List<WarningEO> itemForZCCSSRQ = sarStandardItemDao.select(dataDTO, "ZCCSSRQ");
|
||||
for (WarningEO warningEO : itemForZCCSSRQ) {
|
||||
warningEO.setId(UUIDUtils.randomUUID20())
|
||||
.setPower("1")
|
||||
.setMark("2")
|
||||
.setPutTime(warningEO.getZCCSSRQ());
|
||||
}
|
||||
warningList.addAll(itemForZCCSSRQ);
|
||||
|
||||
//标准 新车型 预警 mark=3
|
||||
List<WarningEO> standInfoXCXSSRQ = sarStandardInfoDao.select(dataDTO, "XCXSSRQ");
|
||||
for (WarningEO warningEO : standInfoXCXSSRQ) {
|
||||
warningEO.setId(UUIDUtils.randomUUID20())
|
||||
.setPower("1")
|
||||
.setMark("3")
|
||||
.setPutTime(warningEO.getXCXSSRQ());
|
||||
}
|
||||
warningList.addAll(standInfoXCXSSRQ);
|
||||
|
||||
|
||||
//标准 在产车型 mark=4
|
||||
List<WarningEO> standInfoZCCSSRQ = sarStandardInfoDao.select(dataDTO, "ZCCSSRQ");
|
||||
for (WarningEO warningEO : standInfoZCCSSRQ) {
|
||||
warningEO.setId(UUIDUtils.randomUUID20())
|
||||
.setPower("1")
|
||||
.setMark("4")
|
||||
.setPutTime(warningEO.getZCCSSRQ());
|
||||
}
|
||||
warningList.addAll(standInfoZCCSSRQ);
|
||||
|
||||
//持久化至预警表 忽略标准id和标志位都一样的数据
|
||||
if (warningList.size()!=0){
|
||||
int count = sarStandardWarningDao.ignoreInsert(warningList);
|
||||
System.out.println("已预警 " + count + " 条标准或条款!!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.adc.da.scheduled.dao;
|
||||
|
||||
|
||||
import com.adc.da.scheduled.entity.DataDTO;
|
||||
import com.adc.da.scheduled.entity.WarningEO;
|
||||
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface SarStandardInfoDao{
|
||||
|
||||
public List<WarningEO> select(DataDTO date, String str);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.adc.da.scheduled.dao;
|
||||
|
||||
import com.adc.da.scheduled.entity.DataDTO;
|
||||
import com.adc.da.scheduled.entity.WarningEO;
|
||||
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface SarStandardItemDao extends BaseMapper{
|
||||
|
||||
public List<WarningEO> select(DataDTO date, String str);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.adc.da.scheduled.dao;
|
||||
|
||||
import com.adc.da.scheduled.entity.WarningEO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
@Repository
|
||||
public interface SarStandardWarningDao extends IService<WarningEO> {
|
||||
|
||||
public int ignoreInsert(@Param(value = "warningEOS") LinkedList<WarningEO> warningEOS);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.adc.da.scheduled.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class DataDTO {
|
||||
|
||||
private LocalDate startDate;
|
||||
|
||||
private LocalDate endDate;
|
||||
|
||||
private String str;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.adc.da.scheduled.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class WarningEO extends EarlyWarningEO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Date XCXSSRQ;
|
||||
|
||||
private Date ZCCSSRQ;
|
||||
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.adc.da.slrs.otConvertMq.controller;
|
||||
|
||||
|
||||
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>
|
||||
* 文档转换记录信息表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2021-08-20
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "|OtConvertMq|")
|
||||
@RequestMapping("/otConvertMq/ot-convert-mq")
|
||||
public class OtConvertMqController extends BaseController<OtConvertMq> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.adc.da.slrs.otConvertMq.dao;
|
||||
|
||||
import com.adc.da.slrs.otConvertMq.entity.OtConvertMq;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文档转换记录信息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2021-08-20
|
||||
*/
|
||||
@Repository
|
||||
public interface OtConvertMqDao extends BaseMapper<OtConvertMq> {
|
||||
|
||||
int deleteByAttId(String value);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.adc.da.slrs.otConvertMq.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
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;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文档转换记录信息表
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2021-08-20
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="OtConvertMq对象", description="文档转换记录信息表")
|
||||
public class OtConvertMq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
@TableId("ID")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "消息队列编码")
|
||||
@TableField("MQ_CODE")
|
||||
private String mqCode;
|
||||
|
||||
@ApiModelProperty(value = "队列状态")
|
||||
@TableField("MQ_STATE")
|
||||
private Integer mqState;
|
||||
|
||||
@TableField("USER_ID")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty(value = "文件路径")
|
||||
@TableField("FILE_PATH")
|
||||
private String filePath;
|
||||
|
||||
@ApiModelProperty(value = "文件ID")
|
||||
@TableField("ATT_ID")
|
||||
private String attId;
|
||||
|
||||
@ApiModelProperty(value = "是否有效")
|
||||
@TableField("VALID_FLAG")
|
||||
private Integer validFlag;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@TableField("CREATION_TIME")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date creationTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
@TableField("MODIFY_TIME")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date modifyTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String fileOriginPath;
|
||||
|
||||
//向文件表添加信息
|
||||
@TableField(exist = false)
|
||||
private String lawsId;
|
||||
@TableField(exist = false)
|
||||
private String resId;
|
||||
@TableField(exist = false)
|
||||
private String convertType;
|
||||
@TableField(exist = false)
|
||||
private String pdfPath;
|
||||
@TableField(exist = false)
|
||||
private String pdfId;
|
||||
@TableField(exist = false)
|
||||
private String addOrUp;
|
||||
@TableField(exist = false)
|
||||
private String oldFileName;
|
||||
@TableField(exist = false)
|
||||
private String standFileClassify;
|
||||
@TableField(exist = false)
|
||||
private String lawsFileClassify;
|
||||
@TableField(exist = false)
|
||||
private String oriAttId;
|
||||
@TableField(exist = false)
|
||||
private int againNum;
|
||||
@TableField(exist = false)
|
||||
private String fileSuffix;
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.adc.da.slrs.otConvertMq.service;
|
||||
|
||||
import com.adc.da.slrs.otConvertMq.entity.OtConvertMq;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文档转换记录信息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2021-08-20
|
||||
*/
|
||||
public interface IOtConvertMqService extends IService<OtConvertMq> {
|
||||
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.adc.da.slrs.otConvertMq.service.impl;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文档转换记录信息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author super_liu
|
||||
* @since 2021-08-20
|
||||
*/
|
||||
@Service
|
||||
public class OtConvertMqServiceImpl extends ServiceImpl<OtConvertMqDao, OtConvertMq> implements IOtConvertMqService {
|
||||
|
||||
}
|
||||
+49
-2
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -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);
|
||||
}
|
||||
|
||||
+10
-1
@@ -67,7 +67,7 @@ public class SarBussStandFile extends BaseEntity {
|
||||
|
||||
@ApiModelProperty(value = "是否有效")
|
||||
@TableField("VALID_FLAG")
|
||||
private String validFlag;
|
||||
private Integer validFlag;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@TableField("CREATION_TIME")
|
||||
@@ -86,4 +86,13 @@ public class SarBussStandFile extends BaseEntity {
|
||||
@TableField(exist = false)
|
||||
private List<String> idList = new ArrayList<>();
|
||||
|
||||
@TableField(exist = false)
|
||||
private String useModule;
|
||||
@TableField(exist = false)
|
||||
private String resId;
|
||||
@TableField(exist = false)
|
||||
private Integer pageCount;
|
||||
@TableField(exist = false)
|
||||
private String fileOldName;
|
||||
|
||||
}
|
||||
|
||||
+4
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
+10
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-22
@@ -10,10 +10,10 @@ import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage;
|
||||
import com.adc.da.slrs.sarUser.service.ITsUserService;
|
||||
import com.adc.da.sys.entity.DicTypeEO;
|
||||
import com.adc.da.sys.service.IDicTypeEOService;
|
||||
import com.adc.da.sys.util.LoginUserUtil;
|
||||
import com.adc.da.http.PageInfo;
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.util.LoginUserUtil;
|
||||
import com.adc.da.util.utils.StringUtils;
|
||||
import com.adc.da.utils.util.SarAdvanceSearchUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -168,33 +168,15 @@ public class SarBussionessStandController extends BaseController<SarBussionessSt
|
||||
page.setAdvanceSearchStr(null);
|
||||
}
|
||||
}
|
||||
page.setUserId(LoginUserUtil.getUserId());
|
||||
if(page.getUserId() == null || page.getUserId().equals("")){
|
||||
page.setUserId(LoginUserUtil.getUserId());
|
||||
}
|
||||
if(StringUtils.isNotBlank(page.getPaixu())){
|
||||
String sql = page.getPaixu()+" "+page.getShunxu();
|
||||
page.setSql(sql);
|
||||
}else{
|
||||
page.setOrderBy("SAR_BUSSIONESS_STAND.MODIFY_TIME DESC");
|
||||
}
|
||||
if(page.getMenuId() != null ){
|
||||
QueryWrapper<TsResource> qw = new QueryWrapper<>();
|
||||
qw.eq("ID",page.getMenuId());
|
||||
qw.isNull("PARENT_ID");
|
||||
List<TsResource> children = iTsResourceService.list(qw);
|
||||
if(!children.isEmpty() || page.getMenuId().equals("nomenu")){
|
||||
List<SarBussionessStand> rows = sarBussionessStandEOService.getSarBussionStandPage(page);
|
||||
return Result.success(getPageInfo(page.getPager(), rows));
|
||||
}
|
||||
List<String> getMenuIdList = tsUserService.getResourceId(new TsResource());
|
||||
if (getMenuIdList != null && !getMenuIdList.isEmpty()) {
|
||||
page.setMenuRoleList(getMenuIdList);
|
||||
} else {
|
||||
page.setMenuRoleList(null);
|
||||
}
|
||||
List<String> ids = iTsResourceService.getChildMenuList(page.getMenuId());
|
||||
if (ids != null && !ids.isEmpty()) {
|
||||
page.setMenuAllChildrenIdList(ids);
|
||||
}
|
||||
}
|
||||
List<SarBussionessStand> rows = sarBussionessStandEOService.getSarBussionStandPage(page);
|
||||
return Result.success(getPageInfo(page.getPager(), rows));
|
||||
// if (StringUtils.isNotBlank(page.getAdvanceSearchVOStr())) {
|
||||
|
||||
+66
@@ -1,10 +1,14 @@
|
||||
package com.adc.da.slrs.sarBussionessStand.dao;
|
||||
|
||||
import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.RecommendVO;
|
||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage;
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -30,4 +34,66 @@ public interface SarBussionessStandDao extends BaseMapper<SarBussionessStand> {
|
||||
|
||||
List<SarBussionessStand> getBussionessStandInfoPage(SarBussionessStandEOPage page);
|
||||
|
||||
List<SarBussionessStand> getBussionessStandInfoPageByRole(SarBussionessStandEOPage page);
|
||||
|
||||
//企标复审使用
|
||||
List<SarBussionessStand> getBussionessStandInfoQbfs(SarBussionessStandEOPage page);
|
||||
|
||||
int getBussionessStandInfoCountByRole(SarBussionessStandEOPage page);
|
||||
|
||||
List<SarBussionessStand> getSarBussionessStand(SarBussionessStandEOPage page);
|
||||
//liwenxuan:标准法规更新数量及清单:企业标准
|
||||
Integer selectBussionessStandardsCount(Date visitTime);
|
||||
//liwenxuan:标准法规更新数量及清单:企业标准All
|
||||
Integer selectBussionessStandardsCountAll();
|
||||
|
||||
|
||||
List<SarBussionessStand> selectSarBussionesDownloadFileInfo(String id);
|
||||
|
||||
List<SarBussionessStand> selectStandardsByStandnumber(SarBussionessStand sarStandardsInfoEO);
|
||||
|
||||
List<SarBussionessStand> selectStandByStandNumber(@Param("standCode") String standCode);
|
||||
|
||||
/**
|
||||
* 搜索中心查询相关推荐
|
||||
*
|
||||
* @param:
|
||||
* @auther: gaoyan
|
||||
* @date: 2018/11/10 9:22
|
||||
*/
|
||||
List<RecommendVO> selectRecommendStand(SarBussionessStandEOPage pagenew);
|
||||
|
||||
List<RecommendVO> selectCloseStand(SarBussionessStandEOPage pagenew);
|
||||
|
||||
List<SarBussionessStand> queryByPutTimeList(SarBussionessStand sarBussionessStandEO);
|
||||
|
||||
int updateByStandNum(SarBussionessStand s);
|
||||
|
||||
/**
|
||||
* 根据唯一的标准code,修改标准的被代替标准号
|
||||
* @param:
|
||||
* @auther: gaoyan
|
||||
* @date: 2018/11/10 9:22
|
||||
*/
|
||||
int updateRelacedNumByNumber(SarBussionessStandEOPage pagenew);
|
||||
|
||||
int updateRelaceNumByNumber(SarBussionessStandEOPage pagenew);
|
||||
|
||||
List<SarBussionessStand> selectBussStandByIdAndRole(SarBussionessStandEOPage pagenew);
|
||||
|
||||
void updateReplacedNumById(SarBussionessStand sarBussionessStandEO);
|
||||
|
||||
Integer selectStandColumn(@Param("columnName") String columnName);
|
||||
|
||||
List<SarBussionessStand> standRemindInfo(@Param("standCode") String standCode, @Param("standName") String standName);
|
||||
|
||||
int selectIsExit(@Param("id") String id);
|
||||
|
||||
List<String> selectPerson(String qbid);
|
||||
|
||||
List<UserEO> selectPersonAll(String qbid);
|
||||
|
||||
int updateByPrimaryKeySelectiveTimeNotNull(SarBussionessStand sarBussionessStandEO);
|
||||
|
||||
|
||||
}
|
||||
|
||||
+3
@@ -180,6 +180,9 @@ public class SarBussionessStand extends BaseEntity {
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> attrInfoMap = new LinkedHashMap<>(); //属性表字段与值
|
||||
|
||||
@TableField(exist = false)
|
||||
private Map<String, Object> attrInfoCaseMap = new LinkedHashMap<>(); //属性表字段与值小写前端带入渲染
|
||||
|
||||
@TableField(exist = false)
|
||||
private String sarStandAttrEOStr; //新增修改时属性表信息
|
||||
|
||||
|
||||
+283
-22
@@ -6,9 +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.mq.dao.OtConvertEODao;
|
||||
import com.adc.da.mq.service.CreateMQService;
|
||||
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.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;
|
||||
@@ -16,32 +20,37 @@ 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.sarStandFile.entity.SarStandFile;
|
||||
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
|
||||
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;
|
||||
import com.adc.da.sys.constant.ValueStateEnum;
|
||||
import com.adc.da.sys.dao.DicTypeEODao;
|
||||
import com.adc.da.sys.entity.DicTypeEO;
|
||||
import com.adc.da.sys.util.LoginUserUtil;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
import com.adc.da.utils.util.FieldConvertUtil;
|
||||
import com.adc.da.utils.util.InitStandAttrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.json.JSONTokener;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.Clob;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -55,6 +64,17 @@ import java.util.*;
|
||||
@Service
|
||||
public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStandDao, SarBussionessStand> implements ISarBussionessStandService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SarBussionessStandServiceImpl.class);
|
||||
|
||||
@Value("${elas.flag}")
|
||||
private boolean elasflag; //ES是否启用
|
||||
|
||||
@Value("${file.path}")
|
||||
private String filePath;//文件存储路径
|
||||
|
||||
@Autowired
|
||||
private SarBussionessStandDao sarBussionessStandEODao;
|
||||
|
||||
@Autowired
|
||||
private ITsUserService tsUserService;
|
||||
|
||||
@@ -67,6 +87,9 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
@Autowired
|
||||
private ITsResourceService iTsResourceService;
|
||||
|
||||
@Autowired
|
||||
private SarStandAttrInfoDao sarStandAttrInfoEODao;
|
||||
|
||||
@Autowired
|
||||
private SysInfoEOService sysInfoEOService;
|
||||
|
||||
@@ -77,7 +100,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
private IPersonCollectEOService personCollectEOService;
|
||||
|
||||
@Autowired
|
||||
private OtConvertEODao otConvertEODao;
|
||||
private OtConvertMqDao otConvertEODao;
|
||||
|
||||
@Autowired
|
||||
private CreateMQService convertMq;
|
||||
@@ -91,6 +114,12 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
@Autowired
|
||||
private SarStandardsInfoDao sarStandardsInfoEODao;
|
||||
|
||||
@Autowired
|
||||
private CreateStandMQService createStandMQService;
|
||||
|
||||
@Autowired
|
||||
private ISarUpdLogService sarUpdLogEOService;
|
||||
|
||||
@Autowired
|
||||
private SarBussStandAttrInfoDao sarBussStandAttrInfoEODao;
|
||||
|
||||
@@ -126,18 +155,147 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
}
|
||||
createStandAttrInfo(sarBussionessStandEO);
|
||||
// 根据代替标准号 ,修改代替标准号标准中的,被代替标准号
|
||||
// updateReplaceConnect(sarBussionessStandEO);
|
||||
// //修改收藏分享编号名称
|
||||
// updateCollectAndShare(sarBussionessStandEO);
|
||||
// // 记录修改日志
|
||||
// saveUpdateLog(sarBussionessStandEO,beforeStandEO);
|
||||
// if (elasflag) {
|
||||
// createStandMQService.sendBussStandMQ(sarBussionessStandEO, "update");
|
||||
// }
|
||||
updateReplaceConnect(sarBussionessStandEO);
|
||||
//修改收藏分享编号名称
|
||||
updateCollectAndShare(sarBussionessStandEO);
|
||||
// 记录修改日志
|
||||
saveUpdateLog(sarBussionessStandEO,beforeStandEO);
|
||||
if (elasflag) {
|
||||
createStandMQService.sendBussStandMQ(sarBussionessStandEO, "update");
|
||||
}
|
||||
}
|
||||
return sarBussionessStandEO;
|
||||
}
|
||||
|
||||
public void saveUpdateLog(SarBussionessStand sarStandardsInfoEO,SarBussionessStand beforeSarStandardsInfo) throws Exception{
|
||||
Map<String,Object> newMap = new HashMap<>();
|
||||
Map<String,Object> oldMap = beforeSarStandardsInfo.getAttrInfoMap();
|
||||
String attrStr = sarStandardsInfoEO.getSarStandAttrEOStr();
|
||||
if (StringUtils.isNotBlank(attrStr)) {
|
||||
newMap = JSONObject.fromObject(attrStr);
|
||||
}
|
||||
newMap = changeMap(sarStandardsInfoEO,newMap);
|
||||
oldMap = changeMap(beforeSarStandardsInfo,oldMap);
|
||||
String sortName = sysInfoEOService.getDicNamesByCodes(sarStandardsInfoEO.getStandSort());
|
||||
String number = sortName + " " + sarStandardsInfoEO.getStandCode();
|
||||
if (StringUtils.isNotBlank(sarStandardsInfoEO.getStandYear())) {
|
||||
number += "-" + sarStandardsInfoEO.getStandYear();
|
||||
}
|
||||
String content = number + " 《" + sarStandardsInfoEO.getStandName() + "》";
|
||||
sarUpdLogEOService.createUpdateLog(SarTypeEnum.BUSINESS.getValue(),sarStandardsInfoEO.getId(),oldMap,newMap,content);
|
||||
}
|
||||
|
||||
public Map<String,Object> changeMap (SarBussionessStand sarStandardsInfoEO,Map<String,Object> map) {
|
||||
map.put("country",sarStandardsInfoEO.getApplyCountry());
|
||||
map.put("standSort",sarStandardsInfoEO.getStandSort());
|
||||
map.put("standNumber",sarStandardsInfoEO.getStandCode());
|
||||
map.put("standYear",sarStandardsInfoEO.getStandYear());
|
||||
map.put("standName",sarStandardsInfoEO.getStandName());
|
||||
map.put("standEnName",sarStandardsInfoEO.getStandEnName());
|
||||
map.put("standNature",sarStandardsInfoEO.getStandNature());
|
||||
map.put("standState",sarStandardsInfoEO.getStandStatus());
|
||||
if (sarStandardsInfoEO.getIssueTime() != null) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String issueStr = format.format(sarStandardsInfoEO.getIssueTime());
|
||||
map.put("issueTime",issueStr);
|
||||
}
|
||||
if (sarStandardsInfoEO.getPutTime() != null) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String issueStr = format.format(sarStandardsInfoEO.getPutTime());
|
||||
map.put("putTime",issueStr);
|
||||
}
|
||||
map.put("replaceStandNum",sarStandardsInfoEO.getReplaceStandNum());
|
||||
map.put("replacedStandNum",sarStandardsInfoEO.getReplacedStandNum());
|
||||
return map;
|
||||
}
|
||||
|
||||
public void updateCollectAndShare(SarBussionessStand sarBussionessStandEO) throws Exception {
|
||||
//修改收藏表中
|
||||
String number = sarBussionessStandEO.getStandCode()+ ")";
|
||||
PersonCollectEOPage personCollectEOPage = new PersonCollectEOPage();
|
||||
personCollectEOPage.setValidFlag("0");
|
||||
personCollectEOPage.setCollectResId(sarBussionessStandEO.getId());
|
||||
List<TsPersonCollect> listCollect = personCollectEOService.queryByList(personCollectEOPage);
|
||||
if (listCollect != null && listCollect.size() > 0) {
|
||||
for (TsPersonCollect getCollect : listCollect) {
|
||||
TsPersonCollect collectEO = new TsPersonCollect();
|
||||
collectEO.setId(getCollect.getId());
|
||||
collectEO.setCollectTitle(sarBussionessStandEO.getStandName() + " " + "( 编号:" + number);
|
||||
personCollectEOService.updateByPrimaryKeySelective(collectEO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void updateReplaceConnect(SarBussionessStand sarBussionessStandEO) throws Exception{
|
||||
if(StringUtils.isNotEmpty(sarBussionessStandEO.getReplaceStandNum())){
|
||||
SarBussionessStandEOPage sarStandardsInfoEOPage = new SarBussionessStandEOPage();
|
||||
//当前代替标准号的标准类别为类别name,需修改为code
|
||||
String[] replaceList = sarBussionessStandEO.getReplaceStandNum().trim().split(",");
|
||||
String replaceListNew[];
|
||||
int countre = 0;
|
||||
// List<String> newReplaceList = new ArrayList<>();
|
||||
if (replaceList!=null && replaceList.length>0) {
|
||||
for(String replaceNum : replaceList){
|
||||
if(replaceNum.indexOf(" ")!=-1){
|
||||
String dicName = replaceNum.substring(0,replaceNum.lastIndexOf(" "));
|
||||
DicTypeEO dicTypeEO = new DicTypeEO();
|
||||
dicTypeEO.setDicTypeName(dicName);
|
||||
dicTypeEO.setDicTypeCode("BUSSSTANDCLASS");
|
||||
List<DicTypeEO> getDicCode = dicTypeEODao.getDicTypeByDicTypeName(dicTypeEO);
|
||||
if(getDicCode!= null && getDicCode.size()>0){
|
||||
replaceNum = replaceNum.replaceFirst(dicName,getDicCode.get(0).getDicTypeCode());
|
||||
replaceList[countre] = replaceNum;
|
||||
countre++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sarStandardsInfoEOPage.setReplaceStandNumList(replaceList);
|
||||
// 2021/03/30 刘慧文修改 标准类别已不存在
|
||||
if(StringUtils.isNotEmpty(sarBussionessStandEO.getStandYear())){
|
||||
sarStandardsInfoEOPage.setReplacedStandNum(sarBussionessStandEO.getStandCode()+"-"+sarBussionessStandEO.getStandYear());
|
||||
} else {
|
||||
sarStandardsInfoEOPage.setReplacedStandNum(sarBussionessStandEO.getStandCode());
|
||||
}
|
||||
int updateResult = sarBussionessStandEODao.updateRelacedNumByNumber(sarStandardsInfoEOPage);
|
||||
|
||||
//编写预警信息
|
||||
// writeWarnings(sarBussionessStandEO);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(sarBussionessStandEO.getReplacedStandNum())) {
|
||||
SarBussionessStandEOPage sarStandardsInfoEOPage = new SarBussionessStandEOPage();
|
||||
//当前代替标准号的标准类别为类别name,需修改为code
|
||||
String[] replaceList = sarBussionessStandEO.getReplacedStandNum().trim().split(",");
|
||||
int countre = 0;
|
||||
// List<String> newReplaceList = new ArrayList<>();
|
||||
if (replaceList!=null && replaceList.length>0) {
|
||||
for(String replaceNum : replaceList){
|
||||
if(replaceNum.indexOf(" ")!=-1){
|
||||
String dicName = replaceNum.substring(0,replaceNum.lastIndexOf(" "));
|
||||
DicTypeEO dicTypeEO = new DicTypeEO();
|
||||
dicTypeEO.setDicTypeName(dicName);
|
||||
dicTypeEO.setDicTypeCode("BUSSSTANDCLASS");
|
||||
List<DicTypeEO> getDicCode = dicTypeEODao.getDicTypeByDicTypeName(dicTypeEO);
|
||||
if(getDicCode!= null && getDicCode.size()>0){
|
||||
replaceNum = replaceNum.replaceFirst(dicName,getDicCode.get(0).getDicTypeCode());
|
||||
replaceList[countre] = replaceNum;
|
||||
countre++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sarStandardsInfoEOPage.setReplacedStandNumList(replaceList);
|
||||
// 2021/03/30 刘慧文修改 标准类别已不存在
|
||||
if(StringUtils.isNotEmpty(sarBussionessStandEO.getStandYear())){
|
||||
sarStandardsInfoEOPage.setReplaceStandNum(sarBussionessStandEO.getStandCode()+"-"+sarBussionessStandEO.getStandYear());
|
||||
} else {
|
||||
sarStandardsInfoEOPage.setReplaceStandNum(sarBussionessStandEO.getStandCode());
|
||||
}
|
||||
int updateResult = sarBussionessStandEODao.updateRelaceNumByNumber(sarStandardsInfoEOPage);
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* @Description: 新增属性表数据
|
||||
* @Author: yangxuenan
|
||||
@@ -266,7 +424,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
sarStandFileEO.setCreationUser(LoginUserUtil.getUserId());
|
||||
sarStandFileEO.setCreationTime(new Date());
|
||||
sarStandFileEO.setModifyTime(new Date());
|
||||
sarStandFileEO.setValidFlag("0");
|
||||
sarStandFileEO.setValidFlag(0);
|
||||
sarStandFileEO.setStandId(standId); //标准ID
|
||||
sarStandFileEO.setUseModel(UseModuleEnum.SOURCE_FILE.getValue()); //文件使用模式
|
||||
sarStandFileEO.setId(com.adc.da.sys.util.UUIDUtils.randomUUID20());
|
||||
@@ -282,7 +440,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
newFileEO.setCreationUser(LoginUserUtil.getUserId());
|
||||
newFileEO.setCreationTime(new Date());
|
||||
newFileEO.setModifyTime(new Date());
|
||||
newFileEO.setValidFlag("0");
|
||||
newFileEO.setValidFlag(0);
|
||||
newFileEO.setStandId(standId); //标准ID
|
||||
newFileEO.setId(com.adc.da.sys.util.UUIDUtils.randomUUID20());
|
||||
newFileEO.setAttId(fileInfo.getId()); //文件ID
|
||||
@@ -294,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);
|
||||
@@ -344,13 +502,13 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) {
|
||||
String name = entry.getKey();
|
||||
String value = "";
|
||||
if (entry.getValue() != null && InitStandAttrUtil.fileFieldList != null && InitStandAttrUtil.fileFieldList.size() > 0 && InitStandAttrUtil.fileFieldList.contains(name)) {
|
||||
if (entry.getValue() != null && InitStandAttrUtil.fileFieldListBuss != null && InitStandAttrUtil.fileFieldListBuss.size() > 0 && InitStandAttrUtil.fileFieldListBuss.contains(name)) {
|
||||
value = entry.getValue().toString();
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(value)) {
|
||||
if (StringUtils.isNotBlank(value)) {
|
||||
List<AttFileEO> fileObj = attFileEOService.getMultiFileInfos(value);
|
||||
entry.setValue(fileObj);
|
||||
}
|
||||
}else if (entry.getValue() != null && InitStandAttrUtil.selectionFieldList != null && InitStandAttrUtil.selectionFieldList.size() > 0 && InitStandAttrUtil.selectionFieldList.contains(name)) {
|
||||
}else if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListBuss != null && InitStandAttrUtil.selectionFieldListBuss.size() > 0 && InitStandAttrUtil.selectionFieldListBuss.contains(name)) {
|
||||
value = entry.getValue().toString();
|
||||
List<String> valArr = Arrays.asList(value.split(","));
|
||||
value = dicTypeEODao.getDicNamesByCodes(valArr);
|
||||
@@ -407,6 +565,26 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
|
||||
@Override
|
||||
public List<SarBussionessStand> getSarBussionStandPage(SarBussionessStandEOPage page) throws Exception {
|
||||
//查询当前登录人角色拥有权限的菜单
|
||||
if(page.getMenuId() != null && page.getUserId() != null && StringUtils.isNotBlank(page.getUserId())){
|
||||
QueryWrapper<TsResource> qw = new QueryWrapper<>();
|
||||
qw.eq("ID",page.getMenuId());
|
||||
qw.isNull("PARENT_ID");
|
||||
List<TsResource> children = iTsResourceService.list(qw);
|
||||
if(children.isEmpty() && !page.getMenuId().equals("nomenu")){
|
||||
List<String> getMenuIdList = tsUserService.getResourceUserId(page.getUserId());
|
||||
if (getMenuIdList != null && !getMenuIdList.isEmpty()) {
|
||||
page.setMenuRoleList(getMenuIdList);
|
||||
} else {
|
||||
page.setMenuRoleList(null);
|
||||
}
|
||||
List<String> ids = iTsResourceService.getChildMenuList(page.getMenuId());
|
||||
if (ids != null && !ids.isEmpty()) {
|
||||
page.setMenuAllChildrenIdList(ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Integer rowCount = this.baseMapper.getBussionessStandInfoCount(page);
|
||||
page.getPager().setRowCount(rowCount);
|
||||
List<SarBussionessStand> sarlist = this.baseMapper.getBussionessStandInfoPage(page);
|
||||
@@ -421,7 +599,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
*/
|
||||
public void attrInfo (List<SarBussionessStand> sarlist) throws Exception {
|
||||
for(SarBussionessStand row : sarlist){
|
||||
attrInfo1(row);
|
||||
attrInfoDetails(row);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,6 +622,85 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
}
|
||||
}
|
||||
|
||||
public void attrInfoShowSearchDetails(SarBussionessStand row,String type) throws Exception {
|
||||
if (row != null) {
|
||||
attrInfoSearchDetails(row,type);
|
||||
Map<String, Object> getAttrMap = row.getAttrInfoMap();
|
||||
if (getAttrMap != null && getAttrMap.size() > 0) {
|
||||
for (Map.Entry<String, Object> entry : getAttrMap.entrySet()) {
|
||||
String name = entry.getKey();
|
||||
String value = "";
|
||||
List<String> valArr = new ArrayList<>();
|
||||
if (entry.getValue() != null && InitStandAttrUtil.selectionFieldListBuss != null && InitStandAttrUtil.selectionFieldListBuss.size() > 0 && InitStandAttrUtil.selectionFieldListBuss.contains(name)) {
|
||||
if(StringUtils.isNotBlank(entry.getValue().toString())){
|
||||
Object json= new JSONTokener(entry.getValue().toString()).nextValue();
|
||||
if(json instanceof org.json.JSONArray){
|
||||
valArr = com.alibaba.fastjson.JSONObject.parseArray(entry.getValue().toString(),String.class);
|
||||
}else {
|
||||
value = entry.getValue().toString();
|
||||
valArr = Arrays.asList(value.split(","));
|
||||
}
|
||||
if(!valArr.isEmpty()){
|
||||
value = dicTypeEODao.getDicNamesByCodes(valArr);
|
||||
}
|
||||
}
|
||||
entry.setValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void attrInfoSearchDetails(SarBussionessStand row,String type) throws Exception {
|
||||
String fieldInfo = InitStandAttrUtil.queryField;
|
||||
String collectId = personCollectEOService.queryCollectByUserAndId(row.getId());
|
||||
row.setCollectId(collectId);
|
||||
// 查询属性表数据
|
||||
if (StringUtils.isNotBlank(fieldInfo)) {
|
||||
Map<String, Object> getAttrMap = new TreeMap<>();
|
||||
if(type.equals("add")){
|
||||
String sarStandAttrEOStr = row.getSarStandAttrEOStr();
|
||||
getAttrMap = JSONObject.fromObject(sarStandAttrEOStr);
|
||||
}else {
|
||||
getAttrMap = sarStandAttrInfoEODao.selectStandFieldAndData(fieldInfo, row.getId());
|
||||
}
|
||||
if (InitStandAttrUtil.clobFieldList != null && !InitStandAttrUtil.clobFieldList.isEmpty()) {
|
||||
// 遍历修改所有clob类型的值
|
||||
for (String clobField : InitStandAttrUtil.clobFieldList) {
|
||||
Clob clobValue = (Clob) getAttrMap.get(clobField);
|
||||
String fieldValue = FieldConvertUtil.ClobToString(clobValue);
|
||||
getAttrMap.put(clobField, fieldValue);
|
||||
}
|
||||
}
|
||||
|
||||
if (getAttrMap != null && !getAttrMap.isEmpty()) {
|
||||
row.setAttrInfoCaseMap(transformUpperCase(getAttrMap));
|
||||
}
|
||||
|
||||
row.setAttrInfoMap(getAttrMap);
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> transformUpperCase(Map<String, Object> orgMap) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, Object> entry : orgMap.entrySet()) {
|
||||
String newKey = entry.getKey().toLowerCase();
|
||||
resultMap.put(newKey, orgMap.get(entry.getKey()));
|
||||
if (entry.getValue() != null && InitStandAttrUtil.fileFieldListBuss != null && !InitStandAttrUtil.fileFieldListBuss.isEmpty() && InitStandAttrUtil.fileFieldListBuss.contains(entry.getKey())) {
|
||||
String value = entry.getValue().toString();
|
||||
if (StringUtils.isNotBlank(value)) {
|
||||
List<AttFileEO> fileObj = attFileEOService.getMultiFileInfos(value);
|
||||
if(!fileObj.isEmpty()){
|
||||
resultMap.put(newKey + "Name", fileObj.get(0).getOldFileName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
public void attrInfoDetails (SarBussionessStand row) throws Exception {
|
||||
String fieldInfo = InitStandAttrUtil.queryFieldBuss;
|
||||
String collectId = personCollectEOService.queryCollectByUserAndId(row.getId());
|
||||
@@ -492,6 +749,10 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
getAttrMap.putAll(newMap);
|
||||
}
|
||||
|
||||
if (getAttrMap != null && !getAttrMap.isEmpty()) {
|
||||
row.setAttrInfoCaseMap(transformUpperCase(getAttrMap));
|
||||
}
|
||||
|
||||
row.setAttrInfoMap(getAttrMap);
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -114,7 +114,6 @@ public class SarLawsDetailedListController extends BaseController<SarLawsDetaile
|
||||
fileNameDto.setFileName(FileNames);//存入
|
||||
|
||||
}
|
||||
list1.set(a,fileNameDto);
|
||||
}else if (null!=list.get(a).getFileIds()){
|
||||
AttFileEO attFileEO = attFileEOController.getAttFileInfo(list.get(a).getFileIds()).getData();
|
||||
FindFileNameDto fileNameDto = list1.get(a);
|
||||
|
||||
+2
@@ -4,6 +4,7 @@ import com.adc.da.slrs.sarStandAttrInfo.entity.SarStandAttrInfo;
|
||||
import com.adc.da.sys.common.SelectionResult;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -16,6 +17,7 @@ import java.util.Map;
|
||||
* @author super_liu
|
||||
* @since 2021-06-01
|
||||
*/
|
||||
@Repository
|
||||
public interface SarStandAttrInfoDao extends BaseMapper<SarStandAttrInfo> {
|
||||
|
||||
void alterStandAttr(@Param("fieldInfo") String fieldInfo);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.adc.da.slrs.sarStandFile.dao;
|
||||
|
||||
import com.adc.da.slrs.sarStandFile.entity.SarStandFile;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -13,6 +14,7 @@ import java.util.List;
|
||||
* @author super_liu
|
||||
* @since 2021-06-02
|
||||
*/
|
||||
@Repository
|
||||
public interface SarStandFileDao extends BaseMapper<SarStandFile> {
|
||||
|
||||
List<SarStandFile> selectFileByStandId(String lawsId);
|
||||
@@ -29,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;
|
||||
|
||||
|
||||
|
||||
+8
@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -52,6 +53,13 @@ public class SarPublicIdeaAllController extends BaseController<SarPublicIdeaAll>
|
||||
return Result.success("200",publicList);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询流程汇总-公共意见")
|
||||
@GetMapping("/getPublicIdea")
|
||||
public ResponseMessage getPublicIdea(@Param("unique") String unique){
|
||||
List<SarPublicIdeaAll> publicList =sarPublicIdeaAllDao.getPublicIdea(unique);
|
||||
return Result.success("200",publicList);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "查询全部意见")
|
||||
@GetMapping("/checkIsShow")
|
||||
|
||||
@@ -3,6 +3,11 @@ package com.adc.da.slrs.sarStandIdea.dao;
|
||||
import com.adc.da.slrs.sarStandIdea.entity.SarPublicIdeaAll;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -15,4 +20,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface SarPublicIdeaAllDao extends BaseMapper<SarPublicIdeaAll> {
|
||||
|
||||
List<SarPublicIdeaAll> getPublicIdea(@Param("unique")String unique);
|
||||
}
|
||||
|
||||
@@ -10,4 +10,5 @@ public class DetAllStandDto {
|
||||
String userId;
|
||||
String endTime;
|
||||
String Account;
|
||||
String ideaId;
|
||||
}
|
||||
|
||||
@@ -63,5 +63,8 @@ public class SarPublicIdea extends BaseEntity {
|
||||
@TableField("stand_type")
|
||||
private String standType;
|
||||
|
||||
@TableField("uniques")
|
||||
private String uniques;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -58,6 +58,9 @@ public class SarPublicIdeaAll extends BaseEntity {
|
||||
@TableField("new_text")
|
||||
private String newText;
|
||||
|
||||
@TableField("idea_id")
|
||||
private String ideaId;
|
||||
|
||||
public static final String CID = "cid";
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class SarPublicIdeaAllServiceImpl extends ServiceImpl<SarPublicIdeaAllDao
|
||||
e.printStackTrace();
|
||||
}
|
||||
QueryWrapper<SarPublicIdeaAll> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("CID", detAllStandDto.getCid());
|
||||
wrapper.eq("idea_id", detAllStandDto.getIdeaId());
|
||||
Page<SarPublicIdeaAll> page = new Page<>(detAllStandDto.getPage(), detAllStandDto.getSize());
|
||||
IPage<SarPublicIdeaAll> userIPage = sarPublicIdeaAllDao.selectPage(page, wrapper);
|
||||
System.out.println("总条数" + userIPage.getTotal());
|
||||
|
||||
+1
-5
@@ -193,13 +193,9 @@ public class SarStandItemsServiceImpl extends ServiceImpl<SarStandItemsDao, SarS
|
||||
|
||||
|
||||
public List<SarStandItems> querySarItemAndInterpretation(FindSarItemsPageReqDTO page){
|
||||
|
||||
|
||||
|
||||
//分页查询的总数
|
||||
Integer count=dao.sarItemCount(page);
|
||||
page.getPager().setRowCount(count);
|
||||
|
||||
|
||||
List<SarStandItems> sarStandItems = dao.querySarItemAndInterpretation(page);
|
||||
return sarStandItems;
|
||||
}
|
||||
|
||||
+43
-33
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1137,6 +1136,17 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
|
||||
* @Return: com.adc.da.util.http.ResponseMessage<com.adc.da.lawss.entity.SarStandardsInfoEO>
|
||||
*/
|
||||
public int updateSarStandardsInfo(SarStandardsInfo sarStandardsInfoEO) throws Exception {
|
||||
|
||||
/**
|
||||
* 加入对应"国家/地区"的清单列表
|
||||
*/
|
||||
|
||||
//1.获取标准清单的"国家/地区"
|
||||
//2.判断修改的标准的"国家/地区"与清单中的是否一致,一致则添加到清单中,不一致不作处理
|
||||
|
||||
|
||||
|
||||
|
||||
String standId = sarStandardsInfoEO.getId();
|
||||
// 查询修改前数据信息,为修改代替标准号使用
|
||||
SarStandardsInfo beforeSarStandardsInfo = dao.selectById(standId);
|
||||
@@ -1152,18 +1162,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 >= #{modifyTime1}
|
||||
</if>
|
||||
<if test="modifyTime2 != null" >
|
||||
and modify_time <= #{modifyTime2}
|
||||
</if>
|
||||
<if test="creationTime != null" >
|
||||
and creation_time ${creationTimeOperator} #{creationTime}
|
||||
</if>
|
||||
<if test="creationTime1 != null" >
|
||||
and creation_time >= #{creationTime1}
|
||||
</if>
|
||||
<if test="creationTime2 != null" >
|
||||
and creation_time <= #{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>
|
||||
+2
-2
@@ -185,9 +185,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>
|
||||
|
||||
+5
-3
@@ -20,6 +20,7 @@
|
||||
<result column="stand_nature" property="standNature" />
|
||||
<result column="stand_sort" property="standSort" />
|
||||
<result column="stand_year" property="standYear" />
|
||||
<result column="text_status_buss" property="textStatusBuss" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="BaseResultMapExcel" type="com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand" >
|
||||
@@ -35,12 +36,13 @@
|
||||
<result column="standNatrueShow" property="standNatrueShow" />
|
||||
<result column="standSortShow" property="standSortShow" />
|
||||
<result column="stand_year" property="standYear" />
|
||||
<result column="text_status_buss" property="textStatusBuss" />
|
||||
</resultMap>
|
||||
|
||||
<!-- SAR_BUSSIONESS_STAND table all fields -->
|
||||
<sql id="Base_Column_List" >
|
||||
modify_time, creation_time, valid_flag, stand_status, replaced_stand_num,replace_stand_num,
|
||||
put_time, issue_time,stand_en_name,stand_name, stand_code, id,apply_country, stand_nature, stand_sort
|
||||
put_time, issue_time,stand_en_name,stand_name, stand_code, id,apply_country, stand_nature, stand_sort,text_status_buss
|
||||
</sql>
|
||||
<sql id="Base_Column_List_show" >
|
||||
stand_year,dicapplyCountry.DIC_TYPE_NAME as applyCountryShow,dicstandSort.DIC_TYPE_NAME as standSortShow,
|
||||
@@ -48,7 +50,7 @@
|
||||
SAR_BUSSIONESS_STAND.creation_time, SAR_BUSSIONESS_STAND.valid_flag,
|
||||
SAR_BUSSIONESS_STAND.apply_country, SAR_BUSSIONESS_STAND.stand_nature,SAR_BUSSIONESS_STAND.stand_sort,
|
||||
stand_status, replaced_stand_num,replace_stand_num,put_time,issue_time,stand_en_name,
|
||||
stand_name, stand_code,SAR_BUSSIONESS_STAND.id,dicstandStatus.DIC_TYPE_NAME as standStatusShow
|
||||
stand_name, stand_code,SAR_BUSSIONESS_STAND.id,dicstandStatus.DIC_TYPE_NAME as standStatusShow,SAR_BUSSIONESS_STAND.text_status_buss
|
||||
</sql>
|
||||
|
||||
<sql id="Group_Column_List_show" >
|
||||
@@ -352,7 +354,7 @@
|
||||
|
||||
<!-- 分页查询条件 -->
|
||||
<sql id="SarBussionInfo_Where_Clause">
|
||||
left join TS_DICTYPE dicstandStatus ON ( dicstandStatus.dic_type_code = SAR_BUSSIONESS_STAND.STAND_STATUS AND dicstandStatus.dic_id IS NOT NULL and dicstandStatus.valid_flag = 0)
|
||||
left join TS_DICTYPE dicstandStatus ON ( dicstandStatus.dic_type_code = SAR_BUSSIONESS_STAND.TEXT_STATUS_BUSS AND dicstandStatus.dic_id IS NOT NULL and dicstandStatus.valid_flag = 0)
|
||||
left join TS_DICTYPE dicstandNature ON ( dicstandNature.dic_type_code = SAR_BUSSIONESS_STAND.STAND_NATURE AND dicstandNature.dic_id IS NOT NULL and dicstandNature.valid_flag = 0)
|
||||
left join TS_DICTYPE dicstandSort ON ( dicstandSort.dic_type_code = SAR_BUSSIONESS_STAND.STAND_SORT AND dicstandSort.dic_id IS NOT NULL and dicstandSort.valid_flag = 0)
|
||||
left join TS_DICTYPE dicapplyCountry ON ( dicapplyCountry.dic_type_code = SAR_BUSSIONESS_STAND.APPLY_COUNTRY AND dicapplyCountry.dic_id IS NOT NULL and dicapplyCountry.valid_flag = 0)
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
<?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.sarStandIdea.dao.SarPublicIdeaAllDao">
|
||||
|
||||
<select id="getPublicIdea" resultType="com.adc.da.slrs.sarStandIdea.entity.SarPublicIdeaAll">
|
||||
SELECT sar_public_idea_all.* FROM sar_public_idea
|
||||
INNER JOIN sar_public_idea_all on sar_public_idea_all.idea_id = sar_public_idea.id
|
||||
WHERE sar_public_idea_all.idea_id IS NOT NULL and sar_public_idea.uniques = #{unique}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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.scheduled.dao.SarStandardInfoDao">
|
||||
|
||||
<!-- Result Map-->
|
||||
<resultMap id="resultMap" type="com.adc.da.scheduled.entity.WarningEO" >
|
||||
<id column="ID" property="id" />
|
||||
<result column="STAND_NUMBER" property="standCode" />
|
||||
<result column="STAND_NAME" property="standName" />
|
||||
<result column="XCXSSRQ" property="XCXSSRQ"/>
|
||||
<result column="ZCCSSRQ" property="ZCCSSRQ"/>
|
||||
<result column="CLLX" property="applyType" />
|
||||
<result column="STAND_TYPE" property="standType" />
|
||||
<result column="ZRGCS" property="dutyEngineer" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 查询条件 -->
|
||||
<select id="select" resultMap="resultMap" parameterType="com.adc.da.scheduled.entity.DataDTO">
|
||||
SELECT
|
||||
info.ID,
|
||||
info.STAND_NUMBER,
|
||||
info.STAND_NAME,
|
||||
info.STAND_TYPE,
|
||||
attrInfo.CLLX,
|
||||
attrInfo.ZRGCS,
|
||||
attrInfo.${str}
|
||||
FROM
|
||||
sar_standards_info AS info
|
||||
JOIN sar_stand_attr_info AS attrInfo ON info.id = attrinfo.stand_id
|
||||
WHERE
|
||||
attrInfo.${str} BETWEEN #{date.startDate} and #{date.endDate}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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.scheduled.dao.SarStandardItemDao">
|
||||
|
||||
<!-- Result Map-->
|
||||
<resultMap id="resultMap" type="com.adc.da.scheduled.entity.WarningEO">
|
||||
<id column="ID" property="id"/>
|
||||
<result column="STAND_NUMBER" property="standCode"/>
|
||||
<result column="STAND_NAME" property="standName"/>
|
||||
<result column="XCXSSRQ" property="XCXSSRQ"/>
|
||||
<result column="ZCCSSRQ" property="ZCCSSRQ"/>
|
||||
<result column="CLLX" property="applyType"/>
|
||||
<result column="STAND_TYPE" property="standType"/>
|
||||
<result column="ZRGCS" property="dutyEngineer"/>
|
||||
</resultMap>
|
||||
<!-- 查询条件 -->
|
||||
<select id="select" resultMap="resultMap" parameterType="com.adc.da.scheduled.entity.DataDTO">
|
||||
SELECT
|
||||
STAND_ID,
|
||||
ITEMS_NUM,
|
||||
TERMS_CONDITIONS,
|
||||
DUTY_ENGINEER,
|
||||
APPLY_ARCTIC,
|
||||
info.STAND_TYPE,
|
||||
|
||||
${str}
|
||||
FROM
|
||||
sar_stand_items AS items
|
||||
JOIN sar_standards_info AS info ON items.STAND_ID=info.ID
|
||||
|
||||
WHERE
|
||||
${str} BETWEEN #{date.startDate} and #{date.endDate}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
<?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.scheduled.dao.SarStandardWarningDao">
|
||||
|
||||
<insert id="ignoreInsert" parameterType="java.util.LinkedList">
|
||||
|
||||
INSERT IGNORE INTO sar_stand_warning (ID, STAND_TYPE, STAND_CODE,STAND_NAME,PUT_TIME,APPLY_TYPE,DUTY_ENGINEER,ITEMS_ID,ITEMS_NAME,POLICY_ID,POLICY_NAME,MARK,POWER)
|
||||
VALUES
|
||||
<if test="warningEOS !=null and warningEOS.size()!=0">
|
||||
<foreach collection="warningEOS" item="item" index="index" separator=",">
|
||||
(
|
||||
#{item.id}
|
||||
,#{item.standType}
|
||||
,#{item.standCode}
|
||||
,#{item.standName}
|
||||
,#{item.putTime}
|
||||
,#{item.applyType}
|
||||
,#{item.dutyEngineer}
|
||||
,#{item.itemsId}
|
||||
,#{item.itemsName}
|
||||
,#{item.policyId}
|
||||
,#{item.policyName}
|
||||
,#{item.mark}
|
||||
,#{item.power}
|
||||
)
|
||||
</foreach>
|
||||
</if>
|
||||
</insert>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user