Merge remote-tracking branch 'origin/develop_master' into develop_1
# Conflicts: # adc-da-slrs/src/main/java/com/adc/da/scheduled/ScheduledJob.java
This commit is contained in:
+17
-9
@@ -24,32 +24,40 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<!-- openOffice 和 jobconverter-->
|
<!-- openOffice 和 jobconverter-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.artofsolving</groupId>
|
<groupId>org.jodconverter</groupId>
|
||||||
<artifactId>jodconverter</artifactId>
|
<artifactId>jodconverter-core</artifactId>
|
||||||
<scope>system</scope>
|
<version>4.2.2</version>
|
||||||
<version>2.2.2</version>
|
</dependency>
|
||||||
<systemPath>${basedir}/src/main/lib/jodconverter-2.2.2.jar</systemPath>
|
<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>
|
</dependency>
|
||||||
<!-- openOffice end-->
|
<!-- openOffice end-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openoffice</groupId>
|
<groupId>org.openoffice</groupId>
|
||||||
<artifactId>juh</artifactId>
|
<artifactId>juh</artifactId>
|
||||||
<version>3.0.1</version>
|
<version>4.1.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openoffice</groupId>
|
<groupId>org.openoffice</groupId>
|
||||||
<artifactId>jurt</artifactId>
|
<artifactId>jurt</artifactId>
|
||||||
<version>3.0.1</version>
|
<version>4.1.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openoffice</groupId>
|
<groupId>org.openoffice</groupId>
|
||||||
<artifactId>ridl</artifactId>
|
<artifactId>ridl</artifactId>
|
||||||
<version>3.0.1</version>
|
<version>4.1.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openoffice</groupId>
|
<groupId>org.openoffice</groupId>
|
||||||
<artifactId>unoil</artifactId>
|
<artifactId>unoil</artifactId>
|
||||||
<version>3.0.1</version>
|
<version>4.1.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--OFFICE CONVERTER END-->
|
<!--OFFICE CONVERTER END-->
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,23 @@
|
|||||||
package com.adc.da.convert.common;
|
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.apache.commons.lang.StringUtils;
|
||||||
|
import org.jodconverter.DocumentConverter;
|
||||||
|
import org.jodconverter.JodConverter;
|
||||||
|
import org.jodconverter.OfficeDocumentConverter;
|
||||||
|
import org.jodconverter.document.DefaultDocumentFormatRegistry;
|
||||||
|
import org.jodconverter.office.*;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
public class DocConverterPdf {
|
public class DocConverterPdf {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(DocConverterPdf.class);
|
private static final Logger logger = LoggerFactory.getLogger(DocConverterPdf.class);
|
||||||
|
|
||||||
private static String OS_NAME = System.getProperty("os.name").toLowerCase();
|
@Autowired
|
||||||
|
private DocumentConverter converter;
|
||||||
|
|
||||||
private static final int ENVIRONMENT = 1;// 环境 1:windows 2:linux
|
private static final int ENVIRONMENT = 1;// 环境 1:windows 2:linux
|
||||||
private String fileString;// (只涉及pdf2swf路径问题)
|
private String fileString;// (只涉及pdf2swf路径问题)
|
||||||
@@ -24,6 +27,7 @@ public class DocConverterPdf {
|
|||||||
private File convertPdfFile;
|
private File convertPdfFile;
|
||||||
private File swfFile;
|
private File swfFile;
|
||||||
private File docFile;
|
private File docFile;
|
||||||
|
private String filesType;
|
||||||
String waterPdfPath;
|
String waterPdfPath;
|
||||||
|
|
||||||
private String convertHost;
|
private String convertHost;
|
||||||
@@ -51,6 +55,7 @@ public class DocConverterPdf {
|
|||||||
fileName = fileString.substring(0, fileString.lastIndexOf("."));
|
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())){
|
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);
|
docFile = new File(fileString);
|
||||||
|
filesType = fileType.toLowerCase();
|
||||||
convertPdfFile=new File(fileName+"_C"+ ".pdf");
|
convertPdfFile=new File(fileName+"_C"+ ".pdf");
|
||||||
pdfFile = new File(fileName + ".pdf");
|
pdfFile = new File(fileName + ".pdf");
|
||||||
swfFile = new File(fileName + ".swf");
|
swfFile = new File(fileName + ".swf");
|
||||||
@@ -60,6 +65,41 @@ public class DocConverterPdf {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* openOffice目录,window 可能在C://Program Files (x86)//OpenOffice 4
|
||||||
|
*/
|
||||||
|
private static final String openOfficeHome = "/opt/openoffice4";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* openOffice端口
|
||||||
|
*/
|
||||||
|
private static final int openOfficePort = 8100;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转化文档
|
||||||
|
* @param input
|
||||||
|
* @param output
|
||||||
|
*/
|
||||||
|
public void convertFile(File input , File output) throws OfficeException {
|
||||||
|
//转换,自动识别转化类型
|
||||||
|
OfficeManager officeManager = LocalOfficeManager.builder()
|
||||||
|
.install()
|
||||||
|
.officeHome(openOfficeHome)
|
||||||
|
.build();
|
||||||
|
try {
|
||||||
|
// Start an office process and connect to the started instance (on port 2002).
|
||||||
|
officeManager.start();
|
||||||
|
// Convert
|
||||||
|
JodConverter
|
||||||
|
.convert(input)
|
||||||
|
.to(output)
|
||||||
|
.execute();
|
||||||
|
} finally {
|
||||||
|
// Stop the office process
|
||||||
|
OfficeUtils.stopQuietly(officeManager);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转为PDF
|
* 转为PDF
|
||||||
*
|
*
|
||||||
@@ -67,22 +107,16 @@ public class DocConverterPdf {
|
|||||||
*/
|
*/
|
||||||
private void doc2pdf() throws Exception {
|
private void doc2pdf() throws Exception {
|
||||||
if (!pdfFile.exists()) {
|
if (!pdfFile.exists()) {
|
||||||
OpenOfficeConnection connection = null;
|
|
||||||
logger.info("转换服务地址接口:"+convertHost);
|
logger.info("转换服务地址接口:"+convertHost);
|
||||||
|
InputStream in = null;
|
||||||
|
OutputStream out = null;
|
||||||
try {
|
try {
|
||||||
if(StringUtils.isNotBlank(convertHost)){
|
// in = new FileInputStream(docFile);
|
||||||
connection = new SocketOpenOfficeConnection(convertHost,8100);
|
// out = new FileOutputStream(convertPdfFile);
|
||||||
}else{
|
convertFile(docFile,convertPdfFile);
|
||||||
connection = new SocketOpenOfficeConnection(8100);
|
// converter.convert(in).as(DefaultDocumentFormatRegistry.getFormatByMediaType(filesType)).
|
||||||
}
|
// to(out).as(DefaultDocumentFormatRegistry.PDF);
|
||||||
connection.connect();
|
|
||||||
DocumentConverter converter = new StreamOpenOfficeDocumentConverter(connection);
|
|
||||||
converter.convert(docFile, convertPdfFile);
|
|
||||||
|
|
||||||
//addWaterToPdf(pdfFile,userId);
|
|
||||||
|
|
||||||
// close the connection
|
// close the connection
|
||||||
connection.disconnect();
|
|
||||||
// 开始设置PDF文档相关属性保证其安全性
|
// 开始设置PDF文档相关属性保证其安全性
|
||||||
logger.info("开始设置转换后的PDF文件安全性相关设置");
|
logger.info("开始设置转换后的PDF文件安全性相关设置");
|
||||||
PDFEditUtils.setPDFFileSecurity(pdfFile.getAbsolutePath(),convertPdfFile.getAbsolutePath());
|
PDFEditUtils.setPDFFileSecurity(pdfFile.getAbsolutePath(),convertPdfFile.getAbsolutePath());
|
||||||
@@ -91,10 +125,6 @@ public class DocConverterPdf {
|
|||||||
logger.error(e.getMessage(),e);
|
logger.error(e.getMessage(),e);
|
||||||
logger.info("****pdf转换器异常,openoffice服务未启动!****");
|
logger.info("****pdf转换器异常,openoffice服务未启动!****");
|
||||||
throw e;
|
throw e;
|
||||||
} catch (com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException e) {
|
|
||||||
logger.error(e.getMessage(),e);
|
|
||||||
logger.info("****pdf转换器异常,读取转换文件失败****");
|
|
||||||
throw e;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e.getMessage(),e);
|
logger.error(e.getMessage(),e);
|
||||||
throw e;
|
throw e;
|
||||||
@@ -240,11 +270,6 @@ public class DocConverterPdf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setConvertHost(String convertHost) {
|
public void setConvertHost(String convertHost) {
|
||||||
OS_NAME = OS_NAME.toLowerCase();
|
this.convertHost = convertHost;
|
||||||
if (OS_NAME.contains("win")) {
|
|
||||||
this.convertHost = convertHost;
|
|
||||||
} else {
|
|
||||||
this.convertHost = "62.234.136.153";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ server.port=9999
|
|||||||
#主服务session超时
|
#主服务session超时
|
||||||
server.servlet.session.timeout =600
|
server.servlet.session.timeout =600
|
||||||
|
|
||||||
|
#tomcat /resource/local/version-manager 创建tomcat指定临时目录
|
||||||
|
server.tomcat.basedir=/resource/local/version-manager
|
||||||
|
|
||||||
# http-only
|
# http-only
|
||||||
server.session.cookie.http-only=true
|
server.session.cookie.http-only=true
|
||||||
spring.mvc.async.request-timeout=20000
|
spring.mvc.async.request-timeout=20000
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.adc.da.scheduled.entity.DataDTO;
|
|||||||
import com.adc.da.scheduled.entity.WarningEO;
|
import com.adc.da.scheduled.entity.WarningEO;
|
||||||
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
|
import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
|
||||||
import com.adc.da.slrs.sarStandAttrInfo.entity.SarStandAttrInfo;
|
import com.adc.da.slrs.sarStandAttrInfo.entity.SarStandAttrInfo;
|
||||||
|
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
|
||||||
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
|
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
|
||||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||||
import com.adc.da.util.UUIDUtils;
|
import com.adc.da.util.UUIDUtils;
|
||||||
@@ -54,8 +55,8 @@ public class ScheduledJob {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行
|
@Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行
|
||||||
@Scheduled(cron="*/5 * * * * ?")
|
// @Scheduled(cron="*/5 * * * * ?")
|
||||||
@Async
|
@Async
|
||||||
public void WarningSchedulingTasks() {
|
public void WarningSchedulingTasks() {
|
||||||
|
|
||||||
@@ -76,61 +77,84 @@ public class ScheduledJob {
|
|||||||
1:新车条款预警
|
1:新车条款预警
|
||||||
2:在产车条款预警
|
2:在产车条款预警
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//删除不在预警范围的标准
|
||||||
|
QueryWrapper<EarlyWarningEO> earlyWarningEOQW = new QueryWrapper<>();
|
||||||
|
earlyWarningEOQW.lt("PUT_TIME",LocalDate.now());
|
||||||
|
int remove = sarStandardWarningDao.delete(earlyWarningEOQW);
|
||||||
|
System.out.println(remove);
|
||||||
|
|
||||||
|
|
||||||
System.out.println("开始执行预警!!!");
|
System.out.println("开始执行预警!!!");
|
||||||
|
|
||||||
DataDTO term = new DataDTO(); //预警期限(当前日期至3个月后)
|
DataDTO term = new DataDTO(); //预警期限(当前日期至3个月后)
|
||||||
|
|
||||||
LinkedList<WarningEO> warningList = new LinkedList<>();//需预警的标准和条款列表集合
|
LinkedList<WarningEO> warningList = new LinkedList<>();//需预警的标准和条款列表集合
|
||||||
//分解单(条款) 新车型 mark=1
|
//分解单(条款) 新车型 mark=1
|
||||||
List<WarningEO> itemForXCXSSRQ = sarStandardItemDao.selectWithinTerm(term, "XCXSSRQ", "APPLY_ARCTIC");
|
List<WarningEO> itemForXCXSSRQ = sarStandardItemDao.selectWithinTerm(term, "XCXSSRQ");
|
||||||
for (WarningEO warningEO : itemForXCXSSRQ) {
|
for (WarningEO warningEO : itemForXCXSSRQ) {
|
||||||
warningEO.setId(UUIDUtils.randomUUID20())
|
warningEO.setId(UUIDUtils.randomUUID20())
|
||||||
.setPower("1")
|
.setPower("1")
|
||||||
.setMark("1")
|
.setMark("1")
|
||||||
.setPutTime(warningEO.getXCXSSRQ())
|
.setPutTime(warningEO.getXCXSSRQ());
|
||||||
.setApplyType(warningEO.getApplyType());
|
|
||||||
}
|
}
|
||||||
warningList.addAll(itemForXCXSSRQ);
|
warningList.addAll(itemForXCXSSRQ);
|
||||||
|
|
||||||
//分解单(条款) 在产车型 mark=2
|
//分解单(条款) 在产车型 mark=2
|
||||||
List<WarningEO> itemForZCCSSRQ = sarStandardItemDao.selectWithinTerm(term, "ZCCSSRQ", "APPLY_ARCTIC");
|
List<WarningEO> itemForZCCSSRQ = sarStandardItemDao.selectWithinTerm(term, "ZCCSSRQ");
|
||||||
for (WarningEO warningEO : itemForZCCSSRQ) {
|
for (WarningEO warningEO : itemForZCCSSRQ) {
|
||||||
warningEO.setId(UUIDUtils.randomUUID20())
|
warningEO.setId(UUIDUtils.randomUUID20())
|
||||||
.setPower("1")
|
.setPower("1")
|
||||||
.setMark("2")
|
.setMark("2")
|
||||||
.setPutTime(warningEO.getZCCSSRQ())
|
.setPutTime(warningEO.getZCCSSRQ());
|
||||||
.setApplyType(warningEO.getApplyType());
|
|
||||||
}
|
}
|
||||||
warningList.addAll(itemForZCCSSRQ);
|
warningList.addAll(itemForZCCSSRQ);
|
||||||
|
|
||||||
//标准 新车型 预警 mark=3
|
//标准 新车型 预警 mark=3
|
||||||
List<WarningEO> standInfoXCXSSRQ = sarStandardInfoDao.selectWithinTerm(term, "XCXSSRQ", "CLLX");
|
List<WarningEO> standInfoXCXSSRQ = sarStandardInfoDao.selectWithinTerm(term, "XCXSSRQ");
|
||||||
for (WarningEO warningEO : standInfoXCXSSRQ) {
|
for (WarningEO warningEO : standInfoXCXSSRQ) {
|
||||||
warningEO.setId(UUIDUtils.randomUUID20())
|
warningEO.setId(UUIDUtils.randomUUID20())
|
||||||
|
/**
|
||||||
|
* //如果插入的值均为NULL,则根据索引的原理,
|
||||||
|
* 全NULL值不被记录在索引上,所以插入全NULL值时,可以有重复的
|
||||||
|
* 则此处设为 '-1'
|
||||||
|
*/
|
||||||
|
.setItemsId("-1")
|
||||||
.setPower("1")
|
.setPower("1")
|
||||||
.setMark("3")
|
.setMark("3")
|
||||||
.setPutTime(warningEO.getXCXSSRQ())
|
|
||||||
.setApplyType(warningEO.getApplyType())
|
|
||||||
.setStandCode(warningEO.getStandSort()+" "+ warningEO.getStandNum()+"-"+ warningEO.getStandYear());
|
.setStandCode(warningEO.getStandSort()+" "+ warningEO.getStandNum()+"-"+ warningEO.getStandYear());
|
||||||
|
|
||||||
|
//实施日期达到预警时间,但新车型实施日期不在时间内
|
||||||
|
if (term.isTerm(warningEO.getXCXSSRQ())){
|
||||||
|
warningEO.setPutTime(warningEO.getXCXSSRQ());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
warningList.addAll(standInfoXCXSSRQ);
|
warningList.addAll(standInfoXCXSSRQ);
|
||||||
|
|
||||||
|
|
||||||
//标准 在产车型 mark=4
|
//标准 在产车型 mark=4
|
||||||
List<WarningEO> standInfoZCCSSRQ = sarStandardInfoDao.selectWithinTerm(term, "ZCCSSRQ", "CLLX");
|
List<WarningEO> standInfoZCCSSRQ = sarStandardInfoDao.selectWithinTerm(term, "ZCCSSRQ");
|
||||||
for (WarningEO warningEO : standInfoZCCSSRQ) {
|
for (WarningEO warningEO : standInfoZCCSSRQ) {
|
||||||
warningEO.setId(UUIDUtils.randomUUID20())
|
warningEO.setId(UUIDUtils.randomUUID20())
|
||||||
|
/**
|
||||||
|
* 同上
|
||||||
|
*/
|
||||||
|
.setItemsId("-1")
|
||||||
.setPower("1")
|
.setPower("1")
|
||||||
.setMark("4")
|
.setMark("4")
|
||||||
.setPutTime(warningEO.getZCCSSRQ())
|
|
||||||
.setApplyType(warningEO.getApplyType())
|
|
||||||
.setStandCode(warningEO.getStandSort()+" "+ warningEO.getStandNum()+"-"+ warningEO.getStandYear());
|
.setStandCode(warningEO.getStandSort()+" "+ warningEO.getStandNum()+"-"+ warningEO.getStandYear());
|
||||||
|
//实施日期达到预警时间,但在产车实施日期不在时间内
|
||||||
|
if (term.isTerm(warningEO.getZCCSSRQ())){
|
||||||
|
warningEO.setPutTime(warningEO.getZCCSSRQ());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
warningList.addAll(standInfoZCCSSRQ);
|
warningList.addAll(standInfoZCCSSRQ);
|
||||||
|
|
||||||
//持久化至预警表 忽略标准id和标志位都一样的数据
|
//持久化至预警表 忽略标准id和标志位都一样的数据
|
||||||
if (warningList.size()!=0){
|
if (warningList.size()!=0){
|
||||||
//此表的STAND_ID和MARK字段以及ITEMS_ID和MARK字段需两个建立唯一性约束
|
//此表的STAND_ID和MARK字段以及ITEMS_ID字段需个建立唯一性约束
|
||||||
int count = sarStandardWarningDao.ignoreInsert(warningList);
|
int count = sarStandardWarningDao.ignoreInsert(warningList);
|
||||||
System.out.println("已预警 " + count + " 条标准或条款!!");
|
System.out.println("已预警 " + count + " 条标准或条款!!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.adc.da.scheduled.dao;
|
package com.adc.da.scheduled.dao;
|
||||||
|
|
||||||
import com.adc.da.scheduled.entity.WarningEO;
|
import com.adc.da.scheduled.entity.WarningEO;
|
||||||
|
import com.adc.da.slrs.sarStandWarning.entity.EarlyWarningEO;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@@ -9,7 +11,7 @@ import org.springframework.stereotype.Repository;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface SarStandardWarningDao extends IService<WarningEO> {
|
public interface SarStandardWarningDao extends BaseMapper<EarlyWarningEO> {
|
||||||
|
|
||||||
public int ignoreInsert(@Param(value = "warningEOS") LinkedList<WarningEO> warningEOS);
|
public int ignoreInsert(@Param(value = "warningEOS") LinkedList<WarningEO> warningEOS);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,18 @@
|
|||||||
package com.adc.da.scheduled.entity;
|
package com.adc.da.scheduled.entity;
|
||||||
|
|
||||||
|
import com.alibaba.druid.sql.visitor.functions.Char;
|
||||||
|
import com.sun.org.apache.bcel.internal.generic.NEW;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@@ -13,21 +21,56 @@ public class DataDTO {
|
|||||||
* 预警的期限为系统日期的次日至3个月后
|
* 预警的期限为系统日期的次日至3个月后
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
|
||||||
private LocalDate startDate;
|
private String startDate;
|
||||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
|
||||||
private LocalDate endDate;
|
private String endDate;
|
||||||
|
|
||||||
// private String str;
|
// private String str;
|
||||||
|
|
||||||
public DataDTO() {
|
public DataDTO() {
|
||||||
this.startDate =LocalDate.now().plusDays(1); //系统当前日期
|
LocalDate starDate = LocalDate.now();//系统当前日期
|
||||||
this.endDate = LocalDate.now().plusMonths(3);//系统当前日期3个月后
|
LocalDate endDate = LocalDate.now().plusMonths(3);//系统当前日期3个月后
|
||||||
|
|
||||||
|
convertToStr(starDate,endDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataDTO(LocalDate startDate,LocalDate endDate){
|
public DataDTO(LocalDate startDate,LocalDate endDate){
|
||||||
this.startDate=startDate;
|
convertToStr(startDate,endDate);
|
||||||
this.endDate=endDate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//判断日期是否在期限内
|
||||||
|
public boolean isTerm(Date date) {
|
||||||
|
|
||||||
|
|
||||||
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String dateString = formatter.format(date);
|
||||||
|
int compareStart = dateString.compareTo(startDate);
|
||||||
|
int compareEnd = dateString.compareTo(startDate);
|
||||||
|
if (compareStart >= 0 && compareEnd <=0) {
|
||||||
|
return true;
|
||||||
|
} else return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 此时的mybatis-plus对localDate类型没有完全支持,则转换为字符串使用
|
||||||
|
* @param startDate
|
||||||
|
* @param endDate
|
||||||
|
*/
|
||||||
|
public void convertToStr(LocalDate startDate,LocalDate endDate){
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用DateTimeFormatter线程安全,但不晓得怎么支持Date类型转换为字符串 ¯\_(ツ)_/¯
|
||||||
|
*/
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
|
||||||
|
// SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");//线程不安全且不支持LocalDate
|
||||||
|
|
||||||
|
this.startDate =formatter.format(startDate);
|
||||||
|
this.endDate=formatter.format(endDate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ public class WarningEO extends EarlyWarningEO {
|
|||||||
@DateTimeFormat(pattern = "YYYY-MM-dd")
|
@DateTimeFormat(pattern = "YYYY-MM-dd")
|
||||||
private Date ZCCSSRQ;
|
private Date ZCCSSRQ;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = "YYYY-MM-dd")
|
||||||
|
private Date SSRQ;
|
||||||
|
|
||||||
private String standNum;
|
private String standNum;
|
||||||
|
|
||||||
private String standSort;
|
private String standSort;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import lombok.experimental.Accessors;
|
|||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
+1
-3
@@ -172,9 +172,7 @@ public class EarlyWarningEOServiceImpl extends ServiceImpl<EarlyWarningEODao, Ea
|
|||||||
return "更改成功";
|
return "更改成功";
|
||||||
}
|
}
|
||||||
private IPage<EarlyWarningEO> getEarlyWarningEOIPage(int current,int pageSize, QueryWrapper<EarlyWarningEO> wrapper) {
|
private IPage<EarlyWarningEO> getEarlyWarningEOIPage(int current,int pageSize, QueryWrapper<EarlyWarningEO> wrapper) {
|
||||||
DataDTO dataDTO = new DataDTO();
|
wrapper.eq("power",1);
|
||||||
wrapper.eq("power",1)
|
|
||||||
.between("PUT_TIME",dataDTO.getStartDate(),dataDTO.getEndDate());
|
|
||||||
Page<EarlyWarningEO> page = new Page<>(current, pageSize);
|
Page<EarlyWarningEO> page = new Page<>(current, pageSize);
|
||||||
IPage<EarlyWarningEO> userIPage = earlyWarningEODao.selectPage(page, wrapper);
|
IPage<EarlyWarningEO> userIPage = earlyWarningEODao.selectPage(page, wrapper);
|
||||||
System.out.println("总条数"+userIPage.getTotal());
|
System.out.println("总条数"+userIPage.getTotal());
|
||||||
|
|||||||
+9
@@ -135,4 +135,13 @@ public class SarStandFileEOController extends BaseController<SarStandFileEO> {
|
|||||||
return Result.success(getPageInfo(page.getPager(), rows));
|
return Result.success(getPageInfo(page.getPager(), rows));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "查询文本信息")
|
||||||
|
@GetMapping("/queryFileInfo")
|
||||||
|
public ResponseMessage<List<SarStandFileEO>> queryFileInfo(String standId){
|
||||||
|
|
||||||
|
List<SarStandFileEO> sarStandFileEOS = sarStandFileEOService.selectFileByStandId(standId);
|
||||||
|
return Result.success(sarStandFileEOS);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
package com.adc.da.slrs.standardSplit.entity;
|
package com.adc.da.slrs.standardSplit.entity;
|
||||||
|
|
||||||
import com.adc.da.base.entity.BaseEntity;
|
import com.adc.da.base.entity.BaseEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -12,14 +17,22 @@ import java.util.List;
|
|||||||
* <b>日期:</b> 2018-09-03 <br>
|
* <b>日期:</b> 2018-09-03 <br>
|
||||||
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("sar_stand_file")
|
||||||
public class SarStandFileEO extends BaseEntity {
|
public class SarStandFileEO extends BaseEntity {
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
@org.springframework.format.annotation.DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
@org.springframework.format.annotation.DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
private Date modifyTime;
|
private Date modifyTime;
|
||||||
|
@TableField(exist = false)
|
||||||
@org.springframework.format.annotation.DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
@org.springframework.format.annotation.DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
private Date creationTime;
|
private Date creationTime;
|
||||||
|
@TableLogic(value = "0",delval = "1")
|
||||||
private String validFlag;
|
private String validFlag;
|
||||||
|
|
||||||
|
@TableField("USE_MODEL")
|
||||||
private String useModel;
|
private String useModel;
|
||||||
|
@TableField("ATT_ID")
|
||||||
private String attId;
|
private String attId;
|
||||||
|
|
||||||
public String getAttId1() {
|
public String getAttId1() {
|
||||||
@@ -29,23 +42,39 @@ public class SarStandFileEO extends BaseEntity {
|
|||||||
public void setAttId1(String attId1) {
|
public void setAttId1(String attId1) {
|
||||||
this.attId1 = attId1;
|
this.attId1 = attId1;
|
||||||
}
|
}
|
||||||
|
@TableField(exist = false)
|
||||||
private String attId1;
|
private String attId1;
|
||||||
|
@TableField(exist = false)
|
||||||
private String resId;
|
private String resId;
|
||||||
|
@TableField("STAND_ID")
|
||||||
private String standId;
|
private String standId;
|
||||||
|
@TableId("id")
|
||||||
private String id;
|
private String id;
|
||||||
|
@TableField(exist = false)
|
||||||
private Integer pageCount;
|
private Integer pageCount;
|
||||||
|
@TableField(exist = false)
|
||||||
private String fileOldName;
|
private String fileOldName;
|
||||||
|
@TableField(exist = false)
|
||||||
private List<String> idlist = new ArrayList<>();
|
private List<String> idlist = new ArrayList<>();
|
||||||
|
@TableField("STAND_FILE_CLASSIFY")
|
||||||
private String standFileClassify;
|
private String standFileClassify;
|
||||||
|
@TableField(exist = false)
|
||||||
private String standFileClassifyShow;
|
private String standFileClassifyShow;
|
||||||
|
@TableField(exist = false)
|
||||||
private String fileSuffix;
|
private String fileSuffix;
|
||||||
|
@TableField("FILE_NAME")
|
||||||
private String fileName;
|
private String fileName;
|
||||||
|
@TableField(exist = false)
|
||||||
private String password;
|
private String password;
|
||||||
|
@TableField(exist = false)
|
||||||
private String creationUser;
|
private String creationUser;
|
||||||
|
@TableField(exist = false)
|
||||||
private String standNumber;
|
private String standNumber;
|
||||||
|
@TableField(exist = false)
|
||||||
private String standName;
|
private String standName;
|
||||||
|
@TableField(exist = false)
|
||||||
private String sarType;
|
private String sarType;
|
||||||
|
@TableField("ORI_ATT_ID")
|
||||||
private String oriAttId;
|
private String oriAttId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -103,7 +132,7 @@ public class SarStandFileEO extends BaseEntity {
|
|||||||
default: return null;
|
default: return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** **/
|
/** **/
|
||||||
public Date getModifyTime() {
|
public Date getModifyTime() {
|
||||||
return this.modifyTime;
|
return this.modifyTime;
|
||||||
|
|||||||
+3
@@ -22,4 +22,7 @@ public interface SarStandFileEOService {
|
|||||||
int deleteByPrimaryKey(String id) throws Exception;
|
int deleteByPrimaryKey(String id) throws Exception;
|
||||||
|
|
||||||
List<SarStandFileEO> selectFileByAttId(String attId) throws Exception;
|
List<SarStandFileEO> selectFileByAttId(String attId) throws Exception;
|
||||||
|
|
||||||
|
List<SarStandFileEO> selectFileByStandId(String standId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+9
@@ -5,6 +5,7 @@ import com.adc.da.slrs.standardSplit.dao.SarStandFileEODao;
|
|||||||
import com.adc.da.slrs.standardSplit.entity.SarStandFileEO;
|
import com.adc.da.slrs.standardSplit.entity.SarStandFileEO;
|
||||||
import com.adc.da.slrs.standardSplit.entity.SarStandFileEOPage;
|
import com.adc.da.slrs.standardSplit.entity.SarStandFileEOPage;
|
||||||
import com.adc.da.slrs.standardSplit.service.SarStandFileEOService;
|
import com.adc.da.slrs.standardSplit.service.SarStandFileEOService;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -63,4 +64,12 @@ public class SarStandFileEOServiceImpl implements SarStandFileEOService {
|
|||||||
return sarStandFileEODao.selectFileByAttId(attId);
|
return sarStandFileEODao.selectFileByAttId(attId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SarStandFileEO> selectFileByStandId(String standId) {
|
||||||
|
QueryWrapper<SarStandFileEO> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("STAND_ID",standId).groupBy("ORI_ATT_ID");
|
||||||
|
return sarStandFileEODao.selectList(queryWrapper);
|
||||||
|
// return sarStandFileEODao.selectFileByStandId(standId);r
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<select id="selectLawsId" resultType="string">
|
<select id="selectLawsId" resultType="string">
|
||||||
select distinct stand_id from sar_laws_attr_detailed_list
|
select stand_id from sar_laws_attr_detailed_list
|
||||||
LEFT JOIN sar_standards_info si ON sar_laws_attr_detailed_list.stand_id = si.ID
|
LEFT JOIN sar_standards_info si ON sar_laws_attr_detailed_list.stand_id = si.ID
|
||||||
<where>
|
<where>
|
||||||
<if test="standId != null">
|
<if test="standId != null">
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
<result column="STAND_YEAR" property="standYear"/>
|
<result column="STAND_YEAR" property="standYear"/>
|
||||||
<result column="XCXSSRQ" property="XCXSSRQ"/>
|
<result column="XCXSSRQ" property="XCXSSRQ"/>
|
||||||
<result column="ZCCSSRQ" property="ZCCSSRQ"/>
|
<result column="ZCCSSRQ" property="ZCCSSRQ"/>
|
||||||
|
<result column="SSRQ" property="SSRQ"/>
|
||||||
<result column="CLLX" property="applyType" />
|
<result column="CLLX" property="applyType" />
|
||||||
<result column="STAND_TYPE" property="standType" />
|
<result column="STAND_TYPE" property="standType" />
|
||||||
<result column="ZRGCS" property="dutyEngineer" />
|
<result column="ZRGCS" property="dutyEngineer" />
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
info.STAND_TYPE,
|
info.STAND_TYPE,
|
||||||
attrInfo.CLLX,
|
attrInfo.CLLX,
|
||||||
attrInfo.ZRGCS,
|
attrInfo.ZRGCS,
|
||||||
|
attrInfo.SSRQ,
|
||||||
attrInfo.${str}
|
attrInfo.${str}
|
||||||
FROM
|
FROM
|
||||||
sar_standards_info AS info
|
sar_standards_info AS info
|
||||||
@@ -35,9 +37,11 @@
|
|||||||
1=1
|
1=1
|
||||||
<if test="date!=null">
|
<if test="date!=null">
|
||||||
and
|
and
|
||||||
|
attrInfo.SSRQ
|
||||||
|
BETWEEN #{date.startDate} and #{date.endDate}
|
||||||
|
or
|
||||||
attrInfo.${str}
|
attrInfo.${str}
|
||||||
BETWEEN DATE_FORMAT( #{date.startDate},'%Y-%m-%d %H:%i:%s')
|
BETWEEN #{date.startDate} and #{date.endDate}
|
||||||
and DATE_FORMAT( #{date.endDate},'%Y-%m-%d %H:%i:%s')
|
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
|
||||||
|
|||||||
@@ -20,22 +20,24 @@
|
|||||||
<select id="selectWithinTerm" resultMap="resultMap" parameterType="com.adc.da.scheduled.entity.DataDTO">
|
<select id="selectWithinTerm" resultMap="resultMap" parameterType="com.adc.da.scheduled.entity.DataDTO">
|
||||||
SELECT
|
SELECT
|
||||||
items.ID,
|
items.ID,
|
||||||
STAND_ID,
|
items.ITEMS_NUM,
|
||||||
ITEMS_NUM,
|
items.ITEMS_NAME,
|
||||||
ITEMS_NAME,
|
items.TERMS_CONDITIONS,
|
||||||
TERMS_CONDITIONS,
|
items.DUTY_ENGINEER,
|
||||||
DUTY_ENGINEER,
|
items.STAND_ID,
|
||||||
APPLY_ARCTIC,
|
info.STAND_NAME,
|
||||||
info.STAND_TYPE,
|
info.STAND_TYPE,
|
||||||
info.STAND_NUMBER,
|
info.STAND_NUMBER,
|
||||||
|
attrInfo.CLLX,
|
||||||
${str}
|
attrInfo.ZRGCS,
|
||||||
|
items.${str}
|
||||||
FROM
|
FROM
|
||||||
sar_stand_items AS items
|
sar_stand_items AS items
|
||||||
JOIN sar_standards_info AS info ON items.STAND_ID=info.ID
|
JOIN sar_standards_info AS info ON items.STAND_ID=info.ID
|
||||||
|
JOIN sar_stand_attr_info AS attrInfo ON info.id = attrinfo.stand_id
|
||||||
|
|
||||||
WHERE
|
WHERE
|
||||||
${str} BETWEEN #{date.startDate} and #{date.endDate}
|
items.${str} BETWEEN #{date.startDate} and #{date.endDate}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<insert id="ignoreInsert" parameterType="java.util.LinkedList">
|
<insert id="ignoreInsert" parameterType="java.util.LinkedList">
|
||||||
|
|
||||||
INSERT IGNORE INTO sar_stand_warning (ID,STAND_ID, STAND_TYPE, STAND_CODE,STAND_NAME,PUT_TIME,APPLY_TYPE,DUTY_ENGINEER,ITEMS_ID,ITEMS_NUM,ITEMS_NAME,POLICY_ID,POLICY_NAME,MARK,POWER)
|
REPLACE INTO sar_stand_warning (ID,STAND_ID, STAND_TYPE, STAND_CODE,STAND_NAME,PUT_TIME,APPLY_TYPE,DUTY_ENGINEER,ITEMS_ID,ITEMS_NUM,ITEMS_NAME,POLICY_ID,POLICY_NAME,MARK,POWER)
|
||||||
VALUES
|
VALUES
|
||||||
<if test="warningEOS !=null and warningEOS.size()!=0">
|
<if test="warningEOS !=null and warningEOS.size()!=0">
|
||||||
<foreach collection="warningEOS" item="item" index="index" separator=",">
|
<foreach collection="warningEOS" item="item" index="index" separator=",">
|
||||||
|
|||||||
@@ -164,7 +164,11 @@ public class OCRRestfulServiceImpl implements OCRRestfulService {
|
|||||||
saveWordFileName=UUIDUtils.randomUUID20()+"_"+wordFile.getOriginalFilename();
|
saveWordFileName=UUIDUtils.randomUUID20()+"_"+wordFile.getOriginalFilename();
|
||||||
saveWordFilePath=ocrFilePath+saveWordFileName;
|
saveWordFilePath=ocrFilePath+saveWordFileName;
|
||||||
logger.info(saveWordFilePath);
|
logger.info(saveWordFilePath);
|
||||||
FileUtils.copyInputStreamToFile(wordFile.getInputStream(),new File(saveWordFilePath));
|
//生成保存文件
|
||||||
|
File saveWordFile = new File(saveWordFilePath);
|
||||||
|
System.out.println(saveWordFile);
|
||||||
|
wordFile.transferTo(saveWordFile);
|
||||||
|
// FileUtils.copyInputStreamToFile(wordFile.getInputStream(),new File(saveWordFilePath));
|
||||||
// savePic(wordFile.getInputStream(),saveWordFilePath);
|
// savePic(wordFile.getInputStream(),saveWordFilePath);
|
||||||
logger.info("word存储完成");
|
logger.info("word存储完成");
|
||||||
}
|
}
|
||||||
@@ -174,7 +178,10 @@ public class OCRRestfulServiceImpl implements OCRRestfulService {
|
|||||||
saveJsonFileName=UUIDUtils.randomUUID20()+"_"+jsonFile.getOriginalFilename();
|
saveJsonFileName=UUIDUtils.randomUUID20()+"_"+jsonFile.getOriginalFilename();
|
||||||
saveJsonFilePath=ocrFilePath+saveJsonFileName;
|
saveJsonFilePath=ocrFilePath+saveJsonFileName;
|
||||||
logger.info(saveJsonFilePath);
|
logger.info(saveJsonFilePath);
|
||||||
FileUtils.copyInputStreamToFile(jsonFile.getInputStream(),new File(saveJsonFilePath));
|
File saveJsonFile = new File(saveJsonFilePath);
|
||||||
|
System.out.println(saveJsonFile);
|
||||||
|
wordFile.transferTo(saveJsonFile);
|
||||||
|
// FileUtils.copyInputStreamToFile(jsonFile.getInputStream(),new File(saveJsonFilePath));
|
||||||
// savePic(jsonFile.getInputStream(),saveJsonFilePath);
|
// savePic(jsonFile.getInputStream(),saveJsonFilePath);
|
||||||
logger.info("Json存储完成");
|
logger.info("Json存储完成");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user