add:升级es到7.6.2
This commit is contained in:
@@ -60,11 +60,11 @@
|
||||
<artifactId>adc-da-base</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!--<dependency>
|
||||
<groupId>com.adc</groupId>
|
||||
<artifactId>adc-da-slrs</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.adc</groupId>
|
||||
@@ -91,12 +91,12 @@
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>transport</artifactId>
|
||||
<version>6.3.2</version>
|
||||
<version>7.6.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
<version>6.3.2</version>
|
||||
<version>7.6.2</version>
|
||||
</dependency>
|
||||
<!-- 6.0版本es需添加此依赖,解决依赖冲突 -->
|
||||
<dependency>
|
||||
|
||||
+22
-11
@@ -4,21 +4,21 @@ import com.adc.da.base.web.BaseController;
|
||||
import com.adc.da.excel.poi.excel.ExcelExportUtil;
|
||||
import com.adc.da.excel.poi.excel.entity.ExportParams;
|
||||
import com.adc.da.excel.poi.excel.entity.enums.ExcelType;
|
||||
import com.adc.da.exception.AdcDaBaseException;
|
||||
import com.adc.da.http.PageInfo;
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.person.service.IPersonCollectEOService;
|
||||
import com.adc.da.search.dto.*;
|
||||
import com.adc.da.search.dto.SearchBussExportDto;
|
||||
import com.adc.da.search.dto.SearchLawsExportDto;
|
||||
import com.adc.da.search.dto.SearchMsgExportDto;
|
||||
import com.adc.da.search.dto.SearchStandExportDto;
|
||||
import com.adc.da.search.entity.CommonSearchInfoEO;
|
||||
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.exception.AdcDaBaseException;
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.tsDictionaryType.entity.TsSearchMenu;
|
||||
import com.adc.da.slrs.tsDictionaryType.service.ITsDicTypeService;
|
||||
import com.adc.da.util.IOUtils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -26,14 +26,25 @@ import org.apache.commons.lang3.StringUtils;
|
||||
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.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
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.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.adc.da.sys.common.ReadExcelName.encodeFileName;
|
||||
|
||||
@RestController
|
||||
@@ -52,14 +63,14 @@ public class SearchCenterController extends BaseController<Map<String, Object>>
|
||||
@Autowired
|
||||
private ElasticsearchService elasticsearchService;
|
||||
|
||||
@Autowired
|
||||
/*@Autowired
|
||||
private ITsDicTypeService iTsDictypeService;
|
||||
|
||||
@ApiOperation("获取筛选条件")
|
||||
@PostMapping("/getMenu")
|
||||
public ResponseMessage<List<TsSearchMenu>> getSearchMenu(){
|
||||
return Result.success(iTsDictypeService.getSearchMenu());
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
+15
-11
@@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
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;
|
||||
@@ -19,6 +18,7 @@ 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.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.update.UpdateRequest;
|
||||
import org.elasticsearch.action.update.UpdateResponse;
|
||||
import org.elasticsearch.client.transport.TransportClient;
|
||||
@@ -26,15 +26,13 @@ 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.aggregations.metrics.Avg;
|
||||
import org.elasticsearch.search.aggregations.metrics.Max;
|
||||
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
import org.slf4j.Logger;
|
||||
@@ -43,7 +41,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Component
|
||||
public class ElasticsearchServiceImpl implements ElasticsearchService {
|
||||
@@ -89,7 +91,8 @@ public class ElasticsearchServiceImpl implements ElasticsearchService {
|
||||
if (!isIndexExist(index)) {
|
||||
logger.info("Index is not exits!");
|
||||
}
|
||||
DeleteIndexResponse dResponse = client.admin().indices().prepareDelete(index).get();
|
||||
AcknowledgedResponse dResponse = client.admin().indices().prepareDelete(index).get();
|
||||
|
||||
if (dResponse.isAcknowledged()) {
|
||||
logger.info("delete index " + index + " successfully!");
|
||||
} else {
|
||||
@@ -184,13 +187,14 @@ public class ElasticsearchServiceImpl implements ElasticsearchService {
|
||||
*/
|
||||
@Override
|
||||
public long deleteAllDataOfIndex(String index) {
|
||||
BulkByScrollResponse response = DeleteByQueryAction.INSTANCE.newRequestBuilder(client)
|
||||
/*BulkByScrollResponse response = DeleteByQueryAction.INSTANCE.newRequestBuilder(client)
|
||||
.filter(QueryBuilders.matchAllQuery())
|
||||
.source(index)
|
||||
.get();
|
||||
//一共删除掉多少条
|
||||
long deleted = response.getDeleted();
|
||||
return deleted;
|
||||
return deleted;*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -390,7 +394,7 @@ public class ElasticsearchServiceImpl implements ElasticsearchService {
|
||||
|
||||
SearchResponse searchResponse = searchRequestBuilder.execute().actionGet();
|
||||
|
||||
long totalHits = searchResponse.getHits().totalHits;
|
||||
long totalHits = searchResponse.getHits().getTotalHits().value;
|
||||
long length = searchResponse.getHits().getHits().length;
|
||||
|
||||
logger.info("共查询到[{}]条数据,处理数据条数[{}]", totalHits, length);
|
||||
@@ -488,7 +492,7 @@ public class ElasticsearchServiceImpl implements ElasticsearchService {
|
||||
// 执行搜索,返回搜索响应信息
|
||||
SearchResponse searchResponse = searchRequestBuilder.execute().actionGet();
|
||||
|
||||
long totalHits = searchResponse.getHits().totalHits;
|
||||
long totalHits = searchResponse.getHits().getTotalHits().value;
|
||||
long length = searchResponse.getHits().getHits().length;
|
||||
|
||||
logger.debug("共查询到[{}]条数据,处理数据条数[{}]", totalHits, length);
|
||||
|
||||
+3
-3
@@ -807,7 +807,7 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
||||
// 获取查询到的结果
|
||||
SearchResponse response = searchRequestBuilder.get();
|
||||
result = SearchResponseToList(response);
|
||||
searchInfoEO.getPager().setRowCount((int) response.getHits().getTotalHits());
|
||||
searchInfoEO.getPager().setRowCount((int) response.getHits().getTotalHits().value);
|
||||
Map<String, Aggregation> aggmap = response.getAggregations().asMap();
|
||||
if (!result.isEmpty()) {
|
||||
for (int i = 0; i < seniortype.length; i++) {
|
||||
@@ -1158,7 +1158,7 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
||||
// }
|
||||
result.add(sourceAsMap);
|
||||
}
|
||||
searchInfoEO.getPager().setRowCount((int) response.getHits().getTotalHits());
|
||||
searchInfoEO.getPager().setRowCount((int) response.getHits().getTotalHits().value);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1243,7 +1243,7 @@ public class SearchCenterServiceImpl implements SearchCenterService {
|
||||
}
|
||||
result.add(sourceAsMap);
|
||||
}
|
||||
searchInfoEO.getPager().setRowCount((int) response.getHits().getTotalHits());
|
||||
searchInfoEO.getPager().setRowCount((int) response.getHits().getTotalHits().value);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,12 @@
|
||||
<version>3.1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.adc</groupId>
|
||||
<artifactId>adc-da-search</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- poi -->
|
||||
|
||||
+404
@@ -191,5 +191,409 @@ public class SarStandardsInfo extends BaseEntity {
|
||||
|
||||
@TableField(exist = false)
|
||||
private String standSystemName;
|
||||
|
||||
public static long getSerialVersionUID() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getStandType() {
|
||||
return standType;
|
||||
}
|
||||
|
||||
public void setStandType(String standType) {
|
||||
this.standType = standType;
|
||||
}
|
||||
|
||||
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 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 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 getStandNature() {
|
||||
return standNature;
|
||||
}
|
||||
|
||||
public void setStandNature(String standNature) {
|
||||
this.standNature = standNature;
|
||||
}
|
||||
|
||||
public String getIssueTime() {
|
||||
return issueTime;
|
||||
}
|
||||
|
||||
public void setIssueTime(String issueTime) {
|
||||
this.issueTime = issueTime;
|
||||
}
|
||||
|
||||
public Date getPutTime() {
|
||||
return putTime;
|
||||
}
|
||||
|
||||
public void setPutTime(Date putTime) {
|
||||
this.putTime = putTime;
|
||||
}
|
||||
|
||||
public String getSynopsis() {
|
||||
return synopsis;
|
||||
}
|
||||
|
||||
public void setSynopsis(String synopsis) {
|
||||
this.synopsis = synopsis;
|
||||
}
|
||||
|
||||
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 getCreationUser() {
|
||||
return creationUser;
|
||||
}
|
||||
|
||||
public void setCreationUser(String creationUser) {
|
||||
this.creationUser = creationUser;
|
||||
}
|
||||
|
||||
public String getValidFlag() {
|
||||
return validFlag;
|
||||
}
|
||||
|
||||
public void setValidFlag(String validFlag) {
|
||||
this.validFlag = validFlag;
|
||||
}
|
||||
|
||||
public Date getCreationTime() {
|
||||
return creationTime;
|
||||
}
|
||||
|
||||
public void setCreationTime(Date creationTime) {
|
||||
this.creationTime = creationTime;
|
||||
}
|
||||
|
||||
public Date getModifyTime() {
|
||||
return modifyTime;
|
||||
}
|
||||
|
||||
public void setModifyTime(Date modifyTime) {
|
||||
this.modifyTime = modifyTime;
|
||||
}
|
||||
|
||||
public String getIsRelateAccess() {
|
||||
return isRelateAccess;
|
||||
}
|
||||
|
||||
public void setIsRelateAccess(String isRelateAccess) {
|
||||
this.isRelateAccess = isRelateAccess;
|
||||
}
|
||||
|
||||
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 getTextStatus() {
|
||||
return textStatus;
|
||||
}
|
||||
|
||||
public void setTextStatus(String textStatus) {
|
||||
this.textStatus = textStatus;
|
||||
}
|
||||
|
||||
public String getStandSystem() {
|
||||
return standSystem;
|
||||
}
|
||||
|
||||
public void setStandSystem(String standSystem) {
|
||||
this.standSystem = standSystem;
|
||||
}
|
||||
|
||||
public String getCollectId() {
|
||||
return collectId;
|
||||
}
|
||||
|
||||
public void setCollectId(String collectId) {
|
||||
this.collectId = collectId;
|
||||
}
|
||||
|
||||
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 getStandStateShow() {
|
||||
return standStateShow;
|
||||
}
|
||||
|
||||
public void setStandStateShow(String standStateShow) {
|
||||
this.standStateShow = standStateShow;
|
||||
}
|
||||
|
||||
public String getStandNatureShow() {
|
||||
return standNatureShow;
|
||||
}
|
||||
|
||||
public void setStandNatureShow(String standNatureShow) {
|
||||
this.standNatureShow = standNatureShow;
|
||||
}
|
||||
|
||||
public String getSychronId() {
|
||||
return sychronId;
|
||||
}
|
||||
|
||||
public void setSychronId(String sychronId) {
|
||||
this.sychronId = sychronId;
|
||||
}
|
||||
|
||||
public List<DicTypeEO> getDicTypeList() {
|
||||
return dicTypeList;
|
||||
}
|
||||
|
||||
public void setDicTypeList(List<DicTypeEO> dicTypeList) {
|
||||
this.dicTypeList = dicTypeList;
|
||||
}
|
||||
|
||||
public List<SarStandAttrDetails> getAttrInfoList() {
|
||||
return attrInfoList;
|
||||
}
|
||||
|
||||
public void setAttrInfoList(List<SarStandAttrDetails> attrInfoList) {
|
||||
this.attrInfoList = attrInfoList;
|
||||
}
|
||||
|
||||
public Map<String, Object> getAttrInfoMap() {
|
||||
return attrInfoMap;
|
||||
}
|
||||
|
||||
public void setAttrInfoMap(Map<String, Object> attrInfoMap) {
|
||||
this.attrInfoMap = attrInfoMap;
|
||||
}
|
||||
|
||||
public Map<String, Object> getAttrInfoCaseMap() {
|
||||
return attrInfoCaseMap;
|
||||
}
|
||||
|
||||
public void setAttrInfoCaseMap(Map<String, Object> attrInfoCaseMap) {
|
||||
this.attrInfoCaseMap = attrInfoCaseMap;
|
||||
}
|
||||
|
||||
public String getSarStandAttrEOStr() {
|
||||
return sarStandAttrEOStr;
|
||||
}
|
||||
|
||||
public void setSarStandAttrEOStr(String sarStandAttrEOStr) {
|
||||
this.sarStandAttrEOStr = sarStandAttrEOStr;
|
||||
}
|
||||
|
||||
public String getMenuId() {
|
||||
return menuId;
|
||||
}
|
||||
|
||||
public void setMenuId(String menuId) {
|
||||
this.menuId = menuId;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public String getFileIds() {
|
||||
return fileIds;
|
||||
}
|
||||
|
||||
public void setFileIds(String fileIds) {
|
||||
this.fileIds = fileIds;
|
||||
}
|
||||
|
||||
public Date getNewCarPutTime() {
|
||||
return newCarPutTime;
|
||||
}
|
||||
|
||||
public void setNewCarPutTime(Date newCarPutTime) {
|
||||
this.newCarPutTime = newCarPutTime;
|
||||
}
|
||||
|
||||
public List<SarStandItems> getItemsList() {
|
||||
return itemsList;
|
||||
}
|
||||
|
||||
public void setItemsList(List<SarStandItems> itemsList) {
|
||||
this.itemsList = itemsList;
|
||||
}
|
||||
|
||||
public String getRelateStand() {
|
||||
return relateStand;
|
||||
}
|
||||
|
||||
public void setRelateStand(String relateStand) {
|
||||
this.relateStand = relateStand;
|
||||
}
|
||||
|
||||
public String getAccessCountry() {
|
||||
return accessCountry;
|
||||
}
|
||||
|
||||
public void setAccessCountry(String accessCountry) {
|
||||
this.accessCountry = accessCountry;
|
||||
}
|
||||
|
||||
public String getProcessNum() {
|
||||
return processNum;
|
||||
}
|
||||
|
||||
public void setProcessNum(String processNum) {
|
||||
this.processNum = processNum;
|
||||
}
|
||||
|
||||
public String getMenuType() {
|
||||
return menuType;
|
||||
}
|
||||
|
||||
public void setMenuType(String menuType) {
|
||||
this.menuType = menuType;
|
||||
}
|
||||
|
||||
public String getAllPutTime() {
|
||||
return allPutTime;
|
||||
}
|
||||
|
||||
public void setAllPutTime(String allPutTime) {
|
||||
this.allPutTime = allPutTime;
|
||||
}
|
||||
|
||||
public String getJspg() {
|
||||
return jspg;
|
||||
}
|
||||
|
||||
public void setJspg(String jspg) {
|
||||
this.jspg = jspg;
|
||||
}
|
||||
|
||||
public String getCHJL() {
|
||||
return CHJL;
|
||||
}
|
||||
|
||||
public void setCHJL(String CHJL) {
|
||||
this.CHJL = CHJL;
|
||||
}
|
||||
|
||||
public String getPutTime2() {
|
||||
return putTime2;
|
||||
}
|
||||
|
||||
public void setPutTime2(String putTime2) {
|
||||
this.putTime2 = putTime2;
|
||||
}
|
||||
|
||||
public String getStandSystemName() {
|
||||
return standSystemName;
|
||||
}
|
||||
|
||||
public void setStandSystemName(String standSystemName) {
|
||||
this.standSystemName = standSystemName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+128
-2
@@ -11,6 +11,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;
|
||||
@@ -60,6 +61,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.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;
|
||||
@@ -70,6 +78,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.*;
|
||||
@@ -175,6 +184,9 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
|
||||
@Autowired
|
||||
private CreateStandMQService createStandMQService;
|
||||
|
||||
@Autowired
|
||||
private StandLawsSearchService standLawsSearchService;
|
||||
|
||||
|
||||
/***
|
||||
* @Description: 分页查询
|
||||
@@ -1957,12 +1969,126 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
|
||||
|
||||
@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();
|
||||
String readFilePath = "E:\\上汽企标流程总览.pdf";
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}*/
|
||||
String readFilePath = "E:\\上汽企标流程总览.pdf";
|
||||
FileInputStream fis = new FileInputStream(readFilePath);
|
||||
WordExtractor wordExtractor = new WordExtractor(fis);
|
||||
String txt = wordExtractor.getText();
|
||||
content.append(txt);
|
||||
} catch (Exception e) {
|
||||
logger.error("搜索中心修改数据读取文档内容时失败");
|
||||
logger.error(e.getMessage(),e);
|
||||
}
|
||||
attrInfoMap.put("content",content.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
attrInfoMap.put("content","");
|
||||
}
|
||||
standLawsSearchService.updateStandLawsSearchForMap(attrInfoMap);
|
||||
}
|
||||
//
|
||||
// @Override
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.adc.da.slrs.search;
|
||||
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.slrs.tsDictionaryType.entity.TsSearchMenu;
|
||||
import com.adc.da.slrs.tsDictionaryType.service.ITsDicTypeService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/${restPath}/search")
|
||||
public class SearchController {
|
||||
|
||||
@Autowired
|
||||
private ITsDicTypeService iTsDictypeService;
|
||||
|
||||
@ApiOperation("获取筛选条件")
|
||||
@PostMapping("/getMenu")
|
||||
public ResponseMessage<List<TsSearchMenu>> getSearchMenu(){
|
||||
return Result.success(iTsDictypeService.getSearchMenu());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user