Merge remote-tracking branch 'origin/develop_master' into develop_1

This commit is contained in:
yanyizhou
2021-08-30 15:26:10 +08:00
15 changed files with 210 additions and 115 deletions
+5 -13
View File
@@ -24,19 +24,11 @@
</dependency> </dependency>
<!-- openOffice 和 jobconverter--> <!-- openOffice 和 jobconverter-->
<dependency> <dependency>
<groupId>org.jodconverter</groupId> <groupId>com.artofsolving</groupId>
<artifactId>jodconverter-core</artifactId> <artifactId>jodconverter</artifactId>
<version>4.2.2</version> <scope>system</scope>
</dependency> <version>2.2.2</version>
<dependency> <systemPath>${basedir}/src/main/lib/jodconverter-2.2.2.jar</systemPath>
<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>
@@ -1,25 +1,19 @@
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.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.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);
@Autowired
private DocumentConverter converter;
private static final int ENVIRONMENT = 1;// 环境 1windows 2:linux private static final int ENVIRONMENT = 1;// 环境 1windows 2:linux
private String fileString;// (只涉及pdf2swf路径问题) private String fileString;// (只涉及pdf2swf路径问题)
private String outputPath = "";// 输入路径 ,如果不设置就输出在默认的位置 private String outputPath = "";// 输入路径 ,如果不设置就输出在默认的位置
@@ -28,7 +22,6 @@ 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;
@@ -56,7 +49,6 @@ 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");
@@ -66,38 +58,6 @@ 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 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 * 转为PDF
* *
@@ -105,16 +65,22 @@ 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 {
// in = new FileInputStream(docFile); if(StringUtils.isNotBlank(convertHost)){
// out = new FileOutputStream(convertPdfFile); connection = new SocketOpenOfficeConnection(convertHost,8100);
convertFile(docFile,convertPdfFile); }else{
// converter.convert(in).as(DefaultDocumentFormatRegistry.getFormatByMediaType(filesType)). connection = new SocketOpenOfficeConnection(8100);
// 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());
@@ -123,6 +89,10 @@ 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;
@@ -5,8 +5,12 @@ import com.adc.da.scheduled.dao.SarStandardItemDao;
import com.adc.da.scheduled.dao.SarStandardWarningDao; import com.adc.da.scheduled.dao.SarStandardWarningDao;
import com.adc.da.scheduled.entity.DataDTO; 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.sarStandWarning.entity.EarlyWarningEO; import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao;
import com.adc.da.slrs.sarStandAttrInfo.entity.SarStandAttrInfo;
import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
import com.adc.da.util.UUIDUtils; import com.adc.da.util.UUIDUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@@ -18,6 +22,7 @@ import org.springframework.stereotype.Component;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map;
@EnableScheduling @EnableScheduling
@Component @Component
@@ -31,35 +36,28 @@ public class ScheduledJob {
@Value("${isNotScheduled}") @Value("${isNotScheduled}")
private boolean 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 @Autowired
private SarStandardWarningDao sarStandardWarningDao; private SarStandardInfoDao sarStandardInfoDao; //标准信息表
@Autowired @Autowired
private SarStandardItemDao sarStandardItemDao; private SarStandardsInfoDao sarStandardsInfoDao;//标准信息表
@Autowired @Autowired
private SarStandardInfoDao sarStandardInfoDao; private SarStandardWarningDao sarStandardWarningDao;//预警表
@Autowired
private SarStandardItemDao sarStandardItemDao; //分解单表
@Autowired
private SarStandAttrInfoDao sarStandAttrInfoDao; //属性字段表
@Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行 @Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行
// @Scheduled(cron="*/5 * * * * ?") // @Scheduled(cron="*/5 * * * * ?")
@Async @Async
public void schedulingTasks() { public void WarningSchedulingTasks() {
/** /**
@@ -79,12 +77,12 @@ public class ScheduledJob {
2:在产车条款预警 2:在产车条款预警
*/ */
System.out.println("开始执行预警!!!"); System.out.println("开始执行预警!!!");
//预警期限
DataDTO term = new DataDTO();
LinkedList<WarningEO> warningList = new LinkedList<>();
DataDTO term = new DataDTO(); //预警期限(当前日期至3个月后)
LinkedList<WarningEO> warningList = new LinkedList<>();//需预警的标准和条款列表集合
//分解单(条款) 新车型 mark=1 //分解单(条款) 新车型 mark=1
List<WarningEO> itemForXCXSSRQ = sarStandardItemDao.select(term, "XCXSSRQ"); 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")
@@ -94,7 +92,7 @@ public class ScheduledJob {
warningList.addAll(itemForXCXSSRQ); warningList.addAll(itemForXCXSSRQ);
//分解单(条款) 在产车型 mark=2 //分解单(条款) 在产车型 mark=2
List<WarningEO> itemForZCCSSRQ = sarStandardItemDao.select(term, "ZCCSSRQ"); 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")
@@ -104,33 +102,110 @@ public class ScheduledJob {
warningList.addAll(itemForZCCSSRQ); warningList.addAll(itemForZCCSSRQ);
//标准 新车型 预警 mark=3 //标准 新车型 预警 mark=3
List<WarningEO> standInfoXCXSSRQ = sarStandardInfoDao.select(term, "XCXSSRQ"); List<WarningEO> standInfoXCXSSRQ = sarStandardInfoDao.selectWithinTerm(term, "XCXSSRQ");
for (WarningEO warningEO : standInfoXCXSSRQ) { for (WarningEO warningEO : standInfoXCXSSRQ) {
warningEO.setId(UUIDUtils.randomUUID20()) warningEO.setId(UUIDUtils.randomUUID20())
.setPower("1") .setPower("1")
.setMark("3") .setMark("3")
.setPutTime(warningEO.getXCXSSRQ()) .setPutTime(warningEO.getXCXSSRQ())
.setStandCode(warningEO.getStandSort()+" "+warningEO.getStandNum()+"-"+warningEO.getStandYear()); .setStandCode(warningEO.getStandSort()+" "+ warningEO.getStandNum()+"-"+ warningEO.getStandYear());
} }
warningList.addAll(standInfoXCXSSRQ); warningList.addAll(standInfoXCXSSRQ);
//标准 在产车型 mark=4 //标准 在产车型 mark=4
List<WarningEO> standInfoZCCSSRQ = sarStandardInfoDao.select(term, "ZCCSSRQ"); List<WarningEO> standInfoZCCSSRQ = sarStandardInfoDao.selectWithinTerm(term, "ZCCSSRQ");
for (WarningEO warningEO : standInfoZCCSSRQ) { for (WarningEO warningEO : standInfoZCCSSRQ) {
warningEO.setId(UUIDUtils.randomUUID20()) warningEO.setId(UUIDUtils.randomUUID20())
.setPower("1") .setPower("1")
.setMark("4") .setMark("4")
.setPutTime(warningEO.getZCCSSRQ()) .setPutTime(warningEO.getZCCSSRQ())
.setStandCode(warningEO.getStandSort()+" "+warningEO.getStandNum()+"-"+warningEO.getStandYear()); .setStandCode(warningEO.getStandSort()+" "+ warningEO.getStandNum()+"-"+ warningEO.getStandYear());
} }
warningList.addAll(standInfoZCCSSRQ); warningList.addAll(standInfoZCCSSRQ);
//持久化至预警表 忽略标准id和标志位都一样的数据 //持久化至预警表 忽略标准id和标志位都一样的数据
if (warningList.size()!=0){ if (warningList.size()!=0){
//此表的STAND_CODE和MARK字段需建立唯一性约束 //此表的STAND_ID和MARK字段以及ITEMS_ID和MARK字段需两个建立唯一性约束
int count = sarStandardWarningDao.ignoreInsert(warningList); int count = sarStandardWarningDao.ignoreInsert(warningList);
System.out.println("已预警 " + count + " 条标准或条款!!"); System.out.println("已预警 " + count + " 条标准或条款!!");
} }
} }
// @Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行
@Scheduled(cron="*/5 * * * * ?")
@Async
public void TextStatusSchedulingTasks() {
QueryWrapper<SarStandardsInfo> wrapper = new QueryWrapper<>();
DataDTO data = new DataDTO(LocalDate.now(), LocalDate.now());
/**
*实施日期是当前系统时间的标准文本状态变为'现行有效'
*/
QueryWrapper<SarStandAttrInfo> columnsAndCondition = new QueryWrapper<>();
columnsAndCondition.select("STAND_ID").like("SSRQ",LocalDate.now());
List<Map<String, Object>> effectiveList=sarStandAttrInfoDao.selectMaps(columnsAndCondition);
// List<ScheduledDTO> effectiveList = sarStandardInfoDao.selectWithinTerm(data, "SSRQ");
effectiveList.forEach(item->{
try {
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
sarStandardsInfo.setId(item.get("STAND_ID").toString());
sarStandardsInfo.setTextStatus("vsaga7nwub");
sarStandardsInfoDao.updateById(sarStandardsInfo);
// sarStandardInfoDao.updateStandardInfo(item.getStandId(),"vsaga7nwub");
}catch (Exception e){
System.out.println("标准id为=="+item.get("STAND_ID").toString()+"==文本状态更新失败");
}
});
/**
* 被多个标准代替的标准变为“被代替”,只有一个被代替的自动变为“废止”
*/
QueryWrapper<SarStandAttrInfo> columns = new QueryWrapper<>();
columns.select("DTBJH","STAND_ID");
List<Map<String, Object>> mapsDTBZH = sarStandAttrInfoDao.selectMaps(columns);
mapsDTBZH.forEach(item->{
if (item.get("DTBJH")!=null && !item.get("DTBJH").toString().equals("")){
String dtbzh = item.get("DTBJH").toString();
String[] split = dtbzh.split(",");
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
sarStandardsInfo.setId(item.get("STAND_ID").toString());
//一个被代替标准号时,文本状态更新为废止状态,两个及以上时更新为被代替状态
switch (split.length){
case 0 :
break;
case 1 :
sarStandardsInfo.setTextStatus("chblaarg77");//废止状态
break;
default:
sarStandardsInfo.setTextStatus("qke0ckro2p");//被代替状态
}
try {
sarStandardsInfoDao.updateById(sarStandardsInfo);
}catch (Exception e){
System.out.println("代替标准状态更新:id为"+item.get("STAND_ID").toString()+"文本状态更新失败");
}
}
});
}
} }
@@ -3,8 +3,8 @@ package com.adc.da.scheduled.dao;
import com.adc.da.scheduled.entity.DataDTO; 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.sarStandWarning.entity.EarlyWarningEO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
@@ -12,6 +12,8 @@ import java.util.List;
@Repository @Repository
public interface SarStandardInfoDao{ public interface SarStandardInfoDao{
public List<WarningEO> select(DataDTO date, String str); public List<WarningEO> selectWithinTerm(DataDTO date, String str);
public int updateStandardInfo(@Param("id")String id, @Param("textStatus") String textStatus);
} }
@@ -2,7 +2,6 @@ package com.adc.da.scheduled.dao;
import com.adc.da.scheduled.entity.DataDTO; 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.sarStandWarning.entity.EarlyWarningEO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@@ -12,6 +11,6 @@ import java.util.List;
@Repository @Repository
public interface SarStandardItemDao extends BaseMapper{ public interface SarStandardItemDao extends BaseMapper{
public List<WarningEO> select(DataDTO date, String str); public List<WarningEO> selectWithinTerm(DataDTO date, String str);
} }
@@ -1,8 +1,8 @@
package com.adc.da.scheduled.entity; package com.adc.da.scheduled.entity;
import com.adc.da.base.entity.BaseEntity;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate; import java.time.LocalDate;
@@ -13,15 +13,21 @@ public class DataDTO {
* 预警的期限为系统日期的次日至3个月后 * 预警的期限为系统日期的次日至3个月后
*/ */
@DateTimeFormat(pattern="yyyy-MM-dd")
private LocalDate startDate; private LocalDate startDate;
@DateTimeFormat(pattern="yyyy-MM-dd")
private LocalDate endDate; private LocalDate endDate;
// private String str; // private String str;
public DataDTO() { public DataDTO() {
this.startDate =LocalDate.now().plusDays(1); //系统日期的下一天 this.startDate =LocalDate.now().plusDays(1); //系统当前日期
this.endDate = LocalDate.now().plusMonths(3).plusDays(1);//系统日期3个月后 this.endDate = LocalDate.now().plusMonths(3);//系统当前日期3个月后
} }
public DataDTO(LocalDate startDate,LocalDate endDate){
this.startDate=startDate;
this.endDate=endDate;
}
} }
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
@@ -15,8 +16,10 @@ import java.util.Date;
public class WarningEO extends EarlyWarningEO { public class WarningEO extends EarlyWarningEO {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@DateTimeFormat(pattern = "YYYY-MM-dd")
private Date XCXSSRQ; private Date XCXSSRQ;
@DateTimeFormat(pattern = "YYYY-MM-dd")
private Date ZCCSSRQ; private Date ZCCSSRQ;
private String standNum; private String standNum;
@@ -24,4 +27,6 @@ public class WarningEO extends EarlyWarningEO {
private String standSort; private String standSort;
private String standYear; private String standYear;
} }
@@ -24,11 +24,11 @@ public class FindSarItemsPageReqDTO extends BasePage {
private String itemsName; private String itemsName;
@ApiModelProperty(value = "新车型实施日期") @ApiModelProperty(value = "新车型实施日期")
@DateTimeFormat(pattern = "yyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
private Date XCXSSRQ; private Date XCXSSRQ;
@ApiModelProperty(value = "在产车实施日期") @ApiModelProperty(value = "在产车实施日期")
@DateTimeFormat(pattern = "yyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
private Date ZCCSSRQ; private Date ZCCSSRQ;
@ApiModelProperty(value = "文件类型") @ApiModelProperty(value = "文件类型")
@@ -5,6 +5,7 @@ import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@@ -63,5 +64,6 @@ public class UtArea extends BaseEntity {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date modifyTime; private Date modifyTime;
@TableField(exist = false)
private List<String> sarTypeList;
} }
@@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -37,6 +38,18 @@ public class UtAreaServiceImpl extends ServiceImpl<UtAreaDao, UtArea> implements
} }
public List<SelectionResult> getAreaSelList(UtArea utAreaEO){ public List<SelectionResult> getAreaSelList(UtArea utAreaEO){
List<String> list = new ArrayList<>();
if(utAreaEO.getSarType().equals("INLAND_STAND")){
utAreaEO.setSarType(null);
list.add("INLAND_STAND");
list.add("STAND");
utAreaEO.setSarTypeList(list);
}else if(utAreaEO.getSarType().equals("FOREIGN_STAND")){
utAreaEO.setSarType(null);
list.add("FOREIGN_STAND");
list.add("STAND");
utAreaEO.setSarTypeList(list);
}
return dao.getAreaSelList(utAreaEO); return dao.getAreaSelList(utAreaEO);
} }
@@ -387,12 +387,12 @@
</if> </if>
<if test="itemsName != null and itemsName!=''"> <if test="itemsName != null and itemsName!=''">
and ITEMS_NAME=#{itemsName} and ITEMS_NAME like CONCAT('%', #{itemsName},'%')
</if> </if>
<if test="XCXSSRQ !=null and XCXSSRQ!=''"> <if test="XCXSSRQ !=null">
and XCXSSRQ=#{XCXSSRQ} and XCXSSRQ=#{XCXSSRQ}
</if> </if>
<if test="ZCCSSRQ !=null and ZCCSSRQ != ''"> <if test="ZCCSSRQ !=null">
and ZCCSSRQ=#{ZCCSSRQ} and ZCCSSRQ=#{ZCCSSRQ}
</if> </if>
</where> </where>
@@ -17,7 +17,7 @@
</resultMap> </resultMap>
<!-- 查询条件 --> <!-- 查询条件 -->
<select id="select" resultMap="resultMap" parameterType="com.adc.da.scheduled.entity.DataDTO"> <select id="selectWithinTerm" resultMap="resultMap" parameterType="com.adc.da.scheduled.entity.DataDTO">
SELECT SELECT
info.ID, info.ID,
info.STAND_SORT, info.STAND_SORT,
@@ -31,12 +31,27 @@
FROM FROM
sar_standards_info AS info sar_standards_info AS info
JOIN sar_stand_attr_info AS attrInfo ON info.id = attrinfo.stand_id JOIN sar_stand_attr_info AS attrInfo ON info.id = attrinfo.stand_id
WHERE <where>
attrInfo.${str} BETWEEN #{date.startDate} and #{date.endDate} 1=1
<if test="date!=null">
and
attrInfo.${str}
BETWEEN DATE_FORMAT( #{date.startDate},'%Y-%m-%d %H:%i:%s')
and DATE_FORMAT( #{date.endDate},'%Y-%m-%d %H:%i:%s')
</if>
</where>
</select> </select>
<update id="updateStandardInfo">
update sar_standards_info
set TEXT_STATUS=#{textStatus}
where ID=#{id}
</update>
</mapper> </mapper>
@@ -17,7 +17,7 @@
<result column="ZRGCS" property="dutyEngineer"/> <result column="ZRGCS" property="dutyEngineer"/>
</resultMap> </resultMap>
<!-- 查询条件 --> <!-- 查询条件 -->
<select id="select" 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, STAND_ID,
@@ -182,7 +182,7 @@
</select> </select>
<select id="getAreaSelList" parameterType="com.adc.da.slrs.utArea.entity.UtArea" resultType="com.adc.da.sys.common.SelectionResult"> <select id="getAreaSelList" parameterType="com.adc.da.slrs.utArea.entity.UtArea" resultType="com.adc.da.sys.common.SelectionResult">
select id as value,area_name as label select id as value,area_name as label,sar_type AS sarType
from UT_AREA from UT_AREA
where 1=1 where 1=1
<if test="id != null" > <if test="id != null" >
@@ -191,6 +191,12 @@
<if test="sarType != null" > <if test="sarType != null" >
and sar_type like concat(concat('%',#{sarType}),'%') and sar_type like concat(concat('%',#{sarType}),'%')
</if> </if>
<if test="sarTypeList != null" >
and sar_type in
<foreach collection="sarTypeList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
order by show_index,id order by show_index,id
</select> </select>
</mapper> </mapper>
@@ -11,6 +11,8 @@ public class SelectionResult {
private String value; private String value;
private String sarType;
public String getLabel() { public String getLabel() {
return label; return label;
} }
@@ -26,4 +28,12 @@ public class SelectionResult {
public void setValue(String value) { public void setValue(String value) {
this.value = value; this.value = value;
} }
public String getSarType() {
return sarType;
}
public void setSarType(String sarType) {
this.sarType = sarType;
}
} }