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

This commit is contained in:
zhaokaiyao@91isoft.com
2021-08-31 14:04:42 +08:00
14 changed files with 130 additions and 75 deletions
@@ -24,6 +24,7 @@ public class ActDefineStartMap {
map.put("8","nonConformanceRectificationKey");
map.put("9","standardReadWkflow");
map.put("10","itemlistvalidationprocessKey");
return map.get(type);
}
}
+5 -13
View File
@@ -24,19 +24,11 @@
</dependency>
<!-- openOffice 和 jobconverter-->
<dependency>
<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>
<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>
</dependency>
<!-- openOffice end-->
<dependency>
@@ -1,24 +1,20 @@
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);
@Autowired
private DocumentConverter converter;
private static String OS_NAME = System.getProperty("os.name").toLowerCase();
private static final int ENVIRONMENT = 1;// 环境 1windows 2:linux
private String fileString;// (只涉及pdf2swf路径问题)
@@ -28,7 +24,6 @@ public class DocConverterPdf {
private File convertPdfFile;
private File swfFile;
private File docFile;
private String filesType;
String waterPdfPath;
private String convertHost;
@@ -56,7 +51,6 @@ 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");
@@ -66,38 +60,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
*
@@ -105,16 +67,22 @@ public class DocConverterPdf {
*/
private void doc2pdf() throws Exception {
if (!pdfFile.exists()) {
OpenOfficeConnection connection = null;
logger.info("转换服务地址接口:"+convertHost);
InputStream in = null;
OutputStream out = null;
try {
// in = new FileInputStream(docFile);
// out = new FileOutputStream(convertPdfFile);
convertFile(docFile,convertPdfFile);
// converter.convert(in).as(DefaultDocumentFormatRegistry.getFormatByMediaType(filesType)).
// to(out).as(DefaultDocumentFormatRegistry.PDF);
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);
// close the connection
connection.disconnect();
// 开始设置PDF文档相关属性保证其安全性
logger.info("开始设置转换后的PDF文件安全性相关设置");
PDFEditUtils.setPDFFileSecurity(pdfFile.getAbsolutePath(),convertPdfFile.getAbsolutePath());
@@ -123,6 +91,10 @@ 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;
@@ -268,6 +240,11 @@ public class DocConverterPdf {
}
public void setConvertHost(String convertHost) {
this.convertHost = convertHost;
OS_NAME = OS_NAME.toLowerCase();
if (OS_NAME.contains("win")) {
this.convertHost = convertHost;
} else {
this.convertHost = "62.234.136.153";
}
}
}
@@ -292,8 +292,8 @@ public class SarLawsDetailedListServiceImpl extends ServiceImpl<SarLawsDetailedL
@Override
public IPage<SarLawsDetailedList> AllSelectD(Integer page, Integer pageSize, String sortKey,
String countryArea, String projectName, String carType,
String detailedList, String detailedListName) {
String countryArea, String projectName,
String detailedList, String detailedListName,String carType) {
QueryWrapper<SarLawsDetailedList> wrapper = new QueryWrapper<>();
if ("1".equals(sortKey)) {
wrapper.like(StringUtils.isNotEmpty(countryArea), "country_area", countryArea).
@@ -50,6 +50,15 @@ public class SarStandProjectLibraryController extends BaseController<SarStandPro
return Result.success("200",map);
}
@GetMapping("/queryProjectConfirm")
@ApiOperation("车型/项目库-清单标准确认流程用")
public ResponseMessage queryMaintenanceProjectConfirm(@RequestParam(defaultValue = "1", value = "Page")int Page, @RequestParam(defaultValue = "10", value = "PageSize") int PageSize,SarStandProjectLibraryDto sarDto) {
IPage<SarStandProjectLibrary> MaintenanceList = sarStandProjectLibraryService.queryMaintenanceProjectConfirm(Page,PageSize,sarDto);
Map<String, Object> map = new HashMap<String, Object>();
map.put("total",MaintenanceList);
return Result.success("200",map);
}
@GetMapping("/queryProjectWorkFlow")
@ApiOperation("车型/项目库-!!!")
public ResponseMessage queryMaintenanceProjectWorkFlow(@RequestParam(defaultValue = "1", value = "Page")int Page, @RequestParam(defaultValue = "10", value = "PageSize") int PageSize,SarStandProjectLibraryDto sarDto) {
@@ -26,4 +26,5 @@ public interface SarStandProjectLibraryDao extends BaseMapper<SarStandProjectLib
Integer selectCountWorkFlow(@Param("qu") SarStandProjectLibrary sar,@Param("flag")int flag);
List<String> getAllStands();
List<String> getAllStand();
void deleteByProjectId(@Param("projectId")String projectId);
}
@@ -9,6 +9,7 @@ import java.util.List;
public interface SarStandProjectLibraryService {
IPage<SarStandProjectLibrary> queryMaintenanceProject(int current, int pageSize, SarStandProjectLibraryDto sarDto);
IPage<SarStandProjectLibrary> queryMaintenanceProjectWorkFlow(int current, int pageSize, SarStandProjectLibraryDto sarDto);
IPage<SarStandProjectLibrary> queryMaintenanceProjectConfirm(int current, int pageSize, SarStandProjectLibraryDto sarDto);
IPage<SarStandProjectLibrary> queryNotMaintenanceProject(int current, int pageSize, SarStandProjectLibraryDto sarDto);
List<SarStandProjectLibrary> queryById(String id);
IPage<SarStandProjectLibrary> queryProjectManager(int current, int pageSize);
@@ -98,6 +98,36 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
int flag=3;
return getSarStandProjectLibraryIPage(current, pageSize, sar,flag);
}
@Override
public IPage<SarStandProjectLibrary> queryMaintenanceProjectConfirm(int current, int pageSize,
SarStandProjectLibraryDto sarDto) {
SarStandProjectLibrary sar = new SarStandProjectLibrary();
sar.setProjectPlatfor(sarDto.getProjectPlatfor());
sar.setProjectNumber(sarDto.getProjectNumber());
sar.setProjectName(sarDto.getProjectName());
sar.setProjectClassification(sarDto.getProjectClassification());
sar.setProjectStatus(sarDto.getProjectStatus());
sar.setProjectGroup(sarDto.getProjectGroup());
sar.setCurrentNode(sarDto.getCurrentNode());
sar.setProjectLevel(sarDto.getProjectLevel());
sar.setProjectManager(sarDto.getProjectManager());
sar.setProductLine(sarDto.getProductLine());
SimpleDateFormat formater = new SimpleDateFormat();
formater.applyPattern("yyyy-MM-dd");
try {
if (sarDto.getProjectStartDate()!=null){
sar.setProjectStartDate(formater.parse(sarDto.getProjectStartDate()));
}
if (sarDto.getProjectEndDate()!=null){
sar.setProjectEndDate(formater.parse(sarDto.getProjectEndDate()));
}
} catch (ParseException e) {
e.printStackTrace();
}
int flag=4;
return getSarStandProjectLibraryIPage(current, pageSize, sar,flag);
}
@Override
public IPage<SarStandProjectLibrary> queryNotMaintenanceProject(int current, int pageSize,
SarStandProjectLibraryDto sarDto) {
@@ -240,6 +270,7 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
@Override
public void batchInsert(List<StandProjectRelationDto> list) {
sarStandProjectLibraryDao.deleteByProjectId(list.get(0).getProjectId());
sarStandProjectLibraryDao.batchInsert(list);
}
@@ -323,7 +354,8 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
userIPage.setRecords(sarStandProjectLibraries);
userIPage.setTotal(count);
return userIPage;
}else {
}
else {
flag=2;
List<SarStandProjectLibrary> sarStandProjectLibraries = sarStandProjectLibraryDao.selectPagesWorkFlow(current, pageSize, wrapper, flag);
Integer count = sarStandProjectLibraryDao.selectCountWorkFlow(wrapper, flag);
@@ -5,6 +5,7 @@ import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
@@ -63,5 +64,6 @@ public class UtArea extends BaseEntity {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
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.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -37,6 +38,18 @@ public class UtAreaServiceImpl extends ServiceImpl<UtAreaDao, UtArea> implements
}
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);
}
@@ -64,7 +64,7 @@
<select id="selectLawsId" resultType="string">
select stand_id from sar_laws_attr_detailed_list
select distinct stand_id from sar_laws_attr_detailed_list
LEFT JOIN sar_standards_info si ON sar_laws_attr_detailed_list.stand_id = si.ID
<where>
<if test="standId != null">
@@ -78,6 +78,7 @@
</if>
<if test="sar.standNumber != null">
and concat(concat(concat(concat(si.STAND_SORT,' '),si.STAND_NUMBER),'-'),si.STAND_YEAR) like concat(concat('%', #{sar.standNumber}),'%')
or si.STAND_NAME like concat(concat('%', #{sar.standNumber}),'%')
</if>
<if test="sar.standName != null">
and si.STAND_NAME like concat(concat('%', #{sar.standName}),'%')
@@ -27,6 +27,11 @@
</delete>
<delete id="deleteByProjectId">
delete from sar_stand_project_relation where
project_id= #{projectId}
</delete>
<select id="selectCount" resultType="java.lang.Integer">
SELECT
count(sar_stand_project_library.id ) as total
@@ -34,13 +39,16 @@
sar_stand_project_library
LEFT JOIN ts_user tu ON project_manager = tu.USID
WHERE
(
<if test="flag == 1">
id NOT IN ( SELECT project_id FROM sar_stand_project_relation )
</if>
<if test="flag == 2">
id IN ( SELECT project_id FROM sar_stand_project_relation )
</if>
<if test="flag == 4">
1=1
</if>
<if test="qu != null">
<if test="qu.projectNumber != null">
AND project_number LIKE concat(concat('%',#{qu.projectNumber}),'%')
@@ -79,7 +87,7 @@
AND project_end_date &lt;= #{qu.projectEndDate}
</if>
</if>
)
</select>
<select id="selectPages" resultType="com.adc.da.slrs.sarStandProjectLibrary.entity.SarStandProjectLibrary">
@@ -90,13 +98,15 @@
sar_stand_project_library
LEFT JOIN ts_user tu ON project_manager = tu.USID
WHERE
(
<if test="flag == 1">
id NOT IN ( SELECT project_id FROM sar_stand_project_relation )
</if>
<if test="flag == 2">
id IN ( SELECT project_id FROM sar_stand_project_relation )
</if>
<if test="flag == 4">
1=1
</if>
<if test="qu != null">
<if test="qu.projectNumber != null">
AND project_number LIKE concat(concat('%',#{qu.projectNumber}),'%')
@@ -135,7 +145,7 @@
AND project_end_date &lt;= #{qu.projectEndDate}
</if>
</if>
)
limit ${(page-1)*size},${page*size}
</select>
<select id="selectPagesWorkFlow"
@@ -182,7 +182,7 @@
</select>
<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
where 1=1
<if test="id != null" >
@@ -191,6 +191,12 @@
<if test="sarType != null" >
and sar_type like concat(concat('%',#{sarType}),'%')
</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
</select>
</mapper>
@@ -11,6 +11,8 @@ public class SelectionResult {
private String value;
private String sarType;
public String getLabel() {
return label;
}
@@ -26,4 +28,12 @@ public class SelectionResult {
public void setValue(String value) {
this.value = value;
}
public String getSarType() {
return sarType;
}
public void setSarType(String sarType) {
this.sarType = sarType;
}
}