add:集成es搜索模块

This commit is contained in:
2510220824
2021-06-22 17:14:39 +08:00
parent 90b6714345
commit 51d3edebfd
36 changed files with 8166 additions and 0 deletions
+245
View File
@@ -0,0 +1,245 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.adc</groupId>
<artifactId>foton-slrs-system-rest</artifactId>
<version>3.0.0</version>
</parent>
<artifactId>adc-da-search</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<java_source_version>1.7</java_source_version>
<java_target_version>1.8</java_target_version>
<ehcache.version>2.6.6</ehcache.version>
<shiro.version>1.4.0-RC2</shiro.version>
<spring.version>4.3.9.RELEASE</spring.version>
</properties>
<repositories>
<repository>
<id>adc</id>
<url>http://60.247.58.121:8182/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>thirdparty</id>
<name>Nexus Thirdparty Repository</name>
<url>http://60.247.58.121:8182/nexus/content/repositories/thirdparty/</url>
</repository>
</distributionManagement>
<dependencies>
<!-- <dependency>-->
<!-- <groupId>com.adc</groupId>-->
<!-- <artifactId>adc-da-activiti</artifactId>-->
<!-- <version>2.2.02</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.adc</groupId>
<artifactId>adc-da-base</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.adc</groupId>
<artifactId>adc-da-util</artifactId>
<version>2.2.41</version>
<exclusions>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk14</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.adc</groupId>
<artifactId>adc-da-sys</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.adc</groupId>
<artifactId>adc-da-file</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>com.adc</groupId>
<artifactId>adc-da-druid</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.adc</groupId>
<artifactId>adc-da-excel</artifactId>
<version>2.0.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- rabbitMQ -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>6.3.2</version>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>6.3.2</version>
</dependency>
<!-- 6.0版本es需添加此依赖,解决依赖冲突 -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- 如果要使用内嵌Jetty服务器,需排除tomcat依赖 -->
<!--<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>-->
</dependency>
<!-- SpringBoot内嵌的Jetty服务器 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>net.sourceforge.javacsv</groupId>
<artifactId>javacsv</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>net.sf.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.9</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
<dependency>
<groupId>com.mashape.unirest</groupId>
<artifactId>unirest-java</artifactId>
<version>1.4.9</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
<exclusion>
<artifactId>commons-beanutils</artifactId>
<groupId>commons-beanutils</groupId>
</exclusion>
<exclusion>
<artifactId>commons-collections</artifactId>
<groupId>commons-collections</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.4.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.1</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
</dependency>
<!-- easypoi使用到 -->
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-base</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-web</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-annotation</artifactId>
<version>4.1.2</version>
</dependency>
<!-- <dependency> -->
<!-- <groupId>commons-lang</groupId> -->
<!-- <artifactId>commons-lang</artifactId> -->
<!-- </dependency> -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerVersion>${java.version}</compilerVersion>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,57 @@
package com.adc.da.search.config;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.transport.client.PreBuiltTransportClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.net.InetAddress;
import java.net.UnknownHostException;
/**
* gaoyan
* 2018-08-23
* elasticsearch配置config
*/
@Configuration
public class ElasticsearchConfig {
private static final Logger logger = LoggerFactory.getLogger(ElasticsearchConfig.class);
@Autowired
private ElasticsearchProperties elasticsearchProperties;
@Bean
public TransportClient client() throws UnknownHostException {
TransportClient client = null;
try {
Settings settings = Settings.builder()
.put("client.transport.sniff", true)//增加嗅探机制,找到ES集群
.put("thread_pool.search.size", elasticsearchProperties.getPoolSize())//增加线程池个数,暂时设为5
.put("cluster.name",elasticsearchProperties.getClustername())
.build();
client = new PreBuiltTransportClient(settings)
.addTransportAddress(new TransportAddress(InetAddress.getByName(elasticsearchProperties.getIp()),elasticsearchProperties.getPort()));
} catch (java.net.UnknownHostException e) {
logger.error(e.getMessage(),e);
}
return client;
}
/*@After
public void tearDown() throws Exception {
if (client != null) {
client.close();
}
}*/
}
@@ -0,0 +1,45 @@
package com.adc.da.search.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "elasticsearch")
public class ElasticsearchProperties {
private String clustername;
private String ip;
private Integer port;
private Integer poolSize;
public String getClustername() {
return clustername;
}
public void setClustername(String clustername) {
this.clustername = clustername;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
public Integer getPoolSize() {
return poolSize;
}
public void setPoolSize(Integer poolSize) {
this.poolSize = poolSize;
}
}
@@ -0,0 +1,328 @@
package com.adc.da.search.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.adc.da.base.web.BaseController;
import com.adc.da.person.service.PersonCollectEOService;
import com.adc.da.search.dto.*;
import com.adc.da.search.entity.SarAdvanceSearchVO;
import com.adc.da.search.entity.SeniorSearchInfoEO;
import com.adc.da.search.service.ElasticsearchService;
import com.adc.da.search.service.SearchCenterService;
import com.adc.da.util.exception.AdcDaBaseException;
import com.adc.da.util.http.PageInfo;
import com.adc.da.util.http.ResponseMessage;
import com.adc.da.util.http.Result;
import com.adc.da.util.utils.IOUtils;
import com.adc.da.util.utils.StringUtils;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.usermodel.Workbook;
import org.elasticsearch.client.transport.TransportClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Pattern;
import static com.adc.da.sys.common.ReadExcelName.encodeFileName;
@RestController
@RequestMapping("/${restPath}/search/searchCenter")
@Api(description = "|SearchCenter|")
public class SearchCenterController extends BaseController<Map<String, Object>> {
@Autowired
private TransportClient client;
@Autowired
private SearchCenterService searchCenterService;
@Autowired
private PersonCollectEOService personCollectEOService;
@Autowired
private ElasticsearchService elasticsearchService;
/**
*
* @param searchInfoEO
* @return
*/
@ApiOperation(value = "|SearchCenter|查询")
@PostMapping(value="/searchSarBykey")
public ResponseMessage<PageInfo<Map<String, Object>>> searchSarBykey(SeniorSearchInfoEO searchInfoEO) throws Exception{
List<Map<String, Object>> result = new ArrayList<>();
if (StringUtils.isAlphanumericSpace(searchInfoEO.getSelectIndex())) {
if(elasticsearchService.isIndexExist(searchInfoEO.getSelectIndex())){
if("fulltextserch".equals(searchInfoEO.getSelectIndex()) || "fulltextserch"== searchInfoEO.getSelectIndex()){
Pattern pattern = Pattern.compile("^[a-zA-Z]+\\s[0-9a-zA-Z\\.\\(\\\\\\)\\-\\s]+$");
if (null != searchInfoEO.getSelectValue() && StringUtils.isNotBlank(searchInfoEO.getSelectValue())) {
if (pattern.matcher(searchInfoEO.getSelectValue()).matches()) {
result = searchCenterService.searchSarBykeyAndHighLightNumber(searchInfoEO);
}else {
result = searchCenterService.searchSarBykeyAndHighLight(searchInfoEO);
}
} else {
result = searchCenterService.searchSarBykeyAndHighLight(searchInfoEO);
}
for (int i = 0; i < result.size(); i++) {
String collectId = personCollectEOService.queryCollectByUserAndId(result.get(i).get("id").toString());
result.get(i).put("collectId", collectId);
}
return Result.success(getPageInfo(searchInfoEO.getPager(), result));
} else {
result = searchCenterService.searchSarBykey(searchInfoEO);
// 非动态消息的需要查询为我推荐
for (int i = 0; i < result.size(); i++) {
String collectId = personCollectEOService.queryCollectByUserAndId(result.get(i).get("id").toString());
result.get(i).put("collectId", collectId);
result.get(i).put("content", "");
result.get(i).put("baseSearchContent", "");
}
return Result.success(getPageInfo(searchInfoEO.getPager(), result));
}
} else {
return Result.error("未查到相关数据");
}
} else {
return Result.error("数据错误");
}
}
@ApiOperation(value = "|SearchCenter|查询用于导出数据")
@PostMapping(value="/searchIdToImport")
public ResponseMessage<String []> searchIdToImport(SeniorSearchInfoEO searchInfoEO){
if (StringUtils.isAlphanumericSpace(searchInfoEO.getSelectIndex())) {
if(elasticsearchService.isIndexExist(searchInfoEO.getSelectIndex())){
String [] result = searchCenterService.searchIdToImport(searchInfoEO);
return Result.success(result);
}
else {
return Result.error("未查到相关数据");
}
} else {
return Result.error("数据错误");
}
}
@ApiOperation(value = "|SearchCenter|查询")
@PostMapping(value="/selectGroupdata")
public ResponseMessage<Map<String, Object>> selectGroupdata(SeniorSearchInfoEO searchInfoEO){
Map<String, Object> result = new HashMap<>();
result = searchCenterService.selectGroupdata(searchInfoEO);
return Result.success(result);
}
@ApiOperation(value = "|SarLawsInfoEO|导出搜索中心数据")
@GetMapping("/exportSearchCenterDatas")
public void exportSearchCenterDatas(String exportDatas,String searchType, HttpServletResponse response, HttpServletRequest request) throws Exception{
OutputStream os = null;
if ("bussstand".equals(searchType)){
searchType = "stand";
}else if ("enterprise".equals(searchType)){
searchType = "bussstand";
}
Workbook workbook = null;
try{
response.setHeader("Content-Disposition",
"attachment; filename=" + encodeFileName( "检索结果.xlsx", request));
response.setContentType("application/force-download");
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
//集合 sarAdvanceSearc 的字符串
String sarAdvanceSearcString = subString(exportDatas,"[{","}]");
if (StringUtils.isNotBlank(sarAdvanceSearcString)){
sarAdvanceSearcString = sarAdvanceSearcString.replace("\\\"","\"");
}
SeniorSearchInfoEO searchInfoEO = null;
if (!"none".equals(sarAdvanceSearcString)) {
exportDatas = exportDatas.replace("[{" + sarAdvanceSearcString + "}]", "");
JSONObject jsonObject = JSONObject.parseObject(exportDatas);
List<String> sarAdvanceSearchVO = new ArrayList<>(Arrays.asList(sarAdvanceSearcString.split("},")));
List<SarAdvanceSearchVO> advanceSearchVOList = new ArrayList<>();
int flag = 0;
for (String sarAdvanceSearch : sarAdvanceSearchVO) {
JSONObject jsonObjectSAS = null;
if (flag == 0) {
jsonObjectSAS = JSONObject.parseObject("{" + sarAdvanceSearch + "}");
} else {
jsonObjectSAS = JSONObject.parseObject(sarAdvanceSearch + "}");
}
SarAdvanceSearchVO sarAdvanceSearchEO = JSONObject.toJavaObject(jsonObjectSAS, SarAdvanceSearchVO.class);
advanceSearchVOList.add(sarAdvanceSearchEO);
flag++;
}
searchInfoEO = JSONObject.toJavaObject(jsonObject, SeniorSearchInfoEO.class);
searchInfoEO.setAdvanceSearchVOList(advanceSearchVOList);
}else {
JSONObject jsonObject=JSONObject.parseObject(exportDatas);
searchInfoEO = JSONObject.toJavaObject(jsonObject, SeniorSearchInfoEO.class);
}
if ("INLAND_STAND".equals(searchType)) {
searchType = "stand"; //guonei
}else if ("INLAND_LAWS".equals(searchType)) {
searchType = "laws"; //zhengce
}else if ("BUSINESS_STAND".equals(searchType)) {
searchType = "bussstand"; //enterprise
}else if ("DYNAMIC_INFORMATION".equals(searchType)) {
searchType = "msgdyinfo";
}else if ("items".equals(searchType)) {
searchType = "items";
}
searchInfoEO.setSelectIndex(searchType);
searchInfoEO.setSelectValue(searchInfoEO.getKeywords());
//存放需要导出的数据
List<Map<String, Object>> result = new ArrayList<>();
result = searchCenterService.searchSarBykey(searchInfoEO);
if("stand".equals(searchType)){
List<SearchStandExportDto> dtoDatas = new ArrayList<>();
for(int i=0;i<result.size();i++){
SearchStandExportDto exportDto = new SearchStandExportDto();
String numbershow = String.valueOf(result.get(i).get("numbershow"));
exportDto.setNumbershow(numbershow);
String nameshow = String.valueOf( result.get(i).get("nameshow"));
exportDto.setNameshow(nameshow);
String issueTime = String.valueOf(result.get(i).get("issue_time"));
exportDto.setIssueTime(issueTime);
// String putTime = changeDate(result.get(i).get("put_time"));
// exportDto.setPutTime(putTime);
exportDto.setStandstateshow(String.valueOf(result.get(i).get("standstateshow")));
dtoDatas.add(exportDto);
}
//导出数据到Excel
workbook = ExcelExportUtil.exportExcel(exportParams, SearchStandExportDto.class, dtoDatas);
} else if("laws".equals(searchType)){
List<SearchLawsExportDto> dtoDatas = new ArrayList<>();
for(int i=0;i<result.size();i++){
SearchLawsExportDto exportDto = new SearchLawsExportDto();
String numbershow = String.valueOf(result.get(i).get("numbershow"));
exportDto.setNumbershow(numbershow);
String nameshow = String.valueOf(result.get(i).get("nameshow"));
exportDto.setNameshow(nameshow);
String issueTime = String.valueOf(result.get(i).get("issue_time"));
exportDto.setIssueTime(issueTime);
// String putTime = changeDate(result.get(i).get("put_time"));
// exportDto.setPutTime(putTime);
exportDto.setStandstateshow(String.valueOf(result.get(i).get("standstateshow")));
dtoDatas.add(exportDto);
}
//导出数据到Excel
workbook = ExcelExportUtil.exportExcel(exportParams, SearchLawsExportDto.class, dtoDatas);
} else if("bussstand".equals(searchType)){
List<SearchBussExportDto> dtoDatas = new ArrayList<>();
for(int i=0;i<result.size();i++){
SearchBussExportDto exportDto = new SearchBussExportDto();
String numbershow = String.valueOf(result.get(i).get("numbershow"));
exportDto.setNumbershow(numbershow);
String nameshow = String.valueOf(result.get(i).get("nameshow"));
exportDto.setNameshow(nameshow);
if (StringUtils.isNotBlank(String.valueOf(result.get(i).get("issue_time"))) && !"null".equals(String.valueOf(result.get(i).get("issue_time")))) {
String issueTime = "";
try {
issueTime = changeDate(String.valueOf(result.get(i).get("issue_time")));
}catch (Exception ignored){
issueTime = "";
}
exportDto.setIssueTime(issueTime);
}else {
exportDto.setIssueTime("");
}
// String putTime = changeDate(result.get(i).get("put_time"));
// exportDto.setPutTime(putTime);
exportDto.setStandstateshow((String) result.get(i).get("standstateshow"));
dtoDatas.add(exportDto);
}
//导出数据到Excel
workbook = ExcelExportUtil.exportExcel(exportParams, SearchBussExportDto.class, dtoDatas);
// } else if("items".equals(searchType)){
// List<SearchItemsExportDto> dtoDatas = new ArrayList<>();
// for(int i=0;i<result.size();i++){
// SearchItemsExportDto exportDto = new SearchItemsExportDto();
// String newcarPutTime = changeDate(String.valueOf(result.get(i).get("newcarPutTime")));
// exportDto.setNewcarPutTime(newcarPutTime);
// String productPutTime = changeDate(String.valueOf(result.get(i).get("productPutTime")));
// exportDto.setProductPutTime(productPutTime);
// exportDto.setApplyArcticShow(String.valueOf(result.get(i).get("applyArcticShow")));
// exportDto.setItemsName(String.valueOf(result.get(i).get("itemsName")));
// exportDto.setItemsNum(String.valueOf(result.get(i).get("itemsNum")));
// exportDto.setParts(String.valueOf(result.get(i).get("parts")));
// dtoDatas.add(exportDto);
// }
//导出数据到Excel
// workbook = ExcelExportUtil.exportExcel(exportParams, SearchItemsExportDto.class, dtoDatas);
} else {
List<SearchMsgExportDto> dtoDatas = new ArrayList<>();
for(int i=0;i<result.size();i++){
SearchMsgExportDto exportDto = new SearchMsgExportDto();
exportDto.setModuleName(String.valueOf(result.get(i).get("moduleName")));
exportDto.setTitle((String) result.get(i).get("title"));
String issueTime = changeDate(String.valueOf(result.get(i).get("issue_time")));
exportDto.setIssueTime(issueTime);
dtoDatas.add(exportDto);
}
//导出数据到Excel
workbook = ExcelExportUtil.exportExcel(exportParams, SearchMsgExportDto.class, dtoDatas);
}
os = response.getOutputStream();
workbook.write(os);
os.flush();
workbook.close();
} catch (Exception e) {
throw new AdcDaBaseException("导出失败,请重试");
} finally {
IOUtils.closeQuietly(os);
if (workbook != null) {
workbook.close();
}
}
}
public String changeDate (Object obj) throws Exception {
String dateStr = "";
if (obj != null) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date issueDate = dateFormat.parse((String) obj);
Calendar calendar = Calendar.getInstance();
calendar.setTime(issueDate);
calendar.add(Calendar.DATE, 1);
issueDate = calendar.getTime();
if (issueDate != null) {
dateStr = dateFormat.format(issueDate);
}
}
return dateStr;
}
/**
* 截取字符串str中指定字符 strStart、strEnd之间的字符串
*
* @param str
* @param strStart
* @param strEnd
* @return
*/
public static String subString(String str, String strStart, String strEnd) {
/* 找出指定的2个字符在 该字符串里面的 位置 */
int strStartIndex = str.indexOf(strStart);
int strEndIndex = str.indexOf(strEnd);
if (strStartIndex < 0 || strEndIndex < 0) {
return "none";
}
/* 开始截取 */
String result = str.substring(strStartIndex, strEndIndex).substring(strStart.length());
return result;
}
}
@@ -0,0 +1,104 @@
package com.adc.da.search.controller;
import com.adc.da.base.web.BaseController;
import com.adc.da.search.service.ElasticsearchService;
import com.adc.da.util.http.ResponseMessage;
import com.adc.da.util.http.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.Map;
@RestController
@RequestMapping("/${restPath}/search/standLawsSearch")
@Api(description = "|StandLawsSearch|")
public class StandLawsSearchController extends BaseController<Map<String, Object>> {
private static final Logger logger = LoggerFactory.getLogger(StandLawsSearchController.class);
@Autowired
private ElasticsearchService elasticsearchService;
/**
*
* @param
* @return
*/
@ApiOperation(value = "|BussnessStand|创建索引")
@PostMapping(value="/createBussstandIndex")
public ResponseMessage createBussstandIndex(){
XContentBuilder mapping = null;
try {
mapping = XContentFactory.jsonBuilder()
.startObject()
.startObject("properties") //设置之定义字段
.startObject("apply_arctic")
.field("type","text") //设置数据类型
.endObject()
.startObject("applyarcticshow")
.field("type","text")
.endObject()
.startObject("energy_kind")
.field("type","text") //设置数据类型
.endObject()
.startObject("id")
.field("type","text") //设置数据类型
.endObject()
.startObject("issue_time")
.field("type","date") //设置Date类型
// .field("format","yyyy-MM-dd HH:mm:ss") //设置Date的格式
.endObject()
.startObject("nameshow")
.field("type","text") //设置数据类型
.endObject()
.startObject("numbershow")
.field("type","text") //设置数据类型
.endObject()
.startObject("put_time")
.field("type","date") //设置数据类型
.endObject()
.startObject("replace_stand_num")
.field("type","text") //设置数据类型
.endObject()
.startObject("replaced_stand_num")
.field("type","text") //设置数据类型
.endObject()
.startObject("standstateshow")
.field("type","text") //设置数据类型
.endObject()
.startObject("statecode")
.field("type","text") //设置数据类型
.endObject()
.startObject("type")
.field("type","text") //设置数据类型
.endObject()
.startObject("valid_flag")
.field("type","long") //设置数据类型
.endObject()
.startObject("content")
.field("type","text") //设置数据类型
.endObject()
.endObject()
.endObject();
} catch (IOException e) {
logger.error(e.getMessage(),e);
}
boolean restule = elasticsearchService.createIndex("newbussstand",mapping);
if (restule) {
return Result.success("创建成功");
} else {
return Result.error("数据错误");
}
}
}
@@ -0,0 +1,161 @@
package com.adc.da.search.controller;
import com.adc.da.search.entity.PartProductEO;
import com.adc.da.search.service.ElasticsearchService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.RangeQueryBuilder;
import org.elasticsearch.search.SearchHit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import static com.adc.da.search.util.ElasticsearchConstant.SUCCESS_DELETED;
@RestController
@RequestMapping("/${restPath}")
@Api(description = "|testElasticsearch|")
public class TestController {
private static final Logger logger = LoggerFactory.getLogger(TestController.class);
@Autowired
private TransportClient client;
@Autowired
private ElasticsearchService elasticsearchService;
@PostMapping("add/book/novel")
@ResponseBody
public ResponseEntity add(@RequestParam(name ="title") String title,
@RequestParam(name ="author") String author,
@RequestParam(name ="word_count") String wordCount,
@RequestParam(name ="publish_date") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date publishDate){
try {
XContentBuilder content =XContentFactory.jsonBuilder()
.startObject()
.field("title",title)
.field("author",author)
.field("word_count",wordCount)
.field("publish_date",publishDate.getTime())
.endObject();
IndexResponse result = this.client.prepareIndex("book","novel").setSource(content).get();
return new ResponseEntity(result.getId(),HttpStatus.OK);
}
catch (IOException e) {
logger.error(e.getMessage(),e);
return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@DeleteMapping("deleteOneDucumentTest")
@ResponseBody
public ResponseEntity delete(@RequestParam(name="id") String id) {
String response = elasticsearchService.deleteDataById("book","novel",id);
if(response.equals(SUCCESS_DELETED)){
return new ResponseEntity(response, HttpStatus.OK);
}
else {
return new ResponseEntity(response, HttpStatus.NOT_FOUND);
}
}
@PostMapping("query/book/novel")
@ResponseBody
public ResponseEntity query(
@RequestParam(name="title",required = false) String title,
@RequestParam(name="author",required = false) String author,
@RequestParam(name="gt_word_count",defaultValue = "0",required = false) int gtWordCount,
@RequestParam(name="lt_word_count",required = false) Integer ltWordCount
){
BoolQueryBuilder boolQueryBuilder =QueryBuilders.boolQuery();
if(author!=null){
boolQueryBuilder.must(QueryBuilders.matchQuery("author",author));
}
if(title!=null){
boolQueryBuilder.must(QueryBuilders.matchQuery("title",title));
}
RangeQueryBuilder rangeQueryBuilder = QueryBuilders.rangeQuery("word_count").from(gtWordCount);
if(ltWordCount!=null && ltWordCount>0 ){
rangeQueryBuilder.to(ltWordCount);
}
boolQueryBuilder.filter(rangeQueryBuilder);
SearchRequestBuilder searchRequestBuilder =this.client.prepareSearch("book")
.setTypes("novel")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(boolQueryBuilder)
.setFrom(0)
.setSize(10);
System.out.println(searchRequestBuilder);
SearchResponse response =searchRequestBuilder.get();
List<Map<String ,Object>> result = new ArrayList<Map<String ,Object>>();
for (SearchHit hit:response.getHits()){
result.add(hit.getSourceAsMap());
}
return new ResponseEntity(result,HttpStatus.OK);
}
@PostMapping("addIndexSerTest")
@ResponseBody
public String searchIndexTest() {
PartProductEO productEO= new PartProductEO();
productEO.setCertNumber("er");
productEO.setCorpId("cid");
productEO.setCorpModel("cmodel");
String indexstate = elasticsearchService.addData((JSONObject) JSON.toJSON(productEO),"testone","two");
return indexstate;
}
@PostMapping("bulktest")
@ResponseBody
public String bulkTest() throws IOException {
List<JSONObject> list = new ArrayList<JSONObject>();
for(int i=0;i<100000;i++){
PartProductEO productEO= new PartProductEO();
productEO.setCertNumber("er"+i);
productEO.setCorpId("cid"+i);
productEO.setCorpModel("cmodel"+i);
list.add(JSONObject.parseObject(JSONObject.toJSON(productEO).toString()));
}
String indexstate = elasticsearchService.addBulkData("ymq_index","two",list);
return indexstate;
}
@PostMapping("justtest")
@ResponseBody
public List<Map<String, Object>> justtest() throws IOException {
String [] index={"bank","book"};
String [] type={"_doc","_type"};
String [] fields={"account_number", "balance"};
List<Map<String, Object>> indexstate = elasticsearchService.searchListDataGroupComplex(index,type);
return indexstate;
}
}
@@ -0,0 +1,61 @@
package com.adc.da.search.dto;
import cn.afterturn.easypoi.excel.annotation.Excel;
public class SearchBussExportDto {
@Excel(name = "企业标准号", orderNum = "1",width = 12)
private String numbershow;
@Excel(name = "企业标准名称", orderNum = "1",width = 14)
private String nameshow;
@Excel(name = "发布日期", orderNum = "1",width = 10)
private String issueTime;
// @Excel(name = "实施日期", orderNum = "1",width = 10)
private String putTime;
@Excel(name = "企业标准状态", orderNum = "1",width = 14)
private String standstateshow;
public String getNumbershow() {
return numbershow;
}
public void setNumbershow(String numbershow) {
this.numbershow = numbershow;
}
public String getNameshow() {
return nameshow;
}
public void setNameshow(String nameshow) {
this.nameshow = nameshow;
}
public String getIssueTime() {
return issueTime;
}
public void setIssueTime(String issueTime) {
this.issueTime = issueTime;
}
public String getPutTime() {
return putTime;
}
public void setPutTime(String putTime) {
this.putTime = putTime;
}
public String getStandstateshow() {
return standstateshow;
}
public void setStandstateshow(String standstateshow) {
this.standstateshow = standstateshow;
}
}
@@ -0,0 +1,74 @@
package com.adc.da.search.dto;
import com.adc.da.excel.annotation.Excel;
public class SearchItemsExportDto {
@Excel(name = "条款号",width = 16)
private String itemsNum;
@Excel(name = "条款名称",width = 16)
private String itemsName;
@Excel(name = "新车型实施日期",width = 16)
private String newcarPutTime;
@Excel(name = "在产车实施日期",width = 16)
private String productPutTime;
@Excel(name = "关联零部件",width = 16)
private String parts;
@Excel(name = "适用车型",width = 16)
private String applyArcticShow;
public String getItemsNum() {
return itemsNum;
}
public void setItemsNum(String itemsNum) {
this.itemsNum = itemsNum;
}
public String getItemsName() {
return itemsName;
}
public void setItemsName(String itemsName) {
this.itemsName = itemsName;
}
public String getParts() {
return parts;
}
public void setParts(String parts) {
this.parts = parts;
}
public String getNewcarPutTime() {
return newcarPutTime;
}
public void setNewcarPutTime(String newcarPutTime) {
this.newcarPutTime = newcarPutTime;
}
public String getProductPutTime() {
return productPutTime;
}
public void setProductPutTime(String productPutTime) {
this.productPutTime = productPutTime;
}
public String getApplyArcticShow() {
return applyArcticShow;
}
public void setApplyArcticShow(String applyArcticShow) {
this.applyArcticShow = applyArcticShow;
}
}
@@ -0,0 +1,61 @@
package com.adc.da.search.dto;
import cn.afterturn.easypoi.excel.annotation.Excel;
public class SearchLawsExportDto {
@Excel(name = "文件号", orderNum = "1",width = 10)
private String numbershow;
@Excel(name = "文件名称", orderNum = "1",width = 10)
private String nameshow;
@Excel(name = "发布日期", orderNum = "1",width = 10)
private String issueTime;
// @Excel(name = "实施日期", orderNum = "1",width = 10)
// private String putTime;
@Excel(name = "文件状态", orderNum = "1",width = 10)
private String standstateshow;
public String getNumbershow() {
return numbershow;
}
public void setNumbershow(String numbershow) {
this.numbershow = numbershow;
}
public String getNameshow() {
return nameshow;
}
public void setNameshow(String nameshow) {
this.nameshow = nameshow;
}
public String getIssueTime() {
return issueTime;
}
public void setIssueTime(String issueTime) {
this.issueTime = issueTime;
}
// public String getPutTime() {
// return putTime;
// }
// public void setPutTime(String putTime) {
// this.putTime = putTime;
// }
//
public String getStandstateshow() {
return standstateshow;
}
public void setStandstateshow(String standstateshow) {
this.standstateshow = standstateshow;
}
}
@@ -0,0 +1,39 @@
package com.adc.da.search.dto;
import com.adc.da.excel.annotation.Excel;
public class SearchMsgExportDto {
@Excel(name = "所属模块", orderNum = "1",width = 10)
private String moduleName;
@Excel(name = "动态标题", orderNum = "1",width = 10)
private String title;
@Excel(name = "发布日期", orderNum = "1",width = 10)
private String issueTime;
public String getModuleName() {
return moduleName;
}
public void setModuleName(String moduleName) {
this.moduleName = moduleName;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getIssueTime() {
return issueTime;
}
public void setIssueTime(String issueTime) {
this.issueTime = issueTime;
}
}
@@ -0,0 +1,61 @@
package com.adc.da.search.dto;
import cn.afterturn.easypoi.excel.annotation.Excel;
public class SearchStandExportDto {
@Excel(name = "标准号", orderNum = "1",width = 10)
private String numbershow;
@Excel(name = "标准名称", orderNum = "1",width = 10)
private String nameshow;
@Excel(name = "发布日期", orderNum = "1",width = 10)
private String issueTime;
// @Excel(name = "实施日期", orderNum = "1",width = 10)
private String putTime;
@Excel(name = "标准状态", orderNum = "1",width = 10)
private String standstateshow;
public String getNumbershow() {
return numbershow;
}
public void setNumbershow(String numbershow) {
this.numbershow = numbershow;
}
public String getNameshow() {
return nameshow;
}
public void setNameshow(String nameshow) {
this.nameshow = nameshow;
}
public String getIssueTime() {
return issueTime;
}
public void setIssueTime(String issueTime) {
this.issueTime = issueTime;
}
public String getPutTime() {
return putTime;
}
public void setPutTime(String putTime) {
this.putTime = putTime;
}
public String getStandstateshow() {
return standstateshow;
}
public void setStandstateshow(String standstateshow) {
this.standstateshow = standstateshow;
}
}
@@ -0,0 +1,117 @@
package com.adc.da.search.entity;
import java.util.List;
import java.util.Map;
public class EsPage {
// 指定的或是页面参数
private int currentPage; // 当前页
private int pageSize; // 每页显示多少条
// 查询es结果
private int recordCount; // 总记录数
private List<Map<String, Object>> recordList; // 本页的数据列表
// 计算
private int pageCount; // 总页数
private int beginPageIndex; // 页码列表的开始索引(包含)
private int endPageIndex; // 页码列表的结束索引(包含)
/**
* 只接受前4个必要的属性,会自动的计算出其他3个属性的值
*
* @param currentPage
* @param pageSize
* @param recordCount
* @param recordList
*/
public EsPage(int currentPage, int pageSize, int recordCount, List<Map<String, Object>> recordList) {
this.currentPage = currentPage;
this.pageSize = pageSize;
this.recordCount = recordCount;
this.recordList = recordList;
// 计算总页码
pageCount = (recordCount + pageSize - 1) / pageSize;
// 计算 beginPageIndex 和 endPageIndex
// >> 总页数不多于10页,则全部显示
if (pageCount <= 10) {
beginPageIndex = 1;
endPageIndex = pageCount;
}
// >> 总页数多于10页,则显示当前页附近的共10个页码
else {
// 当前页附近的共10个页码(前4个 + 当前页 + 后5个)
beginPageIndex = currentPage - 4;
endPageIndex = currentPage + 5;
// 当前面的页码不足4个时,则显示前10个页码
if (beginPageIndex < 1) {
beginPageIndex = 1;
endPageIndex = 10;
}
// 当后面的页码不足5个时,则显示后10个页码
if (endPageIndex > pageCount) {
endPageIndex = pageCount;
beginPageIndex = pageCount - 10 + 1;
}
}
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getRecordCount() {
return recordCount;
}
public void setRecordCount(int recordCount) {
this.recordCount = recordCount;
}
public List<Map<String, Object>> getRecordList() {
return recordList;
}
public void setRecordList(List<Map<String, Object>> recordList) {
this.recordList = recordList;
}
public int getPageCount() {
return pageCount;
}
public void setPageCount(int pageCount) {
this.pageCount = pageCount;
}
public int getBeginPageIndex() {
return beginPageIndex;
}
public void setBeginPageIndex(int beginPageIndex) {
this.beginPageIndex = beginPageIndex;
}
public int getEndPageIndex() {
return endPageIndex;
}
public void setEndPageIndex(int endPageIndex) {
this.endPageIndex = endPageIndex;
}
}
@@ -0,0 +1,93 @@
package com.adc.da.search.entity;
import com.adc.da.base.entity.BaseEntity;
import java.util.Date;
/**
*/
public class FullTextSearchEO extends BaseEntity {
private String id;
private String indexType;
private String title;
private String textContent;
private Date issue_time;
private String issueTimeStr;
private Date put_time;
private String putTimeStr;
private String itemsType;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getIndexType() {
return indexType;
}
public void setIndexType(String indexType) {
this.indexType = indexType;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getTextContent() {
return textContent;
}
public void setTextContent(String textContent) {
this.textContent = textContent;
}
public Date getIssue_time() {
return issue_time;
}
public void setIssue_time(Date issue_time) {
this.issue_time = issue_time;
}
public String getIssueTimeStr() {
return issueTimeStr;
}
public void setIssueTimeStr(String issueTimeStr) {
this.issueTimeStr = issueTimeStr;
}
public Date getPut_time() {
return put_time;
}
public void setPut_time(Date put_time) {
this.put_time = put_time;
}
public String getPutTimeStr() {
return putTimeStr;
}
public void setPutTimeStr(String putTimeStr) {
this.putTimeStr = putTimeStr;
}
public String getItemsType() {
return itemsType;
}
public void setItemsType(String itemsType) {
this.itemsType = itemsType;
}
}
@@ -0,0 +1,37 @@
package com.adc.da.search.entity;
import com.adc.da.base.entity.BaseEntity;
/**
* <b>功能:</b>PART_PRODUCT PartProductEOEntity<br>
* <b>作者:</b>code generator<br>
* <b>日期:</b> 2018-08-22 <br>
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
*/
public class PartProductEO extends BaseEntity {
private String corpId;
private String certNumber;
private String corpModel;
public void setCorpId(String corpId) {
this.corpId = corpId;
}
public void setCertNumber(String certNumber) {
this.certNumber = certNumber;
}
public void setCorpModel(String corpModel) {
this.corpModel = corpModel;
}
public String getCorpId() {
return corpId;
}
public String getCertNumber() {
return certNumber;
}
public String getCorpModel() {
return corpModel;
}
}
@@ -0,0 +1,69 @@
package com.adc.da.search.entity;
/**
* @Description: 标准法规库高级查询
* @Author: yangxuenan
* date: 2020/12/11 9:22
*/
public class SarAdvanceSearchVO {
private String field; //字段 如 标准类别
private String value; //值
private String type; //查询类型 如 = = like
private String connect; //连接符号 如 and or
private String timeSt;
private String timeEd;
public String getField() {
return field;
}
public void setField(String field) {
this.field = field;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getConnect() {
return connect;
}
public void setConnect(String connect) {
this.connect = connect;
}
public String getTimeSt() {
return timeSt;
}
public void setTimeSt(String timeSt) {
this.timeSt = timeSt;
}
public String getTimeEd() {
return timeEd;
}
public void setTimeEd(String timeEd) {
this.timeEd = timeEd;
}
}
@@ -0,0 +1,548 @@
package com.adc.da.search.entity;
import com.adc.da.att.vo.AttFileVo;
import com.adc.da.base.entity.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* <b>功能:</b>SAR_BUSSIONESS_STAND SarBussionessStandEOEntity<br>
* <b>作者:</b>code generator<br>
* <b>日期:</b> 2018-09-03 <br>
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
*/
public class SarBussionessStandEO extends BaseEntity {
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date modifyTime;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date creationTime;
private Integer validFlag;
private String putUser;
private String citationUser;
private String responsibleUnit;
private String standFile;
private String tags;
private String standStatus;
private String replacedStandNum;
private String replaceStandNum;
private String quoteStand;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date firstPutTime;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date putYear;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date putTime;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date issueTime;
private String energyKind;
private String applyArctic;
private String standEnName;
private String standName;
//标准编码
private String standCode;
//分类代号
private String classifyCode;
private String standSubclass;
private String standGenera;
private String id;
//目录ID 非标准信息表中的字段
private String menuId;
private String menuParentId;
private String standStatusShow; // 标准状态下拉框 --单选
private String applyArcticShow; // 适用车型下拉框 --多选
private String energyKindShow; // 能源种类下拉框 --多选
private String standGeneraShow;
private String standSubclassShow;
private String responsibleUnitShow;
private List<AttFileVo> standFileList = new ArrayList<AttFileVo>();
private String collectId;
//文件的下载id
private String attId;
public String getAttId() {
return attId;
}
public void setAttId(String attId) {
this.attId = attId;
}
//记录是否修改了替代文件号
private int upReplaceNumFlag;
//记录是否修改了文件号
private int upNumFlag;
/**
* java字段名转换为原始数据库列名。<b>如果不存在则返回null</b><br>
* <p>字段列表:</p>
* <li>modifyTime -> modify_time</li>
* <li>creationTime -> creation_time</li>
* <li>validFlag -> valid_flag</li>
* <li>putUser -> put_user</li>
* <li>citationUser -> citation_user</li>
* <li>responsibleUnit -> responsible_unit</li>
* <li>standFile -> stand_file</li>
* <li>tags -> tags</li>
* <li>standStatus -> stand_status</li>
* <li>replacedStandNum -> replaced_stand_num</li>
* <li>replaceStandNum -> replace_stand_num</li>
* <li>quoteStand -> quote_stand</li>
* <li>firstPutTime -> first_put_time</li>
* <li>putYear -> put_year</li>
* <li>putTime -> put_time</li>
* <li>issueTime -> issue_time</li>
* <li>energyKind -> energy_kind</li>
* <li>applyArctic -> apply_arctic</li>
* <li>standEnName -> stand_en_name</li>
* <li>standName -> stand_name</li>
* <li>standCode -> stand_code</li>
* <li>classifyCode -> classify_code</li>
* <li>standSubclass -> stand_subclass</li>
* <li>standGenera -> stand_genera</li>
* <li>id -> id</li>
*/
public static String fieldToColumn(String fieldName) {
if (fieldName == null){ return null;}
switch (fieldName) {
case "modifyTime": return "modify_time";
case "creationTime": return "creation_time";
case "validFlag": return "valid_flag";
case "putUser": return "put_user";
case "citationUser": return "citation_user";
case "responsibleUnit": return "responsible_unit";
case "standFile": return "stand_file";
case "tags": return "tags";
case "standStatus": return "stand_status";
case "replacedStandNum": return "replaced_stand_num";
case "replaceStandNum": return "replace_stand_num";
case "quoteStand": return "quote_stand";
case "firstPutTime": return "first_put_time";
case "putYear": return "put_year";
case "putTime": return "put_time";
case "issueTime": return "issue_time";
case "energyKind": return "energy_kind";
case "applyArctic": return "apply_arctic";
case "standEnName": return "stand_en_name";
case "standName": return "stand_name";
case "standCode": return "stand_code";
case "classifyCode": return "classify_code";
case "standSubclass": return "stand_subclass";
case "standGenera": return "stand_genera";
case "id": return "id";
default: return null;
}
}
/**
* 原始数据库列名转换为java字段名。<b>如果不存在则返回null</b><br>
* <p>字段列表:</p>
* <li>modify_time -> modifyTime</li>
* <li>creation_time -> creationTime</li>
* <li>valid_flag -> validFlag</li>
* <li>put_user -> putUser</li>
* <li>citation_user -> citationUser</li>
* <li>responsible_unit -> responsibleUnit</li>
* <li>stand_file -> standFile</li>
* <li>tags -> tags</li>
* <li>stand_status -> standStatus</li>
* <li>replaced_stand_num -> replacedStandNum</li>
* <li>replace_stand_num -> replaceStandNum</li>
* <li>quote_stand -> quoteStand</li>
* <li>first_put_time -> firstPutTime</li>
* <li>put_year -> putYear</li>
* <li>put_time -> putTime</li>
* <li>issue_time -> issueTime</li>
* <li>energy_kind -> energyKind</li>
* <li>apply_arctic -> applyArctic</li>
* <li>stand_en_name -> standEnName</li>
* <li>stand_name -> standName</li>
* <li>stand_code -> standCode</li>
* <li>classify_code -> classifyCode</li>
* <li>stand_subclass -> standSubclass</li>
* <li>stand_genera -> standGenera</li>
* <li>id -> id</li>
*/
public static String columnToField(String columnName) {
if (columnName == null){ return null;}
switch (columnName) {
case "modify_time": return "modifyTime";
case "creation_time": return "creationTime";
case "valid_flag": return "validFlag";
case "put_user": return "putUser";
case "citation_user": return "citationUser";
case "responsible_unit": return "responsibleUnit";
case "stand_file": return "standFile";
case "tags": return "tags";
case "stand_status": return "standStatus";
case "replaced_stand_num": return "replacedStandNum";
case "replace_stand_num": return "replaceStandNum";
case "quote_stand": return "quoteStand";
case "first_put_time": return "firstPutTime";
case "put_year": return "putYear";
case "put_time": return "putTime";
case "issue_time": return "issueTime";
case "energy_kind": return "energyKind";
case "apply_arctic": return "applyArctic";
case "stand_en_name": return "standEnName";
case "stand_name": return "standName";
case "stand_code": return "standCode";
case "classify_code": return "classifyCode";
case "stand_subclass": return "standSubclass";
case "stand_genera": return "standGenera";
case "id": return "id";
default: return null;
}
}
/** **/
public Date getModifyTime() {
return this.modifyTime;
}
/** **/
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
/** **/
public Date getCreationTime() {
return this.creationTime;
}
/** **/
public void setCreationTime(Date creationTime) {
this.creationTime = creationTime;
}
/** **/
public Integer getValidFlag() {
return this.validFlag;
}
/** **/
public void setValidFlag(Integer validFlag) {
this.validFlag = validFlag;
}
/** **/
public String getPutUser() {
return this.putUser;
}
/** **/
public void setPutUser(String putUser) {
this.putUser = putUser;
}
/** **/
public String getCitationUser() {
return this.citationUser;
}
/** **/
public void setCitationUser(String citationUser) {
this.citationUser = citationUser;
}
/** **/
public String getResponsibleUnit() {
return this.responsibleUnit;
}
/** **/
public void setResponsibleUnit(String responsibleUnit) {
this.responsibleUnit = responsibleUnit;
}
/** **/
public String getStandFile() {
return this.standFile;
}
/** **/
public void setStandFile(String standFile) {
this.standFile = standFile;
}
/** **/
public String getTags() {
return this.tags;
}
/** **/
public void setTags(String tags) {
this.tags = tags;
}
/** **/
public String getStandStatus() {
return this.standStatus;
}
/** **/
public void setStandStatus(String standStatus) {
this.standStatus = standStatus;
}
/** **/
public String getReplacedStandNum() {
return this.replacedStandNum;
}
/** **/
public void setReplacedStandNum(String replacedStandNum) {
this.replacedStandNum = replacedStandNum;
}
/** **/
public String getReplaceStandNum() {
return this.replaceStandNum;
}
/** **/
public void setReplaceStandNum(String replaceStandNum) {
this.replaceStandNum = replaceStandNum;
}
/** **/
public String getQuoteStand() {
return this.quoteStand;
}
/** **/
public void setQuoteStand(String quoteStand) {
this.quoteStand = quoteStand;
}
/** **/
public Date getFirstPutTime() {
return this.firstPutTime;
}
/** **/
public void setFirstPutTime(Date firstPutTime) {
this.firstPutTime = firstPutTime;
}
/** **/
public Date getPutYear() {
return this.putYear;
}
/** **/
public void setPutYear(Date putYear) {
this.putYear = putYear;
}
/** **/
public Date getPutTime() {
return this.putTime;
}
/** **/
public void setPutTime(Date putTime) {
this.putTime = putTime;
}
/** **/
public Date getIssueTime() {
return this.issueTime;
}
/** **/
public void setIssueTime(Date issueTime) {
this.issueTime = issueTime;
}
/** **/
public String getEnergyKind() {
return this.energyKind;
}
/** **/
public void setEnergyKind(String energyKind) {
this.energyKind = energyKind;
}
/** **/
public String getApplyArctic() {
return this.applyArctic;
}
/** **/
public void setApplyArctic(String applyArctic) {
this.applyArctic = applyArctic;
}
/** **/
public String getStandEnName() {
return this.standEnName;
}
/** **/
public void setStandEnName(String standEnName) {
this.standEnName = standEnName;
}
/** **/
public String getStandName() {
return this.standName;
}
/** **/
public void setStandName(String standName) {
this.standName = standName;
}
/** **/
public String getStandCode() {
return this.standCode;
}
/** **/
public void setStandCode(String standCode) {
this.standCode = standCode;
}
/** **/
public String getClassifyCode() {
return this.classifyCode;
}
/** **/
public void setClassifyCode(String classifyCode) {
this.classifyCode = classifyCode;
}
/** **/
public String getStandSubclass() {
return this.standSubclass;
}
/** **/
public void setStandSubclass(String standSubclass) {
this.standSubclass = standSubclass;
}
/** **/
public String getStandGenera() {
return this.standGenera;
}
/** **/
public void setStandGenera(String standGenera) {
this.standGenera = standGenera;
}
/** **/
public String getId() {
return this.id;
}
/** **/
public void setId(String id) {
this.id = id;
}
public String getMenuId() {
return menuId;
}
public void setMenuId(String menuId) {
this.menuId = menuId;
}
public String getStandStatusShow() {
return standStatusShow;
}
public void setStandStatusShow(String standStatusShow) {
this.standStatusShow = standStatusShow;
}
public String getApplyArcticShow() {
return applyArcticShow;
}
public void setApplyArcticShow(String applyArcticShow) {
this.applyArcticShow = applyArcticShow;
}
public String getEnergyKindShow() {
return energyKindShow;
}
public void setEnergyKindShow(String energyKindShow) {
this.energyKindShow = energyKindShow;
}
public String getStandGeneraShow() {
return standGeneraShow;
}
public void setStandGeneraShow(String standGeneraShow) {
this.standGeneraShow = standGeneraShow;
}
public String getStandSubclassShow() {
return standSubclassShow;
}
public void setStandSubclassShow(String standSubclassShow) {
this.standSubclassShow = standSubclassShow;
}
public List<AttFileVo> getStandFileList() {
return standFileList;
}
public void setStandFileList(List<AttFileVo> standFileList) {
this.standFileList = standFileList;
}
public String getCollectId() {
return collectId;
}
public void setCollectId(String collectId) {
this.collectId = collectId;
}
public String getResponsibleUnitShow() {
return responsibleUnitShow;
}
public void setResponsibleUnitShow(String responsibleUnitShow) {
this.responsibleUnitShow = responsibleUnitShow;
}
public String getMenuParentId() {
return menuParentId;
}
public void setMenuParentId(String menuParentId) {
this.menuParentId = menuParentId;
}
public int getUpReplaceNumFlag() {
return upReplaceNumFlag;
}
public void setUpReplaceNumFlag(int upReplaceNumFlag) {
this.upReplaceNumFlag = upReplaceNumFlag;
}
public int getUpNumFlag() {
return upNumFlag;
}
public void setUpNumFlag(int upNumFlag) {
this.upNumFlag = upNumFlag;
}
}
@@ -0,0 +1,192 @@
package com.adc.da.search.entity;
import com.adc.da.sys.common.BasePage;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
/**
* <b>功能:</b>SAR_STANDARDS_INFO SarStandardsInfoEOEntity<br>
* <b>作者:</b>code generator<br>
* <b>日期:</b> 2018-09-03 <br>
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
*/
public class SearchInfoEO extends BasePage {
//标准编号 文件号laws_number 标准编号STAND_CODE
private String standNumber;
//标准名称 文件名称laws_name standNAME
private String standName;
//标准英文名称 无 standEnName
private String standEnName;
//标准状态 文件状态laws_status standStatus
private String standState;
//标准文本 支持PDF、doc、docx文件《此项需要按照标准正文内容修改》 无 标准文本文件standFile
private String standFile;
//适用车型 适用车型 适用车型
private String applyArctic;
//发布日期 发布日期 发布日期
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date issueTime;
//实施日期 实施日期 实施日期
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date putTime;
//起草人 无 有发布人和主要编织者putUser,citationUser
private String draftUser;
//起草单位 发布单位issueUnit 无,只有责任部门
private String draftingUnit;
//代替标准号 代替文件号replaceLawsNum 代替标准号
private String replaceStandNum;
//被代替标准号 无 被代替标准号
private String replacedStandNum;
//需求文档中还有 《文件名称》laws 中有 laws_name 标准库,企业标准库没有相关字段
private String lawsName;
// 《动态标题》,标准库中找不到对应 都没有
//记录首页中的下拉选择的数据类别
private String selectKey;
//记录首页搜索框中对应的数据
private String selectValue;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date selectStartTime;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date selectEndTime;
public String getStandNumber() {
return standNumber;
}
public void setStandNumber(String standNumber) {
this.standNumber = standNumber;
}
public String getStandName() {
return standName;
}
public void setStandName(String standName) {
this.standName = standName;
}
public String getStandEnName() {
return standEnName;
}
public void setStandEnName(String standEnName) {
this.standEnName = standEnName;
}
public String getStandState() {
return standState;
}
public void setStandState(String standState) {
this.standState = standState;
}
public String getStandFile() {
return standFile;
}
public void setStandFile(String standFile) {
this.standFile = standFile;
}
public String getApplyArctic() {
return applyArctic;
}
public void setApplyArctic(String applyArctic) {
this.applyArctic = applyArctic;
}
public Date getIssueTime() {
return issueTime;
}
public void setIssueTime(Date issueTime) {
this.issueTime = issueTime;
}
public Date getPutTime() {
return putTime;
}
public void setPutTime(Date putTime) {
this.putTime = putTime;
}
public String getDraftUser() {
return draftUser;
}
public void setDraftUser(String draftUser) {
this.draftUser = draftUser;
}
public String getDraftingUnit() {
return draftingUnit;
}
public void setDraftingUnit(String draftingUnit) {
this.draftingUnit = draftingUnit;
}
public String getReplaceStandNum() {
return replaceStandNum;
}
public void setReplaceStandNum(String replaceStandNum) {
this.replaceStandNum = replaceStandNum;
}
public String getReplacedStandNum() {
return replacedStandNum;
}
public void setReplacedStandNum(String replacedStandNum) {
this.replacedStandNum = replacedStandNum;
}
public String getLawsName() {
return lawsName;
}
public void setLawsName(String lawsName) {
this.lawsName = lawsName;
}
public String getSelectKey() {
return selectKey;
}
public void setSelectKey(String selectKey) {
this.selectKey = selectKey;
}
public String getSelectValue() {
return selectValue;
}
public void setSelectValue(String selectValue) {
this.selectValue = selectValue;
}
public Date getSelectStartTime() {
return selectStartTime;
}
public void setSelectStartTime(Date selectStartTime) {
this.selectStartTime = selectStartTime;
}
public Date getSelectEndTime() {
return selectEndTime;
}
public void setSelectEndTime(Date selectEndTime) {
this.selectEndTime = selectEndTime;
}
}
@@ -0,0 +1,42 @@
package com.adc.da.search.entity;
import org.elasticsearch.index.query.BoolQueryBuilder;
public class SearchListDto {
private BoolQueryBuilder boolQueryBuilder;
private int must;
private int should;
private int mustnot;
public int getMustnot() {
return mustnot;
}
public void setMustnot(int mustnot) {
this.mustnot = mustnot;
}
public int getShould() {
return should;
}
public void setShould(int should) {
this.should = should;
}
public int getMust() {
return must;
}
public void setMust(int must) {
this.must = must;
}
public BoolQueryBuilder getBoolQueryBuilder() {
return boolQueryBuilder;
}
public void setBoolQueryBuilder(BoolQueryBuilder boolQueryBuilder) {
this.boolQueryBuilder = boolQueryBuilder;
}
}
@@ -0,0 +1,715 @@
package com.adc.da.search.entity;
import com.adc.da.sys.common.BasePage;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import java.util.List;
/**
* <b>功能:</b>SAR_STANDARDS_INFO SarStandardsInfoEOEntity<br>
* <b>作者:</b>code generator<br>
* <b>日期:</b> 2018-09-03 <br>
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
*/
public class SeniorSearchInfoEO extends BasePage {
private String standType;
//标准性质
private String nature;
//国家地区
private String country;
//标准类别
private String standSort;
//标准,文件号
private String numberShow;
//标准,文件名称
private String nameShow;
//适用车型
private String applyArctic;
//适用认证
private String applyAuth;
//所属类别
private String category;
//能源种类
private String energyKind;
//采标程度
private String adoptExtent;
//标准状态
private String standState;
//发布日期
private Date issueTime;
//标准大类
private String bussBigClass;
//标准细类
private String bussFineClass;
//记录首页中的下拉选择的数据类别
private String selectKey;
//记录首页搜索框中对应的数据
private String selectValue;
//记录从哪个索引表中查数据
private String selectIndex;
//高级搜索
//标准编号
private String standNumber;
//标准年份
private String standYear;
//标准英文名称
private String standEnName;
//代替标准号 手动输入可以多个,用","隔开
private String replaceStandNum;
//被代替标准号
private String replacedStandNum;
//采用国际标准号
private String interStandNum;
//实施日期
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date putTime;
//新生产车实施日期
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date newproductPutTime;
//在产车实施日期
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date productPutTime;
//新定型车实施日期
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date newcarPutTime;
//起草人
private String draftUser;
//起草单位
private String draftingUnit;
//关键词
private String tags;
//内容摘要
private String synopsis;
//责任部门
private String responsibleUnit;
//发布单位
private String issueUnit;
//分类代号
private String classifyCode;
//实施年份
private String putYear;
//首发日期
private String firstPutTime;
//引用标准
private String quoteStand;
//主要编制者
private String citationUser;
//动态标题
private String title;
//发布人
private String pubUserName;
//发布单位
private String pubOrgName;
//所属模块
private String module;
//注册车
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date registerPutTime;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date selectStartTime;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date selectEndTime;
private String keywords;
private String resultKeyword;
//发布开始日期
private Date issueTimeSt;
//发布结束日期
private Date issueTimeEd;
//实施开始日期
private Date putTimeSt;
//实施结束日期
private Date putTimeEd;
// 条目搜索条件
private String itemsName;
private String itemsNum;
private String parts;
//新车型实施开始日期
private Date newcarPutTimeSt;
//新车型实施结束日期
private Date newcarPutTimeEd;
//在产实施开始日期
private Date productPutTimeSt;
//在产实施结束日期
private Date productPutTimeEd;
private List<SarAdvanceSearchVO> advanceSearchVOList;
private String advanceSearchVOStr;
private String CLLX;
private String CYSD;
private String CBCD;
private String ZRLX;
private String SYCLLX;
private String WSSFCY;
private String ZQCBM;
private String stand_status;
private String isHigh;
public String getNature() {
return nature;
}
public void setNature(String nature) {
this.nature = nature;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getStandSort() {
return standSort;
}
public void setStandSort(String standSort) {
this.standSort = standSort;
}
public String getNumberShow() {
return numberShow;
}
public void setNumberShow(String numberShow) {
this.numberShow = numberShow;
}
public String getNameShow() {
return nameShow;
}
public void setNameShow(String nameShow) {
this.nameShow = nameShow;
}
public String getApplyArctic() {
return applyArctic;
}
public void setApplyArctic(String applyArctic) {
this.applyArctic = applyArctic;
}
public String getApplyAuth() {
return applyAuth;
}
public void setApplyAuth(String applyAuth) {
this.applyAuth = applyAuth;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getEnergyKind() {
return energyKind;
}
public void setEnergyKind(String energyKind) {
this.energyKind = energyKind;
}
public String getAdoptExtent() {
return adoptExtent;
}
public void setAdoptExtent(String adoptExtent) {
this.adoptExtent = adoptExtent;
}
public String getStandState() {
return standState;
}
public void setStandState(String standState) {
this.standState = standState;
}
public Date getIssueTime() {
return issueTime;
}
public void setIssueTime(Date issueTime) {
this.issueTime = issueTime;
}
public String getSelectKey() {
return selectKey;
}
public void setSelectKey(String selectKey) {
this.selectKey = selectKey;
}
public String getSelectValue() {
return selectValue;
}
public void setSelectValue(String selectValue) {
this.selectValue = selectValue;
}
public Date getSelectStartTime() {
return selectStartTime;
}
public void setSelectStartTime(Date selectStartTime) {
this.selectStartTime = selectStartTime;
}
public Date getSelectEndTime() {
return selectEndTime;
}
public void setSelectEndTime(Date selectEndTime) {
this.selectEndTime = selectEndTime;
}
public String getSelectIndex() {
return selectIndex;
}
public void setSelectIndex(String selectIndex) {
this.selectIndex = selectIndex;
}
public String getBussBigClass() {
return bussBigClass;
}
public void setBussBigClass(String bussBigClass) {
this.bussBigClass = bussBigClass;
}
public String getBussFineClass() {
return bussFineClass;
}
public void setBussFineClass(String bussFineClass) {
this.bussFineClass = bussFineClass;
}
public String getStandNumber() {
return standNumber;
}
public void setStandNumber(String standNumber) {
this.standNumber = standNumber;
}
public String getStandYear() {
return standYear;
}
public void setStandYear(String standYear) {
this.standYear = standYear;
}
public String getStandEnName() {
return standEnName;
}
public void setStandEnName(String standEnName) {
this.standEnName = standEnName;
}
public String getReplaceStandNum() {
return replaceStandNum;
}
public void setReplaceStandNum(String replaceStandNum) {
this.replaceStandNum = replaceStandNum;
}
public String getReplacedStandNum() {
return replacedStandNum;
}
public void setReplacedStandNum(String replacedStandNum) {
this.replacedStandNum = replacedStandNum;
}
public String getInterStandNum() {
return interStandNum;
}
public void setInterStandNum(String interStandNum) {
this.interStandNum = interStandNum;
}
public Date getPutTime() {
return putTime;
}
public void setPutTime(Date putTime) {
this.putTime = putTime;
}
public Date getNewproductPutTime() {
return newproductPutTime;
}
public void setNewproductPutTime(Date newproductPutTime) {
this.newproductPutTime = newproductPutTime;
}
public Date getProductPutTime() {
return productPutTime;
}
public void setProductPutTime(Date productPutTime) {
this.productPutTime = productPutTime;
}
public Date getNewcarPutTime() {
return newcarPutTime;
}
public void setNewcarPutTime(Date newcarPutTime) {
this.newcarPutTime = newcarPutTime;
}
public String getDraftUser() {
return draftUser;
}
public void setDraftUser(String draftUser) {
this.draftUser = draftUser;
}
public String getDraftingUnit() {
return draftingUnit;
}
public void setDraftingUnit(String draftingUnit) {
this.draftingUnit = draftingUnit;
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
public String getSynopsis() {
return synopsis;
}
public void setSynopsis(String synopsis) {
this.synopsis = synopsis;
}
public String getResponsibleUnit() {
return responsibleUnit;
}
public void setResponsibleUnit(String responsibleUnit) {
this.responsibleUnit = responsibleUnit;
}
public String getClassifyCode() {
return classifyCode;
}
public void setClassifyCode(String classifyCode) {
this.classifyCode = classifyCode;
}
public String getPutYear() {
return putYear;
}
public void setPutYear(String putYear) {
this.putYear = putYear;
}
public String getFirstPutTime() {
return firstPutTime;
}
public void setFirstPutTime(String firstPutTime) {
this.firstPutTime = firstPutTime;
}
public String getQuoteStand() {
return quoteStand;
}
public void setQuoteStand(String quoteStand) {
this.quoteStand = quoteStand;
}
public String getCitationUser() {
return citationUser;
}
public void setCitationUser(String citationUser) {
this.citationUser = citationUser;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getPubUserName() {
return pubUserName;
}
public void setPubUserName(String pubUserName) {
this.pubUserName = pubUserName;
}
public String getPubOrgName() {
return pubOrgName;
}
public void setPubOrgName(String pubOrgName) {
this.pubOrgName = pubOrgName;
}
public String getModule() {
return module;
}
public void setModule(String module) {
this.module = module;
}
public String getIssueUnit() {
return issueUnit;
}
public void setIssueUnit(String issueUnit) {
this.issueUnit = issueUnit;
}
public Date getRegisterPutTime() {
return registerPutTime;
}
public void setRegisterPutTime(Date registerPutTime) {
this.registerPutTime = registerPutTime;
}
public String getResultKeyword() {
return resultKeyword;
}
public void setResultKeyword(String resultKeyword) {
this.resultKeyword = resultKeyword;
}
public String getKeywords() {
return keywords;
}
public void setKeywords(String keywords) {
this.keywords = keywords;
}
public Date getIssueTimeSt() {
return issueTimeSt;
}
public void setIssueTimeSt(Date issueTimeSt) {
this.issueTimeSt = issueTimeSt;
}
public Date getIssueTimeEd() {
return issueTimeEd;
}
public void setIssueTimeEd(Date issueTimeEd) {
this.issueTimeEd = issueTimeEd;
}
public Date getPutTimeSt() {
return putTimeSt;
}
public void setPutTimeSt(Date putTimeSt) {
this.putTimeSt = putTimeSt;
}
public Date getPutTimeEd() {
return putTimeEd;
}
public void setPutTimeEd(Date putTimeEd) {
this.putTimeEd = putTimeEd;
}
public String getItemsName() {
return itemsName;
}
public void setItemsName(String itemsName) {
this.itemsName = itemsName;
}
public String getItemsNum() {
return itemsNum;
}
public void setItemsNum(String itemsNum) {
this.itemsNum = itemsNum;
}
public String getParts() {
return parts;
}
public void setParts(String parts) {
this.parts = parts;
}
public Date getNewcarPutTimeSt() {
return newcarPutTimeSt;
}
public void setNewcarPutTimeSt(Date newcarPutTimeSt) {
this.newcarPutTimeSt = newcarPutTimeSt;
}
public Date getNewcarPutTimeEd() {
return newcarPutTimeEd;
}
public void setNewcarPutTimeEd(Date newcarPutTimeEd) {
this.newcarPutTimeEd = newcarPutTimeEd;
}
public Date getProductPutTimeSt() {
return productPutTimeSt;
}
public void setProductPutTimeSt(Date productPutTimeSt) {
this.productPutTimeSt = productPutTimeSt;
}
public Date getProductPutTimeEd() {
return productPutTimeEd;
}
public void setProductPutTimeEd(Date productPutTimeEd) {
this.productPutTimeEd = productPutTimeEd;
}
public String getStandType() {
return standType;
}
public void setStandType(String standType) {
this.standType = standType;
}
public List<SarAdvanceSearchVO> getAdvanceSearchVOList() {
return advanceSearchVOList;
}
public void setAdvanceSearchVOList(List<SarAdvanceSearchVO> advanceSearchVOList) {
this.advanceSearchVOList = advanceSearchVOList;
}
public String getCLLX() {
return CLLX;
}
public void setCLLX(String CLLX) {
this.CLLX = CLLX;
}
public String getCYSD() {
return CYSD;
}
public void setCYSD(String CYSD) {
this.CYSD = CYSD;
}
public String getCBCD() {
return CBCD;
}
public void setCBCD(String CBCD) {
this.CBCD = CBCD;
}
public String getZRLX() {
return ZRLX;
}
public void setZRLX(String ZRLX) {
this.ZRLX = ZRLX;
}
public String getSYCLLX() {
return SYCLLX;
}
public void setSYCLLX(String SYCLLX) {
this.SYCLLX = SYCLLX;
}
public String getWSSFCY() {
return WSSFCY;
}
public void setWSSFCY(String WSSFCY) {
this.WSSFCY = WSSFCY;
}
public String getAdvanceSearchVOStr() {
return advanceSearchVOStr;
}
public void setAdvanceSearchVOStr(String advanceSearchVOStr) {
this.advanceSearchVOStr = advanceSearchVOStr;
}
public String getStand_status() {
return stand_status;
}
public void setStand_status(String stand_status) {
this.stand_status = stand_status;
}
public String getZQCBM() {
return ZQCBM;
}
public void setZQCBM(String ZQCBM) {
this.ZQCBM = ZQCBM;
}
public String getIsHigh() {
return isHigh;
}
public void setIsHigh(String isHigh) {
this.isHigh = isHigh;
}
}
@@ -0,0 +1,926 @@
package com.adc.da.search.entity;
import com.adc.da.base.entity.BaseEntity;
import java.util.Date;
/**
* <b>功能:</b>PART_PRODUCT PartProductEOEntity<br>
* <b>作者:</b>code generator<br>
* <b>日期:</b> 2018-11-22 <br>
* <b>版权所有:<br><br>
*/
public class StandLawsEO extends BaseEntity {
private String id;
private String stand_type;
private String laws_type;
private String numbershow;
private String numbershowSplit;
private String standNumber;
private String nameshow;
private String nameshowSplit;
private String standEnName;
private String nature;
private String natureShow;
private String country;
private String countryShow;
private String stand_sort;
private String standSortShow;
private String apply_arctic;
private String applyArcticShow;
private String standYear;
private String apply_auth;
private String applyAuthShow;
private String category;
private String categoryShow;
private String energy_kind;
private String energyKindShow;
private String adopt_extent;
private String adoptExtentShow;
private String statecode;
private String statecodeShow;
private Date issue_time;
private String issueTimeStr;
private Date put_time;
private String putTimeStr;
private String draft_user;
private String drafting_unit;
private String replace_stand_num;
private String replaced_stand_num;
private Integer valid_flag;
private String type;
private String standstateshow;
private String content;
private String lawsstateshow;
private String replace_laws_num;
private String bussBigClass;
private String bussBigClassShow;
private String bussFineClassShow;
private String bussFineClass;
private String classifyCode;
private String putYear;
private String firstPutTime;
private String quoteStand;
private String citationUser;
private String responsibleUnit;
private String responsibleUnitShow;
private String interStandNum;
private Date newproductPutTime;
//在产车实施日期
private Date productPutTime;
//新定型车实施日期
private Date newcarPutTime;
private Date registerPutTime;
private String standTag;
private String synopsis;
//发布单位
private String issueUnit;
//动态信息
private String module;
private String moduleName;
private String title;
private String pubUser;
private String pubUserShow;
private String pubOrg;
private String pubOrgShow;
private String msgContent;
//去掉编号中空格
private String numberExpNull;
// 条目信息
private String itemsName;
private String itemsNum;
private String standId;
private String termsConditions; //条款要求
private String mainPointImplementation; //实施要点
private String parts;
private Date tackTime;
private String remarks;
private String itemsType;
// 新加属性字段
private String issueUnitShow;//发布单位
private String citeStand;
private String citedStand;
private String gkglbm;
private String gkglbmShow;
private String gzzxx;
private String cysd;
private String zrlx;
private String zrlxShow;
private String yqlx;
private String yqlxShow;
private String gxhbq;
private String gxhbqShow;
private String xgbm;
private String xgbmShow;
private String svpps;
private String fo;
private String foShow;
private String xmpgry;
private String xmpgryShow;
private String fgwhr;
public String getApply_arctic() {
return apply_arctic;
}
public void setApply_arctic(String apply_arctic) {
this.apply_arctic = apply_arctic;
}
public String getEnergy_kind() {
return energy_kind;
}
public void setEnergy_kind(String energy_kind) {
this.energy_kind = energy_kind;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Date getIssue_time() {
return issue_time;
}
public void setIssue_time(Date issue_time) {
this.issue_time = issue_time;
}
public String getNameshow() {
return nameshow;
}
public void setNameshow(String nameshow) {
this.nameshow = nameshow;
}
public String getNumbershow() {
return numbershow;
}
public void setNumbershow(String numbershow) {
this.numbershow = numbershow;
}
public Date getPut_time() {
return put_time;
}
public void setPut_time(Date put_time) {
this.put_time = put_time;
}
public String getReplace_stand_num() {
return replace_stand_num;
}
public void setReplace_stand_num(String replace_stand_num) {
this.replace_stand_num = replace_stand_num;
}
public String getReplaced_stand_num() {
return replaced_stand_num;
}
public void setReplaced_stand_num(String replaced_stand_num) {
this.replaced_stand_num = replaced_stand_num;
}
public String getStandstateshow() {
return standstateshow;
}
public void setStandstateshow(String standstateshow) {
this.standstateshow = standstateshow;
}
public String getStatecode() {
return statecode;
}
public void setStatecode(String statecode) {
this.statecode = statecode;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Integer getValid_flag() {
return valid_flag;
}
public void setValid_flag(Integer valid_flag) {
this.valid_flag = valid_flag;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getStand_type() {
return stand_type;
}
public void setStand_type(String stand_type) {
this.stand_type = stand_type;
}
public String getLaws_type() {
return laws_type;
}
public void setLaws_type(String laws_type) {
this.laws_type = laws_type;
}
public String getNature() {
return nature;
}
public void setNature(String nature) {
this.nature = nature;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getStand_sort() {
return stand_sort;
}
public void setStand_sort(String stand_sort) {
this.stand_sort = stand_sort;
}
public String getApply_auth() {
return apply_auth;
}
public void setApply_auth(String apply_auth) {
this.apply_auth = apply_auth;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getAdopt_extent() {
return adopt_extent;
}
public void setAdopt_extent(String adopt_extent) {
this.adopt_extent = adopt_extent;
}
public String getDraft_user() {
return draft_user;
}
public void setDraft_user(String draft_user) {
this.draft_user = draft_user;
}
public String getDrafting_unit() {
return drafting_unit;
}
public void setDrafting_unit(String drafting_unit) {
this.drafting_unit = drafting_unit;
}
public String getLawsstateshow() {
return lawsstateshow;
}
public void setLawsstateshow(String lawsstateshow) {
this.lawsstateshow = lawsstateshow;
}
public String getReplace_laws_num() {
return replace_laws_num;
}
public void setReplace_laws_num(String replace_laws_num) {
this.replace_laws_num = replace_laws_num;
}
public String getBussBigClass() {
return bussBigClass;
}
public void setBussBigClass(String bussBigClass) {
this.bussBigClass = bussBigClass;
}
public String getBussFineClass() {
return bussFineClass;
}
public void setBussFineClass(String bussFineClass) {
this.bussFineClass = bussFineClass;
}
public String getClassifyCode() {
return classifyCode;
}
public void setClassifyCode(String classifyCode) {
this.classifyCode = classifyCode;
}
public String getPutYear() {
return putYear;
}
public void setPutYear(String putYear) {
this.putYear = putYear;
}
public String getFirstPutTime() {
return firstPutTime;
}
public void setFirstPutTime(String firstPutTime) {
this.firstPutTime = firstPutTime;
}
public String getQuoteStand() {
return quoteStand;
}
public void setQuoteStand(String quoteStand) {
this.quoteStand = quoteStand;
}
public String getCitationUser() {
return citationUser;
}
public void setCitationUser(String citationUser) {
this.citationUser = citationUser;
}
public String getStandEnName() {
return standEnName;
}
public void setStandEnName(String standEnName) {
this.standEnName = standEnName;
}
public String getResponsibleUnit() {
return responsibleUnit;
}
public void setResponsibleUnit(String responsibleUnit) {
this.responsibleUnit = responsibleUnit;
}
public String getInterStandNum() {
return interStandNum;
}
public void setInterStandNum(String interStandNum) {
this.interStandNum = interStandNum;
}
public Date getNewproductPutTime() {
return newproductPutTime;
}
public void setNewproductPutTime(Date newproductPutTime) {
this.newproductPutTime = newproductPutTime;
}
public Date getProductPutTime() {
return productPutTime;
}
public void setProductPutTime(Date productPutTime) {
this.productPutTime = productPutTime;
}
public Date getNewcarPutTime() {
return newcarPutTime;
}
public void setNewcarPutTime(Date newcarPutTime) {
this.newcarPutTime = newcarPutTime;
}
public String getSynopsis() {
return synopsis;
}
public void setSynopsis(String synopsis) {
this.synopsis = synopsis;
}
public String getIssueUnit() {
return issueUnit;
}
public void setIssueUnit(String issueUnit) {
this.issueUnit = issueUnit;
}
public String getNatureShow() {
return natureShow;
}
public void setNatureShow(String natureShow) {
this.natureShow = natureShow;
}
public String getCountryShow() {
return countryShow;
}
public void setCountryShow(String countryShow) {
this.countryShow = countryShow;
}
public String getStandSortShow() {
return standSortShow;
}
public void setStandSortShow(String standSortShow) {
this.standSortShow = standSortShow;
}
public String getApplyArcticShow() {
return applyArcticShow;
}
public void setApplyArcticShow(String applyArcticShow) {
this.applyArcticShow = applyArcticShow;
}
public String getApplyAuthShow() {
return applyAuthShow;
}
public void setApplyAuthShow(String applyAuthShow) {
this.applyAuthShow = applyAuthShow;
}
public String getCategoryShow() {
return categoryShow;
}
public void setCategoryShow(String categoryShow) {
this.categoryShow = categoryShow;
}
public String getEnergyKindShow() {
return energyKindShow;
}
public void setEnergyKindShow(String energyKindShow) {
this.energyKindShow = energyKindShow;
}
public String getAdoptExtentShow() {
return adoptExtentShow;
}
public void setAdoptExtentShow(String adoptExtentShow) {
this.adoptExtentShow = adoptExtentShow;
}
public String getStatecodeShow() {
return statecodeShow;
}
public void setStatecodeShow(String statecodeShow) {
this.statecodeShow = statecodeShow;
}
public String getIssueTimeStr() {
return issueTimeStr;
}
public void setIssueTimeStr(String issueTimeStr) {
this.issueTimeStr = issueTimeStr;
}
public String getPutTimeStr() {
return putTimeStr;
}
public void setPutTimeStr(String putTimeStr) {
this.putTimeStr = putTimeStr;
}
public String getBussBigClassShow() {
return bussBigClassShow;
}
public void setBussBigClassShow(String bussBigClassShow) {
this.bussBigClassShow = bussBigClassShow;
}
public String getBussFineClassShow() {
return bussFineClassShow;
}
public void setBussFineClassShow(String bussFineClassShow) {
this.bussFineClassShow = bussFineClassShow;
}
public String getModule() {
return module;
}
public void setModule(String module) {
this.module = module;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getPubUser() {
return pubUser;
}
public void setPubUser(String pubUser) {
this.pubUser = pubUser;
}
public String getPubUserShow() {
return pubUserShow;
}
public void setPubUserShow(String pubUserShow) {
this.pubUserShow = pubUserShow;
}
public String getPubOrg() {
return pubOrg;
}
public void setPubOrg(String pubOrg) {
this.pubOrg = pubOrg;
}
public String getPubOrgShow() {
return pubOrgShow;
}
public void setPubOrgShow(String pubOrgShow) {
this.pubOrgShow = pubOrgShow;
}
public String getModuleName() {
return moduleName;
}
public void setModuleName(String moduleName) {
this.moduleName = moduleName;
}
public String getStandYear() {
return standYear;
}
public void setStandYear(String standYear) {
this.standYear = standYear;
}
public String getResponsibleUnitShow() {
return responsibleUnitShow;
}
public void setResponsibleUnitShow(String responsibleUnitShow) {
this.responsibleUnitShow = responsibleUnitShow;
}
public String getStandNumber() {
return standNumber;
}
public void setStandNumber(String standNumber) {
this.standNumber = standNumber;
}
public Date getRegisterPutTime() {
return registerPutTime;
}
public void setRegisterPutTime(Date registerPutTime) {
this.registerPutTime = registerPutTime;
}
public String getNumberExpNull() {
return numberExpNull;
}
public void setNumberExpNull(String numberExpNull) {
this.numberExpNull = numberExpNull;
}
public String getItemsName() {
return itemsName;
}
public void setItemsName(String itemsName) {
this.itemsName = itemsName;
}
public String getItemsNum() {
return itemsNum;
}
public void setItemsNum(String itemsNum) {
this.itemsNum = itemsNum;
}
public String getStandId() {
return standId;
}
public void setStandId(String standId) {
this.standId = standId;
}
public String getTermsConditions() {
return termsConditions;
}
public void setTermsConditions(String termsConditions) {
this.termsConditions = termsConditions;
}
public String getMainPointImplementation() {
return mainPointImplementation;
}
public void setMainPointImplementation(String mainPointImplementation) {
this.mainPointImplementation = mainPointImplementation;
}
public String getParts() {
return parts;
}
public void setParts(String parts) {
this.parts = parts;
}
public Date getTackTime() {
return tackTime;
}
public void setTackTime(Date tackTime) {
this.tackTime = tackTime;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public String getItemsType() {
return itemsType;
}
public void setItemsType(String itemsType) {
this.itemsType = itemsType;
}
public String getNameshowSplit() {
return nameshowSplit;
}
public void setNameshowSplit(String nameshowSplit) {
this.nameshowSplit = nameshowSplit;
}
public String getNumbershowSplit() {
return numbershowSplit;
}
public void setNumbershowSplit(String numbershowSplit) {
this.numbershowSplit = numbershowSplit;
}
public String getMsgContent() {
return msgContent;
}
public void setMsgContent(String msgContent) {
this.msgContent = msgContent;
}
public String getStandTag() {
return standTag;
}
public void setStandTag(String standTag) {
this.standTag = standTag;
}
public String getIssueUnitShow() {
return issueUnitShow;
}
public void setIssueUnitShow(String issueUnitShow) {
this.issueUnitShow = issueUnitShow;
}
public String getCiteStand() {
return citeStand;
}
public void setCiteStand(String citeStand) {
this.citeStand = citeStand;
}
public String getCitedStand() {
return citedStand;
}
public void setCitedStand(String citedStand) {
this.citedStand = citedStand;
}
public String getGkglbm() {
return gkglbm;
}
public void setGkglbm(String gkglbm) {
this.gkglbm = gkglbm;
}
public String getGkglbmShow() {
return gkglbmShow;
}
public void setGkglbmShow(String gkglbmShow) {
this.gkglbmShow = gkglbmShow;
}
public String getGzzxx() {
return gzzxx;
}
public void setGzzxx(String gzzxx) {
this.gzzxx = gzzxx;
}
public String getCysd() {
return cysd;
}
public void setCysd(String cysd) {
this.cysd = cysd;
}
public String getZrlx() {
return zrlx;
}
public void setZrlx(String zrlx) {
this.zrlx = zrlx;
}
public String getZrlxShow() {
return zrlxShow;
}
public void setZrlxShow(String zrlxShow) {
this.zrlxShow = zrlxShow;
}
public String getYqlx() {
return yqlx;
}
public void setYqlx(String yqlx) {
this.yqlx = yqlx;
}
public String getYqlxShow() {
return yqlxShow;
}
public void setYqlxShow(String yqlxShow) {
this.yqlxShow = yqlxShow;
}
public String getGxhbq() {
return gxhbq;
}
public void setGxhbq(String gxhbq) {
this.gxhbq = gxhbq;
}
public String getGxhbqShow() {
return gxhbqShow;
}
public void setGxhbqShow(String gxhbqShow) {
this.gxhbqShow = gxhbqShow;
}
public String getXgbm() {
return xgbm;
}
public void setXgbm(String xgbm) {
this.xgbm = xgbm;
}
public String getXgbmShow() {
return xgbmShow;
}
public void setXgbmShow(String xgbmShow) {
this.xgbmShow = xgbmShow;
}
public String getSvpps() {
return svpps;
}
public void setSvpps(String svpps) {
this.svpps = svpps;
}
public String getFo() {
return fo;
}
public void setFo(String fo) {
this.fo = fo;
}
public String getFoShow() {
return foShow;
}
public void setFoShow(String foShow) {
this.foShow = foShow;
}
public String getXmpgry() {
return xmpgry;
}
public void setXmpgry(String xmpgry) {
this.xmpgry = xmpgry;
}
public String getXmpgryShow() {
return xmpgryShow;
}
public void setXmpgryShow(String xmpgryShow) {
this.xmpgryShow = xmpgryShow;
}
public String getFgwhr() {
return fgwhr;
}
public void setFgwhr(String fgwhr) {
this.fgwhr = fgwhr;
}
}
@@ -0,0 +1,358 @@
package com.adc.da.search.page;
import com.adc.da.sys.common.BasePage;
import java.util.Date;
/**
* <b>功能:</b>PART_PRODUCT PartProductEOPage<br>
* <b>作者:</b>code generator<br>
* <b>日期:</b> 2018-08-22 <br>
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
*/
public class PartProductEOPage extends BasePage {
private String id;
private String idOperator = "=";
private String corpId;
private String corpIdOperator = "=";
private String partType;
private String partTypeOperator = "=";
private String partName;
private String partNameOperator = "=";
private String partNummber;
private String partNummberOperator = "=";
private String riskGrade;
private String riskGradeOperator = "=";
private String suitModel;
private String suitModelOperator = "=";
private String motoModel;
private String motoModelOperator = "=";
private String motoType;
private String motoTypeOperator = "=";
private String oemCode;
private String oemCodeOperator = "=";
private String certNumber;
private String certNumberOperator = "=";
private String delFlag;
private String delFlagOperator = "=";
private String insertTime;
private String insertTime1;
private String insertTime2;
private String insertTimeOperator = "=";
private String updateTime;
private String updateTime1;
private String updateTime2;
private String updateTimeOperator = "=";
private String corpModel;
private String corpModelOperator = "=";
private String partSup;
private String partSupOperator = "=";
private String qrCodeStatus;
private String qrCodeStatusOperator = "=";
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getIdOperator() {
return this.idOperator;
}
public void setIdOperator(String idOperator) {
this.idOperator = idOperator;
}
public String getCorpId() {
return this.corpId;
}
public void setCorpId(String corpId) {
this.corpId = corpId;
}
public String getCorpIdOperator() {
return this.corpIdOperator;
}
public void setCorpIdOperator(String corpIdOperator) {
this.corpIdOperator = corpIdOperator;
}
public String getPartType() {
return this.partType;
}
public void setPartType(String partType) {
this.partType = partType;
}
public String getPartTypeOperator() {
return this.partTypeOperator;
}
public void setPartTypeOperator(String partTypeOperator) {
this.partTypeOperator = partTypeOperator;
}
public String getPartName() {
return this.partName;
}
public void setPartName(String partName) {
this.partName = partName;
}
public String getPartNameOperator() {
return this.partNameOperator;
}
public void setPartNameOperator(String partNameOperator) {
this.partNameOperator = partNameOperator;
}
public String getPartNummber() {
return this.partNummber;
}
public void setPartNummber(String partNummber) {
this.partNummber = partNummber;
}
public String getPartNummberOperator() {
return this.partNummberOperator;
}
public void setPartNummberOperator(String partNummberOperator) {
this.partNummberOperator = partNummberOperator;
}
public String getRiskGrade() {
return this.riskGrade;
}
public void setRiskGrade(String riskGrade) {
this.riskGrade = riskGrade;
}
public String getRiskGradeOperator() {
return this.riskGradeOperator;
}
public void setRiskGradeOperator(String riskGradeOperator) {
this.riskGradeOperator = riskGradeOperator;
}
public String getSuitModel() {
return this.suitModel;
}
public void setSuitModel(String suitModel) {
this.suitModel = suitModel;
}
public String getSuitModelOperator() {
return this.suitModelOperator;
}
public void setSuitModelOperator(String suitModelOperator) {
this.suitModelOperator = suitModelOperator;
}
public String getMotoModel() {
return this.motoModel;
}
public void setMotoModel(String motoModel) {
this.motoModel = motoModel;
}
public String getMotoModelOperator() {
return this.motoModelOperator;
}
public void setMotoModelOperator(String motoModelOperator) {
this.motoModelOperator = motoModelOperator;
}
public String getMotoType() {
return this.motoType;
}
public void setMotoType(String motoType) {
this.motoType = motoType;
}
public String getMotoTypeOperator() {
return this.motoTypeOperator;
}
public void setMotoTypeOperator(String motoTypeOperator) {
this.motoTypeOperator = motoTypeOperator;
}
public String getOemCode() {
return this.oemCode;
}
public void setOemCode(String oemCode) {
this.oemCode = oemCode;
}
public String getOemCodeOperator() {
return this.oemCodeOperator;
}
public void setOemCodeOperator(String oemCodeOperator) {
this.oemCodeOperator = oemCodeOperator;
}
public String getCertNumber() {
return this.certNumber;
}
public void setCertNumber(String certNumber) {
this.certNumber = certNumber;
}
public String getCertNumberOperator() {
return this.certNumberOperator;
}
public void setCertNumberOperator(String certNumberOperator) {
this.certNumberOperator = certNumberOperator;
}
public String getDelFlag() {
return this.delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlagOperator() {
return this.delFlagOperator;
}
public void setDelFlagOperator(String delFlagOperator) {
this.delFlagOperator = delFlagOperator;
}
public String getInsertTime() {
return this.insertTime;
}
public void setInsertTime(String insertTime) {
this.insertTime = insertTime;
}
public String getInsertTime1() {
return this.insertTime1;
}
public void setInsertTime1(String insertTime1) {
this.insertTime1 = insertTime1;
}
public String getInsertTime2() {
return this.insertTime2;
}
public void setInsertTime2(String insertTime2) {
this.insertTime2 = insertTime2;
}
public String getInsertTimeOperator() {
return this.insertTimeOperator;
}
public void setInsertTimeOperator(String insertTimeOperator) {
this.insertTimeOperator = insertTimeOperator;
}
public String getUpdateTime() {
return this.updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public String getUpdateTime1() {
return this.updateTime1;
}
public void setUpdateTime1(String updateTime1) {
this.updateTime1 = updateTime1;
}
public String getUpdateTime2() {
return this.updateTime2;
}
public void setUpdateTime2(String updateTime2) {
this.updateTime2 = updateTime2;
}
public String getUpdateTimeOperator() {
return this.updateTimeOperator;
}
public void setUpdateTimeOperator(String updateTimeOperator) {
this.updateTimeOperator = updateTimeOperator;
}
public String getCorpModel() {
return this.corpModel;
}
public void setCorpModel(String corpModel) {
this.corpModel = corpModel;
}
public String getCorpModelOperator() {
return this.corpModelOperator;
}
public void setCorpModelOperator(String corpModelOperator) {
this.corpModelOperator = corpModelOperator;
}
public String getPartSup() {
return this.partSup;
}
public void setPartSup(String partSup) {
this.partSup = partSup;
}
public String getPartSupOperator() {
return this.partSupOperator;
}
public void setPartSupOperator(String partSupOperator) {
this.partSupOperator = partSupOperator;
}
public String getQrCodeStatus() {
return this.qrCodeStatus;
}
public void setQrCodeStatus(String qrCodeStatus) {
this.qrCodeStatus = qrCodeStatus;
}
public String getQrCodeStatusOperator() {
return this.qrCodeStatusOperator;
}
public void setQrCodeStatusOperator(String qrCodeStatusOperator) {
this.qrCodeStatusOperator = qrCodeStatusOperator;
}
}
@@ -0,0 +1,270 @@
package com.adc.da.search.service;
import com.adc.da.search.entity.EsPage;
import com.alibaba.fastjson.JSONObject;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.xcontent.XContentBuilder;
import java.util.List;
import java.util.Map;
public interface ElasticsearchService {
/**
* Elasticsearch 创建索引定义
* @param index 要创建的索引
* @return true表示创建成功,false表示创建失败
* @author gaoyan
* date 2018-08-27
*/
boolean createIndex(String index, XContentBuilder mapping);
/**
* Elasticsearch 删除索引定义
* @param index 要删除的索引
* @return true表示删除成功,false表示删除失败
* @author gaoyan
* date 2018-08-27
*/
boolean deleteIndex(String index);
/**
* Elasticsearch 判断索引是否存在定义
* @param index 要判断的索引名称
* @return true表示该索引存在,false表示该索引不存在
* @author gaoyan
* date 2018-08-28
*/
boolean isIndexExist(String index);
/**
* 指定ID数据添加接口定义,
* @param jsonObject 要增加的数据
* @param index 索引,类似数据库
* @param type 类型,类似表 (自6.0改版以后,一个索引里只允许有一种类型,
* 如果索引中已经有类型,增加数据过程中,添加其他类型会报错)
* @param id 数据ID
* @return 返回创建的文档的id
* @author gaoyan
* date 2018-08-28
*/
String addData(JSONObject jsonObject, String index, String type, String id);
String addDataForMap(Map<String,Object> attrInfoMap, String index, String type, String id);
/**
* 不指定ID数据添加接口定义,
* @param jsonObject 要增加的数据
* @param index 索引,类似数据库
* @param type 类型,类似表 (自6.0改版以后,一个索引里只允许有一种类型,
* 如果索引中已经有类型,增加数据过程中,添加其他类型会报错)
* @return 返回创建的文档的id
* @author gaoyan
* date 2018-08-28
*/
String addData(JSONObject jsonObject, String index, String type);
/**
* 通过ID删除数据定义
*
* @param index 索引,类似数据库
* @param type 类型,类似表
* @param id 数据ID
* @return 正确删除返回DELETED
* @author gaoyan
* date 2018-08-28
*/
String deleteDataById(String index, String type, String id);
/**
* Elasticsearch 删除某个index所有的文档接口定义
* @param index 要插入的索引
* @return 删除返回的结果
* @author gaoyan
* date 2018-08-27
*/
long deleteAllDataOfIndex(String index);
/**
* 通过ID 更新数据定义
*
* @param jsonObject 要更新的数据
* @param index 索引,类似数据库
* @param type 类型,类似表
* @param id 数据ID
* @return 如果正确删除返回 UPDATED
* @author gaoyan
* date 2018-08-28
*/
String updateDataById(JSONObject jsonObject, String index, String type, String id);
String updateDataByIdForMap(Map<String,Object> attrInfoMap, String index, String type, String id);
/**
* 通过ID获取数据定义
*
* @param index 索引,类似数据库
* @param type 类型,类似表
* @param id 数据ID
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
* @return
* @author gaoyan
* date 2018-08-28
*/
Map<String, Object> searchDataById(String index, String type, String id, String fields);
/**
* 使用分词查询
*
* @param index 索引名称
* @param type 类型名称,可传入多个type逗号分隔
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
* @param matchStr 过滤条件(xxx=111,aaa=222
* @return
*/
List<Map<String, Object>> searchListData(String index, String type, String fields, String matchStr);
/**
* 使用分词查询
*
* @param index 索引名称
* @param type 类型名称,可传入多个type逗号分隔
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
* @param sortField 排序字段
* @param matchPhrase true 使用,短语精准匹配
* @param matchStr 过滤条件(xxx=111,aaa=222
* @return
*/
List<Map<String, Object>> searchListData(String index, String type, String fields, String sortField, boolean matchPhrase, String matchStr);
/**
* 使用分词查询
*
* @param index 索引名称
* @param type 类型名称,可传入多个type逗号分隔
* @param size 文档大小限制
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
* @param sortField 排序字段
* @param matchPhrase true 使用,短语精准匹配
* @param highlightField 高亮字段
* @param matchStr 过滤条件(xxx=111,aaa=222
* @return
*/
List<Map<String, Object>> searchListData(String index, String type, Integer size, String fields, String sortField, boolean matchPhrase, String highlightField, String matchStr);
/**
* 使用分词查询
*
* @param index 索引名称
* @param type 类型名称,可传入多个type逗号分隔
* @param startTime 开始时间
* @param endTime 结束时间
* @param size 文档大小限制
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
* @param sortField 排序字段
* @param matchPhrase true 使用,短语精准匹配
* @param highlightField 高亮字段
* @param matchStr 过滤条件(xxx=111,aaa=222
* @return
*/
List<Map<String, Object>> searchListData(String index, String type, long startTime, long endTime, Integer size, String fields, String sortField, boolean matchPhrase, String highlightField, String matchStr);
/**
* 使用分词查询,并分页
*
* @param index 索引名称
* @param type 类型名称,可传入多个type逗号分隔
* @param currentPage 当前页
* @param pageSize 每页显示条数
* @param startTime 开始时间
* @param endTime 结束时间
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
* @param sortField 排序字段
* @param matchPhrase true 使用,短语精准匹配
* @param highlightField 高亮字段
* @param matchStr 过滤条件(xxx=111,aaa=222
* @return
*/
EsPage searchDataPage(String index, String type, int currentPage, int pageSize, long startTime, long endTime, String fields, String sortField, boolean matchPhrase, String highlightField, String matchStr);
/**
* 高亮结果集 特殊处理
*
* @param searchResponse
* @param highlightField
*/
List<Map<String, Object>> setSearchResponse(SearchResponse searchResponse, String highlightField);
/**
* Elasticsearch 批量插入接口定义
* @param index 要插入的索引
* @param type 要插入数据对应的type
* @param list 插入数据的list
* @return
* @author gaoyan
* date 2018-08-27
*/
String addBulkData(String index, String type, List<JSONObject> list);
/**
* 默认查询全部数据,并按照对应的字段排序,方法内写了部分基础查询,主要是针对单个field但条件
* 具体业务查询可参考方法体中注释代码
* @param index index名称,可以从多个index中查询,所以这里定义成String数组
* @param type type名称,可以从多种type中查询,所以这里定义成String数组
* @param sortfield 需要排序的字段,
* @return
* @author gaoyan
* date 2018-08-28
*/
List<Map<String, Object>> searchListDataAndSort(String[] index, String[] type, String sortfield, String[] fields);
/**
* 涉及组合查询条件主要涉及到boolQueryBuilder的使用
* @param index index名称,可以从多个index中查询,所以这里定义成String数组
* @param type type名称,可以从多种type中查询,所以这里定义成String数组
* @param sortfield 需要排序的字段,
* @return
* @author gaoyan
* date 2018-08-28
*/
List<Map<String, Object>> searchListDataUnit(String[] index, String[] type, String sortfield, String[] fields);
/**
* 涉及组合查询条件主要涉及到聚合函数的使用,主要是分组求平均值,依靠平均值排序 terms
* @param index index名称,可以从多个index中查询,所以这里定义成String数组
* @param type type名称,可以从多种type中查询,所以这里定义成String数组
* @return
* @author gaoyan
* date 2018-08-28
*/
List<Map<String, Object>> searchListDataGroup(String[] index, String[] type);
/**
* 涉及组合查询条件主要涉及到聚合函数的使用,较为复杂,按照年龄阶段分组后,再安装性别分组,求balance平均值 ranges
* @param index index名称,可以从多个index中查询,所以这里定义成String数组
* @param type type名称,可以从多种type中查询,所以这里定义成String数组
* @return
* @author gaoyan
* date 2018-08-29
*/
List<Map<String, Object>> searchListDataGroupComplex(String[] index, String[] type);
/**
* 查询结果集searchResponse装换成List形式
* @param searchResponse 需要转换的数据
* @return
* @author gaoyan
* date 2018-08-28
*/
List<Map<String, Object>> SearchResponseToList(SearchResponse searchResponse);
}
@@ -0,0 +1,30 @@
package com.adc.da.search.service;
import com.adc.da.search.entity.SeniorSearchInfoEO;
import org.elasticsearch.action.search.SearchResponse;
import java.util.List;
import java.util.Map;
public interface SearchCenterService {
List<Map<String, Object>> searchSarBykey(SeniorSearchInfoEO searchInfoEO) throws Exception;
/**
* 查询结果集searchResponse装换成List形式
* @param searchResponse 需要转换的数据
* @return
* @author gaoyan
* date 2018-08-28
*/
List<Map<String, Object>> SearchResponseToList(SearchResponse searchResponse);
Map<String, Object> selectGroupdata(SeniorSearchInfoEO searchInfoEO);
String [] searchIdToImport(SeniorSearchInfoEO searchInfoEO);
List<Map<String, Object>> searchSarBykeyAndHighLight(SeniorSearchInfoEO searchInfoEO) throws Exception;
List<Map<String, Object>> searchSarBykeyAndHighLightNumber(SeniorSearchInfoEO searchInfoEO) throws Exception;
}
@@ -0,0 +1,19 @@
package com.adc.da.search.service;
import com.adc.da.search.entity.StandLawsEO;
import java.util.Map;
public interface StandLawsSearchService {
String addStandLawsSearch(StandLawsEO standLawsEO);
String addStandLawsSearchForMap(Map<String,Object> attrInfoMap);
// String updateStandLawsSearch(StandLawsEO standLawsEO);
String updateStandLawsSearchForMap(Map<String,Object> attrInfoMap);
String deleteStandLawsSearch(StandLawsEO standLawsEO);
}
@@ -0,0 +1,748 @@
package com.adc.da.search.service.impl;
import com.adc.da.search.entity.EsPage;
import com.adc.da.search.service.ElasticsearchService;
import com.adc.da.util.utils.StringUtils;
import com.alibaba.fastjson.JSONObject;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest;
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse;
import org.elasticsearch.action.bulk.BulkRequestBuilder;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.get.GetRequestBuilder;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.action.update.UpdateResponse;
import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.text.Text;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.reindex.BulkByScrollResponse;
import org.elasticsearch.index.reindex.DeleteByQueryAction;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.BucketOrder;
import org.elasticsearch.search.aggregations.bucket.range.Range;
import org.elasticsearch.search.aggregations.bucket.terms.StringTerms;
import org.elasticsearch.search.aggregations.metrics.avg.Avg;
import org.elasticsearch.search.aggregations.metrics.max.Max;
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
import org.elasticsearch.search.sort.SortOrder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.*;
@Component
public class ElasticsearchServiceImpl implements ElasticsearchService {
private static final Logger logger = LoggerFactory.getLogger(ElasticsearchServiceImpl.class);
@Autowired
private TransportClient transportClient;
private TransportClient client;
@PostConstruct
public void init() {
client = this.transportClient;
}
/**
* Elasticsearch 创建索引实现
* @param index 要创建的索引
* @return true表示创建成功,false表示创建失败
* @author gaoyan
* date 2018-08-27
*/
@Override
public boolean createIndex(String index ,XContentBuilder mapping){
if (!isIndexExist(index)) {
logger.info("Index is not exits!");
}
CreateIndexRequestBuilder cib=client.admin().indices().prepareCreate(index);
cib.addMapping(index, mapping);
CreateIndexResponse indexresponse = cib.execute().actionGet();
logger.info("执行建立成功?" + indexresponse.isAcknowledged());
return indexresponse.isAcknowledged();
}
/**
* Elasticsearch 删除索引实现
* @param index 要删除的索引
* @return true表示删除成功,false表示删除失败
* @author gaoyan
* date 2018-08-27
*/
@Override
public boolean deleteIndex(String index) {
if (!isIndexExist(index)) {
logger.info("Index is not exits!");
}
DeleteIndexResponse dResponse = client.admin().indices().prepareDelete(index).get();
if (dResponse.isAcknowledged()) {
logger.info("delete index " + index + " successfully!");
} else {
logger.info("Fail to delete index " + index);
}
return dResponse.isAcknowledged();
}
/**
* Elasticsearch 判断索引是否存在实现
* @param index 要判断的索引名称
* @return true表示该索引存在,false表示该索引不存在
* @author gaoyan
* date 2018-08-28
*/
@Override
public boolean isIndexExist(String index) {
IndicesExistsResponse inExistsResponse = client.admin().indices().exists(new IndicesExistsRequest(index)).actionGet();
if (inExistsResponse.isExists()) {
logger.info("Index [" + index + "] is exist!");
} else {
logger.info("Index [" + index + "] is not exist!");
}
return inExistsResponse.isExists();
}
/**
* 指定ID数据添加接口实现,
* @param jsonObject 要增加的数据
* @param index 索引,类似数据库
* @param type 类型,类似表 (自6.0改版以后,一个索引里只允许有一种类型,
* 如果索引中已经有类型,增加数据过程中,添加其他类型会报错)
* @param id 数据ID
* @return 返回创建的文档的id
* @author gaoyan
* date 2018-08-28
*/
@Override
public String addData(JSONObject jsonObject, String index, String type, String id) {
IndexResponse response = client.prepareIndex(index, type, id).setSource(jsonObject).get();
logger.info("addData response status:{},id:{}", response.status().getStatus(), response.getId());
return response.getId();
}
@Override
public String addDataForMap(Map<String,Object> attrInfoMap, String index, String type, String id) {
IndexResponse response = client.prepareIndex(index, type, id).setSource(attrInfoMap).get();
logger.info("addData response status:{},id:{}", response.status().getStatus(), response.getId());
return response.getId();
}
/**
* 不指定ID数据添加接口实现,
* @param jsonObject 要增加的数据
* @param index 索引,类似数据库
* @param type 类型,类似表 (自6.0改版以后,一个索引里只允许有一种类型,
* 如果索引中已经有类型,增加数据过程中,添加其他类型会报错)
* @return 返回创建的文档的id
* @author gaoyan
* date 2018-08-28
*/
@Override
public String addData(JSONObject jsonObject, String index, String type) {
IndexResponse response = client.prepareIndex(index, type).setSource(jsonObject).get();
logger.info("addData response status:{},id:{}", response.status().getStatus(), response.getId());
return response.getId();
}
/**
* 通过ID删除数据实现
*
* @param index 索引,类似数据库
* @param type 类型,类似表
* @param id 数据ID
* @return 正确删除返回DELETED
* @author gaoyan
* date 2018-08-28
*/
@Override
public String deleteDataById(String index, String type, String id) {
DeleteResponse response = client.prepareDelete(index, type, id).get();
logger.info("deleteDataById response status:{},id:{}", response.status().getStatus(), response.getId());
return response.getResult().toString();
}
/**
* Elasticsearch 删除某个index所有的文档接口实现
* @param index 要插入的索引
* @return 删除返回的结果,一共删除多少条
* @author gaoyan
* date 2018-08-27
*/
@Override
public long deleteAllDataOfIndex(String index) {
BulkByScrollResponse response = DeleteByQueryAction.INSTANCE.newRequestBuilder(client)
.filter(QueryBuilders.matchAllQuery())
.source(index)
.get();
//一共删除掉多少条
long deleted = response.getDeleted();
return deleted;
}
/**
* 通过ID 更新数据实现
*
* @param jsonObject 要更新的数据
* @param index 索引,类似数据库
* @param type 类型,类似表
* @param id 数据ID
* @return 如果正确删除返回 UPDATED
* @author gaoyan
* date 2018-08-28
*/
@Override
public String updateDataById(JSONObject jsonObject, String index, String type, String id) {
UpdateRequest updateRequest = new UpdateRequest();
updateRequest.index(index).type(type).id(id).doc(jsonObject);
UpdateResponse result;
try {
result = this.client.update(updateRequest).get();
} catch (Exception e) {
logger.error(e.getMessage(),e);
return e.getMessage();
}
return result.getResult().toString();
}
@Override
public String updateDataByIdForMap(Map<String,Object> attrInfoMap, String index, String type, String id) {
UpdateRequest updateRequest = new UpdateRequest();
updateRequest.index(index).type(type).id(id).doc(attrInfoMap);
UpdateResponse result;
try {
result = this.client.update(updateRequest).get();
} catch (Exception e) {
logger.error(e.getMessage(),e);
return e.getMessage();
}
return result.getResult().toString();
}
/**
* 通过ID获取数据实现
*
* @param index 索引,类似数据库
* @param type 类型,类似表
* @param id 数据ID
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
* @return Map结构的数据集
* @author gaoyan
* date 2018-08-28
*/
@Override
public Map<String, Object> searchDataById(String index, String type, String id, String fields) {
GetRequestBuilder getRequestBuilder = client.prepareGet(index, type, id);
if (StringUtils.isNotEmpty(fields)) {
getRequestBuilder.setFetchSource(fields.split(","), null);
}
GetResponse getResponse = getRequestBuilder.get();
return getResponse.getSource();
}
/**
* 使用分词查询
*
* @param index 索引名称
* @param type 类型名称
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
* @param matchStr 过滤条件(xxx=111,aaa=222
* @return
* @author gaoyan
* date 2018-08-28
*/
@Override
public List<Map<String, Object>> searchListData(String index, String type, String fields, String matchStr) {
return searchListData(index, type, 0, 0, null, fields, null, false, null, matchStr);
}
/**
* 使用分词查询
*
* @param index 索引名称
* @param type 类型名称
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
* @param sortField 排序字段
* @param matchPhrase true 使用,短语精准匹配
* @param matchStr 过滤条件(xxx=111,aaa=222
* @return
* @author gaoyan
* date 2018-08-28
*/
@Override
public List<Map<String, Object>> searchListData(String index, String type, String fields, String sortField, boolean matchPhrase, String matchStr) {
return searchListData(index, type, 0, 0, null, fields, sortField, matchPhrase, null, matchStr);
}
/**
* 使用分词查询
*
* @param index 索引名称
* @param type 类型名称
* @param size 文档大小限制
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
* @param sortField 排序字段
* @param matchPhrase true 使用,短语精准匹配
* @param highlightField 高亮字段
* @param matchStr 过滤条件(xxx=111,aaa=222
* @return
*/
@Override
public List<Map<String, Object>> searchListData(String index, String type, Integer size, String fields, String sortField, boolean matchPhrase, String highlightField, String matchStr) {
return searchListData(index, type, 0, 0, size, fields, sortField, matchPhrase, highlightField, matchStr);
}
/**
* 使用分词查询
*
* @param index 索引名称
* @param type 类型名称
* @param startTime 开始时间
* @param endTime 结束时间
* @param size 文档大小限制
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
* @param sortField 排序字段
* @param matchPhrase true 使用,短语精准匹配
* @param highlightField 高亮字段
* @param matchStr 过滤条件(xxx=111,aaa=222
* @return
*/
@Override
public List<Map<String, Object>> searchListData(String index, String type, long startTime, long endTime, Integer size, String fields, String sortField, boolean matchPhrase, String highlightField, String matchStr) {
SearchRequestBuilder searchRequestBuilder = client.prepareSearch(index);
if (StringUtils.isNotEmpty(type)) {
searchRequestBuilder.setTypes(type.split(","));
}
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
if (startTime > 0 && endTime > 0) {
boolQuery.must(QueryBuilders.rangeQuery("processTime")
.format("epoch_millis")
.from(startTime)
.to(endTime)
.includeLower(true)
.includeUpper(true));
}
//搜索的的字段
if (StringUtils.isNotEmpty(matchStr)) {
for (String s : matchStr.split(",")) {
String[] ss = s.split("=");
if (ss.length > 1) {
if (matchPhrase == Boolean.TRUE) {
boolQuery.must(QueryBuilders.matchPhraseQuery(s.split("=")[0], s.split("=")[1]));
} else {
boolQuery.must(QueryBuilders.matchQuery(s.split("=")[0], s.split("=")[1]));
}
}
}
}
// 高亮(xxx=111,aaa=222
if (StringUtils.isNotEmpty(highlightField)) {
HighlightBuilder highlightBuilder = new HighlightBuilder();
//highlightBuilder.preTags("<span style='color:red' >");//设置前缀
//highlightBuilder.postTags("</span>");//设置后缀
// 设置高亮字段
highlightBuilder.field(highlightField);
searchRequestBuilder.highlighter(highlightBuilder);
}
searchRequestBuilder.setQuery(boolQuery);
if (StringUtils.isNotEmpty(fields)) {
searchRequestBuilder.setFetchSource(fields.split(","), null);
}
searchRequestBuilder.setFetchSource(true);
if (StringUtils.isNotEmpty(sortField)) {
searchRequestBuilder.addSort(sortField, SortOrder.DESC);
}
if (size != null && size > 0) {
searchRequestBuilder.setSize(size);
}
//打印的内容 可以在 Elasticsearch head 和 Kibana 上执行查询
logger.info("\n{}", searchRequestBuilder);
SearchResponse searchResponse = searchRequestBuilder.execute().actionGet();
long totalHits = searchResponse.getHits().totalHits;
long length = searchResponse.getHits().getHits().length;
logger.info("共查询到[{}]条数据,处理数据条数[{}]", totalHits, length);
if (searchResponse.status().getStatus() == 200) {
// 解析对象
return setSearchResponse(searchResponse, highlightField);
}
return null;
}
/**
* 使用分词查询,并分页
*
* @param index 索引名称
* @param type 类型名称,可传入多个type逗号分隔
* @param currentPage 当前页
* @param pageSize 每页显示条数
* @param startTime 开始时间
* @param endTime 结束时间
* @param fields 需要显示的字段,逗号分隔(缺省为全部字段)
* @param sortField 排序字段
* @param matchPhrase true 使用,短语精准匹配
* @param highlightField 高亮字段
* @param matchStr 过滤条件(xxx=111,aaa=222
* @return
*/
@Override
public EsPage searchDataPage(String index, String type, int currentPage, int pageSize, long startTime, long endTime, String fields, String sortField, boolean matchPhrase, String highlightField, String matchStr) {
SearchRequestBuilder searchRequestBuilder = client.prepareSearch(index);
if (StringUtils.isNotEmpty(type)) {
searchRequestBuilder.setTypes(type.split(","));
}
searchRequestBuilder.setSearchType(SearchType.QUERY_THEN_FETCH);
// 需要显示的字段,逗号分隔(缺省为全部字段)
if (StringUtils.isNotEmpty(fields)) {
searchRequestBuilder.setFetchSource(fields.split(","), null);
}
//排序字段
if (StringUtils.isNotEmpty(sortField)) {
searchRequestBuilder.addSort(sortField, SortOrder.DESC);
}
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
if (startTime > 0 && endTime > 0) {
boolQuery.must(QueryBuilders.rangeQuery("processTime")
.format("epoch_millis")
.from(startTime)
.to(endTime)
.includeLower(true)
.includeUpper(true));
}
// 查询字段
if (StringUtils.isNotEmpty(matchStr)) {
for (String s : matchStr.split(",")) {
String[] ss = s.split("=");
if (matchPhrase == Boolean.TRUE) {
boolQuery.must(QueryBuilders.matchPhraseQuery(s.split("=")[0], s.split("=")[1]));
} else {
boolQuery.must(QueryBuilders.matchQuery(s.split("=")[0], s.split("=")[1]));
}
}
}
// 高亮(xxx=111,aaa=222
if (StringUtils.isNotEmpty(highlightField)) {
HighlightBuilder highlightBuilder = new HighlightBuilder();
//highlightBuilder.preTags("<span style='color:red' >");//设置前缀
//highlightBuilder.postTags("</span>");//设置后缀
// 设置高亮字段
highlightBuilder.field(highlightField);
searchRequestBuilder.highlighter(highlightBuilder);
}
searchRequestBuilder.setQuery(QueryBuilders.matchAllQuery());
searchRequestBuilder.setQuery(boolQuery);
// 分页应用
searchRequestBuilder.setFrom(currentPage).setSize(pageSize);
// 设置是否按查询匹配度排序
searchRequestBuilder.setExplain(true);
//打印的内容 可以在 Elasticsearch head 和 Kibana 上执行查询
logger.info("\n{}", searchRequestBuilder);
// 执行搜索,返回搜索响应信息
SearchResponse searchResponse = searchRequestBuilder.execute().actionGet();
long totalHits = searchResponse.getHits().totalHits;
long length = searchResponse.getHits().getHits().length;
logger.debug("共查询到[{}]条数据,处理数据条数[{}]", totalHits, length);
if (searchResponse.status().getStatus() == 200) {
// 解析对象
List<Map<String, Object>> sourceList = setSearchResponse(searchResponse, highlightField);
return new EsPage(currentPage, pageSize, (int) totalHits, sourceList);
}
return null;
}
/**
* 高亮结果集 特殊处理
*
* @param searchResponse
* @param highlightField
*/
@Override
public List<Map<String, Object>> setSearchResponse(SearchResponse searchResponse, String highlightField) {
List<Map<String, Object>> sourceList = new ArrayList<Map<String, Object>>();
StringBuffer stringBuffer = new StringBuffer();
for (SearchHit searchHit : searchResponse.getHits().getHits()) {
searchHit.getSourceAsMap().put("id", searchHit.getId());
if (StringUtils.isNotEmpty(highlightField)) {
logger.debug("遍历 高亮结果集,覆盖 正常结果集" + searchHit.getSourceAsMap());
Text[] text = searchHit.getHighlightFields().get(highlightField).getFragments();
if (text != null) {
for (Text str : text) {
stringBuffer.append(str.string());
}
//遍历 高亮结果集,覆盖 正常结果集
searchHit.getSourceAsMap().put(highlightField, stringBuffer.toString());
}
}
sourceList.add(searchHit.getSourceAsMap());
}
return sourceList;
}
/**
* Elasticsearch 批量插入接口实现
* @param index
* @param type
* @param list
* @return
* @author gaoyan
* date 2018-08-27
*/
@Override
public String addBulkData(String index, String type, List<JSONObject> list) {
BulkRequestBuilder bulkRequestBuilder = client.prepareBulk();
for(int i=0;i<list.size();i++){
IndexRequestBuilder indexRequestBuilder = client.prepareIndex(index, type, UUID.randomUUID().toString()).setSource(list.get(i));
bulkRequestBuilder.add(indexRequestBuilder);
}
BulkResponse response = bulkRequestBuilder.get();
/* for (BulkItemResponse respons : response) {
respons.getResponse().getResult().equals("created");
}*/
return "success";
}
/**
* 默认查询全部数据,并按照对应的字段排序,方法内写了部分基础查询,具体业务查询可参考方法体中注释代码
* @param index index名称,可以从多个index中查询,所以这里定义成String数组
* @param type type名称,可以从多种type中查询,所以这里定义成String数组
* @param sortfield 需要排序的字段,
* @return
* @author gaoyan
* date 2018-08-28
*/
@Override
public List<Map<String, Object>> searchListDataAndSort( String[] index,String[] type,String sortfield,String[] fields) {
SearchRequestBuilder searchRequestBuilder = client.prepareSearch(index)
.setTypes(type)
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
//设置全文搜索
//.setQuery(QueryBuilders.matchAllQuery())
//设置某个field的搜索条件项,此处是模糊搜索;text:mill ,搜索address中含有关键字 mill;text:mill lane,搜索address中含有关键字mill或者lane的
//.setQuery(QueryBuilders.matchQuery("address","mill lane"))
//使用matchPhraseQuery过程中,当text:mill lane ,搜索address中即含有关键字mill lane,mill lane 词组不会被拆分,作为一个整体当做查询条件。
.setQuery(QueryBuilders.matchPhraseQuery("address","lane mill"));
//如果需要按照多个字段排序,直接依次添加addSort
//.addSort(sortfield,SortOrder.DESC)
//设置查询数量
//.setSize(60)
//设置从第几个开始查
//.setFrom(0)
//设置要查询的字段,fields
//.setFetchSource(fields,null)
/*.setPostFilter(QueryBuilders.rangeQuery("age").from(12).to(18)) // Filter
.setExplain(true);*/
SearchResponse response = searchRequestBuilder.get();
List<Map<String, Object>> result = SearchResponseToList(response);
return result;
}
@Override
public List<Map<String, Object>> searchListDataUnit(String[] index, String[] type, String sortfield, String[] fields) {
SearchRequestBuilder searchRequestBuilder = client.prepareSearch(index)
.setTypes(type)
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH);
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
//boolQueryBuilder两次.must ,如下,表示address中必须包含lane和mill
//boolQueryBuilder.must(QueryBuilders.matchQuery("address","lane"));
//boolQueryBuilder.must(QueryBuilders.matchQuery("address","mill"));
//boolQueryBuilder两次.should ,如下,表示address中必须包含lane或者mill
//boolQueryBuilder.should(QueryBuilders.matchQuery("address","lane"));
//boolQueryBuilder.should(QueryBuilders.matchQuery("address","mill"));
//boolQueryBuilder两次.mustNot ,如下,表示address中必须不能包含lane和mill
//boolQueryBuilder.mustNot(QueryBuilders.matchQuery("address","lane"));
//boolQueryBuilder.mustNot(QueryBuilders.matchQuery("address","mill"));
//BoolQuerBuilder 可以使用must,should,mustnot 组合使用
//boolQueryBuilder.mustNot(QueryBuilders.matchQuery("state","ID"));
//boolQueryBuilder.must(QueryBuilders.matchQuery("age",40));
//boolQueryBuilder.must(QueryBuilders.matchQuery("balance",28969));
//boolQueryBuilder.filter中可以添加RangeQueryBuilder,下面注释中两种定义的RangeQueryBuilder是一样的,不同的两种方式
//RangeQueryBuilder rangeQueryBuilder = QueryBuilders.rangeQuery("balance").from(20000).to(30000).includeLower(true).includeUpper(true);
//RangeQueryBuilder rangeQueryBuilder2 = QueryBuilders.rangeQuery("age").gte(20).lte(23);
//boolQueryBuilder.filter(rangeQueryBuilder);
//boolQueryBuilder.filter(rangeQueryBuilder2);
searchRequestBuilder.setQuery(boolQueryBuilder);
SearchResponse response = searchRequestBuilder.get();
List<Map<String, Object>> result = SearchResponseToList(response);
return result;
}
/**
* 涉及组合查询条件主要涉及到聚合函数的使用,主要是分组求平均值,依靠平均值排序
* @param index index名称,可以从多个index中查询,所以这里定义成String数组
* @param type type名称,可以从多种type中查询,所以这里定义成String数组
* @return
* @author gaoyan
* date 2018-08-29
*/
@Override
public List<Map<String, Object>> searchListDataGroup(String[] index, String[] type) {
SearchResponse sr = client.prepareSearch(index)
.setTypes(type)
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.addAggregation(
//分组依靠关键字terms
AggregationBuilders.terms("by_state")
.field("state.keyword")
.subAggregation(
//分组后求平均值依靠关键字avg,其他具体聚合函数可以参考官网
// https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/_metrics_aggregations.html
AggregationBuilders.avg("average_balance")
.field("balance")
)
//分组后的排序方法,分别是聚合函数平均值,分组后统计数据,分组后关键字key,根据需求选择合适的排序
.order(BucketOrder.aggregation("average_balance",false))
.order(BucketOrder.count(true))
.order(BucketOrder.key(true))
)
.execute()
.actionGet();
//分组后得到的数据整合
StringTerms result = sr.getAggregations().get("by_state");
List<Map<String, Object>> sourceList = new ArrayList<Map<String, Object>>();
for (StringTerms.Bucket bucket : result.getBuckets()) {
Map<String, Object> map = new HashMap<>();
map.put("key",bucket.getKeyAsString());
map.put("count",bucket.getDocCount());
Avg avg = bucket.getAggregations().get("average_balance");
map.put("averagebalance",avg.getValue());
sourceList.add(map);
}
return sourceList;
}
/**
* 涉及组合查询条件主要涉及到聚合函数的使用,较为复杂,按照年龄阶段分组后,再安装性别分组,求balance平均值 ranges
* @param index index名称,可以从多个index中查询,所以这里定义成String数组
* @param type type名称,可以从多种type中查询,所以这里定义成String数组
* @return
* @author gaoyan
* date 2018-08-29
*/
@Override
public List<Map<String, Object>> searchListDataGroupComplex(String[] index, String[] type) {
SearchResponse sr = client.prepareSearch(index)
.setTypes(type)
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.addAggregation(
//分组依靠关键字range
AggregationBuilders.range("by_age")
.field("age")
.addRange(20,30)
.addRange(30,40)
.addRange(40,50)
.subAggregation(
//分组依靠关键字terms
AggregationBuilders.terms("by_gender")
.field("gender.keyword")
.subAggregation(
//分组后求依靠关键字avg,其他具体聚合函数可以参考官网
// https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/_metrics_aggregations.html
AggregationBuilders.max("max_balance")
.field("balance")
)
)
)
.execute()
.actionGet();
//分组后得到的数据整合
Range result = sr.getAggregations().get("by_age");
List<Map<String, Object>> sourceList = new ArrayList<Map<String, Object>>();
for (Range.Bucket bucket : result.getBuckets()) {
Map<String, Object> map = new HashMap<>();
map.put("key",bucket.getKeyAsString());
map.put("count",bucket.getDocCount());
List<Map<String, Object>> sourcechildList = new ArrayList<Map<String, Object>>();
StringTerms resultchild = bucket.getAggregations().get("by_gender");
for (StringTerms.Bucket bucketchild : resultchild.getBuckets()) {
Map<String, Object> childmap = new HashMap<>();
childmap.put("key",bucketchild.getKeyAsString());
childmap.put("count",bucketchild.getDocCount());
Max max = bucketchild.getAggregations().get("max_balance");
map.put("maxbalance",max.getValue());
sourcechildList.add(childmap);
}
map.put("gender",sourcechildList);
sourceList.add(map);
}
return sourceList;
}
@Override
public List<Map<String, Object>> SearchResponseToList(SearchResponse searchResponse) {
List<Map<String, Object>> sourceList = new ArrayList<Map<String, Object>>();
for (SearchHit searchHit : searchResponse.getHits().getHits()) {
searchHit.getSourceAsMap().put("id", searchHit.getId());
sourceList.add(searchHit.getSourceAsMap());
}
return sourceList;
}
}
@@ -0,0 +1,490 @@
package com.adc.da.search.service.impl;
import com.adc.da.search.entity.FullTextSearchEO;
import com.adc.da.search.entity.StandLawsEO;
import com.adc.da.search.service.ElasticsearchService;
import com.adc.da.search.service.StandLawsSearchService;
import com.adc.da.util.utils.DateUtils;
import com.adc.da.util.utils.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.elasticsearch.client.transport.TransportClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@Component
public class StandLawsSearchServiceImpl implements StandLawsSearchService {
private static final Logger logger = LoggerFactory.getLogger(StandLawsSearchServiceImpl.class);
@Autowired
private TransportClient transportClient;
private TransportClient client;
@PostConstruct
public void init() {
client = this.transportClient;
}
@Autowired
private ElasticsearchService elasticsearchService;
@Override
public String addStandLawsSearch(StandLawsEO standLawsEO) {
String indexstate = "";
//if(elasticsearchService.isIndexExist(standLawsEO.getType())){
indexstate = elasticsearchService.addData((JSONObject) JSON.toJSON(standLawsEO),standLawsEO.getType(),standLawsEO.getType(),standLawsEO.getId());
// 方便全文检索,重新建索引
FullTextSearchEO fullTextSearchEO =getFullTextSearch(standLawsEO);
indexstate = elasticsearchService.addData((JSONObject) JSON.toJSON(fullTextSearchEO),"fulltextserch","fulltextserch",fullTextSearchEO.getId());
return indexstate;
}
@Override
public String addStandLawsSearchForMap(Map<String,Object> attrInfoMap) {
String indexstate = "";
String type = String.valueOf(attrInfoMap.get("type"));
indexstate = elasticsearchService.addDataForMap(attrInfoMap,type,type,String.valueOf(attrInfoMap.get("id")));
if ("stand".equals(type) || "laws".equals(type) || "bussstand".equals(type)) {
// 方便全文检索,重新建索引
Map<String,Object> fullTextSearchEO =getFullTextSearchForMap(attrInfoMap);
indexstate = elasticsearchService.addDataForMap(fullTextSearchEO,"fulltextserch","fulltextserch",String.valueOf(fullTextSearchEO.get("id")));
}
return indexstate;
}
@Override
public String updateStandLawsSearchForMap(Map<String,Object> attrInfoMap){
Set<String> keys = attrInfoMap.keySet();
for (String key:keys) {
String value = String.valueOf(attrInfoMap.get(key));
if (StringUtils.isNotBlank(value) && !"null".equals(value)){
value = value.replace(","," , ");
attrInfoMap.put(key,value);
}
}
String result = "";
// 先判断索引是否存在
String type = String.valueOf(attrInfoMap.get("type"));
String id = String.valueOf(attrInfoMap.get("id"));
if(elasticsearchService.isIndexExist(type)){
Map<String, Object> indexstate = elasticsearchService.searchDataById(type,type,id,null);
if(indexstate == null || indexstate.isEmpty()){
result = elasticsearchService.addDataForMap(attrInfoMap,type,type,id);
} else {
result = elasticsearchService.updateDataByIdForMap(attrInfoMap,type,type,id);
}
} else {
result = elasticsearchService.addDataForMap(attrInfoMap,type,type,id);
}
if ("stand".equals(type) || "laws".equals(type) || "bussstand".equals(type)) {
// 方便全文检索,重新建索引
Map<String,Object> fullTextSearchEO =getFullTextSearchForMap(attrInfoMap);
if(elasticsearchService.isIndexExist("fulltextserch")){
Map<String, Object> indexstate = elasticsearchService.searchDataById("fulltextserch","fulltextserch",id,null);
if(indexstate == null || indexstate.isEmpty()){
result = elasticsearchService.addDataForMap(fullTextSearchEO,"fulltextserch","fulltextserch",id);
} else {
result = elasticsearchService.updateDataByIdForMap(fullTextSearchEO,"fulltextserch","fulltextserch",id);
}
} else {
result = elasticsearchService.updateDataByIdForMap(fullTextSearchEO,"fulltextserch","fulltextserch",id);
}
}
return result;
}
@Override
public String deleteStandLawsSearch(StandLawsEO standLawsEO){
String result = "";
// 先判断索引是否存在
if(elasticsearchService.isIndexExist(standLawsEO.getType())){
Map<String, Object> indexstate = elasticsearchService.searchDataById(standLawsEO.getType(),standLawsEO.getType(),standLawsEO.getId(),null);
if(indexstate != null && !indexstate.isEmpty()){
result = elasticsearchService.deleteDataById(standLawsEO.getType(),standLawsEO.getType(),standLawsEO.getId());
}
}
if(elasticsearchService.isIndexExist("fulltextserch")){
Map<String, Object> indexstate = elasticsearchService.searchDataById("fulltextserch","fulltextserch",standLawsEO.getId(),null);
if(indexstate != null && !indexstate.isEmpty()){
result = elasticsearchService.deleteDataById("fulltextserch","fulltextserch",standLawsEO.getId());
}
}
return result;
}
Map<String,Object> getFullTextSearchForMap(Map<String,Object> attrInfoMap){
boolean isForeign = false;
Map<String,Object> fullTextSearchEO = new HashMap<>();
fullTextSearchEO.put("id",String.valueOf(attrInfoMap.get("id")));
if ("FOREIGN".equals(String.valueOf(attrInfoMap.get("standType")))){
fullTextSearchEO.put("indexType",String.valueOf(attrInfoMap.get("standType")));
isForeign = true;
}else {
fullTextSearchEO.put("indexType", String.valueOf(attrInfoMap.get("type")));
}
if("stand".equals(attrInfoMap.get("type"))){
// 标准全文
fullTextSearchEO.put("title",attrInfoMap.get("numbershow")+" "+attrInfoMap.get("nameshow"));
for (String key : attrInfoMap.keySet()) {
if (null == attrInfoMap.get(key) || "".equals(attrInfoMap.get(key))){
attrInfoMap.put(key, "null");
}
}
// fullTextSearchEO.put("issueTime",attrInfoMap.get("issueTime"));
StringBuilder contentBuilder = new StringBuilder();
// contentBuilder.append("区域:东亚 ");
if (!isForeign) {
contentBuilder.append("适用区域:").append(attrInfoMap.get("countryShow")).append(" ");
}
contentBuilder.append("标准状态:").append(attrInfoMap.get("standstateshow")).append(" ");
//
contentBuilder.append("纳入标准法规清单的国家/地区: ").append(attrInfoMap.get("accessCountry")).append(" ");
contentBuilder.append("标准类别: ").append(attrInfoMap.get("standSortShow")).append(" ");
contentBuilder.append("标准号: ").append(attrInfoMap.get("numbershow")).append(" ");
contentBuilder.append("标准名称: ").append(attrInfoMap.get("nameshow")).append(" ");
contentBuilder.append("标准英文名称: ").append(attrInfoMap.get("standEnName")).append(" ");
// contentBuilder.append("发布日期:"+attrInfoMap.get("issueTime")+" ");
contentBuilder.append("覆盖关系: ").append(attrInfoMap.get("FGXXSXXXShow")).append(" ");
contentBuilder.append("代替标准编号: ").append(attrInfoMap.get("DTBJH")).append(" ");
if (StringUtils.isBlank(String.valueOf(attrInfoMap.get("BDTBH")))){
contentBuilder.append("被代替标准编号: ").append(attrInfoMap.get("BDTBH")).append(" ");
}else {
contentBuilder.append("被代替标准编号: ").append(attrInfoMap.get("BDTBZBH")).append(" ");
}
contentBuilder.append("对应其他标准: ").append(attrInfoMap.get("CBBH")).append(" ");
contentBuilder.append("引用标准: ").append(attrInfoMap.get("YYBJ")).append(" ");
contentBuilder.append("被引用标准: ").append(attrInfoMap.get("BYYBJ")).append(" ");
if (isForeign){
contentBuilder.append("等效标准: ").append(attrInfoMap.get("DXBZ"));
}
contentBuilder.append("相关流程: ").append(attrInfoMap.get("XGLC")).append(" ");
contentBuilder.append("参会记录: ").append(attrInfoMap.get("CHJL")).append(" ");
contentBuilder.append("文本说明: ").append(attrInfoMap.get("synopsis")).append(" ");
contentBuilder.append("重要度: ").append(attrInfoMap.get("isRelateAccess")).append(" ");
if (!isForeign) {
contentBuilder.append("归口管理部门: ").append(attrInfoMap.get("GKDWShow")).append(" ");
}
if (!isForeign) {
contentBuilder.append("我司参与深度: ").append(attrInfoMap.get("CYSDShow")).append(" ");
}
if (!isForeign) {
contentBuilder.append("组织标准起草的执行机构/单位: ").append(attrInfoMap.get("FBJGShow")).append(" ");
}
contentBuilder.append("监管类型: ").append(attrInfoMap.get("ZRLXShow")).append(" ");
contentBuilder.append("适用车辆类型: ").append(attrInfoMap.get("CLLXShow")).append(" ");
contentBuilder.append("标签: ").append(attrInfoMap.get("GXHBQShow")).append(" ");
if (!isForeign) {
contentBuilder.append("工作组信息: ").append(attrInfoMap.get("GZZXXName")).append(" ");
}
contentBuilder.append("要求类型: ").append(attrInfoMap.get("YQLXShow")).append(" ");
contentBuilder.append("新车型实施日期(文本): ").append(attrInfoMap.get("XCXSSRQ")).append(" ");
contentBuilder.append("在产车实施日期(文本): ").append(attrInfoMap.get("ZCCSSRQ")).append(" ");
contentBuilder.append("EOP实施日期(文本): ").append(attrInfoMap.get("EOPSSRQ")).append(" ");
contentBuilder.append("法规维护人: ").append(attrInfoMap.get("FGWHRName")).append(" ");
contentBuilder.append("责任部门: ").append(attrInfoMap.get("ZRBMShow")).append(" ");
contentBuilder.append("相关部门: ").append(attrInfoMap.get("XGBMShow")).append(" ");
contentBuilder.append("SVPPS: ").append(attrInfoMap.get("SVPPSName")).append(" ");
contentBuilder.append("FO: ").append(attrInfoMap.get("FOShow")).append(" ");
contentBuilder.append("项目评估角色: ").append(attrInfoMap.get("XMPGJSShow")).append(" ");
if (attrInfoMap.containsKey("content")){
if (null !=attrInfoMap.get("content") && StringUtils.isNotBlank(String.valueOf(attrInfoMap.get("content")))){
String con = String.valueOf(attrInfoMap.get("content"));
con = con.replace(",","");
if (StringUtils.isBlank(con)){
attrInfoMap.put("content","--");
}
}
}
contentBuilder.append("标准文本: ").append(attrInfoMap.get("content")).append(" ");
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
fullTextSearchEO.put("textContent",textContent.toString());
if (null != attrInfoMap.get("issueTime") && !"".equals(attrInfoMap.get("issueTime")) && !"null".equals(attrInfoMap.get("issueTime"))) {
fullTextSearchEO.put("issue_time", attrInfoMap.get("issueTime"));
}else {
fullTextSearchEO.put("issue_time", "--");
}
} else if("laws".equals(attrInfoMap.get("type"))){
// 政策全文
for (String key : attrInfoMap.keySet()) {
if (null == attrInfoMap.get(key) || "".equals(attrInfoMap.get(key))){
attrInfoMap.put(key, "null");
}
}
fullTextSearchEO.put("title",attrInfoMap.get("numbershow")+" "+attrInfoMap.get("nameshow"));
StringBuilder contentBuilder = new StringBuilder();
contentBuilder.append("适用区域: ").append(attrInfoMap.get("countryShow")).append(" ");
contentBuilder.append("政策状态: ").append(attrInfoMap.get("standstateshow")).append(" ");
contentBuilder.append("政策号: ").append(attrInfoMap.get("numbershow")).append(" ");
contentBuilder.append("政策名称: ").append(attrInfoMap.get("nameshow")).append(" ");
contentBuilder.append("英文名称: ").append(attrInfoMap.get("standEnName")).append(" ");
// contentBuilder.append("发布日期:"+attrInfoMap.get("issueTime")+" ");
contentBuilder.append("纳入标准法规清单的国家/地区: ").append(attrInfoMap.get("accessCountry")).append(" ");
contentBuilder.append("代替政策编号: ").append(attrInfoMap.get("replaceLawsNum")).append(" ");
contentBuilder.append("重要度: ").append(attrInfoMap.get("isRelateAccess")).append(" ");
contentBuilder.append("要求类型: ").append(attrInfoMap.get("YQLXShow")).append(" ");
contentBuilder.append("适用车辆类型: ").append(attrInfoMap.get("SYCLLXShow")).append(" ");
// contentBuilder.append("监管类型:"+attrInfoMap.get("")+" ");
contentBuilder.append("监管类型: ").append(attrInfoMap.get("ZRLXShow")).append(" ");
contentBuilder.append("个性化标签: ").append(attrInfoMap.get("GXHBQShow")).append(" ");
contentBuilder.append("新车型实施日期(文本): ").append(attrInfoMap.get("XCXSSRQ")).append(" ");
contentBuilder.append("在产车实施日期(文本): ").append(attrInfoMap.get("ZCCSSRQ")).append(" ");
contentBuilder.append("EOP实施日期(文本): ").append(attrInfoMap.get("EOPSSRQ")).append(" ");
contentBuilder.append("维护工程师: ").append(attrInfoMap.get("ZCGCSShow")).append(" ");
contentBuilder.append("组织标准起草的执行机构/单位: ").append(attrInfoMap.get("FBJGShow")).append(" ");
contentBuilder.append("SVPPS: ").append(attrInfoMap.get("SVPPSName")).append(" ");
contentBuilder.append("相关部门: ").append(attrInfoMap.get("XGBMShow")).append(" ");
contentBuilder.append("责任部门: ").append(attrInfoMap.get("ZRBMShow")).append(" ");
contentBuilder.append("FO: ").append(attrInfoMap.get("FOShow")).append(" ");
contentBuilder.append("归口管理部门: ").append(attrInfoMap.get("GKGLBMShow")).append(" ");
contentBuilder.append("我司是否参与: ").append(attrInfoMap.get("WSSFCYShow")).append(" ");
contentBuilder.append("相关流程: ").append(attrInfoMap.get("XGLC")).append(" ");
// contentBuilder.append("相关资料:"+attrInfoMap.get("")+" ");
if (attrInfoMap.containsKey("content")){
if (null !=attrInfoMap.get("content") && StringUtils.isNotBlank(String.valueOf(attrInfoMap.get("content")))){
String con = String.valueOf(attrInfoMap.get("content"));
con = con.replace(",","");
if (StringUtils.isBlank(con)){
attrInfoMap.put("content","--");
}
}
}
contentBuilder.append("标准文本: ").append(attrInfoMap.get("content")).append(" ");
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
fullTextSearchEO.put("textContent",textContent.toString());
if (null != attrInfoMap.get("issue_time") && !"".equals(attrInfoMap.get("issue_time")) && !"null".equals(attrInfoMap.get("issue_time"))) {
fullTextSearchEO.put("issue_time", attrInfoMap.get("issue_time"));
}else {
fullTextSearchEO.put("issue_time", "--");
}
}else if ("bussstand".equals(attrInfoMap.get("type"))){
for (String key : attrInfoMap.keySet()) {
if (null == attrInfoMap.get(key) || "".equals(attrInfoMap.get(key))){
attrInfoMap.put(key, "null");
}
}
fullTextSearchEO.put("title",attrInfoMap.get("standNumber")+" - 《"+attrInfoMap.get("nameshow")+"");
StringBuilder contentBuilder = new StringBuilder();
SimpleDateFormat format = new SimpleDateFormat("yyyy-M-dd HH:mm:ss");
contentBuilder.append("企标编号: ").append(String.valueOf(attrInfoMap.get("numbershow"))).append(" ");
contentBuilder.append("企标名称: ").append(String.valueOf(attrInfoMap.get("nameshow"))).append(" ");
contentBuilder.append("英文名称: ").append(attrInfoMap.get("standEnName")).append(" ");
contentBuilder.append("标准状态: ").append(String.valueOf(attrInfoMap.get("standstateshow"))).append(" ");
// contentBuilder.append("发布日期:"+String.valueOf(attrInfoMap.get("issue_time"))+" ");
contentBuilder.append("标准实施日期: ");
contentBuilder.append(String.valueOf(attrInfoMap.get("put_time")));
contentBuilder.append("代替企标编号: ").append(attrInfoMap.get("replaceStandNum"));
contentBuilder.append("被代替企标编号: ").append(attrInfoMap.get("replacedStandNum"));
contentBuilder.append("废止日期: ");
if (StringUtils.isNotBlank(String.valueOf(attrInfoMap.get("FZRQString")).trim())) {
contentBuilder.append(String.valueOf(attrInfoMap.get("FZRQString"))).append(" ");
}else{
contentBuilder.append("--").append(" ");
}
contentBuilder.append("复审日期: ");
if (StringUtils.isNotBlank(String.valueOf(attrInfoMap.get("FSRQString")).trim())) {
contentBuilder.append(String.valueOf(attrInfoMap.get("FSRQString"))).append(" ");
}else{
contentBuilder.append("--").append(" ");
}
contentBuilder.append("密级: ").append(String.valueOf(attrInfoMap.get("QBMJShow"))).append(" ");
contentBuilder.append("授权: ").append(String.valueOf(attrInfoMap.get("QBSQShow"))).append(" ");
contentBuilder.append("涉及会签部门: ").append(String.valueOf(attrInfoMap.get("XHQBMShow"))).append(" ");
contentBuilder.append("SVPPS: ").append(String.valueOf(attrInfoMap.get("SVPPSName"))).append(" ");
contentBuilder.append("相关部门: ").append(String.valueOf(attrInfoMap.get("XGBMShow"))).append(" ");
contentBuilder.append("主起草人: ").append(String.valueOf(attrInfoMap.get("ZYQCRShow"))).append(" ");
contentBuilder.append("起草部门: ").append(String.valueOf(attrInfoMap.get("ZRBMShow"))).append(" ");
contentBuilder.append("主起草部门: ").append(String.valueOf(attrInfoMap.get("ZQCBMName"))).append(" ");
contentBuilder.append("其他起草人: ").append(String.valueOf(attrInfoMap.get("QTQCRShow"))).append(" ");
contentBuilder.append("外发审批角色: ").append(String.valueOf(attrInfoMap.get("WFSPJSShow"))).append(" ");
contentBuilder.append("规范性引用文件: ").append(String.valueOf(attrInfoMap.get("GFXYYWJ"))).append(" ");
contentBuilder.append("相关流程: ").append(String.valueOf(attrInfoMap.get("XGLC"))).append(" ");
if (attrInfoMap.containsKey("content")){
if (null !=attrInfoMap.get("content") && StringUtils.isNotBlank(String.valueOf(attrInfoMap.get("content")))){
String con = String.valueOf(attrInfoMap.get("content"));
con = con.replace(",","");
if (StringUtils.isBlank(con)){
attrInfoMap.put("content","--");
}
}
}
contentBuilder.append("标准文本: ").append(attrInfoMap.get("content")).append(" ");
// contentBuilder.append("相关计划:"+String.valueOf(attrInfoMap.get(""))+" ");
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
fullTextSearchEO.put("textContent",textContent.toString());
if (null != attrInfoMap.get("issue_time") && !"".equals(attrInfoMap.get("issue_time")) && !"null".equals(attrInfoMap.get("issue_time"))) {
fullTextSearchEO.put("issue_time", attrInfoMap.get("issue_time"));
}else {
fullTextSearchEO.put("issue_time", "--");
}
}
return fullTextSearchEO;
}
FullTextSearchEO getFullTextSearch(StandLawsEO standLawsEO){
FullTextSearchEO fullTextSearchEO = new FullTextSearchEO();
fullTextSearchEO.setId(standLawsEO.getId());
fullTextSearchEO.setIndexType(standLawsEO.getType());
if(standLawsEO.getType().equals("stand")){
// 标准全文
fullTextSearchEO.setTitle(standLawsEO.getNumbershow()+" "+standLawsEO.getNameshow());
fullTextSearchEO.setIssue_time(standLawsEO.getIssue_time());
fullTextSearchEO.setIssueTimeStr(standLawsEO.getIssueTimeStr());
fullTextSearchEO.setPut_time(standLawsEO.getPut_time());
fullTextSearchEO.setPutTimeStr(standLawsEO.getPutTimeStr());
StringBuilder contentBuilder = new StringBuilder();
contentBuilder.append("区域:东亚 ");
contentBuilder.append("国家/地区:"+standLawsEO.getCountryShow()+" ");
contentBuilder.append("标准性质:"+standLawsEO.getNatureShow()+" ");
contentBuilder.append("标准状态:"+standLawsEO.getStatecodeShow()+" ");
contentBuilder.append("内容摘要:"+standLawsEO.getSynopsis()+" ");
contentBuilder.append("标准文本:"+standLawsEO.getContent()+" ");
contentBuilder.append("标准类别:"+standLawsEO.getStandSortShow()+" ");
contentBuilder.append("标准号:"+standLawsEO.getNumbershow()+" ");
contentBuilder.append("标准名称:"+standLawsEO.getNameshow()+" ");
contentBuilder.append("标准英文名称:"+standLawsEO.getStandEnName()+" ");
contentBuilder.append("发布日期:"+DateUtils.dateToString(standLawsEO.getIssue_time(),"yyyy-MM-dd")+" ");
contentBuilder.append("实施日期:"+DateUtils.dateToString(standLawsEO.getPut_time(),"yyyy-MM-dd")+" ");
//时间处理
contentBuilder.append("新定型车实施日期:"+ DateUtils.dateToString(standLawsEO.getNewcarPutTime(),"yyyy-MM-dd")+" ");
contentBuilder.append("新生产车实施日期:"+DateUtils.dateToString(standLawsEO.getNewproductPutTime(),"yyyy-MM-dd")+" ");
contentBuilder.append("注册登记车实施日期:"+DateUtils.dateToString(standLawsEO.getRegisterPutTime(),"yyyy-MM-dd")+" ");
contentBuilder.append("在产车实施日期:"+DateUtils.dateToString(standLawsEO.getRegisterPutTime(),"yyyy-MM-dd")+" ");
//时间处理
contentBuilder.append("适用认证:"+standLawsEO.getApplyAuthShow()+" ");
contentBuilder.append("发布部门:"+standLawsEO.getIssueUnit()+" ");
contentBuilder.append("代替标准号:"+standLawsEO.getReplace_stand_num()+" ");
contentBuilder.append("被代替标准号:"+standLawsEO.getReplaced_stand_num()+" ");
contentBuilder.append("采用国际标准号:"+standLawsEO.getInterStandNum()+" ");
contentBuilder.append("采标程度:"+standLawsEO.getAdoptExtentShow()+" ");
contentBuilder.append("适用车型:"+standLawsEO.getApplyArcticShow()+" ");
contentBuilder.append("能源种类:"+standLawsEO.getEnergyKindShow()+" ");
contentBuilder.append("起草单位:"+standLawsEO.getDrafting_unit()+" ");
contentBuilder.append("起草人:"+standLawsEO.getDraft_user()+" ");
contentBuilder.append("关键词:"+standLawsEO.getStandTag()+" ");
contentBuilder.append("备注:"+standLawsEO.getRemarks()+" ");
contentBuilder.append("责任部门:"+standLawsEO.getResponsibleUnitShow()+" ");
contentBuilder.append("所属专业领域:"+standLawsEO.getCategoryShow()+" ");
// contentBuilder.append("总成分类:"+" ");
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
fullTextSearchEO.setTextContent(textContent.toString());
} else if(standLawsEO.getType().equals("bussstand")){
//企业标准全文
fullTextSearchEO.setTitle(standLawsEO.getNumbershow()+" "+standLawsEO.getNameshow());
fullTextSearchEO.setIssue_time(standLawsEO.getIssue_time());
fullTextSearchEO.setIssueTimeStr(standLawsEO.getIssueTimeStr());
fullTextSearchEO.setPut_time(standLawsEO.getPut_time());
fullTextSearchEO.setPutTimeStr(standLawsEO.getPutTimeStr());
StringBuilder contentBuilder = new StringBuilder();
// contentBuilder.append("区域:东亚 ");
contentBuilder.append("国家:"+standLawsEO.getCountryShow()+" ");
contentBuilder.append("标准类别:"+standLawsEO.getStandSortShow()+" ");
contentBuilder.append("标准编号:"+standLawsEO.getNumbershow()+" ");
contentBuilder.append("标准名称:"+standLawsEO.getNameshow()+" ");
contentBuilder.append("标准英文名称:"+standLawsEO.getStandEnName()+" ");
contentBuilder.append("标准状态:"+standLawsEO.getStatecodeShow()+" ");
contentBuilder.append("标准性质:"+standLawsEO.getNatureShow()+" ");
// contentBuilder.append("规范性引用标准:"+standLawsEO.getNatureShow()+" ");
contentBuilder.append("责任部门:"+standLawsEO.getResponsibleUnitShow()+" ");
//contentBuilder.append("主要编制者:"+standLawsEO.getResponsibleUnitShow()+" ");
contentBuilder.append("发布日期:"+standLawsEO.getIssueTimeStr()+" ");
contentBuilder.append("实施日期:"+standLawsEO.getPutTimeStr()+" ");
contentBuilder.append("实施年份:"+standLawsEO.getPutYear()+" ");
contentBuilder.append("首发日期:"+standLawsEO.getFirstPutTime()+" ");
contentBuilder.append("标准文本:"+standLawsEO.getContent()+" ");
contentBuilder.append("适用认证:"+standLawsEO.getApplyAuthShow()+" ");
contentBuilder.append("适用车型:"+standLawsEO.getApplyArcticShow()+" ");
contentBuilder.append("能源种类:"+standLawsEO.getEnergyKindShow()+" ");
contentBuilder.append("代替标准号:"+standLawsEO.getReplace_stand_num()+" ");
contentBuilder.append("被代替标准号:"+standLawsEO.getReplaced_stand_num()+" ");
contentBuilder.append("关键词:"+standLawsEO.getStandTag()+" ");
contentBuilder.append("内容摘要:"+standLawsEO.getSynopsis()+" ");
contentBuilder.append("备注:"+standLawsEO.getRemarks()+" ");
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
fullTextSearchEO.setTextContent(textContent.toString());
} else if(standLawsEO.getType().equals("laws")){
// 政策全文
fullTextSearchEO.setTitle(standLawsEO.getNumbershow()+" "+standLawsEO.getNameshow());
fullTextSearchEO.setIssue_time(standLawsEO.getIssue_time());
fullTextSearchEO.setIssueTimeStr(standLawsEO.getIssueTimeStr());
fullTextSearchEO.setPut_time(standLawsEO.getPut_time());
fullTextSearchEO.setPutTimeStr(standLawsEO.getPutTimeStr());
StringBuilder contentBuilder = new StringBuilder();
contentBuilder.append("国家/地区:"+standLawsEO.getCountryShow()+" ");
contentBuilder.append("文件号:"+standLawsEO.getNumbershow()+" ");
contentBuilder.append("文件名称:"+standLawsEO.getNameshow()+" ");
contentBuilder.append("文件英文名称:"+standLawsEO.getStandEnName()+" ");
contentBuilder.append("文件状态:"+standLawsEO.getStatecodeShow()+" ");
contentBuilder.append("文件性质:"+standLawsEO.getNatureShow()+" ");
contentBuilder.append("发布日期:"+DateUtils.dateToString(standLawsEO.getIssue_time(),"yyyy-MM-dd")+" ");
contentBuilder.append("实施日期:"+DateUtils.dateToString(standLawsEO.getPut_time(),"yyyy-MM-dd")+" ");
//时间处理
contentBuilder.append("新定型车实施日期:"+ DateUtils.dateToString(standLawsEO.getNewcarPutTime(),"yyyy-MM-dd")+" ");
contentBuilder.append("新生产车实施日期:"+DateUtils.dateToString(standLawsEO.getNewproductPutTime(),"yyyy-MM-dd")+" ");
contentBuilder.append("注册登记车实施日期:"+DateUtils.dateToString(standLawsEO.getRegisterPutTime(),"yyyy-MM-dd")+" ");
contentBuilder.append("在产车实施日期:"+DateUtils.dateToString(standLawsEO.getRegisterPutTime(),"yyyy-MM-dd")+" ");
//时间处理
contentBuilder.append("发布部门:"+standLawsEO.getIssueUnit()+" ");
contentBuilder.append("责任部门:"+standLawsEO.getResponsibleUnitShow()+" ");
contentBuilder.append("文件附件全文:"+standLawsEO.getContent()+" ");
contentBuilder.append("适用车型:"+standLawsEO.getApplyArcticShow()+" ");
contentBuilder.append("适用认证:"+standLawsEO.getApplyAuthShow()+" ");
contentBuilder.append("能源种类:"+standLawsEO.getEnergyKindShow()+" ");
contentBuilder.append("所属专业领域:"+standLawsEO.getCategoryShow()+" ");
contentBuilder.append("代替标准号:"+standLawsEO.getReplace_stand_num()+" ");
contentBuilder.append("被代替标准号:"+standLawsEO.getReplaced_stand_num()+" ");
contentBuilder.append("关键词:"+standLawsEO.getStandTag()+" ");
contentBuilder.append("内容摘要:"+standLawsEO.getSynopsis()+" ");
contentBuilder.append("备注:"+standLawsEO.getRemarks()+" ");
StringBuilder textContent = replaceAll(contentBuilder, "null", "--");
fullTextSearchEO.setTextContent(textContent.toString());
}
return fullTextSearchEO;
}
/**
* 实现StringBuilder的replaceAll
*
* @param stb
* @param oldStr 被替换的字符串
* @param newStr 替换oldStr
* @return
*/
public static StringBuilder replaceAll(StringBuilder stb, String oldStr, String newStr) {
if (stb == null || oldStr == null || newStr == null || stb.length() == 0 || oldStr.length() == 0)
return stb;
int index = stb.indexOf(oldStr);
if (index > -1 && !oldStr.equals(newStr)) {
int lastIndex = 0;
while (index > -1) {
stb.replace(index, index + oldStr.length(), newStr);
lastIndex = index + newStr.length();
index = stb.indexOf(oldStr, lastIndex);
}
}
return stb;
}
}
@@ -0,0 +1,17 @@
package com.adc.da.search.util;
/**
*Elasticsearch接口实现过程中用到的常量定义
* @author gaoyan
* date 2018/08/27
*/
public class ElasticsearchConstant {
//构造方法
public ElasticsearchConstant() {
// 不做操作
}
//正确删除后返回结构
public static final String SUCCESS_DELETED = "DELETED";
//删除过程中未找到对应数据返回结果
public static final String HAVE_NOT_FOUND= "NOT_FOUND";
}
+65
View File
@@ -11,6 +11,12 @@
<artifactId>adc-da-slrs</artifactId>
<dependencies>
<dependency>
<groupId>com.adc</groupId>
<artifactId>adc-da-search</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.adc</groupId>
<artifactId>adc-da-base</artifactId>
@@ -35,6 +41,65 @@
<version>3.1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.adc</groupId>
<artifactId>adc-da-util</artifactId>
<version>2.2.41</version>
<exclusions>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk14</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>4.1.2</version>
<exclusions>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>1.8.8</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13</version>
</dependency>
<dependency>
<groupId>com.zip4j</groupId>
<artifactId>zip4j</artifactId>
<scope>system</scope>
<version>1.3.1</version>
<systemPath>${basedir}/src/main/lib/zip4j-1.3.1.jar</systemPath>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,223 @@
package com.adc.da.common;
import com.adc.da.base.entity.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
/**
* <b>功能</b>OT_CONVERT_MQ OtConvertMqEOEntity<br>
* <b>作者</b>code generator<br>
* <b>日期</b> 2018-09-25 <br>
* <b>版权所有<b>版权归北京卡达克数据技术中心所有<br>
*/
public class ConvertMqEO extends BaseEntity {
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date modifyTime;
@org.springframework.format.annotation.DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date creationTime;
private Integer validFlag;
private String attId;
private String filePath;
private String fileOriginPath;
private String userId;
private Integer mqState;
private String mqCode;
private String id;
private String addOrUp;
//向文件表添加信息
private String lawsId;
private String resId;
private String convertType;
private String pdfPath;
private String pdfId;
private String fileSuffix;
private String standFileClassify;
private String oriAttId;
private String lawsFileClassify;
private int againNum;
/** **/
public Integer getValidFlag() {
return this.validFlag;
}
/** **/
public void setValidFlag(Integer validFlag) {
this.validFlag = validFlag;
}
/** **/
public String getAttId() {
return this.attId;
}
/** **/
public void setAttId(String attId) {
this.attId = attId;
}
/** **/
public String getFilePath() {
return this.filePath;
}
/** **/
public void setFilePath(String filePath) {
this.filePath = filePath;
}
/** **/
public String getUserId() {
return this.userId;
}
/** **/
public void setUserId(String userId) {
this.userId = userId;
}
/** **/
public Integer getMqState() {
return this.mqState;
}
/** **/
public void setMqState(Integer mqState) {
this.mqState = mqState;
}
/** **/
public String getMqCode() {
return this.mqCode;
}
/** **/
public void setMqCode(String mqCode) {
this.mqCode = mqCode;
}
/** **/
public String getId() {
return this.id;
}
/** **/
public void setId(String id) {
this.id = id;
}
public String getFileOriginPath() {
return fileOriginPath;
}
public void setFileOriginPath(String fileOriginPath) {
this.fileOriginPath = fileOriginPath;
}
public String getLawsId() {
return lawsId;
}
public void setLawsId(String lawsId) {
this.lawsId = lawsId;
}
public String getResId() {
return resId;
}
public void setResId(String resId) {
this.resId = resId;
}
public String getConvertType() {
return convertType;
}
public void setConvertType(String convertType) {
this.convertType = convertType;
}
public String getPdfPath() {
return pdfPath;
}
public void setPdfPath(String pdfPath) {
this.pdfPath = pdfPath;
}
public String getAddOrUp() {
return addOrUp;
}
public void setAddOrUp(String addOrUp) {
this.addOrUp = addOrUp;
}
public String getPdfId() {
return pdfId;
}
public void setPdfId(String pdfId) {
this.pdfId = pdfId;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public Date getCreationTime() {
return creationTime;
}
public void setCreationTime(Date creationTime) {
this.creationTime = creationTime;
}
public String getFileSuffix() {
return fileSuffix;
}
public void setFileSuffix(String fileSuffix) {
this.fileSuffix = fileSuffix;
}
public String getStandFileClassify() {
return standFileClassify;
}
public void setStandFileClassify(String standFileClassify) {
this.standFileClassify = standFileClassify;
}
public String getOriAttId() {
return oriAttId;
}
public void setOriAttId(String oriAttId) {
this.oriAttId = oriAttId;
}
public int getAgainNum() {
return againNum;
}
public void setAgainNum(int againNum) {
this.againNum = againNum;
}
public String getLawsFileClassify() {
return lawsFileClassify;
}
public void setLawsFileClassify(String lawsFileClassify) {
this.lawsFileClassify = lawsFileClassify;
}
}
@@ -0,0 +1,10 @@
package com.adc.da.mq.dao;
import com.adc.da.common.ConvertMqEO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface OtConvertEODao extends BaseMapper<ConvertMqEO> {
int deleteByAttId(String value);
}
@@ -0,0 +1,77 @@
package com.adc.da.mq.service;
import com.adc.da.common.ConvertMqEO;
import com.adc.da.mq.dao.OtConvertEODao;
import com.adc.da.util.utils.StringUtils;
import com.adc.da.util.utils.UUID;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Component
public class CreateMQService {
@Autowired
private AmqpTemplate rabbitTemplate;
@Autowired
private OtConvertEODao otConvertEODao;
/**
* @Author yangxuenan
* @Description 创建消息队列
* Date 2018/8/24 13:59
* @Param [convert, convertType]
* @return int
**/
public void sendMQ(ConvertMqEO convert) throws Exception{
String otId = UUID.randomUUID(20);
//向OT_CONVERT_EO表中添加/修改数据
//判断用户是初次发送还是重新发送,初次将添加到数据库重新发送将修改原数据信息
convert.setMqState(0);
convert.setModifyTime(new Date());
if("0".equals(convert.getAddOrUp()) && StringUtils.isEmpty(convert.getId())){
convert.setId(otId);
convert.setMqCode(convert.getConvertType());
convert.setCreationTime(new Date());
convert.setValidFlag(0);
otConvertEODao.insert(convert);
} else {
otConvertEODao.updateById(convert);
}
//将数据信息保存并发送给消息队列
Map<String,Object> convertInfo = new HashMap<String,Object>();
//标准/政策ID
convertInfo.put("lawsId", convert.getLawsId());
//标准/政策关联的res表ID
convertInfo.put("resId", convert.getResId());
//文档的ID
convertInfo.put("attId", convert.getAttId());
//判断当前操作是新增还是修改
convertInfo.put("addUpFlag", convert.getAddOrUp());
//资源类型标准政策企标
convertInfo.put("convertType", convert.getConvertType());
//文档路径
convertInfo.put("path", convert.getFilePath());
convertInfo.put("standFileClassify", convert.getStandFileClassify());
convertInfo.put("lawsFileClassify", convert.getLawsFileClassify());
if("0".equals(convert.getAddOrUp())){
//otId在转换表中数据ID
convertInfo.put("otId", otId);
//在stand_file等资源与文件关联表中转换成功的pdf数据ID
convertInfo.put("standFilePdfId", UUID.randomUUID(20));
convertInfo.put("againNum",0);
} else {
convertInfo.put("otId", convert.getId());
convertInfo.put("standFilePdfId", convert.getPdfId());
convertInfo.put("againNum",convert.getAgainNum());
}
//发送消息队列
this.rabbitTemplate.convertAndSend("convert-exchange_SQ_GSAR", "convert-key_SQ_GSAR", convertInfo);
}
}
@@ -0,0 +1,32 @@
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,316 @@
package com.adc.da.mq.service;
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;
import com.adc.da.slrs.sysInfo.service.SysInfoEOService;
import com.rabbitmq.client.Channel;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
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.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component
public class SendStandMQService {
@Autowired
private ISarStandardsInfoService sarStandardsInfoService;
@Autowired
private SysInfoEOService sysInfoEOService;
@Autowired
private IOtSvppsService otSvppsEOService;
private static final Logger logger = LoggerFactory.getLogger(SendStandMQService.class);
@RabbitListener(bindings = @QueueBinding(
value = @Queue(value = "createStandMQ_SQ_GSAR", durable = "true"),
exchange = @Exchange(value = "stand-exchange_SQ_GSAR", ignoreDeclarationExceptions = "true"),
key = "stand-key_SQ_GSAR"))
public void createMQ(Map<String,Object> standMap, Message message, Channel channel) throws Exception{
try{
try{
Thread.sleep(5000);
insertOrUpdateStandInfo(standMap);
}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 insertOrUpdateStandInfo(Map<String,Object> standMap){
String addOrUpdate = standMap.get("addOrUpdate").toString();
String sarStandards = standMap.get("sarStandards").toString();
JSONObject jsonobject = JSONObject.fromObject(sarStandards);
SarStandardsInfo infoEO = (SarStandardsInfo) JSONObject.toBean(jsonobject,SarStandardsInfo.class);
String attr = infoEO.getSarStandAttrEOStr();
JSONObject jsonobject1 = JSONObject.fromObject(attr);
Map<String,Object> map = (Map)jsonobject1;
String GZZXX = String.valueOf(map.get("GZZXX"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// 往索引表中插入数据
String getCodeName = "";
Map<String,Object> saveMap = new HashMap<>();
String baseSearchContent = "";
// 开始存放数据
saveMap.put("id",infoEO.getId());
saveMap.put("BYYBJ", map.getOrDefault("BYYBJ", ""));
saveMap.put("BDTBH", map.getOrDefault("BDTBH", ""));
saveMap.put("country",infoEO.getCountry());
if (StringUtils.isNotEmpty(infoEO.getCountry())) {
String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getCountry());
saveMap.put("countryShow",codeName);
}
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("standNumber",infoEO.getStandNumber());
saveMap.put("stand_number",infoEO.getStandNumber());
saveMap = dealNumberMsg(saveMap,infoEO,getCodeName);
saveMap.put("standYear",infoEO.getStandYear());
saveMap.put("stand_year",infoEO.getStandYear());
saveMap.put("nameshow",infoEO.getStandName());
saveMap.put("stand_name",infoEO.getStandName());
saveMap.put("standEnName",infoEO.getStandEnName());
saveMap.put("stand_en_name",infoEO.getStandEnName());
if ("1".equals(infoEO.getIsRelateAccess())) {
saveMap.put("isRelateAccess","A" );
}else{
saveMap.put("isRelateAccess","B" );
}
if (StringUtils.isNotEmpty(infoEO.getStandState())) {
String codeName = sysInfoEOService.getDicNamesByCodes(infoEO.getStandState());
saveMap.put("standstateshow",codeName);
}
saveMap.put("issueTime",infoEO.getIssueTime());
String newDate = infoEO.getIssueTime();
if (StringUtils.isNotBlank(infoEO.getIssueTime()) && StringUtils.isNotBlank(infoEO.getIssueTime().trim()) && infoEO.getIssueTime().trim().length()>10) {
newDate = infoEO.getIssueTime().trim().substring(0,10);
}
saveMap.put("issue_time",newDate);
Date issue_time_data = null;
if (StringUtils.isNotBlank(infoEO.getIssueTime())) {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
issue_time_data = format.parse(newDate+" 00:00:00");
} catch (ParseException ignored) {
}
}
if (issue_time_data != null) {
saveMap.put("issue_time_data",issue_time_data.getTime());
}else{
saveMap.put("issue_time_data",0L);
}
saveMap.put("synopsis",infoEO.getSynopsis());
saveMap.put("standType",infoEO.getStandType());
// 自定义属性字段
String sarStandAttrEOStr = infoEO.getSarStandAttrEOStr();
Map<String,Object> attrInfoMap = JSONObject.fromObject(sarStandAttrEOStr);
if (attrInfoMap != null && !attrInfoMap.isEmpty()) {
attrInfoMap = sysInfoEOService.changeSelectInfo(attrInfoMap, "stand",baseSearchContent);
saveMap.putAll(attrInfoMap);
}
saveMap.put("baseSearchContent",baseSearchContent);
saveMap.put("type","stand");
saveMap.put("validFlag","0");
saveMap.put("content",infoEO.getFileIds());
saveMap.put("CHJL",infoEO.getCHJL());
String SVPPSSting = "";
if (attrInfoMap != null) {
if (attrInfoMap.containsKey("SVPPS")){
String svpps = String.valueOf(attrInfoMap.get("SVPPS"));
List<String> ids = new ArrayList<>(Arrays.asList(svpps.split(",")));
for (String id: ids){
String num = "";
try {
OtSvpps otSvppsEO = otSvppsEOService.getById(id);
if (null != otSvppsEO) {
if ("NA".equals(otSvppsEO.getTNum())) {
if ("NA".equals(otSvppsEO.getSNum())) {
num = otSvppsEO.getFNum();
} else {
num = otSvppsEO.getSNum();
}
} else {
num = otSvppsEO.getTNum();
}
}
if ("".equals(SVPPSSting)){
SVPPSSting = num;
}else {
SVPPSSting = SVPPSSting + "," + num;
}
} catch (Exception e) {
e.printStackTrace();
}
}
saveMap.put("SVPPSName",SVPPSSting);
}
}
Date XCXSSRQ_data = null;
if (StringUtils.isNotBlank(String.valueOf(saveMap.get("XCXSSRQ")))) {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (String.valueOf(saveMap.get("XCXSSRQ")).trim().length()>10) {
XCXSSRQ_data = format.parse(String.valueOf(saveMap.get("XCXSSRQ")).trim().substring(0,10) + " 00:00:00");
saveMap.put("XCXSSRQ",String.valueOf(saveMap.get("XCXSSRQ")).trim().substring(0,10));
}else{
XCXSSRQ_data = format.parse(String.valueOf(saveMap.get("XCXSSRQ")).trim() + " 00:00:00");
saveMap.put("XCXSSRQ",String.valueOf(saveMap.get("XCXSSRQ")).trim());
}
} catch (ParseException ignored) {
}
}
if (XCXSSRQ_data != null) {
saveMap.put("XCXSSRQ_data",XCXSSRQ_data.getTime());
}else{
saveMap.put("XCXSSRQ_data",0L);
}
saveMap.put("XCXSSRQ",String.valueOf(saveMap.get("XCXSSRQ")+" "));
Date ZCCSSRQ_data = null;
if (StringUtils.isNotBlank(String.valueOf(saveMap.get("ZCCSSRQ")))) {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (String.valueOf(saveMap.get("ZCCSSRQ")).trim().length()>10) {
ZCCSSRQ_data = format.parse(String.valueOf(saveMap.get("ZCCSSRQ")).trim().substring(0, 10) + " 00:00:00");
saveMap.put("ZCCSSRQ",String.valueOf(saveMap.get("ZCCSSRQ")).trim().substring(0, 10));
}else {
ZCCSSRQ_data = format.parse(String.valueOf(saveMap.get("ZCCSSRQ")).trim() + " 00:00:00");
saveMap.put("ZCCSSRQ",String.valueOf(saveMap.get("ZCCSSRQ")).trim());
}
} catch (ParseException ignored) {
}
}
if (ZCCSSRQ_data != null) {
saveMap.put("ZCCSSRQ_data",ZCCSSRQ_data.getTime());
}else{
saveMap.put("ZCCSSRQ_data",0L);
}
saveMap.put("ZCCSSRQ",String.valueOf(saveMap.get("ZCCSSRQ")+" "));
Date EOPSSRQ_data = null;
String ESSRQ= null;
if (StringUtils.isNotBlank(String.valueOf(saveMap.get("EOPSSRQ")))) {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (String.valueOf(saveMap.get("EOPSSRQ")).trim().length()>10){
ESSRQ = String.valueOf(saveMap.get("EOPSSRQ")).trim().substring(0,10);
}else {
ESSRQ = String.valueOf(saveMap.get("EOPSSRQ")).trim();
}
EOPSSRQ_data = format.parse(ESSRQ + " 00:00:00");
} catch (ParseException ignored) {
}
map.put("EOPSSRQ",ESSRQ);
}
if (EOPSSRQ_data != null) {
saveMap.put("EOPSSRQ_data",EOPSSRQ_data.getTime());
}else{
saveMap.put("EOPSSRQ_data",0L);
}
saveMap.put("EOPSSRQ",String.valueOf(saveMap.get("EOPSSRQ")+" "));
if (map.containsKey("DXBZ")){
saveMap.put("DXBZ",map.get("DXBZ"));
}else{
saveMap.put("DXBZ","");
}
//当建立代替时产生的没有文件的问题
if (StringUtils.isBlank(String.valueOf(saveMap.get("content")))) {
String context = String.valueOf(saveMap.get("FBGBJBD")) + ","
+ String.valueOf(saveMap.get("XXZLXX")) + ","
+ String.valueOf(saveMap.get("ZQYJG")) + ","
+ String.valueOf(saveMap.get("BPG")) + ","
+ String.valueOf(saveMap.get("CA")) + ","
+ String.valueOf(saveMap.get("SSG")) + ","
+ String.valueOf(saveMap.get("ZBJBD"));
context = context.replace(",,", ",");
saveMap.put("content", context);
}
if (StringUtils.isNotBlank(String.valueOf(saveMap.get("FO"))) && !"null".equals(String.valueOf(saveMap.get("FO")))){
saveMap.put("FO",String.valueOf(saveMap.get("FO"))+" ");
}
if("add".equals(addOrUpdate)){
sarStandardsInfoService.insertIntoIndexForMap(saveMap);
} else {
sarStandardsInfoService.updateIntoIndexForMap(saveMap);
}
}
public Map<String,Object> dealNumberMsg (Map<String,Object> saveMap,SarStandardsInfo infoEO,String getCodeName) {
if(StringUtils.isNotEmpty(infoEO.getStandYear())){
String number = getCodeName + " " + infoEO.getStandNumber() + "-" + infoEO.getStandYear();
saveMap.put("numbershow",number);
int index = infoEO.getStandNumber().indexOf(".");
int index1 = infoEO.getStandNumber().indexOf(":");
String numberExpNull = "";
if(index > -1){
numberExpNull = (getCodeName + infoEO.getStandNumber() + "-" + number.replaceAll(" ","")
+ "-" + getCodeName + infoEO.getStandNumber().substring(0,index) + "-" + infoEO.getStandNumber().substring(0,index));
} else if (index1 > -1) {
numberExpNull = getCodeName + infoEO.getStandNumber() + "-" + number.replaceAll(" ","")
+ "-" + getCodeName + infoEO.getStandNumber().substring(0,index1) + "-" + infoEO.getStandNumber().substring(0,index1);
} else {
numberExpNull = getCodeName + infoEO.getStandNumber() + "-" + number.replaceAll(" ","");
}
saveMap.put("numberExpNull",numberExpNull);
} else {
String num = getCodeName + " " + infoEO.getStandNumber();
saveMap.put("numbershow",num);
int index = infoEO.getStandNumber().indexOf(".");
String numberExpNull = "";
if(index > -1){
numberExpNull = getCodeName + infoEO.getStandNumber() + "-" + num.replaceAll(" ","")
+ "-" + getCodeName + infoEO.getStandNumber().substring(0,index) + "-" + infoEO.getStandNumber().substring(0,index);
} else {
numberExpNull = getCodeName + infoEO.getStandNumber() + "-" + num.replaceAll(" ","");
}
saveMap.put("numberExpNull",numberExpNull);
}
return saveMap;
}
}
@@ -40,4 +40,8 @@ public interface ISarStandardsInfoService extends IService<SarStandardsInfo> {
List<RecommendVO> selectRecommendStand(SarStandardsInfoEOPage pagenew);
List<ActSarItemsEO> getStandAndItemsForAct (SarStandardsInfoEOPage page) throws Exception;
void insertIntoIndexForMap(Map<String,Object> attrInfoMap);
void updateIntoIndexForMap(Map<String,Object> attrInfoMap);
}
@@ -10,6 +10,7 @@ import com.adc.da.person.dao.PersonCollectEODao;
import com.adc.da.person.dao.PersonShareEODao;
import com.adc.da.person.entity.PersonMsgEO;
import com.adc.da.person.service.IPersonCollectEOService;
import com.adc.da.search.service.StandLawsSearchService;
import com.adc.da.slrs.sarLawsInfo.entity.SarLawsInfo;
import com.adc.da.slrs.sarLawsInfo.page.SarLawsInfoEOPage;
import com.adc.da.slrs.sarLawsInfo.page.SarLawsItemsEOPage;
@@ -51,6 +52,13 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.util.PDFTextStripper;
import org.apache.pdfbox.util.PDFTextStripperByArea;
import org.apache.poi.hwpf.extractor.WordExtractor;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
@@ -61,6 +69,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.io.File;
import java.io.FileInputStream;
import java.sql.Clob;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -151,6 +160,12 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
@Autowired
private SysInfoEOService sysInfoEOService;
@Autowired
private StandLawsSearchService standLawsSearchService;
@Value("${file.path}")
private String filePath;//文件存储路径
/***
@@ -1854,6 +1869,127 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
return standList;
}
@Override
public void insertIntoIndexForMap(Map<String, Object> attrInfoMap) {
Set<String> keys = attrInfoMap.keySet();
for (String key:keys) {
String value = String.valueOf(attrInfoMap.get(key));
if (com.adc.da.util.utils.StringUtils.isNotBlank(value) && !"null".equals(value) && !"SVPPS".equals(key)){
value = value.replace(" , ",",");
value = value.replace(","," , ");
attrInfoMap.put(key,value);
}
}
// 根据文件attid 读取文件内容
if (org.apache.commons.lang.StringUtils.isNotEmpty(String.valueOf(attrInfoMap.get("content")))) {
String[] attidlist = String.valueOf(attrInfoMap.get("content")).split(" , ");
StringBuilder content = new StringBuilder("");
for (int i = 0; i < attidlist.length; i++) {
if(org.apache.commons.lang.StringUtils.isNotEmpty(attidlist[i]) ){
AttFileEO attFileEO = attFileEOService.getFileInfo(attidlist[i]);
String readFilePath = filePath + "/" + attFileEO.getFilePath() + attFileEO.getFileName();
try {
// 判断文件是docx还是PDF
if (null != attFileEO.getFileSuffix() && (attFileEO.getFileSuffix().equals("docx") || attFileEO.getFileSuffix().equals("doc") || attFileEO.getFileSuffix().equals("ppt") || attFileEO.getFileSuffix().equals("pptx"))) {
if(attFileEO.getFileSuffix().equals("doc")){
FileInputStream fis = new FileInputStream(readFilePath);
WordExtractor wordExtractor = new WordExtractor(fis);
String txt = wordExtractor.getText();
content.append(txt);
}else {
OPCPackage opcPackage = XWPFDocument.openPackage(readFilePath);
XWPFWordExtractor extractor = new XWPFWordExtractor(opcPackage);
String txt = extractor.getText();
content.append(txt);
}
} else {
PDDocument document = PDDocument.load(new File(readFilePath));
document.getClass();
if (!document.isEncrypted()) {
PDFTextStripperByArea stripper = new PDFTextStripperByArea();
stripper.setSortByPosition(true);
PDFTextStripper tStripper = new PDFTextStripper();
String pdfFileInText = tStripper.getText(document);
// String[] lines = pdfFileInText.split("\\r?\\n");
content.append(pdfFileInText);
}
}
} catch (Exception e) {
logger.error("搜索中心新增数据读取文档内容时失败");
logger.error(e.getMessage(),e);
}
/*catch (IOException | OpenXML4JException | XmlException e) {
logger.error(e.getMessage(),e);
}*/
attrInfoMap.put("content",content.toString());
}
}
}
else{
attrInfoMap.put("content","");
}
standLawsSearchService.addStandLawsSearchForMap(attrInfoMap);
}
@Override
public void updateIntoIndexForMap(Map<String, Object> attrInfoMap) {
Set<String> keys = attrInfoMap.keySet();
for (String key:keys) {
String value = String.valueOf(attrInfoMap.get(key));
if (com.adc.da.util.utils.StringUtils.isNotBlank(value) && !"null".equals(value) && !"SVPPS".equals(key) && !"content".equals(key)){
value = value.replace(" , ",",");
value = value.replace(","," , ");
attrInfoMap.put(key,value);
}
}
// 根据文件attid 读取文件内容
if (org.apache.commons.lang.StringUtils.isNotEmpty(String.valueOf(attrInfoMap.get("content")))) {
String[] attidlist = String.valueOf(attrInfoMap.get("content")).split(" , ");
StringBuilder content = new StringBuilder("");
for (int i = 0; i < attidlist.length; i++) {
if(org.apache.commons.lang.StringUtils.isNotEmpty(attidlist[i]) && !"null".equals(attidlist[i])){
AttFileEO attFileEO = attFileEOService.getFileInfo(attidlist[i]);
String readFilePath = filePath + "/" + attFileEO.getFilePath() + attFileEO.getFileName();
try {
// 判断文件是docx还是PDF
if (attFileEO.getFileSuffix().equals("docx") || attFileEO.getFileSuffix().equals("doc")) {
if(attFileEO.getFileSuffix().equals("doc")){
FileInputStream fis = new FileInputStream(readFilePath);
WordExtractor wordExtractor = new WordExtractor(fis);
String txt = wordExtractor.getText();
content.append(txt);
}else {
OPCPackage opcPackage = XWPFDocument.openPackage(readFilePath);
XWPFWordExtractor extractor = new XWPFWordExtractor(opcPackage);
String txt = extractor.getText();
content.append(txt);
}
} else if (attFileEO.getFileSuffix().equals("pdf")){
PDDocument document = PDDocument.load(new File(readFilePath));
document.getClass();
if (!document.isEncrypted()) {
PDFTextStripperByArea stripper = new PDFTextStripperByArea();
stripper.setSortByPosition(true);
PDFTextStripper tStripper = new PDFTextStripper();
String pdfFileInText = tStripper.getText(document);
// String[] lines = pdfFileInText.split("\\r?\\n");
content.append(pdfFileInText);
}
}
} catch (Exception e) {
logger.error("搜索中心修改数据读取文档内容时失败");
logger.error(e.getMessage(),e);
}
attrInfoMap.put("content",content.toString());
}
}
}
else{
attrInfoMap.put("content","");
}
standLawsSearchService.updateStandLawsSearchForMap(attrInfoMap);
}
public void getStandDetailsForAct (SarStandardsInfoEOPage page,String[] idArr,String standState,List<ActSarItemsEO> standList) throws Exception{
page.setPageSize(100);
page.setIdlist(idArr);